oomph::QMacroElement< 2 > Class Reference

#include <macro_element.h>

+ Inheritance diagram for oomph::QMacroElement< 2 >:

Public Member Functions

 QMacroElement (Domain *domain_pt, const unsigned &macro_element_number)
 
 QMacroElement ()
 Default constructor (empty and broken) More...
 
 QMacroElement (const QMacroElement &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const QMacroElement &)=delete
 Broken assignment operator. More...
 
virtual ~QMacroElement ()
 Empty destructor. More...
 
void output (const unsigned &t, std::ostream &outfile, const unsigned &nplot)
 
void output_macro_element_boundaries (std::ostream &outfile, const unsigned &nplot)
 Output all macro element boundaries as tecplot zones. More...
 
void macro_map (const unsigned &t, const Vector< double > &S, Vector< double > &r)
 
void macro_map (const double &t, const Vector< double > &s, Vector< double > &r)
 Get global position r(s) at continuous time value, t. More...
 
virtual void assemble_macro_to_eulerian_jacobian (const unsigned &t, const Vector< double > &s, DenseMatrix< double > &jacobian)
 
virtual void assemble_macro_to_eulerian_jacobian2 (const unsigned &t, const Vector< double > &s, DenseMatrix< double > &jacobian2)
 
- Public Member Functions inherited from oomph::MacroElement
 MacroElement (Domain *domain_pt, const unsigned &macro_element_number)
 
 MacroElement ()
 Default constructor (empty and broken) More...
 
 MacroElement (const MacroElement &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const MacroElement &)=delete
 Broken assignment operator. More...
 
virtual ~MacroElement ()
 Empty destructor. More...
 
void output (std::ostream &outfile, const int &nplot)
 
void macro_map (const Vector< double > &s, Vector< double > &r)
 The mapping from local to global coordinates at the current time : r(s) More...
 
void assemble_macro_to_eulerian_jacobian (const Vector< double > &s, DenseMatrix< double > &jacobian)
 
void assemble_macro_to_eulerian_jacobian2 (const Vector< double > &s, DenseMatrix< double > &jacobian2)
 
unsignedmacro_element_number ()
 Access function to the Macro_element_number. More...
 
Domain *& domain_pt ()
 Access function to the Domain_pt. More...
 

Additional Inherited Members

- Protected Attributes inherited from oomph::MacroElement
DomainDomain_pt
 Pointer to domain. More...
 
unsigned Macro_element_number
 What is the number of the current macro element within its domain. More...
 

Detailed Description

QMacroElement specialised to 2 spatial dimensions.

The macro element mapping is based on the member function pointer to the associated Domain 's

virtual void macro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)=0

function which provides a parametrisation of the macro element's boundaries in the form:

\[ {\bf f}_{i} (t,{\bf S}) \]

where

  • \( i \) labels the boundary (N/S/W/E)
  • \( {\bf S} \in [-1,1]^1 \) is the (1D) Vector of local coordinate(s) along the boundary.
  • \( {\bf f} \) is the position Vector to the boundary.
  • \( t \) is the time level (t=0: current; t>0 previous timestep)

Constructor & Destructor Documentation

◆ QMacroElement() [1/3]

oomph::QMacroElement< 2 >::QMacroElement ( Domain domain_pt,
const unsigned macro_element_number 
)
inline

Constructor: Pass the pointer to the domain and the macro element's number within this domain

Domain *& domain_pt()
Access function to the Domain_pt.
Definition: macro_element.h:229
unsigned & macro_element_number()
Access function to the Macro_element_number.
Definition: macro_element.h:223
MacroElement()
Default constructor (empty and broken)
Definition: macro_element.h:86

◆ QMacroElement() [2/3]

Default constructor (empty and broken)

289  {
290  throw OomphLibError("Don't call empty constructor for QMacroElement!",
293  }
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ QMacroElement() [3/3]

oomph::QMacroElement< 2 >::QMacroElement ( const QMacroElement< 2 > &  dummy)
delete

Broken copy constructor.

◆ ~QMacroElement()

virtual oomph::QMacroElement< 2 >::~QMacroElement ( )
inlinevirtual

Empty destructor.

302 {};

Member Function Documentation

◆ assemble_macro_to_eulerian_jacobian()

void oomph::QMacroElement< 2 >::assemble_macro_to_eulerian_jacobian ( const unsigned t,
const Vector< double > &  S,
DenseMatrix< double > &  jacobian 
)
virtual

assemble the jacobian of the mapping from the macro coordinates to the global coordinates

Assembles the jacobian of the mapping from the macro coordinates to the global coordinates

Reimplemented from oomph::MacroElement.

240  {
241  using namespace QuadTreeNames;
242 
243  Vector<double> bound_N(2);
244  Vector<double> bound_S(2);
245  Vector<double> bound_W(2);
246  Vector<double> bound_E(2);
247 
248  Vector<double> dbound_N(2);
249  Vector<double> dbound_S(2);
250  Vector<double> dbound_E(2);
251  Vector<double> dbound_W(2);
252 
253  Vector<double> corner_SE(2);
254  Vector<double> corner_SW(2);
255  Vector<double> corner_NE(2);
256  Vector<double> corner_NW(2);
257 
258  Vector<double> zeta(1);
259 
260 
261  // Determine Vectors to corners
262  zeta[0] = 1.0;
265  zeta[0] = -1.0;
268  zeta[0] = 1.0;
271  zeta[0] = -1.0;
274 
275 
276  // Get the position and first derivativeson the N/S/W/E edges
277  zeta[0] = S[0];
282  zeta[0] = S[0];
287  zeta[0] = S[1];
292  zeta[0] = S[1];
297 
298 
299  // dr0/dm0
300  jacobian(0, 0) =
301  0.25 * (corner_SW[0] - corner_SE[0] + corner_NW[0] - corner_NE[0] -
302  corner_NE[0] * S[1] + corner_NW[0] * S[1] + corner_SE[0] * S[1] -
303  corner_SW[0] * S[1]) +
304  0.5 * (dbound_S[0] + dbound_N[0] - bound_W[0] + bound_E[0] -
305  dbound_S[0] * S[1] + dbound_N[0] * S[1]);
306  // dr1/dm0
307  jacobian(0, 1) =
308  0.25 * (corner_SW[1] - corner_SE[1] + corner_NW[1] - corner_NE[1] -
309  corner_NE[1] * S[1] + corner_NW[1] * S[1] + corner_SE[1] * S[1] -
310  corner_SW[1] * S[1]) +
311  0.5 * (dbound_S[1] + dbound_N[1] - bound_W[1] + bound_E[1] -
312  dbound_S[1] * S[1] + dbound_N[1] * S[1]);
313  // dr0/dm1
314  jacobian(1, 0) =
315  0.25 * (corner_SW[0] + corner_SE[0] - corner_NW[0] - corner_NE[0] +
316  corner_SE[0] * S[0] - corner_SW[0] * S[0] - corner_NE[0] * S[0] +
317  corner_NW[0] * S[0]) +
318  0.5 * (-bound_S[0] + bound_N[0] + dbound_W[0] + dbound_E[0] -
319  dbound_W[0] * S[0] + dbound_E[0] * S[0]);
320  // dr1/dm1
321  jacobian(1, 1) =
322  0.25 * (corner_SW[1] + corner_SE[1] - corner_NW[1] - corner_NE[1] +
323  corner_SE[1] * S[0] - corner_SW[1] * S[0] - corner_NE[1] * S[0] +
324  corner_NW[1] * S[0]) +
325  0.5 * (-bound_S[1] + bound_N[1] + dbound_W[1] + dbound_E[1] -
326  dbound_W[1] * S[0] + dbound_E[1] * S[0]);
327  }
virtual void dmacro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
Definition: domain.h:212
Domain * Domain_pt
Pointer to domain.
Definition: macro_element.h:236
unsigned Macro_element_number
What is the number of the current macro element within its domain.
Definition: macro_element.h:239
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
@ E
Definition: quadtree.h:61
@ S
Definition: quadtree.h:62
@ W
Definition: quadtree.h:63
@ N
Definition: quadtree.h:60
t
Definition: plotPSD.py:36

References oomph::Domain::dmacro_element_boundary(), oomph::MacroElement::Domain_pt, oomph::QuadTreeNames::E, oomph::Domain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, oomph::QuadTreeNames::N, oomph::QuadTreeNames::S, plotPSD::t, oomph::QuadTreeNames::W, and Eigen::zeta().

◆ assemble_macro_to_eulerian_jacobian2()

void oomph::QMacroElement< 2 >::assemble_macro_to_eulerian_jacobian2 ( const unsigned t,
const Vector< double > &  S,
DenseMatrix< double > &  jacobian2 
)
virtual

Assembles the second derivative jacobian of the mapping from the macro coordinates to global coordinates x

Reimplemented from oomph::MacroElement.

336  {
337  using namespace QuadTreeNames;
338 
339  Vector<double> bound_N(2);
340  Vector<double> bound_S(2);
341  Vector<double> bound_W(2);
342  Vector<double> bound_E(2);
343 
344  Vector<double> dbound_N(2);
345  Vector<double> dbound_S(2);
346  Vector<double> dbound_E(2);
347  Vector<double> dbound_W(2);
348 
349  Vector<double> d2bound_N(2);
350  Vector<double> d2bound_S(2);
351  Vector<double> d2bound_E(2);
352  Vector<double> d2bound_W(2);
353 
354  Vector<double> corner_SE(2);
355  Vector<double> corner_SW(2);
356  Vector<double> corner_NE(2);
357  Vector<double> corner_NW(2);
358 
359  Vector<double> zeta(1);
360 
361 
362  // Determine Vectors to corners
363  zeta[0] = 1.0;
366  zeta[0] = -1.0;
369  zeta[0] = 1.0;
372  zeta[0] = -1.0;
375 
376 
377  // Get the position and first derivativeson the N/S/W/E edges
378  zeta[0] = S[0];
385  zeta[0] = S[0];
392  zeta[0] = S[1];
399  zeta[0] = S[1];
406 
407 
408  // d2x0/dm0^2
409  jacobian2(0, 0) = 0.5 * (d2bound_S[0] + d2bound_N[0] - d2bound_S[0] * S[1] +
410  d2bound_N[0] * S[1]);
411  // d2x0/dm1^2
412  jacobian2(1, 0) = 0.5 * (d2bound_W[0] + d2bound_E[0] - d2bound_W[0] * S[0] +
413  d2bound_E[0] * S[0]);
414  // d2x0/dm0dm1
415  jacobian2(2, 0) =
416  0.25 * (-corner_NE[0] + corner_NW[0] + corner_SE[0] - corner_SW[0]) +
417  0.5 * (-dbound_W[0] + dbound_E[0] - dbound_S[0] + dbound_N[0]);
418  // d2x1/dm0^2
419  jacobian2(0, 1) = 0.5 * (d2bound_S[1] + d2bound_N[1] - d2bound_S[1] * S[1] +
420  d2bound_N[1] * S[1]);
421  // d2x1/dm1^2
422  jacobian2(1, 1) = 0.5 * (d2bound_W[1] + d2bound_E[1] - d2bound_W[1] * S[0] +
423  d2bound_E[1] * S[0]);
424  // d2x1/dm0dm1
425  jacobian2(2, 1) =
426  0.25 * (-corner_NE[1] + corner_NW[1] + corner_SE[1] - corner_SW[1]) +
427  0.5 * (-dbound_W[1] + dbound_E[1] - dbound_S[1] + dbound_N[1]);
428  }
virtual void d2macro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
Definition: domain.h:258

References oomph::Domain::d2macro_element_boundary(), oomph::Domain::dmacro_element_boundary(), oomph::MacroElement::Domain_pt, oomph::QuadTreeNames::E, oomph::Domain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, oomph::QuadTreeNames::N, oomph::QuadTreeNames::S, plotPSD::t, oomph::QuadTreeNames::W, and Eigen::zeta().

◆ macro_map() [1/2]

void oomph::QMacroElement< 2 >::macro_map ( const double t,
const Vector< double > &  s,
Vector< double > &  r 
)
virtual

Get global position r(s) at continuous time value, t.

Get global position r(S) at discrete time level t. t=0: Present time; t>0: previous timestep.

Reimplemented from oomph::MacroElement.

38  {
39  using namespace QuadTreeNames;
40 
41  Vector<double> bound_N(2);
42  Vector<double> bound_S(2);
43  Vector<double> bound_W(2);
44  Vector<double> bound_E(2);
45 
46  Vector<double> diff_N(2);
47  Vector<double> diff_S(2);
48  Vector<double> diff_W(2);
49  Vector<double> diff_E(2);
50 
51  Vector<double> f_rect(2);
52 
53  Vector<double> corner_SE(2);
54  Vector<double> corner_SW(2);
55  Vector<double> corner_NE(2);
56  Vector<double> corner_NW(2);
57 
58  Vector<double> edge_N(2);
59  Vector<double> edge_S(2);
60 
61  Vector<double> zeta(1);
62 
63  // Determine Vectors to corners
64  zeta[0] = 1.0;
67  zeta[0] = -1.0;
70  zeta[0] = 1.0;
73  zeta[0] = -1.0;
76 
77 
78  // Get the position on the N/S/W/E edges
79  zeta[0] = s[0];
82  zeta[0] = s[0];
85  zeta[0] = s[1];
88  zeta[0] = s[1];
91 
92 
93  for (int i = 0; i < 2; i++)
94  {
95  // Position on the straight S/W edges of the rectangle formed
96  // by the corner points
97  edge_S[i] =
98  corner_SW[i] + (corner_SE[i] - corner_SW[i]) * 0.5 * (s[0] + 1.0);
99  edge_N[i] =
100  corner_NW[i] + (corner_NE[i] - corner_NW[i]) * 0.5 * (s[0] + 1.0);
101 
102  // Position inside rectangle
103  f_rect[i] = edge_S[i] + (edge_N[i] - edge_S[i]) * 0.5 * (s[1] + 1.0);
104 
105  // Get difference between curved edge and point in rectangle
106  diff_N[i] = bound_N[i] - f_rect[i];
107  diff_S[i] = bound_S[i] - f_rect[i];
108  diff_E[i] = bound_E[i] - f_rect[i];
109  diff_W[i] = bound_W[i] - f_rect[i];
110 
111  // Map it...
112  r[i] = f_rect[i] + diff_S[i] * (1.0 - 0.5 * (s[1] + 1.0)) +
113  diff_N[i] * 0.5 * (s[1] + 1.0) +
114  diff_W[i] * (1.0 - 0.5 * (s[0] + 1.0)) +
115  diff_E[i] * 0.5 * (s[0] + 1.0);
116  }
117  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
RealScalar s
Definition: level1_cplx_impl.h:130
r
Definition: UniformPSDSelfTest.py:20

References oomph::MacroElement::Domain_pt, oomph::QuadTreeNames::E, i, oomph::Domain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, oomph::QuadTreeNames::N, UniformPSDSelfTest::r, s, oomph::QuadTreeNames::S, plotPSD::t, oomph::QuadTreeNames::W, and Eigen::zeta().

◆ macro_map() [2/2]

void oomph::QMacroElement< 2 >::macro_map ( const unsigned t,
const Vector< double > &  S,
Vector< double > &  r 
)
virtual

Get global position r(S) at discrete time level t. t=0: Present time; t>0: previous timestep.

Implements oomph::MacroElement.

126  {
127  using namespace QuadTreeNames;
128 
129  Vector<double> bound_N(2);
130  Vector<double> bound_S(2);
131  Vector<double> bound_W(2);
132  Vector<double> bound_E(2);
133 
134  Vector<double> diff_N(2);
135  Vector<double> diff_S(2);
136  Vector<double> diff_W(2);
137  Vector<double> diff_E(2);
138 
139  Vector<double> f_rect(2);
140 
141  Vector<double> corner_SE(2);
142  Vector<double> corner_SW(2);
143  Vector<double> corner_NE(2);
144  Vector<double> corner_NW(2);
145 
146  Vector<double> edge_N(2);
147  Vector<double> edge_S(2);
148 
149  Vector<double> zeta(1);
150 
151  // Determine Vectors to corners
152  zeta[0] = 1.0;
155  zeta[0] = -1.0;
158  zeta[0] = 1.0;
161  zeta[0] = -1.0;
164 
165 
166  // Get the position on the N/S/W/E edges
167  zeta[0] = S[0];
170  zeta[0] = S[0];
173  zeta[0] = S[1];
176  zeta[0] = S[1];
179 
180 
181  for (int i = 0; i < 2; i++)
182  {
183  // Position on the straight S/W edges of the rectangle formed
184  // by the corner points
185  edge_S[i] =
186  corner_SW[i] + (corner_SE[i] - corner_SW[i]) * 0.5 * (S[0] + 1.0);
187  edge_N[i] =
188  corner_NW[i] + (corner_NE[i] - corner_NW[i]) * 0.5 * (S[0] + 1.0);
189 
190  // Position inside rectangle
191  f_rect[i] = edge_S[i] + (edge_N[i] - edge_S[i]) * 0.5 * (S[1] + 1.0);
192 
193  // Get difference between curved edge and point in rectangle
194  diff_N[i] = bound_N[i] - f_rect[i];
195  diff_S[i] = bound_S[i] - f_rect[i];
196  diff_E[i] = bound_E[i] - f_rect[i];
197  diff_W[i] = bound_W[i] - f_rect[i];
198 
199  // Map it...
200  r[i] = f_rect[i] + diff_S[i] * (1.0 - 0.5 * (S[1] + 1.0)) +
201  diff_N[i] * 0.5 * (S[1] + 1.0) +
202  diff_W[i] * (1.0 - 0.5 * (S[0] + 1.0)) +
203  diff_E[i] * 0.5 * (S[0] + 1.0);
204  }
205  }

References oomph::MacroElement::Domain_pt, oomph::QuadTreeNames::E, i, oomph::Domain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, oomph::QuadTreeNames::N, UniformPSDSelfTest::r, oomph::QuadTreeNames::S, plotPSD::t, oomph::QuadTreeNames::W, and Eigen::zeta().

◆ operator=()

void oomph::QMacroElement< 2 >::operator= ( const QMacroElement< 2 > &  )
delete

Broken assignment operator.

◆ output()

void oomph::QMacroElement< 2 >::output ( const unsigned t,
std::ostream &  outfile,
const unsigned nplot 
)
inlinevirtual

Plot: x,y in tecplot format at time level t (t=0: current; t>0: previous)

Implements oomph::MacroElement.

307  {
308  Vector<double> x(2), f(2);
309  outfile << "ZONE I=" << nplot << ", J=" << nplot << std::endl;
310  for (unsigned i = 0; i < nplot; i++)
311  {
312  x[1] = -1.0 + 2.0 * double(i) / double(nplot - 1);
313  for (unsigned j = 0; j < nplot; j++)
314  {
315  x[0] = -1.0 + 2.0 * double(j) / double(nplot - 1);
316  macro_map(t, x, f);
317  outfile << f[0] << " " << f[1] << std::endl;
318  }
319  }
320  }
void macro_map(const unsigned &t, const Vector< double > &S, Vector< double > &r)
Definition: macro_element.cc:123
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
list x
Definition: plotDoE.py:28
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References f(), i, j, oomph::MacroElement::macro_map(), plotPSD::t, and plotDoE::x.

◆ output_macro_element_boundaries()

void oomph::QMacroElement< 2 >::output_macro_element_boundaries ( std::ostream &  outfile,
const unsigned nplot 
)
virtual

Output all macro element boundaries as tecplot zones.

Implements oomph::MacroElement.

213  {
214  using namespace QuadTreeNames;
215 
216  Vector<double> s(1);
217  Vector<double> f(2);
218  // Dump at present time
219  unsigned t = 0;
220  for (unsigned idirect = N; idirect <= W; idirect++)
221  {
222  outfile << "ZONE I=" << nplot << std::endl;
223  for (unsigned j = 0; j < nplot; j++)
224  {
225  s[0] = -1.0 + 2.0 * double(j) / double(nplot - 1);
227  t, Macro_element_number, idirect, s, f);
228  outfile << f[0] << " " << f[1] << std::endl;
229  }
230  }
231  }
@ N
Definition: constructor.cpp:22

References oomph::MacroElement::Domain_pt, f(), j, oomph::Domain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, N, s, plotPSD::t, and oomph::QuadTreeNames::W.


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