version 3.8
freeflow/rans/oneeq/staggered/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_STAGGERED_ONEEQ_LOCAL_RESIDUAL_HH
13#define DUMUX_STAGGERED_ONEEQ_LOCAL_RESIDUAL_HH
14
15#include <dune/common/hybridutilities.hh>
19
20namespace Dumux {
21
28// forward declaration
29template<class TypeTag, class BaseLocalResidual, class DiscretizationMethod>
30class OneEqResidualImpl;
31
32template<class TypeTag, class BaseLocalResidual>
33class OneEqResidualImpl<TypeTag, BaseLocalResidual, DiscretizationMethods::Staggered>
34: public BaseLocalResidual
35{
36 using ParentType = BaseLocalResidual;
37
39
40 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
41 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
42 using VolumeVariables = typename GridVolumeVariables::VolumeVariables;
43
44 using GridFluxVariablesCache = typename GridVariables::GridFluxVariablesCache;
45 using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView;
47
48 using GridFaceVariables = typename GridVariables::GridFaceVariables;
49 using ElementFaceVariables = typename GridFaceVariables::LocalView;
50
54 using Element = typename GridView::template Codim<0>::Entity;
55 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
56 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
57 using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
60
61 static constexpr int viscosityTildeEqIdx = Indices::viscosityTildeEqIdx - ModelTraits::dim();
62
63public:
64 using ParentType::ParentType;
65
67 CellCenterPrimaryVariables computeStorageForCellCenter(const Problem& problem,
68 const SubControlVolume& scv,
69 const VolumeVariables& volVars) const
70 {
71 CellCenterPrimaryVariables storage = ParentType::computeStorageForCellCenter(problem, scv, volVars);
72 storage[viscosityTildeEqIdx] = volVars.viscosityTilde() * volVars.density();
73 return storage;
74 }
75
76 CellCenterPrimaryVariables computeSourceForCellCenter(const Problem& problem,
77 const Element &element,
78 const FVElementGeometry& fvGeometry,
79 const ElementVolumeVariables& elemVolVars,
80 const ElementFaceVariables& elemFaceVars,
81 const SubControlVolume &scv) const
82 {
83 CellCenterPrimaryVariables source = ParentType::computeSourceForCellCenter(problem, element, fvGeometry,
84 elemVolVars, elemFaceVars, scv);
85
86 const auto& volVars = elemVolVars[scv];
87
88 source[viscosityTildeEqIdx] += volVars.cb1() * (1.0 - volVars.ft2())
89 * volVars.stressTensorScalarProductTilde()
90 * volVars.viscosityTilde() * volVars.density();
91
92 source[viscosityTildeEqIdx] -= (volVars.cw1() * volVars.fW()
93 - volVars.cb1() * volVars.ft2() / problem.karmanConstant() / problem.karmanConstant())
94 * volVars.viscosityTilde() * volVars.viscosityTilde()
95 / volVars.wallDistance() / volVars.wallDistance() * volVars.density();;
96
97 for (unsigned int axisIdx = 0; axisIdx < ModelTraits::dim(); ++axisIdx)
98 {
99 source[viscosityTildeEqIdx] += volVars.cb2() / volVars.sigma()
100 * volVars.storedViscosityTildeGradient()[axisIdx]
101 * volVars.storedViscosityTildeGradient()[axisIdx]
102 * volVars.density();
103 }
104
105 return source;
106 }
107};
108} // end namespace Dumux
109
110#endif
CellCenterPrimaryVariables computeStorageForCellCenter(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate fluxes entering or leaving the cell center control volume.
Definition: freeflow/rans/oneeq/staggered/localresidual.hh:67
CellCenterPrimaryVariables computeSourceForCellCenter(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolume &scv) const
Definition: freeflow/rans/oneeq/staggered/localresidual.hh:76
Element-wise calculation of the residual for one-equation turbulence models using the staggered discr...
Definition: freeflow/rans/oneeq/localresidual.hh:24
Defines all properties used in Dumux.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
Definition: adapt.hh:17