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
src
meshes
annular_mesh.template.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
#ifndef OOMPH_ANNULAR_MESH_TEMPLATE_HEADER
27
#define OOMPH_ANNULAR_MESH_TEMPLATE_HEADER
28
29
#ifndef OOMPH_ANNULAR_MESH_HEADER
30
#error __FILE__ should only be included from annular_mesh.h.
31
#endif
// OOMPH_ANNULAR_MESH_HEADER
32
33
namespace
oomph
34
{
35
//===================================================================
36
/// Helper function to Wrap mesh into annular shape
37
//==================================================================
38
template
<
class
ELEMENT>
39
void
TwoDAnnularMesh<ELEMENT>::wrap_into_annular_shape
(
40
const
double
&
a
,
41
const
double
&
h
,
42
const
double
&
azimuthal_fraction
,
43
const
double
&
phi
)
44
{
45
// Create the hole
46
Ellipse
ellipse
(
a
,
a
);
47
48
// Set all the initial positions of the nodes
49
Vector<double>
xi
(1);
50
Vector<double>
base
(2);
51
Vector<double>
N(2);
52
const
unsigned
n_node
= this->
nnode
();
53
for
(
unsigned
n
= 0;
n
<
n_node
;
n
++)
54
{
55
// Pointer to node
56
Node
*
nod_pt
= this->
node_pt
(
n
);
57
58
// Get the angle of the node -- rotate such that jump in angle
59
// appears at periodic boundary. Shrink domain slightly
60
// to keep angle unique
61
xi
[0] = (1.0 - 1.0e-10) * (-
azimuthal_fraction
*
nod_pt
->x(0)) * 2.0 *
62
MathematicalConstants::Pi +
63
MathematicalConstants::Pi -
64
(1.0 -
azimuthal_fraction
) * 2.0 * MathematicalConstants::Pi;
65
66
// Rotate
67
xi
[0] +=
phi
;
68
69
// Get the node's fraction in the radial direction
70
double
w
=
nod_pt
->x(1);
71
72
// Get the position on the ellipse base
73
ellipse
.position(
xi
,
base
);
74
75
// Get the unit normal, if it were a circle , by normalising the base
76
double
norm
=
sqrt
(
base
[0] *
base
[0] +
base
[1] *
base
[1]);
77
N[0] =
base
[0] /
norm
;
78
N[1] =
base
[1] /
norm
;
79
80
// Set circular film from the ellipse
81
nod_pt
->x(0) =
base
[0] +
w
* (
h
+
a
-
norm
) * N[0];
82
nod_pt
->x(1) =
base
[1] +
w
* (
h
+
a
-
norm
) * N[1];
83
84
// Set boundary coordinates
85
Vector<double>
xi_bound
(1);
86
87
// Polar angle for boundary coordinate on boundary 0
88
if
(
nod_pt
->is_on_boundary(0))
89
{
90
xi_bound
[0] =
atan2
(
nod_pt
->x(1),
nod_pt
->x(0));
91
nod_pt
->set_coordinates_on_boundary(0,
xi_bound
);
92
}
93
94
// Radius for boundary coordinate on boundary 1
95
if
(
nod_pt
->is_on_boundary(1))
96
{
97
xi_bound
[0] =
sqrt
(
pow
(
nod_pt
->x(0), 2) +
pow
(
nod_pt
->x(1), 2));
98
nod_pt
->set_coordinates_on_boundary(1,
xi_bound
);
99
}
100
101
// Polar angle for boundary coordinate on boundary 2
102
if
(
nod_pt
->is_on_boundary(2))
103
{
104
xi_bound
[0] =
atan2
(
nod_pt
->x(1),
nod_pt
->x(0));
105
nod_pt
->set_coordinates_on_boundary(2,
xi_bound
);
106
}
107
108
// Radius for boundary coordinate on boundary 3
109
if
(
nod_pt
->is_on_boundary(3))
110
{
111
xi_bound
[0] =
sqrt
(
pow
(
nod_pt
->x(0), 2) +
pow
(
nod_pt
->x(1), 2));
112
nod_pt
->set_coordinates_on_boundary(3,
xi_bound
);
113
}
114
}
115
116
this->
set_boundary_coordinate_exists
(0);
117
this->
set_boundary_coordinate_exists
(1);
118
this->
set_boundary_coordinate_exists
(2);
119
this->
set_boundary_coordinate_exists
(3);
120
}
121
122
}
// namespace oomph
123
124
#endif
oomph::MacroElementNodeUpdateCollapsibleChannelMesh
Collapsible channel mesh with MacroElement-based node update. The collapsible segment is represented ...
Definition
collapsible_channel_mesh.h:236
oomph::TwoDAnnularMesh::wrap_into_annular_shape
void wrap_into_annular_shape(const double &a, const double &h, const double &azimuthal_fraction, const double &phi)
Wrap mesh into annular shape.
Definition
annular_mesh.template.cc:39
oomph
Definition
annular_domain.h:35