20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_AQUIFERBCKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_AQUIFERBCKERNEL_HPP
24 #include "common/GEOS_RAJA_Interface.hpp"
31 namespace singlePhaseFVMKernels
48 template<
typename VIEWTYPE >
53 compute(
real64 const & aquiferVolFlux,
54 real64 const & dAquiferVolFlux_dPres,
55 real64 const & aquiferDens,
57 real64 const & dDens_dPres,
60 real64 & localFluxJacobian )
62 if( aquiferVolFlux > 0 )
64 localFlux -= dt * aquiferVolFlux * aquiferDens;
65 localFluxJacobian -= dt * dAquiferVolFlux_dPres * aquiferDens;
69 localFlux -= dt * aquiferVolFlux * dens;
70 localFluxJacobian -= dt * (dAquiferVolFlux_dPres * dens + aquiferVolFlux * dDens_dPres);
80 real64 const & aquiferDens,
86 real64 const & timeAtBeginningOfStep,
92 using Deriv = constitutive::singlefluid::DerivativeOffset;
103 real64 localFluxJacobian = 0.0;
105 localIndex const er = seri( iconn, Order::ELEM );
106 localIndex const esr = sesri( iconn, Order::ELEM );
107 localIndex const ei = sefi( iconn, Order::ELEM );
108 real64 const areaFraction = weight( iconn, Order::ELEM );
111 real64 dAquiferVolFlux_dPres = 0.0;
112 real64 const aquiferVolFlux = aquiferBCWrapper.
compute( timeAtBeginningOfStep,
116 gravCoef[er][esr][ei],
118 dAquiferVolFlux_dPres );
121 AquiferBCKernel::compute( aquiferVolFlux,
122 dAquiferVolFlux_dPres,
124 dens[er][esr][ei][0],
125 dDens[er][esr][ei][0][Deriv::dP],
131 if( ghostRank[er][esr][ei] < 0 )
133 globalIndex const globalRow = dofNumber[er][esr][ei];
134 localIndex const localRow = LvArray::integerConversion< localIndex >( globalRow - rankOffset );
138 RAJA::atomicAdd( parallelDeviceAtomic{}, &localRhs[localRow], localFlux );
139 localMatrix.addToRow< parallelDeviceAtomic >( localRow,
140 &dofNumber[er][esr][ei],
#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.
GEOS_HOST_DEVICE real64 compute(real64 const &timeAtBeginningOfStep, real64 const &dt, real64 const &reservoirPressure, real64 const &reservoirPressure_n, real64 const &reservoirGravCoef, real64 const &areaFraction, real64 &dAquiferVolFlux_dPres) const
Compute the aquifer-reservoir volumetric flux.
Provides management of the boundary stencil points (stencils used to prescribe boundary conditions on...
virtual localIndex size() const override
Give the number of stencil entries.
typename ElementViewAccessor< VIEWTYPE >::NestedViewTypeConst ElementViewConst
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
TRAITS::IndexContainerViewConstType getElementSubRegionIndices() const
Const access to the element subregions indices.
TRAITS::IndexContainerViewConstType getElementIndices() const
Const access to the element indices.
TRAITS::WeightContainerViewConstType getWeights() const
Const access to the stencil weights.
TRAITS::IndexContainerViewConstType getElementRegionIndices() const
Const access to the element regions indices.
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).
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
Defines the order of element/face in the stencil.
LvArray::typeManipulation::NestedViewTypeConst< IndexContainerType > IndexContainerViewConstType
The array view to const type for the stencil indices.
LvArray::typeManipulation::NestedViewTypeConst< WeightContainerType > WeightContainerViewConstType
The array view to const type for the stencil weights.
Functions to assemble aquifer boundary condition contributions to residual and Jacobian.
ElementRegionManager::ElementViewConst< VIEWTYPE > ElementViewConst
The type for element-based data. Consists entirely of ArrayView's.