20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PPUPHASEFLUX_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PPUPHASEFLUX_HPP
25 #include "constitutive/fluid/multifluid/Layouts.hpp"
26 #include "constitutive/capillaryPressure/layouts.hpp"
34 namespace isothermalCompositionalMultiphaseFVMKernelUtilities
37 template<
typename VIEWTYPE >
38 using ElementViewConst = ElementRegionManager::ElementViewConst< VIEWTYPE >;
40 using Deriv = constitutive::multifluid::DerivativeOffset;
72 template<
integer numComp,
integer numFluxSupportPo
ints >
78 localIndex const ( &seri )[numFluxSupportPoints],
79 localIndex const ( &sesri )[numFluxSupportPoints],
80 localIndex const ( &sei )[numFluxSupportPoints],
81 real64 const ( &trans )[2],
82 real64 const ( &dTrans_dPres )[2],
99 real64 ( & dPhaseFlux_dP )[numFluxSupportPoints],
100 real64 ( & dPhaseFlux_dC )[numFluxSupportPoints][numComp],
101 real64 ( & compFlux )[numComp],
102 real64 ( & dCompFlux_dP )[numFluxSupportPoints][numComp],
103 real64 ( & dCompFlux_dC )[numFluxSupportPoints][numComp][numComp] )
105 real64 dPresGrad_dP[numFluxSupportPoints]{};
106 real64 dPresGrad_dC[numFluxSupportPoints][numComp]{};
107 real64 dGravHead_dP[numFluxSupportPoints]{};
108 real64 dGravHead_dC[numFluxSupportPoints][numComp]{};
109 PotGrad::compute< numComp, numFluxSupportPoints >( numPhase, ip, hasCapPressure, seri, sesri, sei, trans, dTrans_dPres, pres,
110 gravCoef, phaseVolFrac, dPhaseVolFrac, dCompFrac_dCompDens, phaseMassDens, dPhaseMassDens,
111 phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, potGrad, dPresGrad_dP,
112 dPresGrad_dC, dGravHead_dP, dGravHead_dC );
117 k_up = (potGrad >= 0) ? 0 : 1;
123 real64 const mobility = phaseMob[er_up][esr_up][ei_up][ip];
126 for(
integer ke = 0; ke < numFluxSupportPoints; ++ke )
128 dPhaseFlux_dP[ke] += dPresGrad_dP[ke] - dGravHead_dP[ke];
129 dPhaseFlux_dP[ke] *= mobility;
130 for(
integer jc = 0; jc < numComp; ++jc )
132 dPhaseFlux_dC[ke][jc] += dPresGrad_dC[ke][jc] - dGravHead_dC[ke][jc];
133 dPhaseFlux_dC[ke][jc] *= mobility;
137 phaseFlux = mobility * potGrad;
139 real64 const dMob_dP = dPhaseMob[er_up][esr_up][ei_up][ip][Deriv::dP];
141 dPhaseMob[er_up][esr_up][ei_up][ip];
144 dPhaseFlux_dP[k_up] += dMob_dP * potGrad;
145 for(
integer jc = 0; jc < numComp; ++jc )
147 dPhaseFlux_dC[k_up][jc] += dPhaseMobSub[Deriv::dC+jc] * potGrad;
152 , dPhaseFlux_dP, dPhaseFlux_dC, compFlux, dCompFlux_dP, dCompFlux_dC );
#define GEOS_HOST_DEVICE
Marks a host-device function.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
ArrayView< T, 5, USD > arrayView5d
Alias for 5D array view.
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
std::int32_t integer
Signed integer type.
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
static GEOS_HOST_DEVICE void compute(integer const numPhase, integer const ip, integer const hasCapPressure, localIndex const (&seri)[numFluxSupportPoints], localIndex const (&sesri)[numFluxSupportPoints], localIndex const (&sei)[numFluxSupportPoints], real64 const (&trans)[2], real64 const (&dTrans_dPres)[2], ElementViewConst< arrayView1d< real64 const > > const &pres, ElementViewConst< arrayView1d< real64 const > > const &gravCoef, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const &phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const &dPhaseMob, ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const &phaseVolFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const &dPhaseVolFrac, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const &phaseCompFrac, ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const &dPhaseCompFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const &dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const &phaseMassDens, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const &dPhaseMassDens, ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const &phaseCapPressure, ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const &dPhaseCapPressure_dPhaseVolFrac, localIndex &k_up, real64 &potGrad, real64(&phaseFlux), real64(&dPhaseFlux_dP)[numFluxSupportPoints], real64(&dPhaseFlux_dC)[numFluxSupportPoints][numComp], real64(&compFlux)[numComp], real64(&dCompFlux_dP)[numFluxSupportPoints][numComp], real64(&dCompFlux_dC)[numFluxSupportPoints][numComp][numComp])
Form the PhasePotentialUpwind from pressure gradient and gravitational head.
static GEOS_HOST_DEVICE void compute(localIndex const ip, localIndex const k_up, localIndex const (&seri)[numFluxSupportPoints], localIndex const (&sesri)[numFluxSupportPoints], localIndex const (&sei)[numFluxSupportPoints], ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const &phaseCompFrac, ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const &dPhaseCompFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const &dCompFrac_dCompDens, real64 const &phaseFlux, real64 const (&dPhaseFlux_dP)[numFluxSupportPoints], real64 const (&dPhaseFlux_dC)[numFluxSupportPoints][numComp], real64(&compFlux)[numComp], real64(&dCompFlux_dP)[numFluxSupportPoints][numComp], real64(&dCompFlux_dC)[numFluxSupportPoints][numComp][numComp])
Compute the component flux for a given phase.