12#ifndef DUMUX_NAVIERSTOKES_MASS_1PNC_LOCAL_RESIDUAL_HH
13#define DUMUX_NAVIERSTOKES_MASS_1PNC_LOCAL_RESIDUAL_HH
25template<
class TypeTag>
31 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
32 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
33 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
35 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
36 using ElementFluxVariablesCache =
typename GridFluxVariablesCache::LocalView;
41 using FVElementGeometry =
typename GridGeometry::LocalView;
42 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
43 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
44 using GridView =
typename GridGeometry::GridView;
45 using Element =
typename GridView::template Codim<0>::Entity;
51 static constexpr bool useMoles = ModelTraits::useMoles();
52 static constexpr auto numComponents = ModelTraits::numFluidComponents();
54 static constexpr int replaceCompEqIdx = ModelTraits::replaceCompEqIdx();
55 static constexpr bool useTotalMassBalance = replaceCompEqIdx < numComponents;
59 using ParentType::ParentType;
65 const SubControlVolume& scv,
66 const VolumeVariables& volVars)
const
68 NumEqVector storage(0.0);
70 const Scalar
density = useMoles ? volVars.molarDensity() : volVars.density();
73 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
75 const int eqIdx = compIdx;
77 const Scalar
massOrMoleFraction = useMoles ? volVars.moleFraction(compIdx) : volVars.massFraction(compIdx);
80 if (eqIdx != ModelTraits::replaceCompEqIdx())
85 if constexpr (useTotalMassBalance)
86 storage[ModelTraits::replaceCompEqIdx()] = volVars.density();
89 if constexpr (ModelTraits::enableEnergyBalance())
90 storage[ModelTraits::Indices::energyEqIdx] = volVars.density() * volVars.internalEnergy();
106 const Element& element,
107 const FVElementGeometry& fvGeometry,
108 const ElementVolumeVariables& elemVolVars,
109 const SubControlVolumeFace& scvf,
110 const ElementFluxVariablesCache& elemFluxVarsCache)
const
112 FluxVariables fluxVars;
113 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
114 return fluxVars.flux(0);
Element-wise calculation of the Navier-Stokes residual for multicomponent single-phase flow.
Definition: freeflow/navierstokes/mass/1pnc/localresidual.hh:27
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Calculate the storage term of the equation.
Definition: freeflow/navierstokes/mass/1pnc/localresidual.hh:64
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluatex the mass or mole flux over a face of a sub control volume.
Definition: freeflow/navierstokes/mass/1pnc/localresidual.hh:105
Defines all properties used in Dumux.
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition: numeqvector.hh:34
VolumeVariables::PrimaryVariables::value_type massOrMoleFraction(const VolumeVariables &volVars, ReferenceSystemFormulation referenceSys, const int phaseIdx, const int compIdx)
returns the mass or mole fraction to be used in Fick's law based on the reference system
Definition: referencesystemformulation.hh:54
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
constexpr CCTpfa cctpfa
Definition: method.hh:145
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
A helper to deduce a vector with the same size as numbers of equations.