20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEREACTIVE_ACCUMULATIONKERNELS_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEREACTIVE_ACCUMULATIONKERNELS_HPP
25 #include "constitutive/fluid/reactivefluid/ReactiveSinglePhaseFluid.hpp"
26 #include "constitutive/fluid/reactivefluid/ReactiveFluidLayouts.hpp"
27 #include "constitutive/solid/CoupledSolidBase.hpp"
29 #include "physicsSolvers/fluidFlow/kernels/singlePhase/reactive/KernelLaunchSelectors.hpp"
34 namespace singlePhaseReactiveBaseKernels
43 template<
typename SUBREGION_TYPE,
integer NUM_DOF,
integer NUM_SPECIES,
typename BASE_FLUID_TYPE >
60 using DerivOffset = constitutive::singlefluid::DerivativeOffsetC< 0 >;
77 SUBREGION_TYPE
const & subRegion,
78 constitutive::reactivefluid::ReactiveSinglePhaseFluid< BASE_FLUID_TYPE >
const & fluid,
79 constitutive::CoupledSolidBase
const & solid,
83 :
Base( rankOffset, dofKey, subRegion, localMatrix, localRhs ),
85 m_volume( subRegion.getElementVolume() ),
86 m_deltaVolume( subRegion.template getField< fields::flow::deltaVolume >() ),
88 m_dPoro_dPres( solid.getDporosity_dPressure() ),
91 m_primarySpeciesAggregateConcentration( fluid.primarySpeciesAggregateConcentration() ),
93 m_dPrimarySpeciesAggregateConcentration_dLogPrimarySpeciesConcentrations( fluid.dPrimarySpeciesAggregateConcentration_dLogPrimarySpeciesConcentrations() ),
94 m_primarySpeciesAggregateKineticRate( fluid.aggregateSpeciesRates() ),
96 m_dPrimarySpeciesAggregateKineticRate_dLogPrimaryConc( fluid.dAggregateSpeciesRates_dLogPrimarySpeciesConcentrations() ),
97 m_primarySpeciesAggregateMole_n( subRegion.template getField< fields::flow::primarySpeciesAggregateMole_n >() )
176 constitutive::reactivefluid::USD_SPECIES_DC -
177 2 > dPrimarySpeciesAggregateConcentration_dLogPrimarySpeciesConcentrations = m_dPrimarySpeciesAggregateConcentration_dLogPrimarySpeciesConcentrations[ei][0];
178 arraySlice2d<
real64 const, constitutive::reactivefluid::USD_SPECIES_DC - 2 > dPrimarySpeciesAggregateKineticRate_dLogPrimaryConc = m_dPrimarySpeciesAggregateKineticRate_dLogPrimaryConc[ei][0];
204 stack.
poreVolume * dPrimarySpeciesAggregateConcentration_dLogPrimarySpeciesConcentrations[is][js];
304 template<
typename POLICY,
typename SUBREGION_TYPE,
typename BASE_FLUID_TYPE >
310 SUBREGION_TYPE
const & subRegion,
311 constitutive::reactivefluid::ReactiveSinglePhaseFluid< BASE_FLUID_TYPE >
const & fluid,
312 constitutive::CoupledSolidBase
const & solid,
316 internal::kernelLaunchSelectorCompSwitch( numSpecies, [&] (
auto NS )
318 integer constexpr NUM_SPECIES = NS();
319 integer constexpr NUM_DOF = 1+NS();
320 AccumulationKernel< SUBREGION_TYPE, NUM_DOF, NUM_SPECIES, BASE_FLUID_TYPE > kernel( rankOffset, dofKey, subRegion, fluid, solid, dt, localMatrix, localRhs );
#define GEOS_HOST_DEVICE
Marks a host-device function.
Define the interface for the assembly kernel in charge of accumulation.
constitutive::singlefluid::DerivativeOffsetC< 0 > DerivOffset
Note: Derivative lineup only supports dP & dT, not component terms.
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.
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.
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(integer const numSpecies, real64 const dt, globalIndex const rankOffset, string const dofKey, SUBREGION_TYPE const &subRegion, constitutive::reactivefluid::ReactiveSinglePhaseFluid< BASE_FLUID_TYPE > 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.
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.
real64 const m_dt
Time step size.
GEOS_HOST_DEVICE void setup(localIndex const ei, StackVariables &stack) const
Performs the setup phase for the kernel.
arrayView1d< real64 > const m_localRhs
View on the local RHS.
GEOS_HOST_DEVICE void complete(localIndex const ei, StackVariables &stack) const
Performs the complete phase for the kernel.
static constexpr integer numSpecies
Compile time value for the number of primary species.
arrayView1d< real64 const > const m_volume
View on the element volumes.
CRSMatrixView< real64, globalIndex const > const m_localMatrix
View on the local CRS matrix.
AccumulationKernel(globalIndex const rankOffset, string const dofKey, SUBREGION_TYPE const &subRegion, constitutive::reactivefluid::ReactiveSinglePhaseFluid< BASE_FLUID_TYPE > const &fluid, constitutive::CoupledSolidBase const &solid, real64 const &dt, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Constructor.
arrayView2d< real64 const > const m_porosity
Views on the porosity.
static constexpr integer numEqn
Compute time value for the number of equations.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
LvArray::CRSMatrixView< T, COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
int integer
Signed integer type.
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.
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.
Kernel variables (dof numbers, jacobian and residual) located on the stack.
real64 dPoreVolume_dLogPrimaryConc[numSpecies]
Derivative of pore volume with respect to each primary species concentration.
real64 poreVolume
Pore volume at time n+1.
real64 dPoreVolume_dPres
Derivative of pore volume with respect to pressure.