20 #ifndef GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_RTINNERPRODUCT_HPP_
21 #define GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_RTINNERPRODUCT_HPP_
28 namespace mimeticInnerProduct
54 template< localIndex NF >
63 real64 const (&elemPerm)[ 3 ],
64 real64 const & lengthTolerance,
82 template< localIndex NF >
90 real64 const (&elemPerm)[ 3 ],
91 real64 const & lengthTolerance,
95 template< localIndex NF >
102 real64 const & elemVolume,
103 real64 const (&elemPerm)[ 3 ],
104 real64 const & lengthTolerance,
107 real64 const areaTolerance = lengthTolerance * lengthTolerance;
110 real64 C[ NF ][ 3 ] = {{ 0 }};
111 real64 N[ NF ][ 3 ] = {{ 0 }};
112 real64 faceArea[ NF ] = { 0.0 };
113 real64 M1[ NF ][ NF ] = {{ 0 }};
115 MimeticInnerProductHelpers::computeCellToFaceGeometry< NF >( nodePosition, faceToNodes, elemToFaces,
116 elemCenter, areaTolerance, C, N, faceArea );
117 MimeticInnerProductHelpers::computeConsistencyTerm< NF >( C, elemVolume, elemPerm, M1 );
120 real64 q0[ NF ], q1[ NF ], q2[ NF ];
124 q0[i] = N[i][0] * elemPerm[0];
125 q1[i] = N[i][1] * elemPerm[1];
126 q2[i] = N[i][2] * elemPerm[2];
128 MimeticInnerProductHelpers::orthonormalize< NF >( q0, q1, q2, Qmat );
131 real64 P[ NF ][ NF ] = {{ 0 }};
132 LvArray::tensorOps::addIdentity< NF >( P, -1.0 );
133 LvArray::tensorOps::Rij_add_AikAjk< NF, 3 >( P, Qmat );
134 LvArray::tensorOps::scale< NF, NF >( P, -1.0 );
137 real64 const s = LvArray::tensorOps::trace< NF >( M1 ) / 5.0;
144 M[i][j] = M1[i][j] + s * P[i][j];
149 template< localIndex NF >
157 real64 const & elemVolume,
158 real64 const (&elemPerm)[ 3 ],
159 real64 const & lengthTolerance,
163 computeM< NF >( nodePosition, faceToNodes, elemToFaces, elemCenter,
164 elemVolume, elemPerm, lengthTolerance, transMatrix );
168 real64 W[ NF ][ NF ] = {{ 0 }};
174 A[i][j] = transMatrix[i][j];
181 real64 const invPivot = 1.0 / A[k][k];
191 real64 const factor = A[i][k];
194 A[i][j] -= factor * A[k][j];
195 W[i][j] -= factor * W[k][j];
205 transMatrix[i][j] = W[i][j] * LvArray::math::sqrt( transMultiplier[elemToFaces[i]] * transMultiplier[elemToFaces[j]] );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_ASSERT_GT(lhs, rhs)
Assert that one value compares greater than the other in debug builds.
static GEOS_HOST_DEVICE void computeM(arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const &nodePosition, ArrayOfArraysView< localIndex const > const &faceToNodes, arraySlice1d< localIndex const > const &elemToFaces, arraySlice1d< real64 const > const &elemCenter, real64 const &elemVolume, real64 const (&elemPerm)[3], real64 const &lengthTolerance, arraySlice2d< real64 > const &M)
Compute the mimetic inner product matrix M in a given element.
static GEOS_HOST_DEVICE void compute(arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const &nodePosition, arrayView1d< real64 const > const &transMultiplier, ArrayOfArraysView< localIndex const > const &faceToNodes, arraySlice1d< localIndex const > const &elemToFaces, arraySlice1d< real64 const > const &elemCenter, real64 const &elemVolume, real64 const (&elemPerm)[3], real64 const &lengthTolerance, arraySlice2d< real64 > const &transMatrix)
In a given element, recompute the transmissibility matrix as the exact inverse of the RT inner produc...
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
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).
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.