20 #ifndef GEOS_FINITEELEMENT_ELEMENTFORMULATIONS_H1TETRAHEDRONLAGRANGE1GAUSS_HPP_ 
   21 #define GEOS_FINITEELEMENT_ELEMENTFORMULATIONS_H1TETRAHEDRONLAGRANGE1GAUSS_HPP_ 
   49 template< 
typename NUM_Q_POINTS >
 
   55   static_assert( ( NUM_Q_POINTS::value == 1 ||
 
   56                    NUM_Q_POINTS::value == 5 ||
 
   57                    NUM_Q_POINTS::value == 14 ),
 
   58                  "NUM_Q_POINTS::value must be 1, 5, or 14!" );
 
  134                                                   real64 (& samplingPointCoord)[3] )
 
  142     real64 const r = i0 * step;
 
  143     real64 const s = i1 * step;
 
  144     real64 const t = i2 * step;
 
  147       samplingPointCoord[0] = r;
 
  148       samplingPointCoord[1] = s;
 
  149       samplingPointCoord[2] = t;
 
  154       samplingPointCoord[0] = 1 - t - r;
 
  155       samplingPointCoord[1] = 1 - t - s;
 
  156       samplingPointCoord[2] = t;
 
  210     real64 const r = pointCoord[0];
 
  211     real64 const s = pointCoord[1];
 
  212     real64 const t = pointCoord[2];
 
  214     N[0] = (1 - r - s - t) * r * t;
 
  215     N[1] = (1 - r - s - t) * r * s;
 
  216     N[2] = (1 - r - s - t) * t * s;
 
  233     real64 const pointCoord[3] = {quadratureParentCoords0( q ),
 
  234                                   quadratureParentCoords1( q ),
 
  235                                   quadratureParentCoords2( q )};
 
  325     return LvArray::tensorOps::invert< 3 >( J );
 
  329   constexpr 
static real64 parentVolume = 1.0 / 6.0;
 
  332   constexpr 
static real64 weight = parentVolume;
 
  357                                               0.073493043116361949544,
 
  358                                               0.073493043116361949544,
 
  359                                               0.073493043116361949544,
 
  360                                               0.11268792571801585080,
 
  361                                               0.11268792571801585080,
 
  362                                               0.11268792571801585080,
 
  363                                               0.11268792571801585080,
 
  364                                               0.042546020777081466438,
 
  365                                               0.042546020777081466438,
 
  366                                               0.042546020777081466438,
 
  367                                               0.042546020777081466438,
 
  368                                               0.042546020777081466438,
 
  369                                               0.042546020777081466438 };
 
  399                                                     0.092735250310891226402,
 
  400                                                     0.092735250310891226402,
 
  401                                                     0.092735250310891226402,
 
  402                                                     0.067342242210098170608,
 
  403                                                     0.31088591926330060980,
 
  404                                                     0.31088591926330060980,
 
  405                                                     0.31088591926330060980,
 
  406                                                     0.045503704125649649492,
 
  407                                                     0.045503704125649649492,
 
  408                                                     0.045503704125649649492,
 
  409                                                     0.45449629587435035051,
 
  410                                                     0.45449629587435035051,
 
  411                                                     0.45449629587435035051 };
 
  441                                                     0.72179424906732632079,
 
  442                                                     0.092735250310891226402,
 
  443                                                     0.092735250310891226402,
 
  444                                                     0.31088591926330060980,
 
  445                                                     0.067342242210098170608,
 
  446                                                     0.31088591926330060980,
 
  447                                                     0.31088591926330060980,
 
  448                                                     0.045503704125649649492,
 
  449                                                     0.45449629587435035051,
 
  450                                                     0.45449629587435035051,
 
  451                                                     0.045503704125649649492,
 
  452                                                     0.045503704125649649492,
 
  453                                                     0.45449629587435035051 };
 
  483                                                     0.092735250310891226402,
 
  484                                                     0.72179424906732632079,
 
  485                                                     0.092735250310891226402,
 
  486                                                     0.31088591926330060980,
 
  487                                                     0.31088591926330060980,
 
  488                                                     0.067342242210098170608,
 
  489                                                     0.31088591926330060980,
 
  490                                                     0.45449629587435035051,
 
  491                                                     0.045503704125649649492,
 
  492                                                     0.45449629587435035051,
 
  493                                                     0.045503704125649649492,
 
  494                                                     0.45449629587435035051,
 
  495                                                     0.045503704125649649492 };
 
  515 template< 
typename NUM_Q_POINTS >
 
  519 H1_Tetrahedron_Lagrange1_Gauss< NUM_Q_POINTS >::
 
  520 determinantJacobianTransformation( 
real64 const (&X)[numNodes][3] )
 
  522   return ( X[1][0] - X[0][0] )*( ( X[2][1] - X[0][1] )*( X[3][2] - X[0][2] ) - ( X[3][1] - X[0][1] )*( X[2][2] - X[0][2] ) )
 
  523          + ( X[1][1] - X[0][1] )*( ( X[3][0] - X[0][0] )*( X[2][2] - X[0][2] ) - ( X[2][0] - X[0][0] )*( X[3][2] - X[0][2] ) )
 
  524          + ( X[1][2] - X[0][2] )*( ( X[2][0] - X[0][0] )*( X[3][1] - X[0][1] ) - ( X[3][0] - X[0][0] )*( X[2][1] - X[0][1] ) );
 
  529 template< 
typename NUM_Q_POINTS >
 
  537   real64 const r = coords[0];
 
  538   real64 const s = coords[1];
 
  539   real64 const t = coords[2];
 
  542   N[0] = 1 - r - s - t;
 
  549 template< 
typename NUM_Q_POINTS >
 
  557   real64 const pointCoord[3] = {quadratureParentCoords0( q ),
 
  558                                 quadratureParentCoords1( q ),
 
  559                                 quadratureParentCoords2( q )};
 
  561   calcN( pointCoord, N );
 
  564 template< 
typename NUM_Q_POINTS >
 
  570        real64 ( & N )[numNodes] )
 
  572   return calcN( q, N );
 
  577 template< 
typename NUM_Q_POINTS >
 
  583            real64 const (&X)[numNodes][3],
 
  584            real64 (& gradN)[numNodes][3] )
 
  587   gradN[0][0] =  X[1][1]*( X[3][2] - X[2][2] ) - X[2][1]*( X[3][2] - X[1][2] ) + X[3][1]*( X[2][2] - X[1][2] );
 
  588   gradN[0][1] = -X[1][0]*( X[3][2] - X[2][2] ) + X[2][0]*( X[3][2] - X[1][2] ) - X[3][0]*( X[2][2] - X[1][2] );
 
  589   gradN[0][2] =  X[1][0]*( X[3][1] - X[2][1] ) - X[2][0]*( X[3][1] - X[1][1] ) + X[3][0]*( X[2][1] - X[1][1] );
 
  591   gradN[1][0] = -X[0][1]*( X[3][2] - X[2][2] ) + X[2][1]*( X[3][2] - X[0][2] ) - X[3][1]*( X[2][2] - X[0][2] );
 
  592   gradN[1][1] =  X[0][0]*( X[3][2] - X[2][2] ) - X[2][0]*( X[3][2] - X[0][2] ) + X[3][0]*( X[2][2] - X[0][2] );
 
  593   gradN[1][2] = -X[0][0]*( X[3][1] - X[2][1] ) + X[2][0]*( X[3][1] - X[0][1] ) - X[3][0]*( X[2][1] - X[0][1] );
 
  595   gradN[2][0] =  X[0][1]*( X[3][2] - X[1][2] ) - X[1][1]*( X[3][2] - X[0][2] ) + X[3][1]*( X[1][2] - X[0][2] );
 
  596   gradN[2][1] = -X[0][0]*( X[3][2] - X[1][2] ) + X[1][0]*( X[3][2] - X[0][2] ) - X[3][0]*( X[1][2] - X[0][2] );
 
  597   gradN[2][2] =  X[0][0]*( X[3][1] - X[1][1] ) - X[1][0]*( X[3][1] - X[0][1] ) + X[3][0]*( X[1][1] - X[0][1] );
 
  599   gradN[3][0] = -X[0][1]*( X[2][2] - X[1][2] ) + X[1][1]*( X[2][2] - X[0][2] ) - X[2][1]*( X[1][2] - X[0][2] );
 
  600   gradN[3][1] =  X[0][0]*( X[2][2] - X[1][2] ) - X[1][0]*( X[2][2] - X[0][2] ) + X[2][0]*( X[1][2] - X[0][2] );
 
  601   gradN[3][2] = -X[0][0]*( X[2][1] - X[1][1] ) + X[1][0]*( X[2][1] - X[0][1] ) - X[2][0]*( X[1][1] - X[0][1] );
 
  603   real64 detJ = determinantJacobianTransformation( X );
 
  604   real64 factor = 1.0 / ( detJ );
 
  606   for( 
int i = 0; i < numNodes; ++i )
 
  608     for( 
int j = 0; j < 3; ++j )
 
  610       gradN[i][j] *= factor;
 
  614   return detJ * weight * quadratureWeight( q );
 
  617 template< 
typename NUM_Q_POINTS >
 
  622            real64 const (&X)[numNodes][3],
 
  624            real64 ( & gradN )[numNodes][3] )
 
  626   return calcGradN( q, X, gradN );
 
  629 template< 
typename NUM_Q_POINTS >
 
  634                                                                      real64 const (&X)[numNodes][3],
 
  635                                                                      real64 (& gradN)[numFaces][3] )
 
  642   J[0][0] = X[1][0] - X[0][0];
 
  643   J[0][1] = X[2][0] - X[0][0];
 
  644   J[0][2] = X[3][0] - X[0][0];
 
  646   J[1][0] = X[1][1] - X[0][1];
 
  647   J[1][1] = X[2][1] - X[0][1];
 
  648   J[1][2] = X[3][1] - X[0][1];
 
  650   J[2][0] = X[1][2] - X[0][2];
 
  651   J[2][1] = X[2][2] - X[0][2];
 
  652   J[2][2] = X[3][2] - X[0][2];
 
  654   real64 const detJ = LvArray::tensorOps::invert< 3 >( J );
 
  656   real64 dNdXi[numFaces][3] = {{0}};
 
  658   real64 const r = quadratureParentCoords0( q );
 
  659   real64 const s = quadratureParentCoords1( q );
 
  660   real64 const t = quadratureParentCoords2( q );
 
  662   dNdXi[0][0] = ( 1 - 2 * r - s - t ) * t; 
 
  663   dNdXi[0][1] = -r * t;                    
 
  664   dNdXi[0][2] = ( 1 - r - s - 2 * t ) * r; 
 
  666   dNdXi[1][0] = ( 1 - 2 * r - s - t ) * s; 
 
  667   dNdXi[1][1] = ( 1 - r - 2 * s - t ) * r; 
 
  668   dNdXi[1][2] = -r * s;                    
 
  670   dNdXi[2][0] = -t * s;                    
 
  671   dNdXi[2][1] = ( 1 - r - 2 * s - t ) * t; 
 
  672   dNdXi[2][2] = ( 1 - r - s - 2 * t ) * s; 
 
  678   for( 
int fi=0; fi<numFaces; ++fi )
 
  680     gradN[fi][0] = dNdXi[fi][0] * J[0][0] + dNdXi[fi][1] * J[1][0] + dNdXi[fi][2] * J[2][0];
 
  681     gradN[fi][1] = dNdXi[fi][0] * J[0][1] + dNdXi[fi][1] * J[1][1] + dNdXi[fi][2] * J[2][1];
 
  682     gradN[fi][2] = dNdXi[fi][0] * J[0][2] + dNdXi[fi][1] * J[1][2] + dNdXi[fi][2] * J[2][2];
 
  685   return detJ * weight * quadratureWeight( q );
 
  690 template< 
typename NUM_Q_POINTS >
 
  696                              real64 const (&X)[numNodes][3] )
 
  699   real64 detJ =  determinantJacobianTransformation( X );
 
  701   return detJ * weight * quadratureWeight( q );
 
#define GEOS_HOST_DEVICE
Marks a host-device function.
 
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
 
#define GEOS_FORCE_INLINE
Marks a function or lambda for inlining.
 
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
 
Base class for FEM element implementations.
 
constexpr static int numSamplingPointsPerDirection
Number of sampling points.
 
static GEOS_HOST_DEVICE real64 invJacobianTransformation(int const q, real64 const (&X)[numNodes][3], real64(&J)[3][3])
Calculates the isoparametric "Jacobian" transformation matrix/mapping from the parent space to the ph...
 
static GEOS_HOST_DEVICE void calcN(localIndex const q, real64(&N)[numNodes])
Calculate shape functions values for each support point at a quadrature point.
 
static GEOS_HOST_DEVICE real64 transformedQuadratureWeight(localIndex const q, real64 const (&X)[numNodes][3])
Calculate the integration weights for a quadrature point.
 
GEOS_HOST_DEVICE static GEOS_FORCE_INLINE void calcN(real64 const (&pointCoord)[3], real64(&N)[numNodes])
Calculate shape functions values for each support point at a given point in the parent space.
 
static GEOS_HOST_DEVICE void calcN(localIndex const q, StackVariables const &stack, real64(&N)[numNodes])
Calculate shape functions values for each support point at a quadrature point.
 
GEOS_HOST_DEVICE static GEOS_FORCE_INLINE void calcFaceBubbleN(real64 const (&pointCoord)[3], real64(&N)[numFaces])
Calculate face bubble functions values for each face at a given point in the parent space.
 
static GEOS_HOST_DEVICE real64 calcGradFaceBubbleN(localIndex const q, real64 const (&X)[numNodes][3], real64(&gradN)[numFaces][3])
Calculate the bubble function derivatives wrt the physical coordinates.
 
static GEOS_HOST_DEVICE real64 calcGradN(localIndex const q, real64 const (&X)[numNodes][3], StackVariables const &stack, real64(&gradN)[numNodes][3])
Calculate the shape functions derivatives wrt the physical coordinates.
 
GEOS_HOST_DEVICE static GEOS_FORCE_INLINE void getSamplingPointCoordInParentSpace(int const &linearIndex, real64(&samplingPointCoord)[3])
Get the Sampling Point Coord In the Parent Space.
 
static GEOS_HOST_DEVICE real64 transformedQuadratureWeight(localIndex const q, real64 const (&X)[numNodes][3], StackVariables const &stack)
Calculate the integration weights for a quadrature point.
 
static GEOS_HOST_DEVICE localIndex getNumQuadraturePoints(StackVariables const &stack)
Get the number of quadrature points.
 
static GEOS_HOST_DEVICE void calcFaceBubbleN(localIndex const q, real64(&N)[numFaces])
Calculate face bubble functions values for each face at a quadrature point.
 
static GEOS_HOST_DEVICE localIndex getNumSupportPoints(StackVariables const &stack)
Get the number of support points.
 
constexpr static localIndex maxSupportPoints
The maximum number of support points per element.
 
virtual GEOS_HOST_DEVICE localIndex getNumQuadraturePoints() const override
Virtual getter for the number of quadrature points per element.
 
constexpr static int numSamplingPoints
The number of sampling points per element.
 
constexpr static localIndex numNodes
The number of nodes/support points per element.
 
constexpr static localIndex numFaces
The number of faces/support points per element.
 
static GEOS_HOST_DEVICE real64 calcGradN(localIndex const q, real64 const (&X)[numNodes][3], real64(&gradN)[numNodes][3])
Calculate the shape functions derivatives wrt the physical coordinates.
 
virtual GEOS_HOST_DEVICE localIndex getNumSupportPoints() const override
Virtual getter for the number of support points per element.
 
constexpr static localIndex numQuadraturePoints
The number of quadrature points per element.
 
virtual GEOS_HOST_DEVICE localIndex getMaxSupportPoints() const override
Get the maximum number of support points for this element.
 
double real64
64-bit floating point type.
 
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
 
Kernel variables (dof numbers, jacobian and residual) located on the stack.
 
Kernel variables allocated on the stack.