annular_domain.h
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_DOMAIN_HEADER
27#define OOMPH_ANNULAR_DOMAIN_HEADER
28
29// Generic oomph-lib includes
30#include "generic/quadtree.h"
31#include "generic/domain.h"
32#include "generic/geom_objects.h"
33
34namespace oomph
35{
36 //=================================================================
37 /// Annular domain
38 //=================================================================
39 class AnnularDomain : public Domain
40 {
41 public:
42 /// Constructor: Specify azimuthal fraction (1.0 is 360 degrees)
43 /// number of macro elements in azimuthal and radial direction,
44 /// inner radius and thickness. Rotate mesh by angle phi.
46 const unsigned& ntheta,
47 const unsigned& nr,
48 const double& a,
49 const double& h,
50 const double& phi)
53 Thickness(h),
55 Nr(nr),
56 Phi(phi)
57 {
58 const unsigned n_macro = ntheta * nr;
60
61 // Create the macro elements
62 for (unsigned i = 0; i < n_macro; i++)
63 {
65 }
66 }
67
68 /// Broken copy constructor
69 AnnularDomain(const AnnularDomain&) = delete;
70
71 /// Broken assignment operator
72 void operator=(const AnnularDomain&) = delete;
73
74 /// Destructor: Empty; cleanup done in base class
76
77
78 /// Vector representation of the i_macro-th macro element
79 /// boundary i_direct (N/S/W/E) at time level t
80 /// (t=0: present; t>0: previous):
81 /// f(s).
82 void macro_element_boundary(const unsigned& t,
83 const unsigned& i_macro,
84 const unsigned& i_direct,
85 const Vector<double>& s,
87
88 private:
89 /// Azimuthal fraction
91
92 /// Inner radius
94
95 /// Thickness
96 double Thickness;
97
98 /// Number of macro elements in azimuthal direction
99 unsigned Ntheta;
100
101 /// Number of macro elements in radial direction
102 unsigned Nr;
103
104 /// Rotation angle
105 double Phi;
106 };
107
108
109 /////////////////////////////////////////////////////////////////////////
110 /////////////////////////////////////////////////////////////////////////
111 /////////////////////////////////////////////////////////////////////////
112
113 //=================================================================
114 /// Vector representation of the imacro-th macro element
115 /// boundary idirect (N/S/W/E) at time level t
116 /// (t=0: present; t>0: previous): f(s)
117 //=================================================================
119 const unsigned& imacro,
120 const unsigned& idirect,
121 const Vector<double>& s,
123 {
124 using namespace QuadTreeNames;
125
126 // Get coordinates of macro element
127 unsigned i_theta = imacro % Ntheta;
128 unsigned i_r = (imacro - i_theta) / Ntheta;
129
130 // Angle and radius limits
131 double theta_lo = Azimuthal_fraction * 2.0 * MathematicalConstants::Pi *
133
134 double theta_hi = Azimuthal_fraction * 2.0 * MathematicalConstants::Pi *
135 double(i_theta + 1) / double(Ntheta);
136
137 // Revert direction (convoluted -- don't ask. It mirrors what happens
138 // in the mesh...
139 theta_lo = -MathematicalConstants::Pi +
140 Azimuthal_fraction * 2.0 * MathematicalConstants::Pi - theta_lo;
141 theta_hi = -MathematicalConstants::Pi +
142 Azimuthal_fraction * 2.0 * MathematicalConstants::Pi - theta_hi;
143
144 double r_lo = Inner_radius + Thickness * double(i_r) / double(Nr);
145 double r_hi = Inner_radius + Thickness * double(i_r + 1) / double(Nr);
146
147 // Actual radius and angle
148 double r = 0.0;
149 double theta = 0.0;
150
151 // Which direction?
152 switch (idirect)
153 {
154 case N:
155
156 theta = theta_lo + 0.5 * (s[0] + 1.0) * (theta_hi - theta_lo);
157 r = r_hi;
158
159 break;
160
161 case S:
162
163 theta = theta_lo + 0.5 * (s[0] + 1.0) * (theta_hi - theta_lo);
164 r = r_lo;
165
166 break;
167
168 case W:
169
170 theta = theta_lo;
171 r = r_lo + 0.5 * (s[0] + 1.0) * (r_hi - r_lo);
172
173 break;
174
175 case E:
176
177 theta = theta_hi;
178 r = r_lo + 0.5 * (s[0] + 1.0) * (r_hi - r_lo);
179
180 break;
181
182 default:
183 std::ostringstream error_stream;
184 error_stream << "idirect is " << idirect << " not one of N, S, W, E"
185 << std::endl;
186
187 throw OomphLibError(
189 }
190
191 f[0] = r * cos(theta + Phi);
192 f[1] = r * sin(theta + Phi);
193 }
194
195} // namespace oomph
196
197#endif
Annular domain.
double Phi
Rotation angle.
unsigned Nr
Number of macro elements in radial direction.
AnnularDomain(const AnnularDomain &)=delete
Broken copy constructor.
double Thickness
Thickness.
double Inner_radius
Inner radius.
unsigned Ntheta
Number of macro elements in azimuthal direction.
~AnnularDomain()
Destructor: Empty; cleanup done in base class.
AnnularDomain(const double &azimuthal_fraction, const unsigned &ntheta, const unsigned &nr, const double &a, const double &h, const double &phi)
Constructor: Specify azimuthal fraction (1.0 is 360 degrees) number of macro elements in azimuthal an...
double Azimuthal_fraction
Azimuthal fraction.
void macro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
Vector representation of the i_macro-th macro element boundary i_direct (N/S/W/E) at time level t (t=...
void operator=(const AnnularDomain &)=delete
Broken assignment operator.
Collapsible channel mesh with MacroElement-based node update. The collapsible segment is represented ...