19 #ifndef GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_MIMETICINNERPRODUCTHELPERS_HPP
20 #define GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_MIMETICINNERPRODUCTHELPERS_HPP
24 namespace mimeticInnerProduct
42 real64 (& result)[ 3 ][ 3 ] )
44 LvArray::tensorOps::fill< 3, 3 >( result, 0.0 );
45 result[ 0 ][ 0 ] = values[ 0 ];
46 result[ 1 ][ 1 ] = values[ 1 ];
47 result[ 2 ][ 2 ] = values[ 2 ];
58 template< localIndex NF >
64 real64 (& cellToFaceMat)[ NF ][ 3 ] )
69 LvArray::tensorOps::scale< NF >( q0, 1.0/LvArray::tensorOps::l2Norm< NF >( q0 ) );
72 real64 const q0Dotq1 = LvArray::tensorOps::AiBi< NF >( q0, q1 );
73 LvArray::tensorOps::scaledAdd< NF >( q1, q0, -q0Dotq1 );
74 LvArray::tensorOps::scale< NF >( q1, 1.0/LvArray::tensorOps::l2Norm< NF >( q1 ) );
77 real64 const q0Dotq2 = LvArray::tensorOps::AiBi< NF >( q0, q2 );
78 LvArray::tensorOps::scaledAdd< NF >( q2, q0, -q0Dotq2 );
79 real64 const q1Dotq2 = LvArray::tensorOps::AiBi< NF >( q1, q2 );
80 LvArray::tensorOps::scaledAdd< NF >( q2, q1, -q1Dotq2 );
81 LvArray::tensorOps::scale< NF >( q2, 1.0/LvArray::tensorOps::l2Norm< NF >( q2 ) );
85 cellToFaceMat[ i ][ 0 ] = q0[ i ];
86 cellToFaceMat[ i ][ 1 ] = q1[ i ];
87 cellToFaceMat[ i ][ 2 ] = q2[ i ];
102 template< localIndex NF >
106 real64 const (&faceNormal)[ 3 ],
109 real64 const & weightToleranceInv,
110 real64 (& cellToFaceVec)[ 3 ],
113 real64 const c2fDistance = LvArray::tensorOps::normalize< 3 >( cellToFaceVec );
114 real64 const mult = transMult;
115 tpTransInv = c2fDistance / faceArea;
117 real64 faceConormal[ 3 ] = { 0.0 };
118 LvArray::tensorOps::hadamardProduct< 3 >( faceConormal, elemPerm, faceNormal );
119 real64 halfWeight = LvArray::tensorOps::AiBi< 3 >( cellToFaceVec, faceConormal );
120 if( halfWeight < 0.0 )
122 LvArray::tensorOps::hadamardProduct< 3 >( faceConormal, elemPerm, cellToFaceVec );
123 halfWeight = LvArray::tensorOps::AiBi< 3 >( cellToFaceVec, faceConormal );
125 tpTransInv /= halfWeight;
126 tpTransInv = LvArray::math::min( tpTransInv, weightToleranceInv );
127 tpTransInv *= ( 1.0 - mult ) / mult;
137 template< localIndex NF >
146 real64 const mult = LvArray::math::sqrt( tpTransInv[k] );
147 real64 Tmult[ NF ] = { 0.0 };
150 Tmult[i] = transMatrix[k][i] * mult;
153 real64 const invDenom = 1.0 / ( 1.0 + Tmult[k] * mult );
158 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.
GEOSX_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.