20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_DIRICHLETFLUXCOMPUTEKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_DIRICHLETFLUXCOMPUTEKERNEL_HPP
25 #include "common/GEOS_RAJA_Interface.hpp"
26 #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp"
31 #include "codingUtilities/Utilities.hpp"
36 namespace singlePhaseFVMKernels
46 template<
integer NUM_EQN,
integer NUM_DOF,
typename FLUIDWRAPPER >
48 BoundaryStencilWrapper >
53 using DofNumberAccessor = AbstractBase::DofNumberAccessor;
61 using AbstractBase::m_gravCoef;
64 using AbstractBase::m_dMob_dPres;
66 using AbstractBase::m_dDens_dPres;
68 using AbstractBase::m_dPerm_dPres;
98 FLUIDWRAPPER
const & fluidWrapper,
99 DofNumberAccessor
const & dofNumberAccessor,
109 singlePhaseFlowAccessors,
110 singlePhaseFluidAccessors,
111 permeabilityAccessors,
115 m_facePres( faceManager.getField< fields::flow::facePressure >() ),
116 m_faceGravCoef( faceManager.getField< fields::flow::gravityCoefficient >() ),
178 template<
typename FUNC = NoOpFunc >
182 FUNC && compFluxKernelOp = NoOpFunc{} )
const
191 localIndex const esr = m_sesri( iconn, Order::ELEM );
192 localIndex const ei = m_sei( iconn, Order::ELEM );
193 localIndex const kf = m_sei( iconn, Order::FACE );
196 real64 faceDens, faceVisc;
199 mobility[Order::ELEM] =
m_mob[er][esr][ei];
200 singlePhaseBaseKernels::MobilityKernel::compute( faceDens, faceVisc, mobility[Order::FACE] );
202 dMobility_dP[Order::ELEM] = m_dMob_dPres[er][esr][ei];
203 dMobility_dP[Order::FACE] = 0.0;
206 real64 const densMean = 0.5 * (
m_dens[er][esr][ei][0] + faceDens );
207 real64 const dDens_dP = 0.5 * m_dDens_dPres[er][esr][ei][0];
212 real64 const dPotDif_dP = 1.0 - dDens_dP * m_gravCoef[er][esr][ei];
216 real64 const dTrans_dPres = LvArray::tensorOps::AiBi< 3 >( dTrans_dPerm, m_dPerm_dPres[er][esr][ei][0] );
222 localIndex const k_up = ( potDif >= 0 ) ? Order::ELEM : Order::FACE;
223 real64 const mobility_up = mobility[k_up];
224 real64 const dMobility_dP_up = dMobility_dP[k_up];
229 compFluxKernelOp( er, esr, ei, kf, f, dF_dP, mobility_up, dMobility_dP_up );
244 template<
typename FUNC = NoOpFunc >
248 FUNC && assemblyKernelOp = NoOpFunc{} )
const
253 localIndex const esr = m_sesri( iconn, Order::ELEM );
254 localIndex const ei = m_sei( iconn, Order::ELEM );
270 assemblyKernelOp( localRow );
309 template<
typename POLICY >
312 string const & dofKey,
313 string const & solverName,
317 constitutive::SingleFluidBase & fluidBase,
322 constitutiveUpdatePassThru( fluidBase, [&](
auto & fluid )
324 using FluidType = TYPEOFREF( fluid );
325 typename FluidType::KernelWrapper fluidWrapper = fluid.createKernelWrapper();
334 dofNumberAccessor.setName( solverName +
"/accessors/" + dofKey );
336 typename kernelType::SinglePhaseFlowAccessors singlePhaseFlowAccessors( elemManager, solverName );
337 typename kernelType::SinglePhaseFluidAccessors singlePhaseFluidAccessors( elemManager, solverName );
338 typename kernelType::PermeabilityAccessors permeabilityAccessors( elemManager, solverName );
340 kernelType kernel( rankOffset,
345 singlePhaseFlowAccessors,
346 singlePhaseFluidAccessors,
347 permeabilityAccessors,
352 kernelType::template launch< POLICY >( stencilWrapper.
size(), kernel );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
GEOS_HOST_DEVICE void computeWeights(localIndex const iconn, CoefficientAccessor< arrayView3d< real64 const > > const &coefficient, real64 &weight, real64(&dWeight_dCoef)[3]) const
Compute weights and derivatives w.r.t to the coefficient.
GEOS_HOST_DEVICE GEOS_FORCE_INLINE localIndex size() const
Give the number of stencil entries.
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > > constructArrayViewAccessor(string const &name, string const &neighborName=string()) const
This is a function to construct a ElementViewAccessor to access array data registered on the mesh.
array1d< array1d< VIEWTYPE > > ElementViewAccessor
The ElementViewAccessor at the ElementRegionManager level is an array of array of VIEWTYPE.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
A struct to automatically construct and store element view accessors.
A struct to automatically construct and store element view accessors.
static void createAndLaunch(globalIndex const rankOffset, string const &dofKey, string const &solverName, FaceManager const &faceManager, ElementRegionManager const &elemManager, BoundaryStencilWrapper const &stencilWrapper, constitutive::SingleFluidBase &fluidBase, real64 const &dt, 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 Dirichlet face flux terms.
ElementViewConst< arrayView1d< real64 const > > const m_mob
Views on fluid mobility.
GEOS_HOST_DEVICE void complete(localIndex const iconn, StackVariables &stack, FUNC &&assemblyKernelOp=NoOpFunc{}) const
Performs the complete phase for the kernel.
ElementViewConst< arrayView1d< integer const > > const m_ghostRank
Views on ghost rank numbers and gravity coefficients.
FLUIDWRAPPER const m_fluidWrapper
Reference to the fluid wrapper.
GEOS_HOST_DEVICE void computeFlux(localIndex const iconn, StackVariables &stack, FUNC &&compFluxKernelOp=NoOpFunc{}) const
Compute the local Dirichlet face flux contributions to the residual and Jacobian.
arrayView1d< real64 const > const m_faceGravCoef
View on the face gravity coefficient.
DirichletFluxComputeKernel(globalIndex const rankOffset, FaceManager const &faceManager, BoundaryStencilWrapper const &stencilWrapper, FLUIDWRAPPER const &fluidWrapper, DofNumberAccessor const &dofNumberAccessor, SinglePhaseFlowAccessors const &singlePhaseFlowAccessors, SinglePhaseFluidAccessors const &singlePhaseFluidAccessors, PermeabilityAccessors const &permeabilityAccessors, real64 const &dt, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Constructor for the kernel interface.
ElementViewConst< arrayView1d< globalIndex const > > const m_dofNumber
Views on dof numbers.
ElementViewConst< arrayView1d< real64 const > > const m_pres
Views on pressure.
real64 const m_dt
Time step size.
ElementViewConst< arrayView3d< real64 const > > m_permeability
Views on permeability.
ElementViewConst< arrayView2d< real64 const > > const m_dens
Views on fluid density.
globalIndex const m_rankOffset
Offset for my MPI rank.
GEOS_HOST_DEVICE void setup(localIndex const iconn, StackVariables &stack) const
Performs the setup phase for the kernel.
arrayView1d< real64 const > const m_facePres
Views on face pressure, temperature, and composition.
Base class for FluxComputeKernel that holds all data not dependent on template parameters (like stenc...
ElementViewConst< arrayView1d< real64 const > > const m_mob
Views on fluid mobility.
ElementViewConst< arrayView1d< integer const > > const m_ghostRank
Views on ghost rank numbers and gravity coefficients.
ElementViewConst< arrayView1d< globalIndex const > > const m_dofNumber
Views on dof numbers.
ElementViewConst< arrayView1d< real64 const > > const m_pres
Views on pressure.
real64 const m_dt
Time step size.
arrayView1d< real64 > const m_localRhs
View on the local RHS.
ElementViewConst< arrayView3d< real64 const > > m_permeability
Views on permeability.
ElementViewConst< arrayView2d< real64 const > > const m_dens
Views on fluid density.
globalIndex const m_rankOffset
Offset for my MPI rank.
CRSMatrixView< real64, globalIndex const > const m_localMatrix
View on the local CRS matrix.
Define the interface for the assembly kernel in charge of flux terms.
static constexpr integer numEqn
Compute time value for the number of equations.
STENCILWRAPPER::IndexContainerViewConstType const m_seri
Connection to element maps.
static constexpr integer numDof
Compute time value for the number of degrees of freedom.
BoundaryStencilWrapper const m_stencilWrapper
Reference to the stencil wrapper.
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).
StackArray< T, 1, MAXSIZE > stackArray1d
Alias for 1D stack array.
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.
Defines the order of element/face in the stencil.
static constexpr localIndex ELEM
Order of element index in stencil.
static constexpr localIndex maxNumPointsInFlux
Maximum number of points the flux.
Kernel variables (dof numbers, jacobian and residual) located on the stack.
real64 transmissibility
Transmissibility.
real64 localFlux[numEqn]
Storage for the face local residual.
real64 localFluxJacobian[numEqn][numDof]
Storage for the face local Jacobian.
GEOS_HOST_DEVICE StackVariables(localIndex const GEOS_UNUSED_PARAM(size), localIndex GEOS_UNUSED_PARAM(numElems))
Constructor for the stack variables.
globalIndex dofColIndices[numDof]
Indices of the matrix rows/columns corresponding to the dofs in this face.