21 #ifndef GEOS_PHYSICSSOLVERS_MULTIPHYSICS_HYDROFRACTURESOLVERKERNELS_HPP_
22 #define GEOS_PHYSICSSOLVERS_MULTIPHYSICS_HYDROFRACTURESOLVERKERNELS_HPP_
29 namespace hydrofractureSolverKernels
35 template<
typename POLICY,
typename HYDRAULICAPERTURE_WRAPPER,
typename POROUS_WRAPPER >
36 static std::tuple< double, double, double, double, double, double >
38 HYDRAULICAPERTURE_WRAPPER
const & hydraulicApertureWrapper,
39 POROUS_WRAPPER
const & porousMaterialWrapper,
49 #ifdef GEOS_USE_SEPARATION_COEFFICIENT
59 RAJA::ReduceMax< ReducePolicy< POLICY >,
real64 > maxApertureChange( 0.0 );
60 RAJA::ReduceMax< ReducePolicy< POLICY >,
real64 > maxHydraulicApertureChange( 0.0 );
61 RAJA::ReduceMin< ReducePolicy< POLICY >,
real64 > minAperture( 1e10 );
62 RAJA::ReduceMax< ReducePolicy< POLICY >,
real64 > maxAperture( -1e10 );
63 RAJA::ReduceMin< ReducePolicy< POLICY >,
real64 > minHydraulicAperture( 1e10 );
64 RAJA::ReduceMax< ReducePolicy< POLICY >,
real64 > maxHydraulicAperture( -1e10 );
66 forAll< POLICY >( size,
72 localIndex const numNodesPerFace = faceToNodeMap.sizeOfArray( kf0 );
76 LvArray::tensorOps::add< 3 >( temp, u[ faceToNodeMap( kf0, a ) ] );
77 LvArray::tensorOps::subtract< 3 >( temp, u[ faceToNodeMap( kf1, a ) ] );
81 real64 const normalJump = -LvArray::tensorOps::AiBi< 3 >( temp, faceNormal[kf0] ) / numNodesPerFace;
82 maxApertureChange.max( std::fabs( normalJump - aperture[kfe] ));
83 aperture[kfe] = normalJump;
84 minAperture.min( aperture[kfe] );
85 maxAperture.max( aperture[kfe] );
87 real64 normalTraction = 0.0;
88 real64 dHydraulicAperture_dNormalTraction = 0.0;
89 real64 dHydraulicAperture_dNormalJump = 0.0;
90 real64 const newHydraulicAperture = hydraulicApertureWrapper.computeHydraulicAperture( aperture[kfe],
92 dHydraulicAperture_dNormalJump,
93 dHydraulicAperture_dNormalTraction );
95 maxHydraulicApertureChange.max( std::fabs( newHydraulicAperture - hydraulicAperture[kfe] ));
96 real64 const oldHydraulicAperture = hydraulicAperture[kfe];
97 hydraulicAperture[kfe] = newHydraulicAperture;
98 minHydraulicAperture.min( hydraulicAperture[kfe] );
99 maxHydraulicAperture.max( hydraulicAperture[kfe] );
101 real64 const jump[3] = { normalJump, 0.0, 0.0 };
102 real64 const traction[3] = {0.0, 0.0, 0.0};
104 porousMaterialWrapper.updateStateFromPressureApertureJumpAndTraction( kfe, 0, 0.0,
105 oldHydraulicAperture, newHydraulicAperture,
106 dHydraulicAperture_dNormalJump,
109 #ifdef GEOS_USE_SEPARATION_COEFFICIENT
110 real64 const s = aperture[kfe] / apertureAtFailure[kfe];
111 if( separationCoeff0[kfe]<1.0 && s>separationCoeff0[kfe] )
115 separationCoeff[kfe] = 1.0;
116 dSeparationCoeff_dAper[kfe] = 0.0;
120 separationCoeff[kfe] = s;
121 dSeparationCoeff_dAper[kfe] = 1.0/apertureAtFailure[kfe];
125 deltaVolume[kfe] = hydraulicAperture[kfe] * area[kfe] - volume[kfe];
128 return std::make_tuple( maxApertureChange.get(), maxHydraulicApertureChange.get(), minAperture.get(), maxAperture.get(), minHydraulicAperture.get(), maxHydraulicAperture.get() );
134 template<
typename HYDRAULICAPERTURE_WRAPPER >
138 computeAccumulationDerivative( HYDRAULICAPERTURE_WRAPPER
const & hydraulicApertureWrapper,
143 real64 const (&Nbar)[ 3 ],
150 real64 dHydraulicAperture_dNormalJump = 0.0;
151 real64 dHydraulicAperture_dTraction = 0.0;
152 real64 fractureTraction = 0.0;
153 real64 const hydraulicAperture = hydraulicApertureWrapper.computeHydraulicAperture( aperture,
155 dHydraulicAperture_dNormalJump,
156 dHydraulicAperture_dTraction );
159 constexpr
integer kfSign[2] = { -1, 1 };
162 for(
localIndex a = 0; a < numNodesPerFace; ++a )
164 for(
int i = 0; i < 3; ++i )
166 nodeDOF[kf * 3 * numNodesPerFace + 3 * a + i] = dispDofNumber[faceToNodeMap( elemsToFaces[kf], a )] + i;
168 real64 const dNormalJump_dDisplacement = kfSign[kf] * Nbar[i] / numNodesPerFace;
169 real64 const dHydraulicAperture_dDisplacement = dHydraulicAperture_dNormalJump * dNormalJump_dDisplacement;
170 real64 const dVolume_dDisplacement = area * dHydraulicAperture_dDisplacement;
172 dRdU( kf * 3 * numNodesPerFace + 3 * a + i ) = dens * dVolume_dDisplacement;
188 real64 const (&Nbar)[ 3 ],
192 constexpr
integer kfSign[2] = { -1, 1 };
194 real64 const dR_dNormalJump = values[kfe2];
199 for(
localIndex a = 0; a < numNodesPerFace; ++a )
203 nodeDOF[kf * 3 * numNodesPerFace + 3 * a + i] = dispDofNumber[faceToNodeMap( elemsToFaces[ei2][kf], a )] + i;
205 real64 const dNormalJump_dDisplacement = kfSign[kf] * Nbar[i] / numNodesPerFace;
207 dRdU( kf * 3 * numNodesPerFace + 3 * a + i ) = dR_dNormalJump * dNormalJump_dDisplacement;
213 template<
typename POLICY,
typename HYDRAULICAPERTURE_WRAPPER >
217 HYDRAULICAPERTURE_WRAPPER
const & hydraulicApertureWrapper,
232 localIndex const numNodesPerFace = faceToNodeMap.sizeOfArray( elemsToFaces[ei][0] );
234 real64 Nbar[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( faceNormal[elemsToFaces[ei][0]] );
235 LvArray::tensorOps::subtract< 3 >( Nbar, faceNormal[elemsToFaces[ei][1]] );
236 LvArray::tensorOps::normalize< 3 >( Nbar );
238 globalIndex const rowNumber = presDofNumber[ei] - rankOffset;
242 computeAccumulationDerivative( hydraulicApertureWrapper,
254 if( rowNumber >= 0 && rowNumber < localMatrix.numRows() )
256 localMatrix.addToRowBinarySearchUnsorted< parallelDeviceAtomic >( rowNumber,
259 2 * numNodesPerFace * 3 );
262 if( useQuasiNewton == 0 )
264 localIndex const numColumns = dFluxResidual_dNormalJump.numNonZeros( ei );
268 for(
localIndex kfe2 = 0; kfe2 < numColumns; ++kfe2 )
270 computeFluxDerivative( kfe2,
281 if( rowNumber >= 0 && rowNumber < localMatrix.numRows() )
283 localMatrix.addToRowBinarySearchUnsorted< parallelDeviceAtomic >( rowNumber,
286 2 * numNodesPerFace * 3 );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
LvArray::CRSMatrixView< T, COL_INDEX, localIndex const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
StackArray< T, 1, MAXSIZE > stackArray1d
Alias for 1D stack array.
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
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.
std::int32_t integer
Signed integer type.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.