12#ifndef DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_LOCAL_RESIDUAL_HH
13#define DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_LOCAL_RESIDUAL_HH
20#include <dumux/common/concepts/variables_.hh>
32template<
class Problem>
34:
public std::false_type
41template<
class TypeTag>
47 using GridVariablesCache = Concept::GridVariablesCache_t<GridVariables>;
48 using ElementVariables =
typename GridVariablesCache::LocalView;
49 using Variables = Concept::Variables_t<GridVariables>;
54 using FVElementGeometry =
typename GridGeometry::LocalView;
55 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
56 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
57 using GridView =
typename GridGeometry::GridView;
58 using Element =
typename GridView::template Codim<0>::Entity;
67 using ParentType::ParentType;
73 const SubControlVolume& scv,
74 const Variables& vars)
const
76 NumEqVector storage(0.0);
77 storage[ModelTraits::Indices::conti0EqIdx] = vars.density();
80 if constexpr (ModelTraits::enableEnergyBalance())
81 storage[ModelTraits::Indices::energyEqIdx] = vars.density() * vars.internalEnergy();
96 const ElementVariables& elemVars,
97 const SubControlVolume& scv,
98 bool isPreviousTimeLevel)
const
100 const auto& vars = elemVars[scv];
102 NumEqVector storage(0.0);
103 storage[ModelTraits::Indices::conti0EqIdx] = vars.density();
106 if constexpr (ModelTraits::enableEnergyBalance())
107 storage[ModelTraits::Indices::energyEqIdx] = vars.density() * vars.internalEnergy();
109 storage *= Extrusion::volume(fvGeometry, scv) * vars.extrusionFactor();
124 template<
class ElementFluxVariablesCache>
126 const Element& element,
127 const FVElementGeometry& fvGeometry,
128 const ElementVariables& elemVars,
129 const SubControlVolumeFace& scvf,
130 const ElementFluxVariablesCache& elemFluxVarsCache)
const
132 FluxVariables fluxVars;
133 fluxVars.init(problem, element, fvGeometry, elemVars, scvf, elemFluxVarsCache);
134 auto flux = fluxVars.flux(0);
139 flux += problem.auxiliaryFlux(element, fvGeometry, elemVars, elemFluxVarsCache, scvf);
153 const ElementVariables& elemVars,
154 const SubControlVolumeFace& scvf)
const
156 const auto& problem = this->asImp().problem();
157 NumEqVector flux(0.0);
160 const auto& faceIpData = qpData.ipData();
161 flux += qpData.weight() * (problem.velocity(fvGeometry, faceIpData) * faceIpData.unitOuterNormal());
164 static const auto upwindWeight
167 const auto& insideVars = elemVars[fvGeometry.scv(scvf.insideScvIdx())];
168 const auto& outsideVars = elemVars[fvGeometry.scv(scvf.outsideScvIdx())];
170 flux *= (upwindWeight * insideVars.density() + (1.0 - upwindWeight) * outsideVars.density());
175 flux += problem.auxiliaryFlux(fvGeometry.element(), fvGeometry, elemVars, scvf);
177 return flux * insideVars.extrusionFactor();
Element-wise calculation of the Navier-Stokes residual for single-phase flow.
Definition freeflow/navierstokes/mass/1p/localresidual.hh:44
NumEqVector storageIntegral(const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const SubControlVolume &scv, bool isPreviousTimeLevel) const
Calculate the storage term of the equation.
Definition freeflow/navierstokes/mass/1p/localresidual.hh:95
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const Variables &vars) const
Calculate the storage term of the equation.
Definition freeflow/navierstokes/mass/1p/localresidual.hh:72
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluate the mass flux over a face of a sub control volume.
Definition freeflow/navierstokes/mass/1p/localresidual.hh:125
NumEqVector fluxIntegral(const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const SubControlVolumeFace &scvf) const
Calculates the flux integral over a face of a sub control volume.
Definition freeflow/navierstokes/mass/1p/localresidual.hh:152
Defines all properties used in Dumux.
The default local operator than can be specialized for each discretization scheme.
Helper classes to compute the integration elements.
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
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:149
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
auto quadratureRule(const FVElementGeometry &fvGeometry, const typename FVElementGeometry::SubControlVolume &scv, QuadratureRules::MidpointQuadrature)
Midpoint quadrature for scv.
Definition quadraturerules.hh:159
typename Detail::DiscretizationDefaultLocalOperator< TypeTag >::type DiscretizationDefaultLocalOperator
Definition defaultlocaloperator.hh:26
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition extrusion.hh:236
A helper to deduce a vector with the same size as numbers of equations.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Quadrature rules over sub-control volumes and sub-control volume faces.
Traits class to be specialized for problems to add auxiliary fluxes.
Definition freeflow/navierstokes/mass/1p/localresidual.hh:35