version 3.8
freeflow/navierstokes/mass/1p/localresidual.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_LOCAL_RESIDUAL_HH
13#define DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_LOCAL_RESIDUAL_HH
14
15#include <type_traits>
16
19
20namespace Dumux {
21
27template<class Problem>
29: public std::false_type
30{};
31
36template<class TypeTag>
37class NavierStokesMassOnePLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual>
38{
41 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
42 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
43 using VolumeVariables = typename GridVolumeVariables::VolumeVariables;
44
45 using GridFluxVariablesCache = typename GridVariables::GridFluxVariablesCache;
46 using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
47
51 using FVElementGeometry = typename GridGeometry::LocalView;
52 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
53 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
54 using GridView = typename GridGeometry::GridView;
55 using Element = typename GridView::template Codim<0>::Entity;
59
60public:
62 using ParentType::ParentType;
63
67 NumEqVector computeStorage(const Problem& problem,
68 const SubControlVolume& scv,
69 const VolumeVariables& volVars) const
70 {
71 NumEqVector storage(0.0);
72 storage[ModelTraits::Indices::conti0EqIdx] = volVars.density();
73
74 // consider energy storage for non-isothermal models
75 if constexpr (ModelTraits::enableEnergyBalance())
76 storage[ModelTraits::Indices::energyEqIdx] = volVars.density() * volVars.internalEnergy();
77
78 return storage;
79 }
80
91 NumEqVector computeFlux(const Problem& problem,
92 const Element& element,
93 const FVElementGeometry& fvGeometry,
94 const ElementVolumeVariables& elemVolVars,
95 const SubControlVolumeFace& scvf,
96 const ElementFluxVariablesCache& elemFluxVarsCache) const
97 {
98 FluxVariables fluxVars;
99 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
100 auto flux = fluxVars.flux(0);
101
102 // the auxiliary flux is enabled if the trait is specialized for the problem
103 // this can be used, for example, to implement flux stabilization terms
105 flux += problem.auxiliaryFlux(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
106
107 return flux;
108 }
109};
110
111} // end namespace Dumux
112
113#endif
Element-wise calculation of the Navier-Stokes residual for single-phase flow.
Definition: freeflow/navierstokes/mass/1p/localresidual.hh:38
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, 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:91
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Calculate the storage term of the equation.
Definition: freeflow/navierstokes/mass/1p/localresidual.hh:67
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
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Definition: adapt.hh:17
A helper to deduce a vector with the same size as numbers of equations.
Traits class to be specialized for problems to add auxiliary fluxes.
Definition: freeflow/navierstokes/mass/1p/localresidual.hh:30