quarter_circle_sector_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// Include guards
27#ifndef OOMPH_QUARTER_CIRCLE_SECTOR_DOMAIN_HEADER
28#define OOMPH_QUARTER_CIRCLE_SECTOR_DOMAIN_HEADER
29
30// Generic oomph-lib includes
31#include "generic/quadtree.h"
32#include "generic/domain.h"
34
35namespace oomph
36{
37 //=================================================================
38 /// Circular sector as domain. Domain is bounded by
39 /// curved boundary which is represented by a GeomObject. Domain is
40 /// parametrised by three macro elements.
41 //=================================================================
43 {
44 public:
45 /// Constructor: Pass boundary object and start and end coordinates
46 /// and fraction along boundary object where outer ring is divided.
47 QuarterCircleSectorDomain(GeomObject* boundary_geom_object_pt,
48 const double& xi_lo,
49 const double& fract_mid,
50 const double& xi_hi)
51 : Xi_lo(xi_lo),
53 Xi_hi(xi_hi),
54 Wall_pt(boundary_geom_object_pt),
56 {
57 // There are three macro elements
58 unsigned nmacro = 3;
59
60 // Resize
62
63 // Create macro elements
64 for (unsigned i = 0; i < nmacro; i++)
65 {
67 }
68 }
69
70 /// Broken copy constructor
72
73 /// Broken assignment operator
74 void operator=(const QuarterCircleSectorDomain&) = delete;
75
76 /// Destructor: empty; cleanup done in base class
78
79 /// Typedef for function pointer for function that squashes
80 /// the outer two macro elements towards
81 /// the wall by mapping the input value of the "radial" macro element
82 /// coordinate to the return value
83 typedef double (*BLSquashFctPt)(const double& s);
84
85 /// Function pointer for function that squashes
86 /// the outer two macro elements towards
87 /// the wall by mapping the input value of the "radial" macro element
88 /// coordinate to the return value
93
94 /// Function that squashes the outer two macro elements towards
95 /// the wall by mapping the input value of the "radial" macro element
96 /// coordinate to the return value
97 double s_squashed(const double& s)
98 {
99 return BL_squash_fct_pt(s);
100 }
101
102 /// Vector representation of the i_macro-th macro element
103 /// boundary i_direct (N/S/W/E) at time level t
104 /// (t=0: present; t>0: previous):
105 /// f(s). Note that the local coordinate \b s is a 1D
106 /// Vector rather than a scalar -- this is unavoidable because
107 /// this function implements the pure virtual function in the
108 /// Domain base class.
109 void macro_element_boundary(const unsigned& t,
110 const unsigned& i_macro,
111 const unsigned& i_direct,
112 const Vector<double>& s,
113 Vector<double>& f);
114
115 private:
116 /// Lower limit for the (1D) coordinates along the wall
117 double Xi_lo;
118
119 /// Fraction along wall where outer ring is to be divided
120 double Fract_mid;
121
122 /// Upper limit for the (1D) coordinates along the wall
123 double Xi_hi;
124
125 /// Pointer to geometric object that represents the curved wall
127
128 /// Function pointer for function that squashes
129 /// the outer two macro elements towards
130 /// the wall by mapping the input value of the "radial" macro element
131 /// coordinate to the return value
133
134 /// Default for function that squashes
135 /// the outer two macro elements towards
136 /// the wall by mapping the input value of the "radial" macro element
137 /// coordinate to the return value: Identity.
138 static double default_BL_squash_fct(const double& s)
139 {
140 return s;
141 }
142
143 /// Boundary of top left macro element zeta \f$ \in [-1,1] \f$
144 void r_top_left_N(const unsigned& t,
145 const Vector<double>& zeta,
146 Vector<double>& f);
147
148 /// Boundary of top left macro element zeta \f$ \in [-1,1] \f$
149 void r_top_left_W(const unsigned& t,
150 const Vector<double>& zeta,
151 Vector<double>& f);
152
153 /// Boundary of top left macro element zeta \f$ \in [-1,1] \f$
154 void r_top_left_S(const unsigned& t,
155 const Vector<double>& zeta,
156 Vector<double>& f);
157
158 /// Boundary of top left macro element zeta \f$ \in [-1,1] \f$
159 void r_top_left_E(const unsigned& t,
160 const Vector<double>& zeta,
161 Vector<double>& f);
162
163 /// Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
164 void r_bot_right_N(const unsigned& t,
165 const Vector<double>& zeta,
166 Vector<double>& f);
167
168 /// Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
169 void r_bot_right_W(const unsigned& t,
170 const Vector<double>& zeta,
171 Vector<double>& f);
172
173 /// Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
174 void r_bot_right_S(const unsigned& t,
175 const Vector<double>& zeta,
176 Vector<double>& f);
177
178 /// Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
179 void r_bot_right_E(const unsigned& t,
180 const Vector<double>& zeta,
181 Vector<double>& f);
182
183 /// Boundary of central box macro element zeta \f$ \in [-1,1] \f$
184 void r_centr_N(const unsigned& t,
185 const Vector<double>& zeta,
186 Vector<double>& f);
187
188 /// Boundary of central box macro element zeta \f$ \in [-1,1] \f$
189 void r_centr_E(const unsigned& t,
190 const Vector<double>& zeta,
191 Vector<double>& f);
192
193 /// Boundary of central box macro element zeta \f$ \in [-1,1] \f$
194 void r_centr_S(const unsigned& t,
195 const Vector<double>& zeta,
196 Vector<double>& f);
197
198 /// Boundary of central box macro element zeta \f$ \in [-1,1] \f$
199 void r_centr_W(const unsigned& t,
200 const Vector<double>& zeta,
201 Vector<double>& f);
202 };
203
204
205 /////////////////////////////////////////////////////////////////////////
206 /////////////////////////////////////////////////////////////////////////
207 /////////////////////////////////////////////////////////////////////////
208
209 //=================================================================
210 /// Vector representation of the imacro-th macro element
211 /// boundary idirect (N/S/W/E) at time level t (t=0: present; t>0: previous):
212 /// f(s)
213 //=================================================================
215 const unsigned& t,
216 const unsigned& imacro,
217 const unsigned& idirect,
218 const Vector<double>& s,
220 {
221#ifdef WARN_ABOUT_SUBTLY_CHANGED_OOMPH_INTERFACES
222 // Warn about time argument being moved to the front
224 "Order of function arguments has changed between versions 0.8 and 0.85",
225 "QuarterCircleSectorDomain::macro_element_boundary(...)",
227#endif
228
229 // Which macro element?
230 // --------------------
231 switch (imacro)
232 {
233 using namespace QuadTreeNames;
234
235 // Macro element 0: Central box
236 case 0:
237
238 // Which direction?
239 if (idirect == N)
240 {
241 r_centr_N(t, s, f);
242 }
243 else if (idirect == S)
244 {
245 r_centr_S(t, s, f);
246 }
247 else if (idirect == W)
248 {
249 r_centr_W(t, s, f);
250 }
251 else if (idirect == E)
252 {
253 r_centr_E(t, s, f);
254 }
255 else
256 {
257 std::ostringstream error_stream;
258 error_stream << "idirect is " << idirect << " not one of N, S, E, W"
259 << std::endl;
260
261 throw OomphLibError(error_stream.str(),
264 }
265
266 break;
267
268 // Macro element 1: Bottom right
269 case 1:
270
271 // Which direction?
272 if (idirect == N)
273 {
274 r_bot_right_N(t, s, f);
275 }
276 else if (idirect == S)
277 {
278 r_bot_right_S(t, s, f);
279 }
280 else if (idirect == W)
281 {
282 r_bot_right_W(t, s, f);
283 }
284 else if (idirect == E)
285 {
286 r_bot_right_E(t, s, f);
287 }
288 else
289 {
290 std::ostringstream error_stream;
291 error_stream << "idirect is " << idirect << " not one of N, S, E, W"
292 << std::endl;
293
294 throw OomphLibError(error_stream.str(),
297 }
298
299 break;
300
301 // Macro element 2:Top left
302 case 2:
303
304 // Which direction?
305 if (idirect == N)
306 {
307 r_top_left_N(t, s, f);
308 }
309 else if (idirect == S)
310 {
311 r_top_left_S(t, s, f);
312 }
313 else if (idirect == W)
314 {
315 r_top_left_W(t, s, f);
316 }
317 else if (idirect == E)
318 {
319 r_top_left_E(t, s, f);
320 }
321 else
322 {
323 std::ostringstream error_stream;
324 error_stream << "idirect is " << idirect << " not one of N, S, E, W"
325 << std::endl;
326
327 throw OomphLibError(error_stream.str(),
330 }
331
332 break;
333
334 default:
335
336 // Error
337 std::ostringstream error_stream;
338 error_stream << "Wrong imacro " << imacro << std::endl;
339
340 throw OomphLibError(
342 }
343 }
344
345 //=================================================================
346 /// Northern edge of top left macro element \f$ s \in [-1,1] \f$
347 //=================================================================
349 const Vector<double>& s,
351 {
352 Vector<double> x(1);
353
354 // Coordinate along wall
355 x[0] = Xi_hi + (Fract_mid * (Xi_hi - Xi_lo) - Xi_hi) * 0.5 * (s[0] + 1.0);
356
357 Wall_pt->position(t, x, f);
358 }
359
360 //=================================================================
361 /// Western edge of top left macro element \f$s \in [-1,1] \f$
362 //=================================================================
364 const Vector<double>& s,
366 {
367 Vector<double> x(1);
368
369 // Top left corner
371 x[0] = Xi_hi;
372
373 Wall_pt->position(t, x, r_top);
374
375 f[0] = 0.0;
376 f[1] = 0.5 * r_top[1] * (1.0 + s_squashed(0.5 * (s[0] + 1.0)));
377 }
378
379 //=================================================================
380 /// Southern edge of top left macro element \f$ s \in [-1,1] \f$
381 //=================================================================
383 const Vector<double>& s,
385 {
386 Vector<double> x(1);
387
388 // Top left corner
390 x[0] = Xi_hi;
391
392 Wall_pt->position(t, x, r_top);
393
394 // Bottom right corner
396 x[0] = 0.0;
397
398 Wall_pt->position(t, x, r_bot);
399
400 f[0] = 0.5 * r_bot[0] * 0.5 * (s[0] + 1.0);
401 f[1] = 0.5 * r_top[1];
402 }
403
404 //=================================================================
405 /// Eastern edge of top left macro element \f$ s \in [-1,1] \f$
406 //=================================================================
408 const Vector<double>& s,
410 {
411 Vector<double> x(1);
412
413 // Top left corner
415 x[0] = Xi_hi;
416
417 Wall_pt->position(t, x, r_top);
418
419 // Bottom right corner
421 x[0] = Xi_lo;
422
423 Wall_pt->position(t, x, r_bot);
424
425 // Halfway along wall
427 x[0] = Xi_lo + Fract_mid * (Xi_hi - Xi_lo);
428
429 Wall_pt->position(t, x, r_half);
430
431 f[0] = 0.5 * (r_bot[0] + s_squashed(0.5 * (s[0] + 1.0)) *
432 (2.0 * r_half[0] - r_bot[0]));
433 f[1] = 0.5 * (r_top[1] + s_squashed(0.5 * (s[0] + 1.0)) *
434 (2.0 * r_half[1] - r_top[1]));
435 }
436
437 //=================================================================
438 /// Northern edge of bottom right macro element
439 //=================================================================
441 const Vector<double>& s,
443 {
444 r_top_left_E(t, s, f);
445 }
446
447 //=================================================================
448 /// Western edge of bottom right macro element
449 //=================================================================
451 const Vector<double>& s,
453 {
454 Vector<double> x(1);
455
456 // Top left corner
458 x[0] = Xi_hi;
459
460 Wall_pt->position(t, x, r_top);
461
462 // Bottom right corner
464 x[0] = Xi_lo;
465
466 Wall_pt->position(t, x, r_bot);
467
468 f[0] = 0.5 * r_bot[0];
469 f[1] = 0.5 * r_top[1] * 0.5 * (s[0] + 1.0);
470 }
471
472 //=================================================================
473 /// Southern edge of bottom right macro element
474 //=================================================================
476 const Vector<double>& s,
478 {
479 Vector<double> x(1);
480
481 // Bottom right corner
483 x[0] = Xi_lo;
484 Wall_pt->position(t, x, r_bot);
485
486 f[0] = 0.5 * r_bot[0] * (1.0 + s_squashed(0.5 * (s[0] + 1.0)));
487 f[1] = 0.0;
488 }
489
490 //=================================================================
491 /// Eastern edge of bottom right macro element
492 //=================================================================
494 const Vector<double>& s,
496 {
497 Vector<double> x(1);
498
499 // Coordinate along wall
500 x[0] = Xi_lo + (Fract_mid * (Xi_hi - Xi_lo) - Xi_lo) * (s[0] + 1.0) * 0.5;
501
502 Wall_pt->position(t, x, f);
503 }
504
505 //=================================================================
506 /// Northern edge of central box
507 //=================================================================
509 const Vector<double>& s,
511 {
512 r_top_left_S(t, s, f);
513 }
514
515 //=================================================================
516 /// Eastern edge of central box
517 //=================================================================
519 const Vector<double>& s,
521 {
522 r_bot_right_W(t, s, f);
523 }
524
525 //=================================================================
526 /// Southern edge of central box
527 //=================================================================
529 const Vector<double>& s,
531 {
532 Vector<double> x(1);
533
534 // Bottom right corner
536 x[0] = Xi_lo;
537 Wall_pt->position(t, x, r_bot);
538
539 f[0] = 0.5 * r_bot[0] * 0.5 * (s[0] + 1.0);
540 f[1] = 0.0;
541 }
542
543 //=================================================================
544 /// Western edge of central box
545 //=================================================================
547 const Vector<double>& s,
549 {
550 Vector<double> x(1);
551
552 // Top left corner
554 x[0] = Xi_hi;
555 Wall_pt->position(t, x, r_top);
556
557 f[0] = 0.0;
558 f[1] = 0.5 * r_top[1] * 0.5 * (s[0] + 1.0);
559 }
560
561} // namespace oomph
562
563#endif
static char t char * s
Definition cfortran.h:568
cstr elem_len * i
Definition cfortran.h:603
char t
Definition cfortran.h:568
Base class for Domains with curvilinear and/or time-dependent boundaries. Domain boundaries are typic...
Definition domain.h:67
Vector< MacroElement * > Macro_element_pt
Vector of pointers to macro elements.
Definition domain.h:301
A geometric object is an object that provides a parametrised description of its shape via the functio...
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
Circular sector as domain. Domain is bounded by curved boundary which is represented by a GeomObject....
void r_top_left_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of top left macro element zeta .
QuarterCircleSectorDomain(const QuarterCircleSectorDomain &)=delete
Broken copy constructor.
void r_centr_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of central box macro element zeta .
void r_centr_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of central box macro element zeta .
void r_bot_right_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of bottom right macro element zeta .
GeomObject * Wall_pt
Pointer to geometric object that represents the curved wall.
double s_squashed(const double &s)
Function that squashes the outer two macro elements towards the wall by mapping the input value of th...
double(* BLSquashFctPt)(const double &s)
Typedef for function pointer for function that squashes the outer two macro elements towards the wall...
void operator=(const QuarterCircleSectorDomain &)=delete
Broken assignment operator.
void r_top_left_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of top left macro element zeta .
void r_bot_right_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of bottom right macro element zeta .
void r_top_left_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of top left macro element zeta .
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=...
BLSquashFctPt & bl_squash_fct_pt()
Function pointer for function that squashes the outer two macro elements towards the wall by mapping ...
void r_centr_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of central box macro element zeta .
double Xi_hi
Upper limit for the (1D) coordinates along the wall.
void r_bot_right_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of bottom right macro element zeta .
QuarterCircleSectorDomain(GeomObject *boundary_geom_object_pt, const double &xi_lo, const double &fract_mid, const double &xi_hi)
Constructor: Pass boundary object and start and end coordinates and fraction along boundary object wh...
void r_bot_right_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of bottom right macro element zeta .
static double default_BL_squash_fct(const double &s)
Default for function that squashes the outer two macro elements towards the wall by mapping the input...
double Fract_mid
Fraction along wall where outer ring is to be divided.
void r_centr_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of central box macro element zeta .
BLSquashFctPt BL_squash_fct_pt
Function pointer for function that squashes the outer two macro elements towards the wall by mapping ...
~QuarterCircleSectorDomain()
Destructor: empty; cleanup done in base class.
void r_top_left_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of top left macro element zeta .
double Xi_lo
Lower limit for the (1D) coordinates along the wall.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).