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_dPres;
70 SUBREGION_TYPE
const & subRegion,
71 constitutive::SingleFluidBase
const & fluid,
72 constitutive::CoupledSolidBase
const & solid,
75 :
Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ),
79 m_dInternalEnergy_dPres( fluid.dInternalEnergy_dPressure() ),
80 m_dInternalEnergy_dTemp( fluid.dInternalEnergy_dTemperature() ),
82 m_dRockInternalEnergy_dTemp( solid.getDinternalEnergy_dTemperature() ),
83 m_energy_n( subRegion.template getField< fields::flow::energy_n >() )
137 real64 const dSolidVolume_dPres = -(
m_volume[ei] + m_deltaVolume[ei] ) * m_dPoro_dPres[ei][0];
255 constitutive::SingleFluidBase
const & fluid,
256 constitutive::CoupledSolidBase
const & solid,
259 :
Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ),
260 m_creationMass( subRegion.getField< fields::flow::massCreated >() )
271 Base::StackVariables & stack )
const
276 stack.localResidual[0] += m_creationMass[ei] * 0.25;
304 template<
typename POLICY,
typename SUBREGION_TYPE >
308 SUBREGION_TYPE
const & subRegion,
309 constitutive::SingleFluidBase
const & fluid,
310 constitutive::CoupledSolidBase
const & solid,
314 if constexpr ( std::is_base_of_v< CellElementSubRegion, SUBREGION_TYPE > )
320 else if constexpr ( std::is_base_of_v< SurfaceElementSubRegion, SUBREGION_TYPE > )
323 SurfaceElementAccumulationKernel::launch< POLICY >( subRegion.size(), kernel );
327 GEOS_UNUSED_VAR( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs );
328 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_density
Views on density.
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.
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_internalEnergy
Views on fluid internal energy.
arrayView2d< real64 const > const m_density
Views on density.
arrayView2d< real64 const > const m_porosity
Views on the porosity.
arrayView2d< real64 const > const m_dDensity_dTemp
View on derivative of fluid density w.r.t temperature.
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.
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.
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.
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.