20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_ACCUMULATIONKERNELS_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_ACCUMULATIONKERNELS_HPP
24 #include "common/GEOS_RAJA_Interface.hpp"
25 #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp"
26 #include "constitutive/solid/CoupledSolidBase.hpp"
28 #include "codingUtilities/Utilities.hpp"
33 namespace singlePhaseBaseKernels
42 template<
typename SUBREGION_TYPE,
integer NUM_DOF >
66 SUBREGION_TYPE
const & subRegion,
67 constitutive::SingleFluidBase
const & fluid,
68 constitutive::CoupledSolidBase
const & solid,
75 m_volume( subRegion.getElementVolume() ),
76 m_deltaVolume( subRegion.template getField< fields::flow::deltaVolume >() ),
78 m_dPoro_dPres( solid.getDporosity_dPressure() ),
80 m_dDensity_dPres( fluid.dDensity_dPressure() ),
81 m_mass_n( subRegion.template getField< fields::flow::mass_n >() ),
156 template<
typename FUNC = NoOpFunc >
160 FUNC && kernelOp = NoOpFunc{} )
const
197 template<
typename POLICY,
typename KERNEL_TYPE >
200 KERNEL_TYPE
const & kernelComponent )
206 if( kernelComponent.elemGhostRank( ei ) >= 0 )
211 typename KERNEL_TYPE::StackVariables stack;
213 kernelComponent.setup( ei, stack );
214 kernelComponent.computeAccumulation( ei, stack );
215 kernelComponent.complete( ei, stack );
276 constitutive::SingleFluidBase
const & fluid,
277 constitutive::CoupledSolidBase
const & solid,
280 :
Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs )
281 , m_creationMass( subRegion.getField< fields::flow::massCreated >() )
292 Base::StackVariables & stack )
const
298 stack.localResidual[0] += m_creationMass[ei] * 0.25;
327 template<
typename POLICY,
typename SUBREGION_TYPE >
331 SUBREGION_TYPE
const & subRegion,
332 constitutive::SingleFluidBase
const & fluid,
333 constitutive::CoupledSolidBase
const & solid,
337 if constexpr ( std::is_base_of_v< CellElementSubRegion, SUBREGION_TYPE > )
343 else if constexpr ( std::is_base_of_v< SurfaceElementSubRegion, SUBREGION_TYPE > )
346 SurfaceElementAccumulationKernel::launch< POLICY >( subRegion.size(), kernel );
350 GEOS_UNUSED_VAR( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs );
351 GEOS_ERROR(
"Unsupported subregion type: " <<
typeid(SUBREGION_TYPE).name() );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
#define GEOS_ERROR(msg)
Raise a hard error and terminate the program.
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
static void createAndLaunch(globalIndex const rankOffset, string const dofKey, SUBREGION_TYPE const &subRegion, constitutive::SingleFluidBase const &fluid, constitutive::CoupledSolidBase const &solid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Create a new kernel and launch.
Define the interface for the assembly kernel in charge of accumulation.
arrayView2d< real64 const > const m_density
Views on density.
arrayView2d< real64 const > const m_porosity
Views on the porosity.
static void launch(localIndex const numElems, KERNEL_TYPE const &kernelComponent)
Performs the kernel launch.
GEOS_HOST_DEVICE void computeAccumulation(localIndex const ei, StackVariables &stack, FUNC &&kernelOp=NoOpFunc{}) const
Compute the local accumulation contributions to the residual and Jacobian.
AccumulationKernel(globalIndex const rankOffset, string const dofKey, SUBREGION_TYPE const &subRegion, constitutive::SingleFluidBase const &fluid, constitutive::CoupledSolidBase const &solid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Constructor.
arrayView1d< globalIndex const > const m_dofNumber
View on the dof numbers.
arrayView1d< real64 const > const m_mass_n
View on mass.
static constexpr integer numDof
Compute time value for the number of degrees of freedom.
GEOS_HOST_DEVICE void complete(localIndex const GEOS_UNUSED_PARAM(ei), StackVariables &stack) const
Performs the complete phase for the kernel.
arrayView1d< real64 > const m_localRhs
View on the local RHS.
arrayView1d< real64 const > const m_volume
View on the element volumes.
GEOS_HOST_DEVICE integer elemGhostRank(localIndex const ei) const
Getter for the ghost rank of an element.
CRSMatrixView< real64, globalIndex const > const m_localMatrix
View on the local CRS matrix.
GEOS_HOST_DEVICE void setup(localIndex const ei, StackVariables &stack) const
Performs the setup phase for the kernel.
arrayView1d< integer const > const m_elemGhostRank
View on the ghost ranks.
static constexpr integer numEqn
Compute time value for the number of equations.
globalIndex const m_rankOffset
Offset for my MPI rank.
Define the interface for the assembly kernel in charge of accumulation in SurfaceElementSubRegion.
SurfaceElementAccumulationKernel(globalIndex const rankOffset, string const dofKey, SurfaceElementSubRegion const &subRegion, constitutive::SingleFluidBase const &fluid, constitutive::CoupledSolidBase const &solid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Constructor.
GEOS_HOST_DEVICE void computeAccumulation(localIndex const ei, Base::StackVariables &stack) const
Compute the local accumulation contributions to the residual and Jacobian.
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 (dof numbers, jacobian and residual) located on the stack.
real64 localJacobian[numEqn][numDof]
Storage for the element local Jacobian matrix.
localIndex localRow
Index of the local row corresponding to this element.
real64 poreVolume
Pore volume at time n+1.
globalIndex dofIndices[numDof]
Index of the matrix row/column corresponding to the dof in this element.
real64 localResidual[numEqn]
Storage for the element local residual vector.
real64 dPoreVolume_dPres
Derivative of pore volume with respect to pressure.