20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_FLUXCOMPUTEKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_FLUXCOMPUTEKERNEL_HPP
29 namespace singlePhaseFVMKernels
38 template<
integer NUM_EQN,
integer NUM_DOF,
typename STENCILWRAPPER >
71 STENCILWRAPPER
const & stencilWrapper,
72 DofNumberAccessor
const & dofNumberAccessor,
81 singlePhaseFlowAccessors,
82 singlePhaseFluidAccessors,
83 permeabilityAccessors,
88 m_seri( stencilWrapper.getElementRegionIndices() ),
89 m_sesri( stencilWrapper.getElementSubRegionIndices() ),
90 m_sei( stencilWrapper.getElementIndices() )
149 {
return m_sei[iconn].size(); }
188 template<
typename FUNC = NoOpFunc >
192 FUNC && kernelOp = NoOpFunc{} )
const
206 for( k[1] = k[0] + 1; k[1] < stack.
numFluxElems; ++k[1] )
209 real64 dFlux_dTrans = 0.0;
215 real64 dFlux_dP[2] = {0.0, 0.0};
217 localIndex const subRegionIndex[2] = {m_sesri( iconn, k[0] ), m_sesri( iconn, k[1] )};
218 localIndex const elementIndex[2] = {m_sei( iconn, k[0] ), m_sei( iconn, k[1] )};
220 singlePhaseFluxKernelsHelper::computeSinglePhaseFlux( regionIndex, subRegionIndex, elementIndex,
240 for(
integer ke = 0; ke < 2; ++ke )
248 kernelOp( k, regionIndex, subRegionIndex, elementIndex, connectionIndex, alpha, mobility, potGrad, fluxVal, dFlux_dP );
260 template<
typename FUNC = NoOpFunc >
264 FUNC && kernelOp = NoOpFunc{} )
const
271 if(
m_ghostRank[
m_seri( iconn, i )][m_sesri( iconn, i )][m_sei( iconn, i )] < 0 )
279 m_localMatrix.addToRowBinarySearchUnsorted< parallelDeviceAtomic >( localRow,
285 kernelOp( i, localRow );
297 template<
typename POLICY,
typename KERNEL_TYPE >
300 KERNEL_TYPE
const & kernelComponent )
306 typename KERNEL_TYPE::StackVariables stack( kernelComponent.stencilSize( iconn ),
307 kernelComponent.numPointsInFlux( iconn ) );
309 kernelComponent.setup( iconn, stack );
310 kernelComponent.computeFlux( iconn, stack );
311 kernelComponent.complete( iconn, stack );
324 typename STENCILWRAPPER::IndexContainerViewConstType
const m_seri;
325 typename STENCILWRAPPER::IndexContainerViewConstType
const m_sesri;
326 typename STENCILWRAPPER::IndexContainerViewConstType
const m_sei;
349 template<
typename POLICY,
typename STENCILWRAPPER >
352 string const & dofKey,
353 string const & solverName,
355 STENCILWRAPPER
const & stencilWrapper,
365 dofNumberAccessor.setName( solverName +
"/accessors/" + dofKey );
368 typename kernelType::SinglePhaseFlowAccessors flowAccessors( elemManager, solverName );
369 typename kernelType::SinglePhaseFluidAccessors fluidAccessors( elemManager, solverName );
370 typename kernelType::PermeabilityAccessors permAccessors( elemManager, solverName );
372 kernelType kernel( rankOffset, stencilWrapper, dofNumberAccessor,
373 flowAccessors, fluidAccessors, permAccessors,
374 dt, localMatrix, localRhs );
375 kernelType::template launch< POLICY >( stencilWrapper.size(), kernel );
#define GEOS_HOST_DEVICE
Marks a host-device function.
#define GEOS_ASSERT_GT(lhs, rhs)
Assert that one value compares greater than the other in debug builds.
#define GEOS_ASSERT_GE(lhs, rhs)
Assert that one value compares greater than or equal to the other in debug builds.
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
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.
A struct to automatically construct and store element view accessors.
A struct to automatically construct and store element view accessors.
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.
static void createAndLaunch(globalIndex const rankOffset, string const &dofKey, string const &solverName, ElementRegionManager const &elemManager, STENCILWRAPPER const &stencilWrapper, 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 flux terms.
static constexpr integer numEqn
Compute time value for the number of equations.
GEOS_HOST_DEVICE void setup(localIndex const iconn, StackVariables &stack) const
Performs the setup phase for the kernel.
static constexpr localIndex maxNumConns
Maximum number of connections at the face.
static void launch(localIndex const numConnections, KERNEL_TYPE const &kernelComponent)
Performs the kernel launch.
GEOS_HOST_DEVICE void complete(localIndex const iconn, StackVariables &stack, FUNC &&kernelOp=NoOpFunc{}) const
Performs the complete phase for the kernel.
static constexpr localIndex maxStencilSize
Maximum number of points in the stencil.
STENCILWRAPPER::IndexContainerViewConstType const m_seri
Connection to element maps.
static constexpr integer numDof
Compute time value for the number of degrees of freedom.
FluxComputeKernel(globalIndex const rankOffset, STENCILWRAPPER const &stencilWrapper, 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.
GEOS_HOST_DEVICE localIndex stencilSize(localIndex const iconn) const
Getter for the stencil size at this connection.
GEOS_HOST_DEVICE localIndex numPointsInFlux(localIndex const iconn) const
Getter for the number of elements at this connection.
STENCILWRAPPER const m_stencilWrapper
Reference to the stencil wrapper.
GEOS_HOST_DEVICE void computeFlux(localIndex const iconn, StackVariables &stack, FUNC &&kernelOp=NoOpFunc{}) const
Compute the local flux contributions to the residual and Jacobian.
static constexpr localIndex maxNumElems
Maximum number of elements at the face.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
StackArray< T, 2, MAXSIZE > stackArray2d
Alias for 2D stack array.
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.
Kernel variables (dof numbers, jacobian and residual) located on the stack.
real64 dTrans_dPres[maxNumConns][2]
Derivatives of transmissibility with respect to pressure.
real64 transmissibility[maxNumConns][2]
Transmissibility.
stackArray1d< globalIndex, maxNumElems *numDof > dofColIndices
Indices of the matrix rows/columns corresponding to the dofs in this face.
GEOS_HOST_DEVICE StackVariables(localIndex const size, localIndex numElems)
Constructor for the stack variables.
stackArray1d< real64, maxNumElems *numEqn > localFlux
Storage for the face local residual vector (all equations except volume balance)
localIndex const stencilSize
Stencil size for a given connection.
stackArray2d< real64, maxNumElems *numEqn *maxStencilSize *numDof > localFluxJacobian
Storage for the face local Jacobian matrix.
localIndex const numFluxElems
Number of elements for a given connection.