3.4
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:
46 using Indices = typename Traits::ModelTraits::Indices;
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 flowDirectionAxis = problem.flowDirectionAxis(RANSParentType::elementIdx());
93 yPlusNominal_ = RANSParentType::wallDistance() * uStarNominal / problem.kinematicViscosity(RANSParentType::elementIdx());
94 uPlusNominal_ = RANSParentType::ccVelocityVector()[flowDirectionAxis] / 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 { return turbulentKineticEnergy_; }
122
126 Scalar dissipation() const
127 { return dissipation_; }
128
134
138 Scalar storedDissipation() const
139 { return storedDissipation_; }
140
146
147 /*
148 * \brief Returns if an element is located in the near-wall region
149 */
150 bool inNearWallRegion() const
151 { return inNearWallRegion_; }
152
156 bool isMatchingPoint() const
157 { return isMatchingPoint_; }
158
160 const Scalar cMu() const
161 { return cMu_; }
162
164 const Scalar sigmaK() const
165 { return 1.0; }
166
168 const Scalar sigmaEpsilon() const
169 { return 1.3; }
170
172 const Scalar cOneEpsilon() const
173 { return 1.44; }
174
176 const Scalar cTwoEpsilon() const
177 { return 1.92; }
178
180 Scalar yPlusNominal() const
181 { return yPlusNominal_; }
182
184 Scalar uPlusNominal() const
185 { return uPlusNominal_; }
186
187protected:
189 Scalar dissipation_ = 0.0;
191 Scalar storedDissipation_ = 0.0;
193 Scalar yPlusNominal_ = 0.0;
194 Scalar uPlusNominal_ = 0.0;
195 Scalar cMu_ = 0.0;
196 bool inNearWallRegion_ = false;
197 bool isMatchingPoint_ = false;
198};
199
200} // end namespace Dumux
201
202#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Definition: adapt.hh:29
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:144
bool inNearWallRegion_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:196
bool isMatchingPoint() const
Returns if an element is the matching point.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:156
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:164
bool isMatchingPoint_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:197
Scalar storedDissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:138
Scalar storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:190
Scalar turbulentKineticEnergy_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:188
Scalar storedTurbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:132
bool inNearWallRegion() const
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:150
const Scalar sigmaEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:168
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:191
Scalar uPlusNominal_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:194
Scalar uPlusNominal() const
Return the nominal dimensionless velocity .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:184
Scalar stressTensorScalarProduct_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:192
Scalar yPlusNominal_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:193
const Scalar cOneEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:172
const Scalar cTwoEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:176
Scalar yPlusNominal() const
Returns the nominal dimensionless wall distance .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:180
Scalar cMu_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:195
const Scalar cMu() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:160
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:126
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:189
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:221
Scalar wallDistance() const
Return the wall distance of the control volume.
Definition: freeflow/rans/volumevariables.hh:150
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 ccVelocityVector() const
Return the velocity vector at the control volume center.
Definition: freeflow/rans/volumevariables.hh:126
Scalar setDynamicEddyViscosity_(Scalar value)
Sets the dynamic eddy viscosity .
Definition: freeflow/rans/volumevariables.hh:266
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:210
unsigned int elementIdx() const
Return the element Idx of the control volume.
Definition: freeflow/rans/volumevariables.hh:120