20 #ifndef GEOS_PHYSICSSOLVERS_MULTIPHYSICS_POROMECHANICSKERNELS_POROMECHANICSBASE_HPP_
21 #define GEOS_PHYSICSSOLVERS_MULTIPHYSICS_POROMECHANICSKERNELS_POROMECHANICSBASE_HPP_
23 #include "finiteElement/BilinearFormUtilities.hpp"
24 #include "finiteElement/LinearFormUtilities.hpp"
32 namespace poromechanicsKernels
50 template<
typename SUBREGION_TYPE,
51 typename CONSTITUTIVE_TYPE,
90 SUBREGION_TYPE
const & elementSubRegion,
91 FE_TYPE
const & finiteElementSpace,
92 CONSTITUTIVE_TYPE & inputConstitutiveType,
98 real64 const (&gravityVector)[3],
99 string const inputFlowDofKey,
100 string const fluidModelKey ):
107 inputConstitutiveType,
113 m_X( nodeManager.referencePosition() ),
114 m_disp( nodeManager.getField< fields::solidMechanics::totalDisplacement >() ),
115 m_uhat( nodeManager.getField< fields::solidMechanics::incrementalDisplacement >() ),
116 m_gravityVector{ gravityVector[0], gravityVector[1], gravityVector[2] },
120 m_pressure_n( elementSubRegion.template getField< fields::flow::pressure_n >() ),
121 m_pressure( elementSubRegion.template getField< fields::flow::pressure >() )
138 static constexpr
int numDispDofPerElem = Base::StackVariables::maxNumRows;
150 localPressureDofIndex{ 0 }
153 #if !defined(CALC_FEM_SHAPE_IN_KERNEL)
177 typename CONSTITUTIVE_TYPE::KernelWrapper::DiscretizationOps
stiffness;
186 real64 dBodyForce_dVolStrainIncrement[3]{};
198 real64 ( &localResidualMomentum )[numDispDofPerElem];
200 real64 ( &dLocalResidualMomentum_dDisplacement )[numDispDofPerElem][numDispDofPerElem];
202 real64 dLocalResidualMomentum_dPressure[numDispDofPerElem][1]{};
225 m_finiteElementSpace.template setup< FE_TYPE >( k, m_meshData, stack.feStack );
227 m_finiteElementSpace.template numSupportPoints< FE_TYPE >( stack.feStack );
229 for(
localIndex a=0; a<numSupportPoints; ++a )
231 localIndex const localNodeIndex = m_elemsToNodes( k, a );
233 for(
integer i = 0; i < numDims; ++i )
235 #if defined(CALC_FEM_SHAPE_IN_KERNEL)
236 stack.
xLocal[a][i] = m_X[localNodeIndex][i];
238 stack.
u_local[a][i] = m_disp[localNodeIndex][i];
239 stack.
uhat_local[a][i] = m_uhat[localNodeIndex][i];
240 stack.localRowDofIndex[a*numDims+i] = m_dofNumber[localNodeIndex]+i;
241 stack.localColDofIndex[a*numDims+i] = m_dofNumber[localNodeIndex]+i;
249 real64 const stabilizationScaling = computeStabilizationScaling( k );
250 m_finiteElementSpace.template addGradGradStabilizationMatrix
251 < FE_TYPE, numDofPerTrialSupportPoint,
false >( stack.feStack,
253 -stabilizationScaling );
254 m_finiteElementSpace.template
255 addEvaluatedGradGradStabilizationVector< FE_TYPE,
256 numDofPerTrialSupportPoint >
260 -stabilizationScaling );
274 return 2.0 * m_constitutiveUpdate.getShearModulus( k );
#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.
This class provides an interface to ObjectManagerBase in order to manage edge data.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Define the base interface for implicit finite element kernels.
traits::ViewTypeConst< typename SUBREGION_TYPE::NodeMapType::base_type > const m_elemsToNodes
The element to nodes map.
FE_TYPE const m_finiteElementSpace
FE_TYPE::template MeshData< SUBREGION_TYPE > m_meshData
Data structure containing mesh data used to setup the finite element.
static constexpr int numDofPerTestSupportPoint
static constexpr int numDofPerTrialSupportPoint
arrayView1d< globalIndex const > const m_dofNumber
The global degree of freedom number.
static constexpr int maxNumTestSupportPointsPerElem
CONSTITUTIVE_TYPE::KernelWrapper const m_constitutiveUpdate
Defines the kernel structure for solving quasi-static poromechanics.
arrayView1d< real64 const > const m_pressure
The rank-global fluid pressure.
arrayView2d< real64 const > m_solidDensity
The rank global density.
GEOS_HOST_DEVICE GEOS_FORCE_INLINE void setup(localIndex const k, StackVariables &stack) const
Copy global values from primary field to a local stack array.
arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const m_X
The array containing the nodal position array.
arrayView2d< real64 const, nodes::INCR_DISPLACEMENT_USD > const m_uhat
The rank-global incremental displacement array.
real64 const m_gravityVector[3]
The gravity vector.
arrayView2d< real64 const, nodes::TOTAL_DISPLACEMENT_USD > const m_disp
The rank-global displacement array.
static constexpr int numNodesPerElem
GEOS_HOST_DEVICE GEOS_FORCE_INLINE real64 computeStabilizationScaling(localIndex const k) const
Get a parameter representative of the stiffness, used as physical scaling for the stabilization matri...
arrayView1d< globalIndex const > const m_flowDofNumber
The global degree of freedom number.
real64 const m_gravityAcceleration
The L2-norm of the gravity vector.
arrayView1d< real64 const > const m_pressure_n
The rank-global fluid pressure at the previous converged time step.
PoromechanicsBase(NodeManager const &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, localIndex const targetRegionIndex, SUBREGION_TYPE const &elementSubRegion, FE_TYPE const &finiteElementSpace, CONSTITUTIVE_TYPE &inputConstitutiveType, arrayView1d< globalIndex const > const inputDispDofNumber, globalIndex const rankOffset, CRSMatrixView< real64, globalIndex const > const inputMatrix, arrayView1d< real64 > const inputRhs, real64 const inputDt, real64 const (&gravityVector)[3], string const inputFlowDofKey, string const fluidModelKey)
Constructor.
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).
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
std::int32_t integer
Signed integer type.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Array< T, 1 > array1d
Alias for 1D array.
Kernel variables allocated on the stack.
Kernel variables allocated on the stack.
real64(& dLocalResidualMomentum_dDisplacement)[numDispDofPerElem][numDispDofPerElem]
Derivative of linear momentum balance residual wrt displacement.
globalIndex localPressureDofIndex
C-array storage for the element local row degrees of freedom.
CONSTITUTIVE_TYPE::KernelWrapper::DiscretizationOps stiffness
Derivative of total stress wrt displacement.
real64 uhat_local[numNodesPerElem][numDofPerTrialSupportPoint]
Stack storage for the element local nodal incremental displacement.
real64 u_local[numNodesPerElem][numDofPerTrialSupportPoint]
Stack storage for the element local nodal displacement.
real64 dLocalResidualMomentum_dPressure[numDispDofPerElem][1]
Derivative of linear momentum balance residual wrt pressure.
GEOS_HOST_DEVICE StackVariables()
Constructor.
real64(& localResidualMomentum)[numDispDofPerElem]
Linear momentum balance residual.