20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_THERMALACCUMULATIONKERNELS_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_THERMALACCUMULATIONKERNELS_HPP
28 namespace thermalSinglePhaseBaseKernels
37 template<
typename SUBREGION_TYPE,
integer NUM_DOF >
50 using Base::m_deltaVolume;
52 using Base::m_dPoro_dPres;
54 using Base::m_dDensity;
60 using DerivOffset = constitutive::singlefluid::DerivativeOffsetC< isThermal >;
73 SUBREGION_TYPE
const & subRegion,
74 constitutive::SingleFluidBase
const & fluid,
75 constitutive::CoupledSolidBase
const & solid,
78 :
Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ),
81 m_dInternalEnergy( fluid.dInternalEnergy() ),
83 m_dRockInternalEnergy_dTemp( solid.getDinternalEnergy_dTemperature() ),
84 m_energy_n( subRegion.template getField< fields::flow::energy_n >() )
138 real64 const dSolidVolume_dPres = -(
m_volume[ei] + m_deltaVolume[ei] ) * m_dPoro_dPres[ei][0];
252 constitutive::SingleFluidBase
const & fluid,
253 constitutive::CoupledSolidBase
const & solid,
256 :
Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ),
257 m_creationMass( subRegion.getField< fields::flow::massCreated >() )
268 Base::StackVariables & stack )
const
273 stack.localResidual[0] += m_creationMass[ei] * 0.25;
301 template<
typename POLICY,
typename SUBREGION_TYPE >
305 SUBREGION_TYPE
const & subRegion,
306 constitutive::SingleFluidBase
const & fluid,
307 constitutive::CoupledSolidBase
const & solid,
311 if constexpr ( std::is_base_of_v< CellElementSubRegion, SUBREGION_TYPE > )
317 else if constexpr ( std::is_base_of_v< SurfaceElementSubRegion, SUBREGION_TYPE > )
320 SurfaceElementAccumulationKernel::launch< POLICY >( subRegion.size(), kernel );
324 GEOS_UNUSED_VAR( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs );
325 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_ERROR(msg)
Raise a hard error and terminate the program.
Define the interface for the assembly kernel in charge of accumulation.
arrayView2d< real64 const > const m_porosity
Views on the porosity.
GEOS_HOST_DEVICE void computeAccumulation(localIndex const ei, StackVariables &stack, FUNC &&kernelOp=NoOpFunc{}) const
Compute the local accumulation contributions to the residual and Jacobian.
arrayView2d< real64 const, constitutive::singlefluid::USD_FLUID > const m_density
Views on density.
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.
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.
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_porosity
Views on the porosity.
arrayView2d< real64 const, constitutive::singlefluid::USD_FLUID > const m_density
Views on density.
GEOS_HOST_DEVICE void complete(localIndex const ei, StackVariables &stack) const
Performs the complete phase for the kernel.
GEOS_HOST_DEVICE void computeAccumulation(localIndex const ei, StackVariables &stack) const
Compute the local accumulation contributions to the residual and Jacobian.
static constexpr integer numDof
Compute time value for the number of degrees of freedom.
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.
static constexpr integer isThermal
Note: Derivative lineup only supports dP & dT, not component terms.
arrayView1d< real64 > const m_localRhs
View on the local RHS.
arrayView1d< real64 const > const m_volume
View on the element volumes.
arrayView1d< real64 const > const m_energy_n
View on energy.
CRSMatrixView< real64, globalIndex const > const m_localMatrix
View on the local CRS matrix.
arrayView2d< real64 const > const m_dPoro_dTemp
View on derivative of porosity w.r.t temperature.
arrayView2d< real64 const > const m_rockInternalEnergy
Views on rock internal energy.
static constexpr integer numEqn
Compute time value for the number of equations.
arrayView2d< real64 const, constitutive::singlefluid::USD_FLUID > const m_internalEnergy
Views on fluid internal energy.
GEOS_HOST_DEVICE void setup(localIndex const ei, StackVariables &stack) const
Performs the setup phase for the kernel.
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.
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
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.
Kernel variables (dof numbers, jacobian and residual) located on the stack.
real64 dSolidEnergy_dTemp
Derivative of solid internal energy with respect to temperature.
real64 dPoreVolume_dTemp
Derivative of pore volume with respect to temperature.
real64 dSolidEnergy_dPres
Derivative of solid internal energy with respect to pressure.
real64 solidEnergy
Solid energy at time n+1.