oomph::HalfRectangleWithHoleDomain Class Reference

Rectangular domain with Half-elliptical hole. More...

#include <half_rectangle_with_hole_mesh.h>

+ Inheritance diagram for oomph::HalfRectangleWithHoleDomain:

Public Member Functions

 HalfRectangleWithHoleDomain (GeomObject *cylinder_pt, const double &radius, const double &length, const double &up_length, const unsigned &nup, const double &down_length, const unsigned &ndown, const double &width_near_cylinder, const unsigned &ncolumn)
 
 ~HalfRectangleWithHoleDomain ()
 Destructor: Empty; cleanup done in base class. More...
 
void linear_interpolate (Vector< double > left, Vector< double > right, const double &s, Vector< double > &f)
 
void macro_element_boundary (const unsigned &time, const unsigned &m, const unsigned &direction, const Vector< double > &s, Vector< double > &f)
 
 HalfRectangleWithHoleDomain (GeomObject *cylinder_pt, const double &radius, const double &length, const double &up_length, const unsigned &nup, const double &down_length, const unsigned &ndown, const double &width_near_cylinder, const unsigned &ncolumn)
 
 ~HalfRectangleWithHoleDomain ()
 Destructor: Empty; cleanup done in base class. More...
 
void linear_interpolate (Vector< double > left, Vector< double > right, const double &s, Vector< double > &f)
 
void macro_element_boundary (const unsigned &time, const unsigned &m, const unsigned &direction, const Vector< double > &s, Vector< double > &f)
 
- Public Member Functions inherited from oomph::Domain
 Domain ()
 Constructor. More...
 
 Domain (const Domain &)=delete
 Broken copy constructor. More...
 
void operator= (const Domain &)=delete
 Broken assignment operator. More...
 
virtual ~Domain ()
 
MacroElementmacro_element_pt (const unsigned &i)
 Access to i-th macro element. More...
 
unsigned nmacro_element ()
 Number of macro elements in domain. More...
 
void output (const std::string &filename, const unsigned &nplot)
 Output macro elements. More...
 
void output (std::ostream &outfile, const unsigned &nplot)
 Output macro elements. More...
 
virtual void macro_element_boundary (const double &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 
void macro_element_boundary (const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 
void output_macro_element_boundaries (const std::string &filename, const unsigned &nplot)
 Output all macro element boundaries as tecplot zones. More...
 
void output_macro_element_boundaries (std::ostream &outfile, const unsigned &nplot)
 Output all macro element boundaries as tecplot zones. More...
 
virtual void dmacro_element_boundary (const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 
virtual void dmacro_element_boundary (const double &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 
void dmacro_element_boundary (const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 
virtual void d2macro_element_boundary (const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 
virtual void d2macro_element_boundary (const double &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 
void d2macro_element_boundary (const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
 

Private Attributes

Vector< Vector< Vector< double > > > Up
 Left and right side of lines in the upstream region. More...
 
Vector< Vector< Vector< double > > > Down
 Left and right side of lines in the downstream region. More...
 
GeomObjectCylinder_pt
 Pointer to geometric object that represents the central cylinder. More...
 
unsigned Nup
 Number of upstream macro elements. More...
 
unsigned Ndown
 Number of downstream macro elements. More...
 
unsigned Ncolumn
 Number of columns. More...
 

Additional Inherited Members

- Protected Attributes inherited from oomph::Domain
Vector< MacroElement * > Macro_element_pt
 Vector of pointers to macro elements. More...
 

Detailed Description

Rectangular domain with Half-elliptical hole.

///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////

Constructor & Destructor Documentation

◆ HalfRectangleWithHoleDomain() [1/2]

oomph::HalfRectangleWithHoleDomain::HalfRectangleWithHoleDomain ( GeomObject cylinder_pt,
const double radius,
const double length,
const double up_length,
const unsigned nup,
const double down_length,
const unsigned ndown,
const double width_near_cylinder,
const unsigned ncolumn 
)
inline

Constructor, Pass pointer to geometric object that represents the cylinder, the length (z) and half-height (r) of the domain. The GeomObject must be parametrised such that \(\zeta \in [0,\pi]\) sweeps around the circumference in anticlockwise direction.

114  :
115  Cylinder_pt(cylinder_pt), Nup(nup), Ndown(ndown), Ncolumn(ncolumn)
116  {
117 
118  //Axial spacing between lines
119  double up_spacing = up_length/(double)nup;
120  double down_spacing = down_length/(double)ndown;
121 
122  //Resize the storage for the corners of the squared
123  Up.resize(ncolumn+1); Down.resize(ncolumn+1);
124 
125  //The first column is special
126  {
127  unsigned j=0;
128  Up[j].resize(nup+1); Up[j].resize(nup+1);
129  //Set the coordinates
130  for(unsigned i=0;i<(nup+1);i++)
131  {
132  Up[j][i].resize(2);
133  Up[j][i][0] = 0.0; Up[j][i][1] = i*up_spacing;
134  }
135 
136  //There are going to be ndown+1 lines in the downstream region
137  Down[j].resize(ndown+1); Down[j].resize(ndown+1);
138 
139  //Set the coordinates
140  for(unsigned i=0;i<(ndown+1);i++)
141  {
142  Down[j][i].resize(2); Down[j][i].resize(2);
143  Down[j][i][0] = 0.0;
144  Down[j][i][1] = length - (ndown - i)*down_spacing;
145  }
146  }
147 
148  //What is the column spacing.
149  double radial_start = radius;
150  double radial_spacing = 0.0;
151 
152  if(ncolumn > 1)
153  {
154  radial_start = width_near_cylinder;
155  radial_spacing = (radius - width_near_cylinder)/(double)(ncolumn-1);
156  }
157 
158  //There are going to be nup+1 lines in the upstream region
159  for(unsigned j=1;j<(ncolumn+1);j++)
160  {
161  Up[j].resize(nup+1); Up[j].resize(nup+1);
162  //Set the coordinates
163  for(unsigned i=0;i<(nup+1);i++)
164  {
165  Up[j][i].resize(2);
166  Up[j][i][0] = radial_start + (j-1)*radial_spacing;
167  Up[j][i][1] = i*up_spacing;
168  }
169 
170  //There are going to be ndown+1 lines in the downstream region
171  Down[j].resize(ndown+1); Down[j].resize(ndown+1);
172 
173  //Set the coordinates
174  for(unsigned i=0;i<(ndown+1);i++)
175  {
176  Down[j][i].resize(2); Down[j][i].resize(2);
177  Down[j][i][0] = radial_start + (j-1)*radial_spacing;
178  Down[j][i][1] = length - (ndown - i)*down_spacing;
179  }
180  }
181 
182  //There are three + nup + ndown macro elements in the first column
183  //Plus the additional columns of 1 + nup + ndowm
184  unsigned n_macro = 3 + nup + ndown + (ncolumn-1)*(1 + nup + ndown);
185  Macro_element_pt.resize(n_macro);
186 
187  // Build the 2D macro elements
188  for (unsigned i=0;i<n_macro;i++)
189  {Macro_element_pt[i]= new QMacroElement<2>(this,i);}
190  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Vector< MacroElement * > Macro_element_pt
Vector of pointers to macro elements.
Definition: domain.h:301
Vector< Vector< Vector< double > > > Up
Left and right side of lines in the upstream region.
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:541
unsigned Nup
Number of upstream macro elements.
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:550
Vector< Vector< Vector< double > > > Down
Left and right side of lines in the downstream region.
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:544
unsigned Ncolumn
Number of columns.
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:556
GeomObject * Cylinder_pt
Pointer to geometric object that represents the central cylinder.
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:547
unsigned Ndown
Number of downstream macro elements.
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:553
radius
Definition: UniformPSDSelfTest.py:15
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References i, j, and UniformPSDSelfTest::radius.

◆ ~HalfRectangleWithHoleDomain() [1/2]

oomph::HalfRectangleWithHoleDomain::~HalfRectangleWithHoleDomain ( )
inline

Destructor: Empty; cleanup done in base class.

195 {}

◆ HalfRectangleWithHoleDomain() [2/2]

oomph::HalfRectangleWithHoleDomain::HalfRectangleWithHoleDomain ( GeomObject cylinder_pt,
const double radius,
const double length,
const double up_length,
const unsigned nup,
const double down_length,
const unsigned ndown,
const double width_near_cylinder,
const unsigned ncolumn 
)
inline

Constructor, Pass pointer to geometric object that represents the cylinder, the length (z) and half-height (r) of the domain. The GeomObject must be parametrised such that \(\zeta \in [0,\pi]\) sweeps around the circumference in anticlockwise direction.

114  :
115  Cylinder_pt(cylinder_pt), Nup(nup), Ndown(ndown), Ncolumn(ncolumn)
116  {
117 
118  //Axial spacing between lines
119  double up_spacing = up_length/(double)nup;
120  double down_spacing = down_length/(double)ndown;
121 
122  //Resize the storage for the corners of the squared
123  Up.resize(ncolumn+1); Down.resize(ncolumn+1);
124 
125  //The first column is special
126  {
127  unsigned j=0;
128  Up[j].resize(nup+1); Up[j].resize(nup+1);
129  //Set the coordinates
130  for(unsigned i=0;i<(nup+1);i++)
131  {
132  Up[j][i].resize(2);
133  Up[j][i][0] = 0.0; Up[j][i][1] = i*up_spacing;
134  }
135 
136  //There are going to be ndown+1 lines in the downstream region
137  Down[j].resize(ndown+1); Down[j].resize(ndown+1);
138 
139  //Set the coordinates
140  for(unsigned i=0;i<(ndown+1);i++)
141  {
142  Down[j][i].resize(2); Down[j][i].resize(2);
143  Down[j][i][0] = 0.0;
144  Down[j][i][1] = length - (ndown - i)*down_spacing;
145  }
146  }
147 
148  //What is the column spacing.
149  double radial_start = radius;
150  double radial_spacing = 0.0;
151 
152  if(ncolumn > 1)
153  {
154  radial_start = width_near_cylinder;
155  radial_spacing = (radius - width_near_cylinder)/(double)(ncolumn-1);
156  }
157 
158  //There are going to be nup+1 lines in the upstream region
159  for(unsigned j=1;j<(ncolumn+1);j++)
160  {
161  Up[j].resize(nup+1); Up[j].resize(nup+1);
162  //Set the coordinates
163  for(unsigned i=0;i<(nup+1);i++)
164  {
165  Up[j][i].resize(2);
166  Up[j][i][0] = radial_start + (j-1)*radial_spacing;
167  Up[j][i][1] = i*up_spacing;
168  }
169 
170  //There are going to be ndown+1 lines in the downstream region
171  Down[j].resize(ndown+1); Down[j].resize(ndown+1);
172 
173  //Set the coordinates
174  for(unsigned i=0;i<(ndown+1);i++)
175  {
176  Down[j][i].resize(2); Down[j][i].resize(2);
177  Down[j][i][0] = radial_start + (j-1)*radial_spacing;
178  Down[j][i][1] = length - (ndown - i)*down_spacing;
179  }
180  }
181 
182  //There are three + nup + ndown macro elements in the first column
183  //Plus the additional columns of 1 + nup + ndowm
184  unsigned n_macro = 3 + nup + ndown + (ncolumn-1)*(1 + nup + ndown);
185  Macro_element_pt.resize(n_macro);
186 
187  // Build the 2D macro elements
188  for (unsigned i=0;i<n_macro;i++)
189  {Macro_element_pt[i]= new QMacroElement<2>(this,i);}
190  }

References i, j, and UniformPSDSelfTest::radius.

◆ ~HalfRectangleWithHoleDomain() [2/2]

oomph::HalfRectangleWithHoleDomain::~HalfRectangleWithHoleDomain ( )
inline

Destructor: Empty; cleanup done in base class.

195 {}

Member Function Documentation

◆ linear_interpolate() [1/2]

void oomph::HalfRectangleWithHoleDomain::linear_interpolate ( Vector< double left,
Vector< double right,
const double s,
Vector< double > &  f 
)
inline

Helper function to interpolate linearly between the "right" and "left" points; \( s \in [-1,1] \)

202  {
203  for(unsigned i=0;i<2;i++)
204  {
205  f[i] = left[i] + (right[i] - left[i])*0.5*(s+1.0);
206  }
207  }
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
RealScalar s
Definition: level1_cplx_impl.h:130

References f(), i, and s.

◆ linear_interpolate() [2/2]

void oomph::HalfRectangleWithHoleDomain::linear_interpolate ( Vector< double left,
Vector< double right,
const double s,
Vector< double > &  f 
)
inline

Helper function to interpolate linearly between the "right" and "left" points; \( s \in [-1,1] \)

201  {
202  for(unsigned i=0;i<2;i++)
203  {
204  f[i] = left[i] + (right[i] - left[i])*0.5*(s+1.0);
205  }
206  }

References f(), i, and s.

◆ macro_element_boundary() [1/2]

void oomph::HalfRectangleWithHoleDomain::macro_element_boundary ( const unsigned time,
const unsigned m,
const unsigned direction,
const Vector< double > &  s,
Vector< double > &  f 
)
inlinevirtual

Parametrisation of macro element boundaries: f(s) is the position vector to macro-element m's boundary in the specified direction [N/S/E/W] at the specfied discrete time level (time=0: present; time>0: previous)

Implements oomph::Domain.

219  {
220  // Lagrangian coordinate along surface of cylinder
221  Vector<double> xi(1);
222 
223  // Point on circle
224  Vector<double> point_on_circle(2);
225 
226  //Upstream region all rectangular blocks
227  if(m < Nup)
228  {
229  //Switch on the direction
230 
231  switch(direction)
232  {
233  case N:
234  linear_interpolate(Up[0][m+1],Up[1][m+1],s[0],f);
235  break;
236 
237  case S:
238  linear_interpolate(Up[0][m],Up[1][m],s[0],f);
239  break;
240 
241  case W:
242  linear_interpolate(Up[0][m],Up[0][m+1],s[0],f);
243  break;
244 
245  case E:
246  linear_interpolate(Up[1][m],Up[1][m+1],s[0],f);
247  break;
248 
249  default:
250 
251  std::ostringstream error_stream;
252  error_stream << "Direction is incorrect: " << direction << std::endl;
253  throw OomphLibError(
254  error_stream.str(),
257  }
258  }
259  //The special cases around the half-domain
260  else if(m < Nup + 3)
261  {
262  //Scale the macro element number
263  unsigned m_mod = m - Nup;
264 
265  //Switch on the macro element
266  switch(m_mod)
267  {
268  //Macro element 0, is is immediately below the cylinder
269  case 0:
270 
271  switch(direction)
272  {
273  case N:
274  xi[0] = 4.0*atan(1.0) - atan(1.0)*0.5*(1.0+s[0]);
275  Cylinder_pt->position(time,xi,f);
276  break;
277 
278  case S:
279  linear_interpolate(Up[0][Nup],Up[1][Nup],s[0],f);
280  break;
281 
282  case W:
283  xi[0] = 4.0*atan(1.0);
284  Cylinder_pt->position(time,xi,point_on_circle);
285  linear_interpolate(Up[0][Nup],point_on_circle,s[0],f);
286  break;
287 
288  case E:
289  xi[0] = 3.0*atan(1.0);
290  Cylinder_pt->position(time,xi,point_on_circle);
291  linear_interpolate(Up[1][Nup],point_on_circle,s[0],f);
292  break;
293 
294  default:
295 
296  std::ostringstream error_stream;
297  error_stream << "Direction is incorrect: " << direction
298  << std::endl;
299  throw OomphLibError(
300  error_stream.str(),
303  }
304 
305  break;
306 
307  //Macro element 1, is immediately to the right the cylinder
308  case 1:
309 
310  switch(direction)
311  {
312  case N:
313  xi[0] = atan(1.0);
314  Cylinder_pt->position(time,xi,point_on_circle);
315  linear_interpolate(point_on_circle,Down[1][0],s[0],f);
316  break;
317 
318  case S:
319  xi[0] = 3.0*atan(1.0);
320  Cylinder_pt->position(time,xi,point_on_circle);
321  linear_interpolate(point_on_circle,Up[1][Nup],s[0],f);
322  break;
323 
324  case W:
325  xi[0] = 3.0*atan(1.0) - 2.0*atan(1.0)*0.5*(1.0+s[0]);
326  Cylinder_pt->position(time,xi,f);
327  break;
328 
329  case E:
330  linear_interpolate(Up[1][Nup],Down[1][0],s[0],f);
331  break;
332 
333  default:
334 
335  std::ostringstream error_stream;
336  error_stream << "Direction is incorrect: " << direction << std::endl;
337  throw OomphLibError(
338  error_stream.str(),
341  }
342 
343  break;
344 
345  //Macro element 2, is immediately above the cylinder
346  case 2:
347 
348  switch(direction)
349  {
350  case N:
351  linear_interpolate(Down[0][0],Down[1][0],s[0],f);
352  break;
353 
354  case S:
355  xi[0] = atan(1.0)*0.5*(1.0+s[0]);
356  Cylinder_pt->position(time,xi,f);
357  break;
358 
359  case W:
360  xi[0] = 0.0;
361  Cylinder_pt->position(time,xi,point_on_circle);
362  linear_interpolate(point_on_circle,Down[0][0],s[0],f);
363  break;
364 
365  case E:
366  xi[0] = atan(1.0);
367  Cylinder_pt->position(time,xi,point_on_circle);
368  linear_interpolate(point_on_circle,Down[1][0],s[0],f);
369  break;
370 
371 
372  default:
373 
374  std::ostringstream error_stream;
375  error_stream << "Direction is incorrect: " << direction << std::endl;
376  throw OomphLibError(error_stream.str(),
379  }
380  break;
381  }
382  } //End of macro elements around the half-cylinder
383  else
384  {
385  //Other cases
386  if(m < Nup+Ndown+3)
387  {
388  unsigned m_mod = m - Nup -3;
389 
390  //Switch on the direction
391 
392  switch(direction)
393  {
394  case N:
395  linear_interpolate(Down[0][m_mod+1],Down[1][m_mod+1],s[0],f);
396  break;
397 
398  case S:
399  linear_interpolate(Down[0][m_mod],Down[1][m_mod],s[0],f);
400  break;
401 
402  case W:
403  linear_interpolate(Down[0][m_mod],Down[0][m_mod+1],s[0],f);
404  break;
405 
406  case E:
407  linear_interpolate(Down[1][m_mod],Down[1][m_mod+1],s[0],f);
408  break;
409 
410  default:
411 
412  std::ostringstream error_stream;
413  error_stream << "Direction is incorrect: " << direction << std::endl;
414  throw OomphLibError(
415  error_stream.str(),
418  }
419  }
420  else if(m < Nup+Ndown+3 + (Ncolumn-1)*(Nup+Ndown+1))
421  {
422  //Work out the modified m
423  unsigned m_col = m - (Nup+Ndown+3);
424  //Work out which column we are in
425  unsigned j_col = 1 + m_col/(Nup+Ndown+1);
426  //Work out the actual vertical position
427  unsigned m_mod = m_col%(Nup+Ndown+1);
428 
429  //If we're in the upstream region
430  if(m_mod < Nup)
431  {
432  switch(direction)
433  {
434  case N:
435  linear_interpolate(Up[j_col][m_mod+1],Up[j_col+1][m_mod+1],s[0],f);
436  break;
437 
438  case S:
439  linear_interpolate(Up[j_col][m_mod],Up[j_col+1][m_mod],s[0],f);
440  break;
441 
442  case W:
443  linear_interpolate(Up[j_col][m_mod],Up[j_col][m_mod+1],s[0],f);
444  break;
445 
446  case E:
447  linear_interpolate(Up[j_col+1][m_mod],Up[j_col+1][m_mod+1],s[0],f);
448  break;
449 
450  default:
451 
452  std::ostringstream error_stream;
453  error_stream << "Direction is incorrect: " << direction << std::endl;
454  throw OomphLibError(
455  error_stream.str(),
458  }
459  }
460  //Otherwise central zone
461  else if(m_mod==Nup)
462  {
463  switch(direction)
464  {
465  case N:
466  linear_interpolate(Down[j_col][0],Down[j_col+1][0],s[0],f);
467  break;
468 
469  case S:
470  linear_interpolate(Up[j_col][Nup],Up[j_col+1][Nup],s[0],f);
471  break;
472 
473  case W:
474  linear_interpolate(Up[j_col][Nup],Down[j_col][0],s[0],f);
475  break;
476 
477  case E:
478  linear_interpolate(Up[j_col+1][Nup],Down[j_col+1][0],s[0],f);
479  break;
480 
481  default:
482 
483  std::ostringstream error_stream;
484  error_stream << "Direction is incorrect: " << direction << std::endl;
485  throw OomphLibError(
486  error_stream.str(),
489  }
490  }
491  else if(m_mod < Nup+Ndown+1)
492  {
493  unsigned m_mod2 = m_mod - Nup -1;
494 
495  //Switch on the direction
496 
497  switch(direction)
498  {
499  case N:
500  linear_interpolate(Down[j_col][m_mod2+1],Down[j_col+1][m_mod2+1],s[0],f);
501  break;
502 
503  case S:
504  linear_interpolate(Down[j_col][m_mod2],Down[j_col+1][m_mod2],s[0],f);
505  break;
506 
507  case W:
508  linear_interpolate(Down[j_col][m_mod2],Down[j_col][m_mod2+1],s[0],f);
509  break;
510 
511  case E:
512  linear_interpolate(Down[j_col+1][m_mod2],Down[j_col+1][m_mod2+1],s[0],f);
513  break;
514 
515  default:
516 
517  std::ostringstream error_stream;
518  error_stream << "Direction is incorrect: " << direction << std::endl;
519  throw OomphLibError(
520  error_stream.str(),
523  }
524  }
525  }
526  else
527  {
528  std::ostringstream error_stream;
529  error_stream << "Wrong macro element number" << m << std::endl;
530  throw OomphLibError(
531  error_stream.str(),
534  }
535  }
536  }
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
void linear_interpolate(Vector< double > left, Vector< double > right, const double &s, Vector< double > &f)
Definition: axisym_heat_sphere/half_rectangle_with_hole_mesh.h:200
@ N
Definition: constructor.cpp:22
int * m
Definition: level2_cplx_impl.h:294
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 atan(const bfloat16 &a)
Definition: BFloat16.h:636
double E
Elastic modulus.
Definition: TwenteMeshGluing.cpp:68
@ S
Definition: quadtree.h:62
@ W
Definition: quadtree.h:63
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References Eigen::bfloat16_impl::atan(), GlobalParameters::Cylinder_pt, oomph::QuadTreeNames::E, f(), m, oomph::QuadTreeNames::N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, OscillatingCylinder::position(), s, oomph::QuadTreeNames::S, and oomph::QuadTreeNames::W.

◆ macro_element_boundary() [2/2]

void oomph::HalfRectangleWithHoleDomain::macro_element_boundary ( const unsigned time,
const unsigned m,
const unsigned direction,
const Vector< double > &  s,
Vector< double > &  f 
)
inlinevirtual

Parametrisation of macro element boundaries: f(s) is the position vector to macro-element m's boundary in the specified direction [N/S/E/W] at the specfied discrete time level (time=0: present; time>0: previous)

Implements oomph::Domain.

218  {
219  // Lagrangian coordinate along surface of cylinder
220  Vector<double> xi(1);
221 
222  // Point on circle
223  Vector<double> point_on_circle(2);
224 
225  //Upstream region all rectangular blocks
226  if(m < Nup)
227  {
228  //Switch on the direction
229 
230  switch(direction)
231  {
232  case N:
233  linear_interpolate(Up[0][m+1],Up[1][m+1],s[0],f);
234  break;
235 
236  case S:
237  linear_interpolate(Up[0][m],Up[1][m],s[0],f);
238  break;
239 
240  case W:
241  linear_interpolate(Up[0][m],Up[0][m+1],s[0],f);
242  break;
243 
244  case E:
245  linear_interpolate(Up[1][m],Up[1][m+1],s[0],f);
246  break;
247 
248  default:
249 
250  std::ostringstream error_stream;
251  error_stream << "Direction is incorrect: " << direction << std::endl;
252  throw OomphLibError(
253  error_stream.str(),
256  }
257  }
258  //The special cases around the half-domain
259  else if(m < Nup + 3)
260  {
261  //Scale the macro element number
262  unsigned m_mod = m - Nup;
263 
264  //Switch on the macro element
265  switch(m_mod)
266  {
267  //Macro element 0, is is immediately below the cylinder
268  case 0:
269 
270  switch(direction)
271  {
272  case N:
273  xi[0] = 4.0*atan(1.0) - atan(1.0)*0.5*(1.0+s[0]);
274  Cylinder_pt->position(time,xi,f);
275  break;
276 
277  case S:
278  linear_interpolate(Up[0][Nup],Up[1][Nup],s[0],f);
279  break;
280 
281  case W:
282  xi[0] = 4.0*atan(1.0);
283  Cylinder_pt->position(time,xi,point_on_circle);
284  linear_interpolate(Up[0][Nup],point_on_circle,s[0],f);
285  break;
286 
287  case E:
288  xi[0] = 3.0*atan(1.0);
289  Cylinder_pt->position(time,xi,point_on_circle);
290  linear_interpolate(Up[1][Nup],point_on_circle,s[0],f);
291  break;
292 
293  default:
294 
295  std::ostringstream error_stream;
296  error_stream << "Direction is incorrect: " << direction
297  << std::endl;
298  throw OomphLibError(
299  error_stream.str(),
302  }
303 
304  break;
305 
306  //Macro element 1, is immediately to the right the cylinder
307  case 1:
308 
309  switch(direction)
310  {
311  case N:
312  xi[0] = atan(1.0);
313  Cylinder_pt->position(time,xi,point_on_circle);
314  linear_interpolate(point_on_circle,Down[1][0],s[0],f);
315  break;
316 
317  case S:
318  xi[0] = 3.0*atan(1.0);
319  Cylinder_pt->position(time,xi,point_on_circle);
320  linear_interpolate(point_on_circle,Up[1][Nup],s[0],f);
321  break;
322 
323  case W:
324  xi[0] = 3.0*atan(1.0) - 2.0*atan(1.0)*0.5*(1.0+s[0]);
325  Cylinder_pt->position(time,xi,f);
326  break;
327 
328  case E:
329  linear_interpolate(Up[1][Nup],Down[1][0],s[0],f);
330  break;
331 
332  default:
333 
334  std::ostringstream error_stream;
335  error_stream << "Direction is incorrect: " << direction << std::endl;
336  throw OomphLibError(
337  error_stream.str(),
340  }
341 
342  break;
343 
344  //Macro element 2, is immediately above the cylinder
345  case 2:
346 
347  switch(direction)
348  {
349  case N:
350  linear_interpolate(Down[0][0],Down[1][0],s[0],f);
351  break;
352 
353  case S:
354  xi[0] = atan(1.0)*0.5*(1.0+s[0]);
355  Cylinder_pt->position(time,xi,f);
356  break;
357 
358  case W:
359  xi[0] = 0.0;
360  Cylinder_pt->position(time,xi,point_on_circle);
361  linear_interpolate(point_on_circle,Down[0][0],s[0],f);
362  break;
363 
364  case E:
365  xi[0] = atan(1.0);
366  Cylinder_pt->position(time,xi,point_on_circle);
367  linear_interpolate(point_on_circle,Down[1][0],s[0],f);
368  break;
369 
370 
371  default:
372 
373  std::ostringstream error_stream;
374  error_stream << "Direction is incorrect: " << direction << std::endl;
375  throw OomphLibError(error_stream.str(),
378  }
379  break;
380  }
381  } //End of macro elements around the half-cylinder
382  else
383  {
384  //Other cases
385  if(m < Nup+Ndown+3)
386  {
387  unsigned m_mod = m - Nup -3;
388 
389  //Switch on the direction
390 
391  switch(direction)
392  {
393  case N:
394  linear_interpolate(Down[0][m_mod+1],Down[1][m_mod+1],s[0],f);
395  break;
396 
397  case S:
398  linear_interpolate(Down[0][m_mod],Down[1][m_mod],s[0],f);
399  break;
400 
401  case W:
402  linear_interpolate(Down[0][m_mod],Down[0][m_mod+1],s[0],f);
403  break;
404 
405  case E:
406  linear_interpolate(Down[1][m_mod],Down[1][m_mod+1],s[0],f);
407  break;
408 
409  default:
410 
411  std::ostringstream error_stream;
412  error_stream << "Direction is incorrect: " << direction << std::endl;
413  throw OomphLibError(
414  error_stream.str(),
417  }
418  }
419  else if(m < Nup+Ndown+3 + (Ncolumn-1)*(Nup+Ndown+1))
420  {
421  //Work out the modified m
422  unsigned m_col = m - (Nup+Ndown+3);
423  //Work out which column we are in
424  unsigned j_col = 1 + m_col/(Nup+Ndown+1);
425  //Work out the actual vertical position
426  unsigned m_mod = m_col%(Nup+Ndown+1);
427 
428  //If we're in the upstream region
429  if(m_mod < Nup)
430  {
431  switch(direction)
432  {
433  case N:
434  linear_interpolate(Up[j_col][m_mod+1],Up[j_col+1][m_mod+1],s[0],f);
435  break;
436 
437  case S:
438  linear_interpolate(Up[j_col][m_mod],Up[j_col+1][m_mod],s[0],f);
439  break;
440 
441  case W:
442  linear_interpolate(Up[j_col][m_mod],Up[j_col][m_mod+1],s[0],f);
443  break;
444 
445  case E:
446  linear_interpolate(Up[j_col+1][m_mod],Up[j_col+1][m_mod+1],s[0],f);
447  break;
448 
449  default:
450 
451  std::ostringstream error_stream;
452  error_stream << "Direction is incorrect: " << direction << std::endl;
453  throw OomphLibError(
454  error_stream.str(),
457  }
458  }
459  //Otherwise central zone
460  else if(m_mod==Nup)
461  {
462  switch(direction)
463  {
464  case N:
465  linear_interpolate(Down[j_col][0],Down[j_col+1][0],s[0],f);
466  break;
467 
468  case S:
469  linear_interpolate(Up[j_col][Nup],Up[j_col+1][Nup],s[0],f);
470  break;
471 
472  case W:
473  linear_interpolate(Up[j_col][Nup],Down[j_col][0],s[0],f);
474  break;
475 
476  case E:
477  linear_interpolate(Up[j_col+1][Nup],Down[j_col+1][0],s[0],f);
478  break;
479 
480  default:
481 
482  std::ostringstream error_stream;
483  error_stream << "Direction is incorrect: " << direction << std::endl;
484  throw OomphLibError(
485  error_stream.str(),
488  }
489  }
490  else if(m_mod < Nup+Ndown+1)
491  {
492  unsigned m_mod2 = m_mod - Nup -1;
493 
494  //Switch on the direction
495 
496  switch(direction)
497  {
498  case N:
499  linear_interpolate(Down[j_col][m_mod2+1],Down[j_col+1][m_mod2+1],s[0],f);
500  break;
501 
502  case S:
503  linear_interpolate(Down[j_col][m_mod2],Down[j_col+1][m_mod2],s[0],f);
504  break;
505 
506  case W:
507  linear_interpolate(Down[j_col][m_mod2],Down[j_col][m_mod2+1],s[0],f);
508  break;
509 
510  case E:
511  linear_interpolate(Down[j_col+1][m_mod2],Down[j_col+1][m_mod2+1],s[0],f);
512  break;
513 
514  default:
515 
516  std::ostringstream error_stream;
517  error_stream << "Direction is incorrect: " << direction << std::endl;
518  throw OomphLibError(
519  error_stream.str(),
522  }
523  }
524  }
525  else
526  {
527  std::ostringstream error_stream;
528  error_stream << "Wrong macro element number" << m << std::endl;
529  throw OomphLibError(
530  error_stream.str(),
533  }
534  }
535  }

References Eigen::bfloat16_impl::atan(), GlobalParameters::Cylinder_pt, oomph::QuadTreeNames::E, f(), m, oomph::QuadTreeNames::N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, OscillatingCylinder::position(), s, oomph::QuadTreeNames::S, and oomph::QuadTreeNames::W.

Member Data Documentation

◆ Cylinder_pt

GeomObject * oomph::HalfRectangleWithHoleDomain::Cylinder_pt
private

Pointer to geometric object that represents the central cylinder.

◆ Down

Vector< Vector< Vector< double > > > oomph::HalfRectangleWithHoleDomain::Down
private

Left and right side of lines in the downstream region.

◆ Ncolumn

unsigned oomph::HalfRectangleWithHoleDomain::Ncolumn
private

Number of columns.

◆ Ndown

unsigned oomph::HalfRectangleWithHoleDomain::Ndown
private

Number of downstream macro elements.

◆ Nup

unsigned oomph::HalfRectangleWithHoleDomain::Nup
private

Number of upstream macro elements.

◆ Up

Vector< Vector< Vector< double > > > oomph::HalfRectangleWithHoleDomain::Up
private

Left and right side of lines in the upstream region.


The documentation for this class was generated from the following file: