version 3.11-dev
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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-FileCopyrightText: 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
20
21namespace Dumux {
22
28template<class Problem>
30: public std::false_type
31{};
32
37template<class TypeTag>
40{
43 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
44 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
45 using VolumeVariables = typename GridVolumeVariables::VolumeVariables;
46
47 using GridFluxVariablesCache = typename GridVariables::GridFluxVariablesCache;
48 using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
49
53 using FVElementGeometry = typename GridGeometry::LocalView;
54 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
55 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
56 using GridView = typename GridGeometry::GridView;
57 using Element = typename GridView::template Codim<0>::Entity;
61
62public:
64 using ParentType::ParentType;
65
69 NumEqVector computeStorage(const Problem& problem,
70 const SubControlVolume& scv,
71 const VolumeVariables& volVars) const
72 {
73 NumEqVector storage(0.0);
74 storage[ModelTraits::Indices::conti0EqIdx] = volVars.density();
75
76 // consider energy storage for non-isothermal models
77 if constexpr (ModelTraits::enableEnergyBalance())
78 storage[ModelTraits::Indices::energyEqIdx] = volVars.density() * volVars.internalEnergy();
79
80 return storage;
81 }
82
93 NumEqVector computeFlux(const Problem& problem,
94 const Element& element,
95 const FVElementGeometry& fvGeometry,
96 const ElementVolumeVariables& elemVolVars,
97 const SubControlVolumeFace& scvf,
98 const ElementFluxVariablesCache& elemFluxVarsCache) const
99 {
100 FluxVariables fluxVars;
101 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
102 auto flux = fluxVars.flux(0);
103
104 // the auxiliary flux is enabled if the trait is specialized for the problem
105 // this can be used, for example, to implement flux stabilization terms
107 flux += problem.auxiliaryFlux(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
108
109 return flux;
110 }
111};
112
113} // end namespace Dumux
114
115#endif
Element-wise calculation of the Navier-Stokes residual for single-phase flow.
Definition: freeflow/navierstokes/mass/1p/localresidual.hh:40
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:93
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:69
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
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Definition: adapt.hh:17
typename Detail::DiscretizationDefaultLocalOperator< TypeTag >::type DiscretizationDefaultLocalOperator
Definition: defaultlocaloperator.hh:27
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:31