Toggle navigation
Documentation
Big picture
The finite element method
The data structure
Not-so-quick guide
Optimisation
Order of action functions
Example codes and tutorials
List of example codes and tutorials
Meshing
Solvers
MPI parallel processing
Post-processing/visualisation
Other
Change log
Creating documentation
Coding conventions
Index
FAQ
About
People
Contact/Get involved
Publications
Acknowledgements
Copyright
Picture show
Go
demo_drivers
interaction
free_boundary_poisson
doc_sparse_macro_node_update.cc
Go to the documentation of this file.
1
//LIC// ====================================================================
2
//LIC// This file forms part of oomph-lib, the object-oriented,
3
//LIC// multi-physics finite-element library, available
4
//LIC// at http://www.oomph-lib.org.
5
//LIC//
6
//LIC// Copyright (C) 2006-2025 Matthias Heil and Andrew Hazel
7
//LIC//
8
//LIC// This library is free software; you can redistribute it and/or
9
//LIC// modify it under the terms of the GNU Lesser General Public
10
//LIC// License as published by the Free Software Foundation; either
11
//LIC// version 2.1 of the License, or (at your option) any later version.
12
//LIC//
13
//LIC// This library is distributed in the hope that it will be useful,
14
//LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
//LIC// Lesser General Public License for more details.
17
//LIC//
18
//LIC// You should have received a copy of the GNU Lesser General Public
19
//LIC// License along with this library; if not, write to the Free Software
20
//LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
//LIC// 02110-1301 USA.
22
//LIC//
23
//LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24
//LIC//
25
//LIC//====================================================================
26
// Doc sparse MacroElement-based node update
27
28
29
// Generic oomph-lib headers
30
#include "generic.h"
31
32
// The Poisson equations
33
#include "poisson.h"
34
35
// The fish mesh
36
#include "meshes/fish_mesh.h"
37
38
// Circle as generalised element:
39
#include "
circle_as_generalised_element.h
"
40
41
using namespace
std;
42
43
using namespace
oomph
;
44
45
//==================start_of_main=========================================
46
/// Driver to document sparse MacroElement-based node update.
47
//========================================================================
48
int
main
()
49
{
50
51
// Shorthand for element type
52
typedef
MacroElementNodeUpdateElement<RefineableQPoissonElement<2,3>
>
53
ELEMENT
;
54
55
// Set coordinates and radius for the circle that will become the fish back
56
double
x_c=0.5;
57
double
y_c=-0.2;
58
double
r_back
=1.0;
59
60
// Build geometric object that will become the fish back
61
ElasticallySupportedRingElement
* Fish_back_pt=
62
new
ElasticallySupportedRingElement
(x_c,y_c,
r_back
);
63
64
// Build fish mesh with geometric object that specifies the fish back
65
MacroElementNodeUpdateRefineableFishMesh<ELEMENT>
* Fish_mesh_pt=
new
66
MacroElementNodeUpdateRefineableFishMesh<ELEMENT>
(Fish_back_pt);
67
68
69
70
// Number of plot points in each coordinate direction.
71
unsigned
npts
=11;
72
73
ofstream
some_file
;
74
char
filename
[100];
75
76
// Output initial mesh
77
unsigned
count
=0;
78
snprintf
(
filename
,
sizeof
(
filename
),
"RESLT/soln%i.dat"
,
count
);
79
some_file
.open(
filename
);
80
Fish_mesh_pt->output(
some_file
,
npts
);
81
some_file
.close();
82
count
++;
83
84
85
86
// Increment y_c
87
Fish_back_pt->
y_c
()+=0.2;
88
89
90
91
// Adjust each node in turn and doc
92
unsigned
nnod
=Fish_mesh_pt->nnode();
93
for
(
unsigned
i
=0;
i
<
nnod
;
i
++)
94
{
95
// Update individual nodal position
96
Fish_mesh_pt->node_pt(
i
)->node_update();
97
98
// Doc mesh
99
snprintf
(
filename
,
sizeof
(
filename
),
"RESLT/soln%i.dat"
,
count
);
100
some_file
.open(
filename
);
101
Fish_mesh_pt->output(
some_file
,
npts
);
102
some_file
.close();
103
count
++;
104
}
105
106
}
// end of main
107
108
demo_fish_poisson
void demo_fish_poisson(const string &directory_name)
Demonstrate how to solve 2D Poisson problem in deformable fish-shaped domain with mesh adaptation.
Definition
algebraic_free_boundary_poisson.cc:460
circle_as_generalised_element.h
oomph::ElasticallySupportedRingElement
GeneralCircle "upgraded" to a GeneralisedElement: Circular ring whose position is given by.
Definition
circle_as_generalised_element.h:55
oomph::GeneralCircle::y_c
double & y_c()
Access function to y-coordinate of centre of circle.
Definition
circle.h:208
main
int main()
Driver to document sparse MacroElement-based node update.
Definition
doc_sparse_macro_node_update.cc:48
oomph
Definition
circle.h:34