3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
freeflow/rans/twoeq/kepsilon/volumevariables.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_KEPSILON_VOLUME_VARIABLES_HH
25#define DUMUX_KEPSILON_VOLUME_VARIABLES_HH
26
29
30namespace Dumux {
31
36template <class Traits, class NSVolumeVariables>
38: public RANSVolumeVariables<Traits, NSVolumeVariables>
39{
41
42 using Scalar = typename Traits::PrimaryVariables::value_type;
43
44public:
47
57 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
58 void update(const ElementSolution &elemSol,
59 const Problem &problem,
60 const Element &element,
61 const SubControlVolume& scv)
62 {
63 RANSParentType::updateNavierStokesVolVars(elemSol, problem, element, scv);
64 updateRANSProperties(elemSol, problem, element, scv);
65 }
66
77 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
78 void updateRANSProperties(const ElementSolution &elemSol,
79 const Problem &problem,
80 const Element &element,
81 const SubControlVolume& scv)
82 {
83 RANSParentType::updateRANSProperties(elemSol, problem, element, scv);
84 isMatchingPoint_ = problem.isMatchingPoint(RANSParentType::elementIdx());
85 inNearWallRegion_ = problem.inNearWallRegion(RANSParentType::elementIdx());
86 turbulentKineticEnergy_ = elemSol[0][Indices::turbulentKineticEnergyIdx];
87 dissipation_ = elemSol[0][Indices::dissipationIdx];
88 storedDissipation_ = problem.storedDissipation_[RANSParentType::elementIdx()];
89 storedTurbulentKineticEnergy_ = problem.storedTurbulentKineticEnergy_[RANSParentType::elementIdx()];
90 stressTensorScalarProduct_ = problem.stressTensorScalarProduct_[RANSParentType::elementIdx()];
91 const Scalar uStarNominal = problem.uStarNominal(RANSParentType::elementIdx());
92 const auto flowNormalAxis = problem.flowNormalAxis_[RANSParentType::elementIdx()];
93 yPlusNominal_ = RANSParentType::wallDistance() * uStarNominal / problem.kinematicViscosity_[RANSParentType::elementIdx()];
94 uPlusNominal_ = RANSParentType::velocity()[flowNormalAxis] / uStarNominal;
95 cMu_ = problem.cMu();
96 if (problem.useStoredEddyViscosity_)
97 RANSParentType::setDynamicEddyViscosity_(problem.storedDynamicEddyViscosity_[RANSParentType::elementIdx()]);
98 else
101 {
102 RANSParentType::setDynamicEddyViscosity_(problem.zeroEqDynamicEddyViscosity_[RANSParentType::elementIdx()]);
103 }
106 }
107
112 {
115 }
116
121 {
123 }
124
128 Scalar dissipation() const
129 {
130 return dissipation_;
131 }
132
137 {
139 }
140
144 Scalar storedDissipation() const
145 {
146 return storedDissipation_;
147 }
148
153 {
155 }
156
157 /*
158 * \brief Returns if an element is located in the near-wall region
159 */
160 bool inNearWallRegion() const
161 {
162 return inNearWallRegion_;
163 }
164
168 bool isMatchingPoint() const
169 {
170 return isMatchingPoint_;
171 }
172
174 const Scalar cMu() const
175 { return cMu_; }
176
178 const Scalar sigmaK() const
179 { return 1.0; }
180
182 const Scalar sigmaEpsilon() const
183 { return 1.3; }
184
186 const Scalar cOneEpsilon() const
187 { return 1.44; }
188
190 const Scalar cTwoEpsilon() const
191 { return 1.92; }
192
196 Scalar yPlusNominal() const
197 { return yPlusNominal_; }
198
202 Scalar uPlusNominal() const
203 { return uPlusNominal_; }
204
205protected:
207 Scalar dissipation_ = 0.0;
209 Scalar storedDissipation_ = 0.0;
211 Scalar yPlusNominal_ = 0.0;
212 Scalar uPlusNominal_ = 0.0;
213 Scalar cMu_ = 0.0;
214 bool inNearWallRegion_ = false;
215 bool isMatchingPoint_ = false;
216};
217
218} // end namespace Dumux
219
220#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Volume variables for the isothermal single-phase k-epsilon model.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:39
Scalar stressTensorScalarProduct() const
Returns the scalar product of the stress tensor.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:152
bool inNearWallRegion_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:214
bool isMatchingPoint() const
Returns if an element is the matching point.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:168
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:46
const Scalar sigmaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:178
bool isMatchingPoint_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:215
Scalar storedDissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:144
Scalar storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:208
Scalar turbulentKineticEnergy_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:206
Scalar storedTurbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:136
bool inNearWallRegion() const
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:160
const Scalar sigmaEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:182
void updateRANSProperties(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all turbulent quantities for a given control volume.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:78
Scalar storedDissipation_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:209
Scalar uPlusNominal_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:212
Scalar uPlusNominal() const
Return the nominal dimensionless velocity .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:202
Scalar stressTensorScalarProduct_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:210
Scalar yPlusNominal_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:211
const Scalar cOneEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:186
const Scalar cTwoEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:190
Scalar yPlusNominal() const
Return the nominal dimensionless wall distance .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:196
Scalar cMu_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:213
const Scalar cMu() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:174
Scalar turbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:120
Scalar dissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:128
Scalar calculateEddyViscosity()
Returns the dynamic eddy viscosity .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:111
void update(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:58
Scalar dissipation_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:207
Volume variables for the isothermal single-phase Reynolds-Averaged Navier-Stokes models.
Definition: freeflow/rans/volumevariables.hh:42
void calculateEddyThermalConductivity(const Problem &problem)
Calculates the eddy thermal conductivity based on the kinematic eddy viscosity and the turbulent Pra...
Definition: freeflow/rans/volumevariables.hh:209
Scalar wallDistance() const
Return the wall distance of the control volume.
Definition: freeflow/rans/volumevariables.hh:138
void updateNavierStokesVolVars(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: freeflow/rans/volumevariables.hh:65
DimVector velocity() const
Return the velocity vector at the control volume center.
Definition: freeflow/rans/volumevariables.hh:120
Scalar setDynamicEddyViscosity_(Scalar value)
Sets the dynamic eddy viscosity .
Definition: freeflow/rans/volumevariables.hh:259
void updateRANSProperties(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all turbulent quantities for a given control volume.
Definition: freeflow/rans/volumevariables.hh:85
void calculateEddyDiffusivity(const Problem &problem)
Calculates the eddy diffusivity based on the kinematic eddy viscosity and the turbulent Schmidt numb...
Definition: freeflow/rans/volumevariables.hh:198
unsigned int elementIdx() const
Return the element Idx of the control volume.
Definition: freeflow/rans/volumevariables.hh:114