20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PHASEMOBILITYKERNEL_HPP 
   21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_PHASEMOBILITYKERNEL_HPP 
   28 namespace isothermalCompositionalMultiphaseFVMKernels
 
   39 template< 
integer NUM_COMP, 
integer NUM_PHASE >
 
   57                        constitutive::MultiFluidBase 
const & fluid,
 
   58                        constitutive::RelativePermeabilityBase 
const & relperm )
 
   60     m_phaseVolFrac( subRegion.getField< fields::flow::phaseVolumeFraction >() ),
 
   61     m_dPhaseVolFrac( subRegion.getField< fields::flow::dPhaseVolumeFraction >() ),
 
   62     m_dCompFrac_dCompDens( subRegion.getField< fields::flow::dGlobalCompFraction_dGlobalCompDensity >() ),
 
   64     m_dPhaseDens( fluid.dPhaseDensity() ),
 
   66     m_dPhaseVisc( fluid.dPhaseViscosity() ),
 
   68     m_dPhaseRelPerm_dPhaseVolFrac( relperm.dPhaseRelPerm_dPhaseVolFraction() ),
 
   69     m_phaseMob( subRegion.getField< fields::flow::phaseMobility >() ),
 
   70     m_dPhaseMob( subRegion.getField< fields::flow::dPhaseMobility >() )
 
   79   template< 
typename FUNC = NoOpFunc >
 
   82                 FUNC && phaseMobilityKernelOp = NoOpFunc{} ) 
const 
   84     using Deriv = constitutive::multifluid::DerivativeOffset;
 
   86     arraySlice2d< 
real64 const, compflow::USD_COMP_DC - 1 > 
const dCompFrac_dCompDens = m_dCompFrac_dCompDens[ei];
 
   88     arraySlice2d< 
real64 const, constitutive::multifluid::USD_PHASE_DC - 2 > 
const dPhaseDens = m_dPhaseDens[ei][0];
 
   90     arraySlice2d< 
real64 const, constitutive::multifluid::USD_PHASE_DC - 2 > 
const dPhaseVisc = m_dPhaseVisc[ei][0];
 
   92     arraySlice2d< 
real64 const, constitutive::relperm::USD_RELPERM_DS - 2 > 
const dPhaseRelPerm_dPhaseVolFrac = m_dPhaseRelPerm_dPhaseVolFrac[ei][0];
 
   94     arraySlice2d< 
real64 const, compflow::USD_PHASE_DC - 1 > 
const dPhaseVolFrac = m_dPhaseVolFrac[ei];
 
  106       bool const phaseExists = (phaseVolFrac[ip] > 0);
 
  112           dPhaseMob[ip][jc] = 0.0;
 
  117       real64 const density = phaseDens[ip];
 
  118       real64 const dDens_dP = dPhaseDens[ip][Deriv::dP];
 
  119       applyChainRule( 
numComp, dCompFrac_dCompDens, dPhaseDens[ip], dDens_dC, Deriv::dC );
 
  121       real64 const viscosity = phaseVisc[ip];
 
  122       real64 const dVisc_dP = dPhaseVisc[ip][Deriv::dP];
 
  123       applyChainRule( 
numComp, dCompFrac_dCompDens, dPhaseVisc[ip], dVisc_dC, Deriv::dC );
 
  125       real64 const relPerm = phaseRelPerm[ip];
 
  129         dRelPerm_dC[ic] = 0.0;
 
  134         real64 const dRelPerm_dS = dPhaseRelPerm_dPhaseVolFrac[ip][jp];
 
  135         dRelPerm_dP += dRelPerm_dS * dPhaseVolFrac[jp][Deriv::dP];
 
  139           dRelPerm_dC[jc] += dRelPerm_dS * dPhaseVolFrac[jp][Deriv::dC+jc];
 
  143       real64 const mobility = relPerm * density / viscosity;
 
  145       phaseMob[ip] = mobility;
 
  146       dPhaseMob[ip][Deriv::dP] = dRelPerm_dP * density / viscosity
 
  147                                  + mobility * (dDens_dP / density - dVisc_dP / viscosity);
 
  152         dPhaseMob[ip][Deriv::dC+jc] = dRelPerm_dC[jc] * density / viscosity
 
  153                                       + mobility * (dDens_dC[jc] / density - dVisc_dC[jc] / viscosity);
 
  158       phaseMobilityKernelOp( ip, phaseMob[ip], dPhaseMob[ip] );
 
  207   template< 
typename POLICY >
 
  212                    constitutive::MultiFluidBase 
const & fluid,
 
  213                    constitutive::RelativePermeabilityBase 
const & relperm )
 
  217       isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch( numComp, [&] ( 
auto NC )
 
  219         integer constexpr NUM_COMP = NC();
 
  224     else if( numPhase == 3 )
 
  226       isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch( numComp, [&] ( 
auto NC )
 
  228         integer constexpr NUM_COMP = NC();
 
#define GEOS_HOST_DEVICE
Marks a host-device function.
 
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
 
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
 
Define the base interface for the property update kernels.
 
static constexpr integer numComp
Compile time value for the number of components.
 
static void createAndLaunch(integer const numComp, integer const numPhase, ObjectManagerBase &subRegion, constitutive::MultiFluidBase const &fluid, constitutive::RelativePermeabilityBase const &relperm)
Create a new kernel and launch.
 
Defines the interface for the property kernel in charge of computing the phase mobilities.
 
arrayView2d< real64 const, compflow::USD_PHASE > m_phaseVolFrac
Views on the phase volume fractions.
 
PhaseMobilityKernel(ObjectManagerBase &subRegion, constitutive::MultiFluidBase const &fluid, constitutive::RelativePermeabilityBase const &relperm)
Constructor.
 
arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > m_phaseDens
Views on the phase densities.
 
arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > m_phaseVisc
Views on the phase viscosities.
 
static constexpr integer numPhase
Compile time value for the number of phases.
 
GEOS_HOST_DEVICE void compute(localIndex const ei, FUNC &&phaseMobilityKernelOp=NoOpFunc{}) const
Compute the phase mobilities in an element.
 
arrayView3d< real64 const, constitutive::relperm::USD_RELPERM > m_phaseRelPerm
Views on the phase relative permeabilities.
 
static constexpr integer numComp
Compile time value for the number of components.
 
arrayView2d< real64, compflow::USD_PHASE > m_phaseMob
Views on the phase mobilities.
 
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
 
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.
 
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
 
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
 
int integer
Signed integer type.
 
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.