12#ifndef DUMUX_NAVIERSTOKES_MASS_1PNC_LOCAL_RESIDUAL_HH
13#define DUMUX_NAVIERSTOKES_MASS_1PNC_LOCAL_RESIDUAL_HH
26template<
class TypeTag>
33 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
34 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
35 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
37 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
38 using ElementFluxVariablesCache =
typename GridFluxVariablesCache::LocalView;
43 using FVElementGeometry =
typename GridGeometry::LocalView;
44 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
45 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
46 using GridView =
typename GridGeometry::GridView;
47 using Element =
typename GridView::template Codim<0>::Entity;
53 static constexpr bool useMoles = ModelTraits::useMoles();
54 static constexpr auto numComponents = ModelTraits::numFluidComponents();
56 static constexpr int replaceCompEqIdx = ModelTraits::replaceCompEqIdx();
57 static constexpr bool useTotalMassBalance = replaceCompEqIdx < numComponents;
61 using ParentType::ParentType;
67 const SubControlVolume& scv,
68 const VolumeVariables& volVars)
const
70 NumEqVector storage(0.0);
72 const Scalar
density = useMoles ? volVars.molarDensity() : volVars.density();
75 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
77 const int eqIdx = compIdx;
79 const Scalar
massOrMoleFraction = useMoles ? volVars.moleFraction(compIdx) : volVars.massFraction(compIdx);
82 if (eqIdx != ModelTraits::replaceCompEqIdx())
87 if constexpr (useTotalMassBalance)
88 storage[ModelTraits::replaceCompEqIdx()] = volVars.density();
91 if constexpr (ModelTraits::enableEnergyBalance())
92 storage[ModelTraits::Indices::energyEqIdx] = volVars.density() * volVars.internalEnergy();
108 const Element& element,
109 const FVElementGeometry& fvGeometry,
110 const ElementVolumeVariables& elemVolVars,
111 const SubControlVolumeFace& scvf,
112 const ElementFluxVariablesCache& elemFluxVarsCache)
const
114 FluxVariables fluxVars;
115 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
116 return fluxVars.flux(0);
Element-wise calculation of the Navier-Stokes residual for multicomponent single-phase flow.
Definition: freeflow/navierstokes/mass/1pnc/localresidual.hh:29
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:66
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluates the mass or mole flux over a face of a sub control volume.
Definition: freeflow/navierstokes/mass/1pnc/localresidual.hh:107
Defines all properties used in Dumux.
The default local operator than can be specialized for each discretization scheme.
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
typename Detail::DiscretizationDefaultLocalOperator< TypeTag >::type DiscretizationDefaultLocalOperator
Definition: defaultlocaloperator.hh:27
A helper to deduce a vector with the same size as numbers of equations.