20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_THERMALSINGLEPHASEWELLKERNELS_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_THERMALSINGLEPHASEWELLKERNELS_HPP
23 #include "constitutive/fluid/singlefluid/SingleFluidFields.hpp"
24 #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp"
26 #include "common/GEOS_RAJA_Interface.hpp"
30 #include "physicsSolvers/fluidFlow/wells/WellControls.hpp"
36 namespace thermalSinglePhaseWellKernels
48 template<
integer NUM_DOF >
52 using Base = singlePhaseWellKernels::ElementBasedAssemblyKernel< NUM_DOF >;
53 using Base::m_rankOffset;
54 using Base::m_wellElemDofNumber;
55 using Base::m_elemGhostRank;
56 using Base::m_wellElemVolume;
57 using Base::m_wellElemDensity;
58 using Base::m_wellElemDensity_n;
59 using Base::m_dWellElemDensity_dPressure;
60 using Base::m_localMatrix;
61 using Base::m_localRhs;
84 constitutive::SingleFluidBase
const & fluid,
87 : Base( rankOffset, dofKey, subRegion, fluid, localMatrix, localRhs ),
90 m_internalEnergy_n( fluid.internalEnergy_n() ),
91 m_dInternalEnergy_dPres( fluid.dInternalEnergy_dPressure() ),
92 m_dInternalEnergy_dTemp( fluid.dInternalEnergy_dTemperature() )
104 : Base::StackVariables()
106 using Base::StackVariables::eqnRowIndices;
107 using Base::StackVariables::dofColIndices;
108 using Base::StackVariables::localJacobian;
109 using Base::StackVariables::localResidual;
110 using Base::StackVariables::localRow;
111 using Base::StackVariables::volume;
112 using Base::StackVariables::density;
113 using Base::StackVariables::density_n;
114 using Base::StackVariables::dDensity_dPres;
124 {
return m_elemGhostRank( ei ); }
135 template<
typename FUNC = NoOpFunc >
140 Base::computeAccumulation( iwelem, stack, [&]( )
148 real64 const fluidEnergy_n = stack.volume * stack.density_n * m_internalEnergy_n[iwelem][0];
151 + stack.volume * stack.density * m_dInternalEnergy_dPres[iwelem][0];
155 + stack.volume * stack.density * m_dInternalEnergy_dTemp[iwelem][0];
158 stack.localResidual[
numEqn-1] = fluidEnergy - fluidEnergy_n;
161 stack.localJacobian[
numEqn-1][0] = dFluidEnergy_dP;
162 stack.localJacobian[
numEqn-1][
numDof-1] = dFluidEnergy_dT;
175 template<
typename POLICY,
typename KERNEL_TYPE >
178 KERNEL_TYPE
const & kernelComponent )
184 if( kernelComponent.elemGhostRank( iwelem ) >= 0 )
188 typename KERNEL_TYPE::StackVariables stack;
189 kernelComponent.setup( iwelem, stack );
190 kernelComponent.computeAccumulation( iwelem, stack );
191 kernelComponent.complete( iwelem, stack );
226 template<
typename POLICY >
231 constitutive::SingleFluidBase
const & fluid,
237 kernel( rankOffset, dofKey, subRegion, fluid, localMatrix, localRhs );
239 launch< POLICY, ElementBasedAssemblyKernel< NUM_DOF > >( subRegion.
size(), kernel );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
static void createAndLaunch(globalIndex const rankOffset, string const dofKey, ElementSubRegionBase const &subRegion, constitutive::SingleFluidBase const &fluid, 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 and volume balance.
static void launch(localIndex const numElems, KERNEL_TYPE const &kernelComponent)
Performs the kernel launch.
ElementBasedAssemblyKernel(globalIndex const rankOffset, string const dofKey, ElementSubRegionBase const &subRegion, constitutive::SingleFluidBase const &fluid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Constructor.
GEOS_HOST_DEVICE integer elemGhostRank(localIndex const ei) const
Getter for the ghost rank of an element.
GEOS_HOST_DEVICE void computeAccumulation(localIndex const iwelem, StackVariables &stack) const
Compute the local accumulation contributions to the residual and Jacobian.
static constexpr integer numEqn
Compute time value for the number of equations.
static constexpr integer numDof
Compute time value for the number of degrees of freedom.
arrayView2d< real64 const > const m_internalEnergy
Views on fluid internal energy.
arrayView2d< real64 const > const m_dWellElemDensity_dTemperature
View on derivative of fluid density w.r.t temperature.
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.