oomph::RectangleWithHoleDomain Class Reference

Rectangular domain with circular whole. More...

#include <rectangle_with_hole_domain.h>

+ Inheritance diagram for oomph::RectangleWithHoleDomain:

Public Member Functions

 RectangleWithHoleDomain (GeomObject *cylinder_pt, const double &length)
 
 ~RectangleWithHoleDomain ()
 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< doubleLower_left
 Lower left corner of rectangle. More...
 
Vector< doubleLower_right
 Lower right corner of rectangle. More...
 
Vector< doubleLower_mid_left
 Where the "radial" line from circle meets lower boundary on left. More...
 
Vector< doubleLower_mid_right
 Where the "radial" line from circle meets lower boundary on right. More...
 
Vector< doubleUpper_left
 Upper left corner of rectangle. More...
 
Vector< doubleUpper_right
 Upper right corner of rectangle. More...
 
Vector< doubleUpper_mid_left
 Where the "radial" line from circle meets upper boundary on left. More...
 
Vector< doubleUpper_mid_right
 Where the "radial" line from circle meets upper boundary on right. More...
 
GeomObjectCylinder_pt
 Pointer to geometric object that represents the central cylinder. 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 circular whole.

Constructor & Destructor Documentation

◆ RectangleWithHoleDomain()

oomph::RectangleWithHoleDomain::RectangleWithHoleDomain ( GeomObject cylinder_pt,
const double length 
)
inline

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

51  : Cylinder_pt(cylinder_pt)
52  {
53  // Vertices of rectangle
54  Lower_left.resize(2);
55  Lower_left[0] = -0.5 * length;
56  Lower_left[1] = -0.5 * length;
57 
58  Upper_left.resize(2);
59  Upper_left[0] = -0.5 * length;
60  Upper_left[1] = 0.5 * length;
61 
62  Lower_right.resize(2);
63  Lower_right[0] = 0.5 * length;
64  Lower_right[1] = -0.5 * length;
65 
66  Upper_right.resize(2);
67  Upper_right[0] = 0.5 * length;
68  Upper_right[1] = 0.5 * length;
69 
70 
71  // Coordinates of points where the "radial" lines from central
72  // cylinder meet the upper and lower boundaries
73  Lower_mid_left.resize(2);
74  Lower_mid_left[0] = -0.5 * length;
75  Lower_mid_left[1] = -0.5 * length;
76 
77  Upper_mid_left.resize(2);
78  Upper_mid_left[0] = -0.5 * length;
79  Upper_mid_left[1] = 0.5 * length;
80 
81  Lower_mid_right.resize(2);
82  Lower_mid_right[0] = 0.5 * length;
83  Lower_mid_right[1] = -0.5 * length;
84 
85  Upper_mid_right.resize(2);
86  Upper_mid_right[0] = 0.5 * length;
87  Upper_mid_right[1] = 0.5 * length;
88 
89 
90  // There are four macro elements
91  Macro_element_pt.resize(4);
92 
93  // Build the 2D macro elements
94  for (unsigned i = 0; i < 4; i++)
95  {
96  Macro_element_pt[i] = new QMacroElement<2>(this, i);
97  }
98  }
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< double > Upper_mid_left
Where the "radial" line from circle meets upper boundary on left.
Definition: rectangle_with_hole_domain.h:330
Vector< double > Lower_mid_left
Where the "radial" line from circle meets lower boundary on left.
Definition: rectangle_with_hole_domain.h:318
Vector< double > Lower_mid_right
Where the "radial" line from circle meets lower boundary on right.
Definition: rectangle_with_hole_domain.h:321
Vector< double > Upper_left
Upper left corner of rectangle.
Definition: rectangle_with_hole_domain.h:324
Vector< double > Lower_left
Lower left corner of rectangle.
Definition: rectangle_with_hole_domain.h:312
GeomObject * Cylinder_pt
Pointer to geometric object that represents the central cylinder.
Definition: rectangle_with_hole_domain.h:336
Vector< double > Upper_mid_right
Where the "radial" line from circle meets upper boundary on right.
Definition: rectangle_with_hole_domain.h:333
Vector< double > Upper_right
Upper right corner of rectangle.
Definition: rectangle_with_hole_domain.h:327
Vector< double > Lower_right
Lower right corner of rectangle.
Definition: rectangle_with_hole_domain.h:315

References i, Lower_left, Lower_mid_left, Lower_mid_right, Lower_right, oomph::Domain::Macro_element_pt, Upper_left, Upper_mid_left, Upper_mid_right, and Upper_right.

◆ ~RectangleWithHoleDomain()

oomph::RectangleWithHoleDomain::~RectangleWithHoleDomain ( )
inline

Destructor: Empty; cleanup done in base class.

102 {}

Member Function Documentation

◆ linear_interpolate()

void oomph::RectangleWithHoleDomain::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] \)

110  {
111  for (unsigned i = 0; i < 2; i++)
112  {
113  f[i] = left[i] + (right[i] - left[i]) * 0.5 * (s + 1.0);
114  }
115  }
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.

Referenced by macro_element_boundary().

◆ macro_element_boundary()

void oomph::RectangleWithHoleDomain::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.

127  {
128 #ifdef WARN_ABOUT_SUBTLY_CHANGED_OOMPH_INTERFACES
129  // Warn about time argument being moved to the front
130  OomphLibWarning(
131  "Order of function arguments has changed between versions 0.8 and 0.85",
132  "RectangleWithHoleDomain::macro_element_boundary(...)",
134 #endif
135 
136  // Lagrangian coordinate along surface of cylinder
137  Vector<double> xi(1);
138 
139  // Point on circle
140  Vector<double> point_on_circle(2);
141 
142  using namespace QuadTreeNames;
143 
144  // Switch on the macro element
145  switch (m)
146  {
147  // Macro element 0, is is immediately left of the cylinder
148  case 0:
149 
150  switch (direction)
151  {
152  case N:
153  xi[0] = 3.0 * atan(1.0);
154  Cylinder_pt->position(time, xi, point_on_circle);
155  linear_interpolate(Upper_mid_left, point_on_circle, s[0], f);
156  break;
157 
158  case S:
159  xi[0] = -3.0 * atan(1.0);
160  Cylinder_pt->position(time, xi, point_on_circle);
161  linear_interpolate(Lower_mid_left, point_on_circle, s[0], f);
162  break;
163 
164  case W:
166  break;
167 
168  case E:
169  xi[0] = 5.0 * atan(1.0) - 2.0 * atan(1.0) * 0.5 * (1.0 + s[0]);
170  Cylinder_pt->position(time, xi, f);
171  break;
172 
173  default:
174 
175  std::ostringstream error_stream;
176  error_stream << "Direction is incorrect: " << direction
177  << std::endl;
178  throw OomphLibError(error_stream.str(),
181  }
182 
183  break;
184 
185  // Macro element 1, is immediately above the cylinder
186  case 1:
187 
188  switch (direction)
189  {
190  case N:
192  break;
193 
194  case S:
195  xi[0] = 3.0 * atan(1.0) - 2.0 * atan(1.0) * 0.5 * (1.0 + s[0]);
196  Cylinder_pt->position(time, xi, f);
197  break;
198 
199  case W:
200  xi[0] = 3.0 * atan(1.0);
201  Cylinder_pt->position(time, xi, point_on_circle);
202  linear_interpolate(point_on_circle, Upper_mid_left, s[0], f);
203  break;
204 
205  case E:
206  xi[0] = 1.0 * atan(1.0);
207  Cylinder_pt->position(time, xi, point_on_circle);
208  linear_interpolate(point_on_circle, Upper_mid_right, s[0], f);
209  break;
210 
211  default:
212 
213  std::ostringstream error_stream;
214  error_stream << "Direction is incorrect: " << direction
215  << std::endl;
216  throw OomphLibError(error_stream.str(),
219  }
220 
221  break;
222 
223  // Macro element 2, is immediately right of the cylinder
224  case 2:
225 
226  switch (direction)
227  {
228  case N:
229  xi[0] = 1.0 * atan(1.0);
230  Cylinder_pt->position(time, xi, point_on_circle);
231  linear_interpolate(point_on_circle, Upper_mid_right, s[0], f);
232  break;
233 
234  case S:
235  xi[0] = -1.0 * atan(1.0);
236  Cylinder_pt->position(time, xi, point_on_circle);
237  linear_interpolate(point_on_circle, Lower_mid_right, s[0], f);
238  break;
239 
240  case W:
241  xi[0] = -atan(1.0) + 2.0 * atan(1.0) * 0.5 * (1.0 + s[0]);
242  Cylinder_pt->position(time, xi, f);
243  break;
244 
245  case E:
247  break;
248 
249  default:
250 
251  std::ostringstream error_stream;
252  error_stream << "Direction is incorrect: " << direction
253  << std::endl;
254  throw OomphLibError(error_stream.str(),
257  }
258 
259  break;
260 
261  // Macro element 3, is immediately below cylinder
262  case 3:
263 
264  switch (direction)
265  {
266  case N:
267  xi[0] = -3.0 * atan(1.0) + 2.0 * atan(1.0) * 0.5 * (1.0 + s[0]);
268  Cylinder_pt->position(time, xi, f);
269  break;
270 
271  case S:
273  break;
274 
275  case W:
276  xi[0] = -3.0 * atan(1.0);
277  Cylinder_pt->position(time, xi, point_on_circle);
278  linear_interpolate(Lower_mid_left, point_on_circle, s[0], f);
279  break;
280 
281  case E:
282  xi[0] = -1.0 * atan(1.0);
283  Cylinder_pt->position(time, xi, point_on_circle);
284  linear_interpolate(Lower_mid_right, point_on_circle, s[0], f);
285  break;
286 
287  default:
288 
289  std::ostringstream error_stream;
290  error_stream << "Direction is incorrect: " << direction
291  << std::endl;
292  throw OomphLibError(error_stream.str(),
295  }
296 
297  break;
298 
299  default:
300 
301  std::ostringstream error_stream;
302  error_stream << "Wrong macro element number" << m << std::endl;
303  throw OomphLibError(error_stream.str(),
306  }
307  }
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: rectangle_with_hole_domain.h:106
@ 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(), Cylinder_pt, Global_Physical_Variables::E, f(), linear_interpolate(), Lower_mid_left, Lower_mid_right, m, N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::GeomObject::position(), s, oomph::QuadTreeNames::S, Upper_mid_left, Upper_mid_right, and oomph::QuadTreeNames::W.

Member Data Documentation

◆ Cylinder_pt

GeomObject * RectangleWithHoleDomain::Cylinder_pt
private

Pointer to geometric object that represents the central cylinder.

Referenced by macro_element_boundary().

◆ Lower_left

Vector< double > RectangleWithHoleDomain::Lower_left
private

Lower left corner of rectangle.

Referenced by RectangleWithHoleDomain().

◆ Lower_mid_left

Vector< double > RectangleWithHoleDomain::Lower_mid_left
private

Where the "radial" line from circle meets lower boundary on left.

Referenced by macro_element_boundary(), and RectangleWithHoleDomain().

◆ Lower_mid_right

Vector< double > RectangleWithHoleDomain::Lower_mid_right
private

Where the "radial" line from circle meets lower boundary on right.

Referenced by macro_element_boundary(), and RectangleWithHoleDomain().

◆ Lower_right

Vector< double > RectangleWithHoleDomain::Lower_right
private

Lower right corner of rectangle.

Referenced by RectangleWithHoleDomain().

◆ Upper_left

Vector< double > RectangleWithHoleDomain::Upper_left
private

Upper left corner of rectangle.

Referenced by RectangleWithHoleDomain().

◆ Upper_mid_left

Vector< double > RectangleWithHoleDomain::Upper_mid_left
private

Where the "radial" line from circle meets upper boundary on left.

Referenced by macro_element_boundary(), and RectangleWithHoleDomain().

◆ Upper_mid_right

Vector< double > RectangleWithHoleDomain::Upper_mid_right
private

Where the "radial" line from circle meets upper boundary on right.

Referenced by macro_element_boundary(), and RectangleWithHoleDomain().

◆ Upper_right

Vector< double > RectangleWithHoleDomain::Upper_right
private

Upper right corner of rectangle.

Referenced by RectangleWithHoleDomain().


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