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// Version 1.0; svn revision $LastChangedRevision: 1104 $
7 //LIC//
8 //LIC// $LastChangedDate: 2016-01-09 08:06:50 +0000 (Sat, 09 Jan 2016) $
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 //Include guards
31 #ifndef OOMPH_QUARTER_CIRCLE_SECTOR_DOMAIN_HEADER
32 #define OOMPH_QUARTER_CIRCLE_SECTOR_DOMAIN_HEADER
33 
34 // Generic oomph-lib includes
35 #include "../generic/quadtree.h"
36 #include "../generic/domain.h"
37 #include "../generic/geom_objects.h"
38 
39 namespace oomph
40 {
41 
42 
43 
44 
45 //=================================================================
46 /// \short Circular sector as domain. Domain is bounded by
47 /// curved boundary which is represented by a GeomObject. Domain is
48 /// parametrised by three macro elements.
49 //=================================================================
51 {
52 
53 public:
54 
55 
56 
57  /// \short Constructor: Pass boundary object and start and end coordinates
58  /// and fraction along boundary object where outer ring is divided.
59  QuarterCircleSectorDomain(GeomObject* boundary_geom_object_pt,
60  const double& xi_lo,
61  const double& fract_mid,
62  const double& xi_hi) :
63  Xi_lo(xi_lo), Fract_mid(fract_mid), Xi_hi(xi_hi),
64  Wall_pt(boundary_geom_object_pt), BL_squash_fct_pt(&default_BL_squash_fct)
65  {
66  // There are three macro elements
67  unsigned nmacro=3;
68 
69  // Resize
70  Macro_element_pt.resize(nmacro);
71 
72  // Create macro elements
73  for (unsigned i=0;i<nmacro;i++)
74  {
76  }
77  }
78 
79 
80  /// Broken copy constructor
82  {
83  BrokenCopy::broken_copy("QuarterCircleSectorDomain");
84  }
85 
86  /// Broken assignment operator
88  {
89  BrokenCopy::broken_assign("QuarterCircleSectorDomain");
90  }
91 
92 
93  /// Destructor: Kill macro elements
95  {
96  for (unsigned i=0;i<3;i++)
97  {
98  delete Macro_element_pt[i];
99  }
100  }
101 
102  /// \short Typedef for function pointer for function that squashes
103  /// the outer two macro elements towards
104  /// the wall by mapping the input value of the "radial" macro element
105  /// coordinate to the return value
106  typedef double (*BLSquashFctPt)(const double& s);
107 
108 
109  /// \short Function pointer for function that squashes
110  /// the outer two macro elements towards
111  /// the wall by mapping the input value of the "radial" macro element
112  /// coordinate to the return value
114  {
115  return BL_squash_fct_pt;
116  }
117 
118 
119  /// \short Function that squashes the outer two macro elements towards
120  /// the wall by mapping the input value of the "radial" macro element
121  /// coordinate to the return value
122  double s_squashed(const double& s)
123  {
124  return BL_squash_fct_pt(s);
125  }
126 
127  /// \short Vector representation of the i_macro-th macro element
128  /// boundary i_direct (N/S/W/E) at time level t
129  /// (t=0: present; t>0: previous):
130  /// f(s). Note that the local coordinate \b s is a 1D
131  /// Vector rather than a scalar -- this is unavoidable because
132  /// this function implements the pure virtual function in the
133  /// Domain base class.
134  void macro_element_boundary(const unsigned& t,
135  const unsigned& i_macro,
136  const unsigned& i_direct,
137  const Vector<double>& s,
138  Vector<double>& f);
139 
140 
141 private:
142 
143  /// Lower limit for the (1D) coordinates along the wall
144  double Xi_lo;
145 
146  /// Fraction along wall where outer ring is to be divided
147  double Fract_mid;
148 
149  /// Upper limit for the (1D) coordinates along the wall
150  double Xi_hi;
151 
152  /// Pointer to geometric object that represents the curved wall
154 
155  /// \short Function pointer for function that squashes
156  /// the outer two macro elements towards
157  /// the wall by mapping the input value of the "radial" macro element
158  /// coordinate to the return value
160 
161  /// \short Default for function that squashes
162  /// the outer two macro elements towards
163  /// the wall by mapping the input value of the "radial" macro element
164  /// coordinate to the return value: Identity.
165  static double default_BL_squash_fct(const double& s)
166  {
167  return s;
168  }
169 
170  /// \short Boundary of top left macro element zeta \f$ \in [-1,1] \f$
171  void r_top_left_N(const unsigned& t, const Vector<double>& zeta,
172  Vector<double>& f);
173 
174  /// \short Boundary of top left macro element zeta \f$ \in [-1,1] \f$
175  void r_top_left_W(const unsigned& t, const Vector<double>& zeta,
176  Vector<double>& f);
177 
178  /// \short Boundary of top left macro element zeta \f$ \in [-1,1] \f$
179  void r_top_left_S(const unsigned& t, const Vector<double>& zeta,
180  Vector<double>& f);
181 
182  /// \short Boundary of top left macro element zeta \f$ \in [-1,1] \f$
183  void r_top_left_E(const unsigned& t, const Vector<double>& zeta,
184  Vector<double>& f);
185 
186  /// \short Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
187  void r_bot_right_N(const unsigned& t, const Vector<double>& zeta,
188  Vector<double>& f);
189 
190  /// \short Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
191  void r_bot_right_W(const unsigned& t, const Vector<double>& zeta,
192  Vector<double>& f);
193 
194  /// \short Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
195  void r_bot_right_S(const unsigned& t, const Vector<double>& zeta,
196  Vector<double>& f);
197 
198  /// \short Boundary of bottom right macro element zeta \f$ \in [-1,1] \f$
199  void r_bot_right_E(const unsigned& t, const Vector<double>& zeta,
200  Vector<double>& f);
201 
202  /// \short Boundary of central box macro element zeta \f$ \in [-1,1] \f$
203  void r_centr_N(const unsigned& t, const Vector<double>& zeta,
204  Vector<double>& f);
205 
206  /// \short Boundary of central box macro element zeta \f$ \in [-1,1] \f$
207  void r_centr_E(const unsigned& t, const Vector<double>& zeta,
208  Vector<double>& f);
209 
210  /// \short Boundary of central box macro element zeta \f$ \in [-1,1] \f$
211  void r_centr_S(const unsigned& t, const Vector<double>& zeta,
212  Vector<double>& f);
213 
214  /// \short Boundary of central box macro element zeta \f$ \in [-1,1] \f$
215  void r_centr_W(const unsigned& t, const Vector<double>& zeta,
216  Vector<double>& f);
217 
218 
219 };
220 
221 
222 /////////////////////////////////////////////////////////////////////////
223 /////////////////////////////////////////////////////////////////////////
224 /////////////////////////////////////////////////////////////////////////
225 
226 
227 
228 //=================================================================
229 /// Vector representation of the imacro-th macro element
230 /// boundary idirect (N/S/W/E) at time level t (t=0: present; t>0: previous):
231 /// f(s)
232 //=================================================================
234  const unsigned& t,
235  const unsigned& imacro,
236  const unsigned& idirect,
237  const Vector<double>& s,
238  Vector<double>& f)
239 {
240 
241 
242 #ifdef WARN_ABOUT_SUBTLY_CHANGED_OOMPH_INTERFACES
243  // Warn about time argument being moved to the front
245  "Order of function arguments has changed between versions 0.8 and 0.85",
246  "QuarterCircleSectorDomain::macro_element_boundary(...)",
247  OOMPH_EXCEPTION_LOCATION);
248 #endif
249 
250  // Which macro element?
251  // --------------------
252  switch(imacro)
253  {
254 
255  using namespace QuadTreeNames;
256 
257  // Macro element 0: Central box
258  case 0:
259 
260  // Which direction?
261  if (idirect==N)
262  {
263  r_centr_N(t,s,f);
264  }
265  else if (idirect==S)
266  {
267  r_centr_S(t,s,f);
268  }
269  else if (idirect==W)
270  {
271  r_centr_W(t,s,f);
272  }
273  else if (idirect==E)
274  {
275  r_centr_E(t,s,f);
276  }
277  else
278  {
279  std::ostringstream error_stream;
280  error_stream << "idirect is " << idirect
281  << " not one of N, S, E, W" << std::endl;
282 
283  throw OomphLibError(
284  error_stream.str(),
285  OOMPH_CURRENT_FUNCTION,
286  OOMPH_EXCEPTION_LOCATION);
287  }
288 
289  break;
290 
291  // Macro element 1: Bottom right
292  case 1:
293 
294  // Which direction?
295  if (idirect==N)
296  {
297  r_bot_right_N(t,s,f);
298  }
299  else if (idirect==S)
300  {
301  r_bot_right_S(t,s,f);
302  }
303  else if (idirect==W)
304  {
305  r_bot_right_W(t,s,f);
306  }
307  else if (idirect==E)
308  {
309  r_bot_right_E(t,s,f);
310  }
311  else
312  {
313  std::ostringstream error_stream;
314  error_stream << "idirect is " << idirect
315  << " not one of N, S, E, W" << std::endl;
316 
317  throw OomphLibError(
318  error_stream.str(),
319  OOMPH_CURRENT_FUNCTION,
320  OOMPH_EXCEPTION_LOCATION);
321  }
322 
323  break;
324 
325  // Macro element 2:Top left
326  case 2:
327 
328  // Which direction?
329  if (idirect==N)
330  {
331  r_top_left_N(t,s,f);
332  }
333  else if (idirect==S)
334  {
335  r_top_left_S(t,s,f);
336  }
337  else if (idirect==W)
338  {
339  r_top_left_W(t,s,f);
340  }
341  else if (idirect==E)
342  {
343  r_top_left_E(t,s,f);
344  }
345  else
346  {
347  std::ostringstream error_stream;
348  error_stream << "idirect is " << idirect
349  << " not one of N, S, E, W" << std::endl;
350 
351  throw OomphLibError(
352  error_stream.str(),
353  OOMPH_CURRENT_FUNCTION,
354  OOMPH_EXCEPTION_LOCATION);
355  }
356 
357  break;
358 
359  default:
360 
361  // Error
362  std::ostringstream error_stream;
363  error_stream << "Wrong imacro " << imacro << std::endl;
364 
365  throw OomphLibError(error_stream.str(),
366  OOMPH_CURRENT_FUNCTION,
367  OOMPH_EXCEPTION_LOCATION);
368  }
369 
370 }
371 
372 
373 
374 
375 //=================================================================
376 /// Northern edge of top left macro element \f$ s \in [-1,1] \f$
377 //=================================================================
379  const Vector<double>& s,
380  Vector<double>& f)
381  {
382  Vector<double> x(1);
383 
384  // Coordinate along wall
385  x[0]=Xi_hi+(Fract_mid*(Xi_hi-Xi_lo)-Xi_hi)*0.5*(s[0]+1.0);
386 
387  Wall_pt->position(t,x,f);
388  }
389 
390 
391 
392 
393 //=================================================================
394 /// Western edge of top left macro element \f$s \in [-1,1] \f$
395 //=================================================================
397  const Vector<double>& s,
398  Vector<double>& f)
399  {
400  Vector<double> x(1);
401 
402  // Top left corner
403  Vector<double> r_top(2);
404  x[0]=Xi_hi;
405 
406  Wall_pt->position(t,x,r_top);
407 
408  f[0]=0.0;
409  f[1]=0.5*r_top[1]*(1.0+s_squashed(0.5*(s[0]+1.0)));
410  }
411 
412 
413 
414 //=================================================================
415 /// Southern edge of top left macro element \f$ s \in [-1,1] \f$
416 //=================================================================
418  const Vector<double>& s,
419  Vector<double>& f)
420  {
421  Vector<double> x(1);
422 
423  // Top left corner
424  Vector<double> r_top(2);
425  x[0]=Xi_hi;
426 
427  Wall_pt->position(t,x,r_top);
428 
429 
430  // Bottom right corner
431  Vector<double> r_bot(2);
432  x[0]=0.0;
433 
434  Wall_pt->position(t,x,r_bot);
435 
436  f[0]=0.5*r_bot[0]*0.5*(s[0]+1.0);
437  f[1]=0.5*r_top[1];
438 
439  }
440 
441 
442 
443 //=================================================================
444 /// Eastern edge of top left macro element \f$ s \in [-1,1] \f$
445 //=================================================================
447  const Vector<double>& s,
448  Vector<double>& f)
449 {
450  Vector<double> x(1);
451 
452  // Top left corner
453  Vector<double> r_top(2);
454  x[0]=Xi_hi;
455 
456  Wall_pt->position(t,x,r_top);
457 
458  // Bottom right corner
459  Vector<double> r_bot(2);
460  x[0]=Xi_lo;
461 
462  Wall_pt->position(t,x,r_bot);
463 
464  // Halfway along wall
465  Vector<double> r_half(2);
466  x[0]=Xi_lo+Fract_mid*(Xi_hi-Xi_lo);
467 
468  Wall_pt->position(t,x,r_half);
469 
470  f[0]=0.5*(r_bot[0]+s_squashed(0.5*(s[0]+1.0))*(2.0*r_half[0]-r_bot[0]));
471  f[1]=0.5*(r_top[1]+s_squashed(0.5*(s[0]+1.0))*(2.0*r_half[1]-r_top[1]));
472 
473  }
474 
475 
476 
477 
478 
479 
480 //=================================================================
481 /// Northern edge of bottom right macro element
482 //=================================================================
484  const Vector<double>& s,
485  Vector<double>& f)
486  {
487  r_top_left_E(t,s,f);
488  }
489 
490 //=================================================================
491 /// Western edge of bottom right macro element
492 //=================================================================
494  const Vector<double>& s,
495  Vector<double>& f)
496  {
497  Vector<double> x(1);
498 
499  // Top left corner
500  Vector<double> r_top(2);
501  x[0]=Xi_hi;
502 
503  Wall_pt->position(t,x,r_top);
504 
505  // Bottom right corner
506  Vector<double> r_bot(2);
507  x[0]=Xi_lo;
508 
509  Wall_pt->position(t,x,r_bot);
510 
511  f[0]=0.5*r_bot[0];
512  f[1]=0.5*r_top[1]*0.5*(s[0]+1.0);
513  }
514 
515 //=================================================================
516 /// Southern edge of bottom right macro element
517 //=================================================================
519  const Vector<double>& s,
520  Vector<double>& f)
521  {
522  Vector<double> x(1);
523 
524  // Bottom right corner
525  Vector<double> r_bot(2);
526  x[0]=Xi_lo;
527  Wall_pt->position(t,x,r_bot);
528 
529 
530  f[0]=0.5*r_bot[0]*(1.0+s_squashed(0.5*(s[0]+1.0)));
531  f[1]=0.0;
532 
533  }
534 
535 //=================================================================
536 /// Eastern edge of bottom right macro element
537 //=================================================================
539  const Vector<double>& s,
540  Vector<double>& f)
541 {
542  Vector<double> x(1);
543 
544  // Coordinate along wall
545  x[0]=Xi_lo+(Fract_mid*(Xi_hi-Xi_lo)-Xi_lo)*(s[0]+1.0)*0.5;
546 
547  Wall_pt->position(t,x,f);
548 
549 }
550 
551 
552 //=================================================================
553 /// Northern edge of central box
554 //=================================================================
556  const Vector<double>& s,
557  Vector<double>& f)
558  {
559  r_top_left_S(t,s,f);
560  }
561 
562 
563 
564 
565 //=================================================================
566 /// Eastern edge of central box
567 //=================================================================
569  const Vector<double>& s,
570  Vector<double>& f)
571  {
572  r_bot_right_W(t,s,f);
573  }
574 
575 
576 
577 
578 //=================================================================
579 /// Southern edge of central box
580 //=================================================================
582  const Vector<double>& s,
583  Vector<double>& f)
584 {
585  Vector<double> x(1);
586 
587  // Bottom right corner
588  Vector<double> r_bot(2);
589  x[0]=Xi_lo;
590  Wall_pt->position(t,x,r_bot);
591 
592  f[0]=0.5*r_bot[0]*0.5*(s[0]+1.0);
593  f[1]=0.0;
594 }
595 
596 
597 
598 
599 //=================================================================
600 /// Western edge of central box
601 //=================================================================
603  const Vector<double>& s,
604  Vector<double>& f)
605 {
606 
607  Vector<double> x(1);
608 
609  // Top left corner
610  Vector<double> r_top(2);
611  x[0]=Xi_hi;
612  Wall_pt->position(t,x,r_top);
613 
614  f[0]=0.0;
615  f[1]=0.5*r_top[1]*0.5*(s[0]+1.0);
616 
617 }
618 
619 
620 
621 }
622 
623 #endif
void r_top_left_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of top left macro element zeta .
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
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...
cstr elem_len * i
Definition: cfortran.h:607
void r_centr_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of central box macro element zeta .
Vector< MacroElement * > Macro_element_pt
Vector of pointers to macro elements.
Definition: domain.h:237
void r_bot_right_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of bottom right macro element zeta .
double Xi_hi
Upper limit for the (1D) coordinates along the wall.
char t
Definition: cfortran.h:572
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=...
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
void r_centr_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of central box macro element zeta .
double s_squashed(const double &s)
Function that squashes the outer two macro elements towards the wall by mapping the input value of th...
static char t char * s
Definition: cfortran.h:572
BLSquashFctPt & bl_squash_fct_pt()
Function pointer for function that squashes the outer two macro elements towards the wall by mapping ...
QuarterCircleSectorDomain(const QuarterCircleSectorDomain &)
Broken copy constructor.
void r_bot_right_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of bottom right macro element zeta .
void r_bot_right_E(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.
void r_bot_right_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of bottom right macro element zeta .
Circular sector as domain. Domain is bounded by curved boundary which is represented by a GeomObject...
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...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
double Fract_mid
Fraction along wall where outer ring is to be divided.
void r_top_left_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of top left macro element zeta .
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 .
void r_centr_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Boundary of central box 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 r_top_left_S(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.
Base class for Domains with curvilinear and/or time-dependent boundaries. Domain boundaries are typic...
Definition: domain.h:71
double(* BLSquashFctPt)(const double &s)
Typedef for function pointer for function that squashes the outer two macro elements towards the wall...
~QuarterCircleSectorDomain()
Destructor: Kill macro elements.
void operator=(const QuarterCircleSectorDomain &)
Broken assignment operator.