oomph::QMacroElement< 3 > Class Reference

#include <macro_element.h>

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

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)
 
- 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::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 3 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 (L/R/D/U/B/F)
  • \( {\bf S} \in [-1,1]^2 \) is the (2D) 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< 3 >::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)

382  {
383  throw OomphLibError("Don't call empty constructor for QMacroElement!",
386  }
#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< 3 >::QMacroElement ( const QMacroElement< 3 > &  dummy)
delete

Broken copy constructor.

◆ ~QMacroElement()

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

Empty destructor.

395 {};

Member Function Documentation

◆ macro_map()

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

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

Implements oomph::MacroElement.

443  {
444  // get the eight corners
445  Vector<double> corner_LDB(3);
446  Vector<double> corner_RDB(3);
447  Vector<double> corner_LUB(3);
448  Vector<double> corner_RUB(3);
449  Vector<double> corner_LDF(3);
450  Vector<double> corner_RDF(3);
451  Vector<double> corner_LUF(3);
452  Vector<double> corner_RUF(3);
453 
454  Vector<double> zeta(2);
455  zeta[0] = -1.0;
456  zeta[1] = -1.0;
458  t, Macro_element_number, OcTreeNames::B, zeta, corner_LDB);
460  t, Macro_element_number, OcTreeNames::U, zeta, corner_LUB);
462  t, Macro_element_number, OcTreeNames::F, zeta, corner_LDF);
464  t, Macro_element_number, OcTreeNames::R, zeta, corner_RDB);
465  zeta[0] = 1.0;
466  zeta[1] = 1.0;
468  t, Macro_element_number, OcTreeNames::B, zeta, corner_RUB);
470  t, Macro_element_number, OcTreeNames::D, zeta, corner_RDF);
472  t, Macro_element_number, OcTreeNames::L, zeta, corner_LUF);
474  t, Macro_element_number, OcTreeNames::R, zeta, corner_RUF);
475 
476 
477  // get the position of the 4 corners of the center slice
478  Vector<double> corner_LD(3);
479  Vector<double> corner_RD(3);
480  Vector<double> corner_LU(3);
481  Vector<double> corner_RU(3);
482 
483  zeta[0] = -1.0;
484  zeta[1] = S[2];
486  t, Macro_element_number, OcTreeNames::D, zeta, corner_LD);
488  t, Macro_element_number, OcTreeNames::U, zeta, corner_LU);
489  zeta[0] = 1.0;
491  t, Macro_element_number, OcTreeNames::D, zeta, corner_RD);
493  t, Macro_element_number, OcTreeNames::U, zeta, corner_RU);
494 
495  // get position on the B,F faces;
496  Vector<double> face_B(3);
497  Vector<double> face_F(3);
498 
499  zeta[0] = S[0];
500  zeta[1] = S[1];
505 
506 
507  // get position on the edges of the middle slice
508  Vector<double> edge_mid_L(3);
509  Vector<double> edge_mid_R(3);
510  Vector<double> edge_mid_D(3);
511  Vector<double> edge_mid_U(3);
512  zeta[0] = S[0];
513  zeta[1] = S[2];
515  t, Macro_element_number, OcTreeNames::U, zeta, edge_mid_U);
516 
518  t, Macro_element_number, OcTreeNames::D, zeta, edge_mid_D);
519  zeta[0] = S[1];
520  zeta[1] = S[2];
522  t, Macro_element_number, OcTreeNames::L, zeta, edge_mid_L);
523 
525  t, Macro_element_number, OcTreeNames::R, zeta, edge_mid_R);
526 
527  // get position on the edges of the back slice
528  Vector<double> edge_back_L(3);
529  Vector<double> edge_back_R(3);
530  Vector<double> edge_back_D(3);
531  Vector<double> edge_back_U(3);
532  zeta[0] = S[0];
533  zeta[1] = -1.0;
535  t, Macro_element_number, OcTreeNames::U, zeta, edge_back_U);
536 
538  t, Macro_element_number, OcTreeNames::D, zeta, edge_back_D);
539  zeta[0] = S[1];
540  zeta[1] = -1.0;
542  t, Macro_element_number, OcTreeNames::L, zeta, edge_back_L);
543 
545  t, Macro_element_number, OcTreeNames::R, zeta, edge_back_R);
546 
547  // get position on the edges of the front slice
548  Vector<double> edge_front_L(3);
549  Vector<double> edge_front_R(3);
550  Vector<double> edge_front_D(3);
551  Vector<double> edge_front_U(3);
552  zeta[0] = S[0];
553  zeta[1] = 1.0;
555  t, Macro_element_number, OcTreeNames::U, zeta, edge_front_U);
556 
558  t, Macro_element_number, OcTreeNames::D, zeta, edge_front_D);
559  zeta[0] = S[1];
560  zeta[1] = 1.0;
562  t, Macro_element_number, OcTreeNames::L, zeta, edge_front_L);
563 
565  t, Macro_element_number, OcTreeNames::R, zeta, edge_front_R);
566 
567 
568  for (unsigned i = 0; i < 3; i++)
569  {
570  // Position on the middle slice
571  // ============================
572  double slice_mid;
573 
574  // the points on the up and down edges of the middle "rectangular slice"
575  double ptUp, ptDo;
576  ptUp = corner_LU[i] + (corner_RU[i] - corner_LU[i]) * 0.5 * (S[0] + 1.0);
577  ptDo = corner_LD[i] + (corner_RD[i] - corner_LD[i]) * 0.5 * (S[0] + 1.0);
578  // position in the rectangular middle slice
579  slice_mid = ptDo + 0.5 * (1.0 + S[1]) * (ptUp - ptDo);
580 
581  // get the differences to the edges of the middle slice
582  double diff_L, diff_R, diff_D, diff_U;
583  diff_L = edge_mid_L[i] - slice_mid;
584  diff_R = edge_mid_R[i] - slice_mid;
585  diff_D = edge_mid_D[i] - slice_mid;
586  diff_U = edge_mid_U[i] - slice_mid;
587 
588  // Map it to get the position in the middle slice
589  slice_mid +=
590  diff_L * (1.0 - 0.5 * (S[0] + 1.0)) + diff_R * 0.5 * (S[0] + 1.0) +
591  diff_D * (1.0 - 0.5 * (S[1] + 1.0)) + diff_U * 0.5 * (S[1] + 1.0);
592 
593 
594  // Position on the back slice
595  //===========================
596  double slice_back;
597 
598  // the points on the up and down edges of the back "rectangular slice"
599  ptUp =
600  corner_LUB[i] + (corner_RUB[i] - corner_LUB[i]) * 0.5 * (S[0] + 1.0);
601  ptDo =
602  corner_LDB[i] + (corner_RDB[i] - corner_LDB[i]) * 0.5 * (S[0] + 1.0);
603  // position in the rectangular back slice
604  slice_back = ptDo + 0.5 * (1.0 + S[1]) * (ptUp - ptDo);
605 
606  // get the differences to the edges of the middle slice
607  diff_L = edge_back_L[i] - slice_back;
608  diff_R = edge_back_R[i] - slice_back;
609  diff_D = edge_back_D[i] - slice_back;
610  diff_U = edge_back_U[i] - slice_back;
611 
612  // Map it to get the position in the back slice
613  slice_back +=
614  diff_L * (1.0 - 0.5 * (S[0] + 1.0)) + diff_R * 0.5 * (S[0] + 1.0) +
615  diff_D * (1.0 - 0.5 * (S[1] + 1.0)) + diff_U * 0.5 * (S[1] + 1.0);
616 
617  // Position on the front slice
618  //============================
619  double slice_front;
620 
621  // the points on the up and down edges of the back "rectangular slice"
622  ptUp =
623  corner_LUF[i] + (corner_RUF[i] - corner_LUF[i]) * 0.5 * (S[0] + 1.0);
624  ptDo =
625  corner_LDF[i] + (corner_RDF[i] - corner_LDF[i]) * 0.5 * (S[0] + 1.0);
626  // position in the rectangular back slice
627  slice_front = ptDo + 0.5 * (1.0 + S[1]) * (ptUp - ptDo);
628 
629  // get the differences to the edges of the middle slice
630  diff_L = edge_front_L[i] - slice_front;
631  diff_R = edge_front_R[i] - slice_front;
632  diff_D = edge_front_D[i] - slice_front;
633  diff_U = edge_front_U[i] - slice_front;
634 
635  // Map it to get the position in the back slice
636  slice_front +=
637  diff_L * (1.0 - 0.5 * (S[0] + 1.0)) + diff_R * 0.5 * (S[0] + 1.0) +
638  diff_D * (1.0 - 0.5 * (S[1] + 1.0)) + diff_U * 0.5 * (S[1] + 1.0);
639 
640  // Get difference between the back and front slices and the actual
641  // boundary
642  // ========================================================================
643 
644  double diff_back = face_B[i] - slice_back;
645  double diff_front = face_F[i] - slice_front;
646 
647  // final map
648  //==========
649 
650  r[i] = slice_mid + 0.5 * (1 + S[2]) * diff_front +
651  0.5 * (1 - S[2]) * diff_back;
652  }
653  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
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
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
@ S
Definition: quadtree.h:62
t
Definition: plotPSD.py:36

References oomph::OcTreeNames::B, oomph::OcTreeNames::D, oomph::MacroElement::Domain_pt, oomph::OcTreeNames::F, i, oomph::OcTreeNames::L, oomph::Domain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, UniformPSDSelfTest::r, oomph::OcTreeNames::R, oomph::QuadTreeNames::S, plotPSD::t, oomph::OcTreeNames::U, and Eigen::zeta().

◆ operator=()

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

Broken assignment operator.

◆ output()

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

401  {
402  Vector<double> x(3), f(3);
403 
404  outfile << "ZONE I=" << nplot << ", J=" << nplot << ", k=" << nplot
405  << std::endl;
406  for (unsigned i = 0; i < nplot; i++)
407  {
408  x[2] = -1.0 + 2.0 * double(i) / double(nplot - 1);
409 
410  for (unsigned j = 0; j < nplot; j++)
411  {
412  x[1] = -1.0 + 2.0 * double(j) / double(nplot - 1);
413 
414  for (unsigned k = 0; k < nplot; k++)
415  {
416  x[0] = -1.0 + 2.0 * double(k) / double(nplot - 1);
417 
418  macro_map(t, x, f);
419 
420  outfile << f[0] << " " << f[1] << " " << f[2] << std::endl;
421  }
422  }
423  }
424  }
void macro_map(const unsigned &t, const Vector< double > &S, Vector< double > &r)
Definition: macro_element.cc:440
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
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 f(), i, j, k, oomph::MacroElement::macro_map(), plotPSD::t, and plotDoE::x.

◆ output_macro_element_boundaries()

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

Output all macro element boundaries as tecplot zones.

Implements oomph::MacroElement.

661  {
662  using namespace OcTreeNames;
663 
664  Vector<double> s(2);
665  Vector<double> f(3);
666  // Dump at present time
667  unsigned t = 0;
668  for (unsigned idirect = L; idirect <= F; idirect++)
669  {
670  outfile << "ZONE I=" << nplot << ", J=" << nplot << std::endl;
671  for (unsigned i = 0; i < nplot; i++)
672  {
673  s[1] = -1.0 + 2.0 * double(i) / double(nplot - 1);
674  for (unsigned j = 0; j < nplot; j++)
675  {
676  s[0] = -1.0 + 2.0 * double(j) / double(nplot - 1);
678  t, Macro_element_number, idirect, s, f);
679  outfile << f[0] << " " << f[1] << " " << f[2] << std::endl;
680  }
681  }
682  }
683  }
MatrixXd L
Definition: LLT_example.cpp:6
RealScalar s
Definition: level1_cplx_impl.h:130

References oomph::MacroElement::Domain_pt, f(), oomph::OcTreeNames::F, i, j, L, oomph::Domain::macro_element_boundary(), oomph::MacroElement::Macro_element_number, s, and plotPSD::t.


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