oomph::QExtrudedMacroElement< 3 > Class Reference

#include <extruded_macro_element.h>

+ Inheritance diagram for oomph::QExtrudedMacroElement< 3 >:

Public Member Functions

 QExtrudedMacroElement (ExtrudedDomain *domain_pt, const unsigned &macro_element_number)
 
 QExtrudedMacroElement ()
 Default constructor (empty and broken) More...
 
 QExtrudedMacroElement (const QExtrudedMacroElement &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const QExtrudedMacroElement &)=delete
 Broken assignment operator. More...
 
virtual ~QExtrudedMacroElement ()
 Empty destructor. More...
 
void output (const unsigned &t, std::ostream &outfile, const unsigned &nplot)
 Plot: x,y,t in tecplot format. More...
 
void macro_map (const unsigned &t, const Vector< double > &s, Vector< double > &r)
 Get the global position r(s) at the continuous time, t. More...
 
void output_macro_element_boundaries (std::ostream &outfile, const unsigned &nplot)
 Output all macro element boundaries as tecplot zones. More...
 
- Public Member Functions inherited from oomph::ExtrudedMacroElement
 ExtrudedMacroElement (ExtrudedDomain *extruded_domain_pt, unsigned macro_element_number)
 
 ExtrudedMacroElement ()
 Default constructor (empty and broken) More...
 
 ExtrudedMacroElement (const ExtrudedMacroElement &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const ExtrudedMacroElement &)=delete
 Broken assignment operator. More...
 
virtual ~ExtrudedMacroElement ()
 Empty destructor. More...
 
ExtrudedDomain *& extruded_domain_pt ()
 Access function to the ExtrudedDomain. More...
 
- 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...
 
virtual 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)
 
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::ExtrudedMacroElement
ExtrudedDomainExtruded_domain_pt
 Pointer to the extruded domain. More...
 
- 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

DRAIG: FILL IN COMPLETE DESCRIPTION ONCE FINISHED...

Constructor & Destructor Documentation

◆ QExtrudedMacroElement() [1/3]

oomph::QExtrudedMacroElement< 3 >::QExtrudedMacroElement ( ExtrudedDomain domain_pt,
const unsigned macro_element_number 
)
inline

Constructor: Pass the pointer to the domain and the ID number of this extruded macro element

153  {
154  }
ExtrudedMacroElement()
Default constructor (empty and broken)
Definition: extruded_macro_element.h:80
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

◆ QExtrudedMacroElement() [2/3]

Default constructor (empty and broken)

158  {
159  // Create an error message
161  "Don't call empty constructor for QExtrudedMacroElement!";
162 
163  // Throw the error message
164  throw OomphLibError(
166  } // End of QExtrudedMacroElement
int error
Definition: calibrate.py:297
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References calibrate::error, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().

◆ QExtrudedMacroElement() [3/3]

Broken copy constructor.

◆ ~QExtrudedMacroElement()

virtual oomph::QExtrudedMacroElement< 3 >::~QExtrudedMacroElement ( )
inlinevirtual

Empty destructor.

176 {}

Member Function Documentation

◆ macro_map()

void oomph::QExtrudedMacroElement< 3 >::macro_map ( const unsigned t,
const Vector< double > &  s,
Vector< double > &  r 
)
virtual

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

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

Implements oomph::MacroElement.

38  {
39  // Make sure that t=0 otherwise this doesn't make sense
40  if (t != 0)
41  {
42  // Create an output stream
43  std::ostringstream error_message_stream;
44 
45  // Create an error message
46  error_message_stream << "This output function outputs a space-time\n"
47  << "representation of the solution. As such, it\n"
48  << "does not make sense to output the solution\n"
49  << "at a previous time level!" << std::endl;
50 
51  // Throw an error
52  throw OomphLibError(error_message_stream.str(),
55  }
56 
57  // Storage for the eight corners
58  Vector<double> corner_LDB(3, 0.0);
59  Vector<double> corner_RDB(3, 0.0);
60  Vector<double> corner_LUB(3, 0.0);
61  Vector<double> corner_RUB(3, 0.0);
62  Vector<double> corner_LDF(3, 0.0);
63  Vector<double> corner_RDF(3, 0.0);
64  Vector<double> corner_LUF(3, 0.0);
65  Vector<double> corner_RUF(3, 0.0);
66 
67  // Lagrangian coordinates of a point on a 2D surface in 3D space
68  Vector<double> zeta(2, 0.0);
69 
70  // First coordinate of the bottom-left coordinates of a surface
71  zeta[0] = -1.0;
72 
73  // Second coordinate of the bottom-left coordinates of a surface
74  zeta[1] = -1.0;
75 
76  // Calculate the space-time coordinates of the LDB corner
78  t, Macro_element_number, OcTreeNames::B, zeta, corner_LDB);
79 
80  // Calculate the space-time coordinates of the LUB corner
82  t, Macro_element_number, OcTreeNames::U, zeta, corner_LUB);
83 
84  // Calculate the space-time coordinates of the LDF corner
86  t, Macro_element_number, OcTreeNames::F, zeta, corner_LDF);
87 
88  // Calculate the space-time coordinates of the RDB corner
90  t, Macro_element_number, OcTreeNames::R, zeta, corner_RDB);
91 
92  // First coordinate of the the top-right coordinates of a surface
93  zeta[0] = 1.0;
94 
95  // Second coordinate of the the top-right coordinates of a surface
96  zeta[1] = 1.0;
97 
98  // Calculate the space-time coordinates of the RUB corner
100  t, Macro_element_number, OcTreeNames::B, zeta, corner_RUB);
101 
102  // Calculate the space-time coordinates of the RDF corner
104  t, Macro_element_number, OcTreeNames::D, zeta, corner_RDF);
105 
106  // Calculate the space-time coordinates of the LUF corner
108  t, Macro_element_number, OcTreeNames::L, zeta, corner_LUF);
109 
110  // Calculate the space-time coordinates of the RUF corner
112  t, Macro_element_number, OcTreeNames::R, zeta, corner_RUF);
113 
114  // Get the position of the 4 corners of the center slice
115  Vector<double> corner_LD(3, 0.0);
116  Vector<double> corner_RD(3, 0.0);
117  Vector<double> corner_LU(3, 0.0);
118  Vector<double> corner_RU(3, 0.0);
119 
120  // Set the coordinates of the point on a surface
121  zeta[0] = -1.0;
122  zeta[1] = s[2];
123 
125  t, Macro_element_number, OcTreeNames::D, zeta, corner_LD);
127  t, Macro_element_number, OcTreeNames::U, zeta, corner_LU);
128  zeta[0] = 1.0;
130  t, Macro_element_number, OcTreeNames::D, zeta, corner_RD);
132  t, Macro_element_number, OcTreeNames::U, zeta, corner_RU);
133 
134  // Get position on the B,F faces;
135  Vector<double> face_B(3);
136  Vector<double> face_F(3);
137 
138  zeta[0] = s[0];
139  zeta[1] = s[1];
144 
145 
146  // Get position on the edges of the middle slice
147  Vector<double> edge_mid_L(3);
148  Vector<double> edge_mid_R(3);
149  Vector<double> edge_mid_D(3);
150  Vector<double> edge_mid_U(3);
151  zeta[0] = s[0];
152  zeta[1] = s[2];
154  t, Macro_element_number, OcTreeNames::U, zeta, edge_mid_U);
155 
157  t, Macro_element_number, OcTreeNames::D, zeta, edge_mid_D);
158  zeta[0] = s[1];
159  zeta[1] = s[2];
161  t, Macro_element_number, OcTreeNames::L, zeta, edge_mid_L);
162 
164  t, Macro_element_number, OcTreeNames::R, zeta, edge_mid_R);
165 
166  // Get position on the edges of the back slice
167  Vector<double> edge_back_L(3);
168  Vector<double> edge_back_R(3);
169  Vector<double> edge_back_D(3);
170  Vector<double> edge_back_U(3);
171  zeta[0] = s[0];
172  zeta[1] = -1.0;
174  t, Macro_element_number, OcTreeNames::U, zeta, edge_back_U);
175 
177  t, Macro_element_number, OcTreeNames::D, zeta, edge_back_D);
178  zeta[0] = s[1];
179  zeta[1] = -1.0;
181  t, Macro_element_number, OcTreeNames::L, zeta, edge_back_L);
182 
184  t, Macro_element_number, OcTreeNames::R, zeta, edge_back_R);
185 
186  // Get position on the edges of the front slice
187  Vector<double> edge_front_L(3);
188  Vector<double> edge_front_R(3);
189  Vector<double> edge_front_D(3);
190  Vector<double> edge_front_U(3);
191  zeta[0] = s[0];
192  zeta[1] = 1.0;
194  t, Macro_element_number, OcTreeNames::U, zeta, edge_front_U);
195 
197  t, Macro_element_number, OcTreeNames::D, zeta, edge_front_D);
198  zeta[0] = s[1];
199  zeta[1] = 1.0;
201  t, Macro_element_number, OcTreeNames::L, zeta, edge_front_L);
202 
204  t, Macro_element_number, OcTreeNames::R, zeta, edge_front_R);
205 
206  // The number of dimensions (=space+time)
207  unsigned n_dim = 3;
208 
209  // Loop over the coordinate directions
210  for (unsigned i = 0; i < n_dim; i++)
211  {
212  //-----------------------------
213  // Position on the middle slice
214  //-----------------------------
215  double slice_mid;
216 
217  // The points on the up and down edges of the middle "rectangular slice"
218  double point_up = 0.0;
219  double point_down = 0.0;
220 
221  // Calculate the point on the upper edge
222  point_up =
223  corner_LU[i] + (corner_RU[i] - corner_LU[i]) * 0.5 * (s[0] + 1.0);
224 
225  // Calculate the point on the lower edge
226  point_down =
227  corner_LD[i] + (corner_RD[i] - corner_LD[i]) * 0.5 * (s[0] + 1.0);
228 
229  // Position in the rectangular middle slice
230  slice_mid = point_down + 0.5 * (1.0 + s[1]) * (point_up - point_down);
231 
232  // Get the differences to the edges of the middle slice
233  double diff_L, diff_R, diff_D, diff_U;
234  diff_L = edge_mid_L[i] - slice_mid;
235  diff_R = edge_mid_R[i] - slice_mid;
236  diff_D = edge_mid_D[i] - slice_mid;
237  diff_U = edge_mid_U[i] - slice_mid;
238 
239  // Map it to get the position in the middle slice
240  slice_mid +=
241  (diff_L * (1.0 - 0.5 * (s[0] + 1.0)) + diff_R * 0.5 * (s[0] + 1.0) +
242  diff_D * (1.0 - 0.5 * (s[1] + 1.0)) + diff_U * 0.5 * (s[1] + 1.0));
243 
244  //---------------------------
245  // Position on the back slice
246  //---------------------------
247  double slice_back;
248 
249  // Calculate the point on the upper edge of the back "rectangular slice"
250  point_up =
251  corner_LUB[i] + (corner_RUB[i] - corner_LUB[i]) * 0.5 * (s[0] + 1.0);
252 
253  // Calculate the point on the lower edge of the back "rectangular slice"
254  point_down =
255  corner_LDB[i] + (corner_RDB[i] - corner_LDB[i]) * 0.5 * (s[0] + 1.0);
256 
257  // Position in the rectangular back slice
258  slice_back = point_down + 0.5 * (1.0 + s[1]) * (point_up - point_down);
259 
260  // Get the differences to the edges of the middle slice
261  diff_L = edge_back_L[i] - slice_back;
262  diff_R = edge_back_R[i] - slice_back;
263  diff_D = edge_back_D[i] - slice_back;
264  diff_U = edge_back_U[i] - slice_back;
265 
266  // Map it to get the position in the back slice
267  slice_back +=
268  (diff_L * (1.0 - 0.5 * (s[0] + 1.0)) + diff_R * 0.5 * (s[0] + 1.0) +
269  diff_D * (1.0 - 0.5 * (s[1] + 1.0)) + diff_U * 0.5 * (s[1] + 1.0));
270 
271  //----------------------------
272  // Position on the front slice
273  //----------------------------
274  double slice_front;
275 
276  // Calculate the point on the upper edge of the back "rectangular slice"
277  point_up =
278  corner_LUF[i] + (corner_RUF[i] - corner_LUF[i]) * 0.5 * (s[0] + 1.0);
279 
280  // Calculate the point on the lower edge of the back "rectangular slice"
281  point_down =
282  corner_LDF[i] + (corner_RDF[i] - corner_LDF[i]) * 0.5 * (s[0] + 1.0);
283 
284  // Position in the rectangular back slice
285  slice_front = point_down + 0.5 * (1.0 + s[1]) * (point_up - point_down);
286 
287  // Get the differences to the edges of the middle slice
288  diff_L = edge_front_L[i] - slice_front;
289  diff_R = edge_front_R[i] - slice_front;
290  diff_D = edge_front_D[i] - slice_front;
291  diff_U = edge_front_U[i] - slice_front;
292 
293  // Map it to get the position in the back slice
294  slice_front +=
295  (diff_L * (1.0 - 0.5 * (s[0] + 1.0)) + diff_R * 0.5 * (s[0] + 1.0) +
296  diff_D * (1.0 - 0.5 * (s[1] + 1.0)) + diff_U * 0.5 * (s[1] + 1.0));
297 
298  //-------------------------------------------------------------------------
299  // Get difference between the back and front slices and the actual
300  // boundary
301  //-------------------------------------------------------------------------
302  double diff_back = face_B[i] - slice_back;
303  double diff_front = face_F[i] - slice_front;
304 
305  //----------
306  // Final map
307  //----------
308  r[i] = slice_mid + 0.5 * (1.0 + s[2]) * diff_front +
309  0.5 * (1.0 - s[2]) * diff_back;
310  }
311  } // End of macro_map
int i
Definition: BiCGSTAB_step_by_step.cpp:9
void macro_element_boundary(const unsigned &time, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &x)
Definition: extruded_domain.cc:148
ExtrudedDomain * Extruded_domain_pt
Pointer to the extruded domain.
Definition: extruded_macro_element.h:115
unsigned Macro_element_number
What is the number of the current macro element within its domain.
Definition: macro_element.h:239
RealScalar s
Definition: level1_cplx_impl.h:130
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
r
Definition: UniformPSDSelfTest.py:20
@ B
Definition: octree.h:73
@ D
Definition: octree.h:71
@ L
Definition: octree.h:69
@ R
Definition: octree.h:70
@ F
Definition: octree.h:74
@ U
Definition: octree.h:72
t
Definition: plotPSD.py:36

References oomph::OcTreeNames::B, oomph::OcTreeNames::D, oomph::ExtrudedMacroElement::Extruded_domain_pt, oomph::OcTreeNames::F, i, oomph::OcTreeNames::L, oomph::ExtrudedDomain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, UniformPSDSelfTest::r, oomph::OcTreeNames::R, s, plotPSD::t, oomph::OcTreeNames::U, and Eigen::zeta().

◆ operator=()

void oomph::QExtrudedMacroElement< 3 >::operator= ( const QExtrudedMacroElement< 3 > &  )
delete

Broken assignment operator.

◆ output()

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

Plot: x,y,t in tecplot format.

Implements oomph::MacroElement.

180  {
181  // Make sure that t=0 otherwise this doesn't make sense
182  if (t != 0)
183  {
184  // Create an output stream
185  std::ostringstream error_message_stream;
186 
187  // Create an error message
188  error_message_stream << "This output function outputs a space-time\n"
189  << "representation of the solution. As such, it\n"
190  << "does not make sense to output the solution\n"
191  << "at a previous time level!" << std::endl;
192 
193  // Throw an error
194  throw OomphLibError(error_message_stream.str(),
197  }
198 
199  // Storage for the local (space-time) coordinates
200  Vector<double> s(3, 0.0);
201 
202  // Storage for the global (space-time) coordinates
203  Vector<double> x(3, 0.0);
204 
205  // Output the header
206  outfile << "ZONE I=" << nplot << ", J=" << nplot << ", K=" << nplot
207  << std::endl;
208 
209  // Loop over the plot points in the t-direction
210  for (unsigned i = 0; i < nplot; i++)
211  {
212  // Calculate the time value
213  // s[2]=-1.0+2.0*double(i)/double(nplot-1);
214  s[2] = -1.0 + 2.0 * double(i) / double(nplot - 1);
215 
216  // Loop over the plot points in the y-direction
217  for (unsigned j = 0; j < nplot; j++)
218  {
219  // Calculate the y value
220  s[1] = -1.0 + 2.0 * double(j) / double(nplot - 1);
221 
222  // Loop over the plot points in the x-direction
223  for (unsigned k = 0; k < nplot; k++)
224  {
225  // Calculate the x value
226  s[0] = -1.0 + 2.0 * double(k) / double(nplot - 1);
227 
228  // Get the corresponding global space-time coordinates.
229  // NOTE: Calling the macro_map function from the base class requires
230  // the time level. To make the call function normally, we simply
231  // pass the argument t=0 and the appropriate function will be
232  // called.
233  macro_map(t, s, x);
234 
235  // Output the global coordinates
236  outfile << x[0] << " " << x[1] << " " << x[2] << " " << 0.0
237  << std::endl;
238  }
239  } // for (unsigned j=0;j<nplot;j++)
240  } // for (unsigned i=0;i<nplot;i++)
241  } // End of output
void macro_map(const unsigned &t, const Vector< double > &s, Vector< double > &r)
Get the global position r(s) at the continuous time, t.
Definition: extruded_macro_element.cc:35
char char char int int * k
Definition: level2_impl.h:374
list x
Definition: plotDoE.py:28
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References i, j, k, oomph::MacroElement::macro_map(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, plotPSD::t, and plotDoE::x.

◆ output_macro_element_boundaries()

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

Output all macro element boundaries as tecplot zones.

Implements oomph::MacroElement.

318  {
319  // Use the OcTree enumeration for corners, edges and faces
320  using namespace OcTreeNames;
321 
322  // Storage for the local coordinates (of a point on a face)
323  Vector<double> s(2);
324 
325  // Storage for the global coordinates
326  Vector<double> x(3);
327 
328  // Loop over the faces
329  for (unsigned idirect = L; idirect <= F; idirect++)
330  {
331  // Output the header
332  outfile << "ZONE I=" << nplot << ", J=" << nplot << std::endl;
333 
334  // Loop over the plot points in the second surface direction
335  for (unsigned i = 0; i < nplot; i++)
336  {
337  // Calculate the second local coordinate associated with this plot point
338  s[1] = -1.0 + 2.0 * double(i) / double(nplot - 1);
339 
340  // Loop over the plot points in the first surface direction
341  for (unsigned j = 0; j < nplot; j++)
342  {
343  // Calculate the first local coordinate associated with this plot
344  // point
345  s[0] = -1.0 + 2.0 * double(j) / double(nplot - 1);
346 
347  // To make the extrusion machinery consistent with the Domain
348  // machinery a time level argument has to be provided. For our
349  // purposes we set this to zero to ensure that the appropriate output
350  // is provided.
351  unsigned t = 0;
352 
353  // Get the global coordinates associated with these local coordinates
355  t, Macro_element_number, idirect, s, x);
356 
357  // Output the global (space-time) coordinates
358  outfile << x[0] << " " << x[1] << " " << x[2] << std::endl;
359  }
360  } // for (unsigned i=0;i<nplot;i++)
361  } // for (unsigned idirect=L;idirect<=F;idirect++)
362  } // End of output_macro_element_boundaries
MatrixXd L
Definition: LLT_example.cpp:6

References oomph::ExtrudedMacroElement::Extruded_domain_pt, oomph::OcTreeNames::F, i, j, L, oomph::ExtrudedDomain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, s, plotPSD::t, and plotDoE::x.


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