20 #ifndef GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_MIMETICINNERPRODUCTHELPERS_HPP 
   21 #define GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_MIMETICINNERPRODUCTHELPERS_HPP 
   25 namespace mimeticInnerProduct
 
   43                        real64 (& result)[ 3 ][ 3 ] )
 
   45     LvArray::tensorOps::fill< 3, 3 >( result, 0.0 );
 
   46     result[ 0 ][ 0 ] = values[ 0 ];
 
   47     result[ 1 ][ 1 ] = values[ 1 ];
 
   48     result[ 2 ][ 2 ] = values[ 2 ];
 
   59   template< localIndex NF >
 
   65                        real64 (& cellToFaceMat)[ NF ][ 3 ] )
 
   70     LvArray::tensorOps::scale< NF >( q0, 1.0/LvArray::tensorOps::l2Norm< NF >( q0 ) );
 
   73     real64 const q0Dotq1 = LvArray::tensorOps::AiBi< NF >( q0, q1 );
 
   74     LvArray::tensorOps::scaledAdd< NF >( q1, q0, -q0Dotq1 );
 
   75     LvArray::tensorOps::scale< NF >( q1, 1.0/LvArray::tensorOps::l2Norm< NF >( q1 ) );
 
   78     real64 const q0Dotq2 = LvArray::tensorOps::AiBi< NF >( q0, q2 );
 
   79     LvArray::tensorOps::scaledAdd< NF >( q2, q0, -q0Dotq2 );
 
   80     real64 const q1Dotq2 = LvArray::tensorOps::AiBi< NF >( q1, q2 );
 
   81     LvArray::tensorOps::scaledAdd< NF >( q2, q1, -q1Dotq2 );
 
   82     LvArray::tensorOps::scale< NF >( q2, 1.0/LvArray::tensorOps::l2Norm< NF >( q2 ) );
 
   86       cellToFaceMat[ i ][ 0 ] = q0[ i ];
 
   87       cellToFaceMat[ i ][ 1 ] = q1[ i ];
 
   88       cellToFaceMat[ i ][ 2 ] = q2[ i ];
 
  103   template< localIndex NF >
 
  107                                      real64 const (&faceNormal)[ 3 ],
 
  110                                      real64 const & weightToleranceInv,
 
  111                                      real64 (& cellToFaceVec)[ 3 ],
 
  114     real64 const c2fDistance = LvArray::tensorOps::normalize< 3 >( cellToFaceVec );
 
  115     real64 const mult = transMult;
 
  116     tpTransInv = c2fDistance / faceArea;
 
  118     real64 faceConormal[ 3 ] = { 0.0 };
 
  119     LvArray::tensorOps::hadamardProduct< 3 >( faceConormal, elemPerm, faceNormal );
 
  120     real64 halfWeight = LvArray::tensorOps::AiBi< 3 >( cellToFaceVec, faceConormal );
 
  121     if( halfWeight < 0.0 )
 
  123       LvArray::tensorOps::hadamardProduct< 3 >( faceConormal, elemPerm, cellToFaceVec );
 
  124       halfWeight = LvArray::tensorOps::AiBi< 3 >( cellToFaceVec, faceConormal );
 
  126     tpTransInv /= halfWeight;
 
  127     tpTransInv  = LvArray::math::min( tpTransInv, weightToleranceInv );
 
  128     tpTransInv *=  ( 1.0 - mult ) / mult;
 
  138   template< localIndex NF >
 
  147       real64 const mult = LvArray::math::sqrt( tpTransInv[k] );
 
  148       real64 Tmult[ NF ] = { 0.0 };
 
  151         Tmult[i] = transMatrix[k][i] * mult;
 
  154       real64 const invDenom = 1.0 / ( 1.0 + Tmult[k] * mult );
 
  159           transMatrix[i][j] -= Tmult[i]*Tmult[j]*invDenom;
 
#define GEOS_HOST_DEVICE
Marks a host-device function.
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Helper struct handling inner product for hybrid finite volume schemes.
static GEOS_HOST_DEVICE void computeInvTPFATransWithMultiplier(real64 const (&elemPerm)[3], real64 const (&faceNormal)[3], real64 const &faceArea, real64 const &transMult, real64 const &weightToleranceInv, real64(&cellToFaceVec)[3], real64 &tpTransInv)
For a given face, compute the TPFA entry incorporating the multiplier.
static GEOS_HOST_DEVICE void makeFullTensor(real64 const (&values)[3], real64(&result)[3][3])
Create a full tensor from an array.
static GEOS_HOST_DEVICE void computeTransMatrixWithMultipliers(real64 const (&tpTransInv)[NF], arraySlice2d< real64 > const &transMatrix)
Incorporate the transmissibility multiplier into the transmissibility matrix.
static GEOS_HOST_DEVICE void orthonormalize(real64(&q0)[NF], real64(&q1)[NF], real64(&q2)[NF], real64(&cellToFaceMat)[NF][3])
Orthonormalize a set of three vectors.