20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PHASECOMPONENTFLUX_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PHASECOMPONENTFLUX_HPP
25 #include "constitutive/fluid/multifluid/Layouts.hpp"
32 namespace isothermalCompositionalMultiphaseFVMKernelUtilities
35 template<
typename VIEWTYPE >
36 using ElementViewConst = ElementRegionManager::ElementViewConst< VIEWTYPE >;
38 using Deriv = constitutive::multifluid::DerivativeOffset;
61 template< localIndex numComp, localIndex numFluxSupportPo
ints >
66 localIndex const ( &seri )[numFluxSupportPoints],
67 localIndex const ( &sesri )[numFluxSupportPoints],
68 localIndex const ( &sei )[numFluxSupportPoints],
73 real64 const ( &dPhaseFlux_dP )[numFluxSupportPoints],
74 real64 const ( &dPhaseFlux_dC )[numFluxSupportPoints][numComp],
75 real64 ( & compFlux )[numComp],
76 real64 ( & dCompFlux_dP )[numFluxSupportPoints][numComp],
77 real64 ( & dCompFlux_dC )[numFluxSupportPoints][numComp][numComp] )
83 real64 dProp_dC[numComp]{};
86 arraySlice1d<
real64 const, constitutive::multifluid::USD_PHASE_COMP-3 > phaseCompFracSub =
87 phaseCompFrac[er_up][esr_up][ei_up][0][ip];
88 arraySlice2d<
real64 const, constitutive::multifluid::USD_PHASE_COMP_DC-3 > dPhaseCompFracSub =
89 dPhaseCompFrac[er_up][esr_up][ei_up][0][ip];
92 for(
integer ic = 0; ic < numComp; ++ic )
94 real64 const ycp = phaseCompFracSub[ic];
95 compFlux[ic] += phaseFlux * ycp;
98 for(
integer ke = 0; ke < numFluxSupportPoints; ++ke )
100 dCompFlux_dP[ke][ic] += dPhaseFlux_dP[ke] * ycp;
101 for(
integer jc = 0; jc < numComp; ++jc )
103 dCompFlux_dC[ke][ic][jc] += dPhaseFlux_dC[ke][jc] * ycp;
108 dCompFlux_dP[k_up][ic] += phaseFlux * dPhaseCompFracSub[ic][Deriv::dP];
111 applyChainRule( numComp,
112 dCompFrac_dCompDens[er_up][esr_up][ei_up],
113 dPhaseCompFracSub[ic],
116 for(
integer jc = 0; jc < numComp; ++jc )
118 dCompFlux_dC[k_up][ic][jc] += phaseFlux * dProp_dC[jc];
#define GEOS_HOST_DEVICE
Marks a host-device function.
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
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, 3, USD > arrayView3d
Alias for 3D array view.
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.