version 3.8
freeflow/rans/twoeq/sst/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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_SST_VOLUME_VARIABLES_HH
14#define DUMUX_SST_VOLUME_VARIABLES_HH
15
20
21namespace Dumux {
22
27template <class Traits, class NSVolumeVariables>
29: public RANSVolumeVariables<Traits, NSVolumeVariables>
30{
32
33 using Scalar = typename Traits::PrimaryVariables::value_type;
34 using DimVector = Dune::FieldVector<Scalar, Traits::ModelTraits::dim()>;
35
36public:
38 using Indices = typename Traits::ModelTraits::Indices;
39
48 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
49 void update(const ElementSolution &elemSol,
50 const Problem &problem,
51 const Element &element,
52 const SubControlVolume& scv)
53 {
54 RANSParentType::updateNavierStokesVolVars(elemSol, problem, element, scv);
55 updateRANSProperties(elemSol, problem, element, scv);
56 }
57
68 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
69 void updateRANSProperties(const ElementSolution &elemSol,
70 const Problem &problem,
71 const Element &element,
72 const SubControlVolume& scv)
73 {
74 RANSParentType::updateRANSProperties(elemSol, problem, element, scv);
75
76 turbulentKineticEnergy_ = elemSol[0][Indices::turbulentKineticEnergyIdx];
77 dissipation_ = elemSol[0][Indices::dissipationIdx];
78
79 storedDissipation_ = problem.storedDissipation(RANSParentType::elementIdx());
80 storedTurbulentKineticEnergy_ = problem.storedTurbulentKineticEnergy(RANSParentType::elementIdx());
81
82 storedDissipationGradient_ = problem.storedDissipationGradient(RANSParentType::elementIdx());
83 storedTurbulentKineticEnergyGradient_ = problem.storedTurbulentKineticEnergyGradient(RANSParentType::elementIdx());
84
85 stressTensorScalarProduct_ = problem.stressTensorScalarProduct(RANSParentType::elementIdx());
86 vorticityTensorScalarProduct_ = problem.vorticityTensorScalarProduct(RANSParentType::elementIdx());
87 wallDistance_ = problem.wallDistance(RANSParentType::elementIdx());
88 kinematicViscosity_ = problem.kinematicViscosity(RANSParentType::elementIdx());
89
90 if (problem.useStoredEddyViscosity())
91 RANSParentType::setDynamicEddyViscosity_(problem.storedDynamicEddyViscosity(RANSParentType::elementIdx()));
92 else
94
97 }
98
102 template<class Problem>
103 Scalar calculateEddyViscosity(const Problem& problem)
104 {
105 using std::sqrt;
106 using std::max;
107
108 if(problem.sstModelVersion() == SSTModel::BSL)
110 else if(problem.sstModelVersion() == SSTModel::SST)
111 {
112 const Scalar dividend = a1SST() * turbulentKineticEnergy();
113 const Scalar possibleMax1 = a1SST()*dissipation();
114 const Scalar possibleMax2 = absoluteValueVorticity() * F2();
115 const Scalar divisor = std::max(possibleMax1,possibleMax2);
116 return dividend / divisor * RANSParentType::density();
117 }
118 else
119 DUNE_THROW(Dune::NotImplemented, "\nThis SST Model is not implemented.\n");
120 }
121
122
125 { return turbulentKineticEnergy_; }
126
128 Scalar dissipation() const
129 { return dissipation_; }
130
134
136 Scalar storedDissipation() const
137 { return storedDissipation_; }
138
142
146
150
154
156 Scalar kinematicViscosity() const
157 { return kinematicViscosity_; }
158
159 Scalar wallDistance() const
160 { return wallDistance_; }
161
163 const Scalar betaOmega() const
164 { return 0.0708; }
165
167 const Scalar alpha() const
168 { return 0.52; }
169
171 const Scalar sigmaK() const
172 { return 0.6; }
173
175 const Scalar sigmaOmega() const
176 { return 0.5; }
177
179 const Scalar betaK() const
180 { return 0.09; }
181
183 const Scalar sigmaK1BSL() const
184 { return 0.5; }
185
187 const Scalar sigmaK1SST() const
188 { return 0.85; }
189
191 const Scalar sigmaK2() const
192 { return 1.0; }
193
195 const Scalar sigmaOmega1BSL() const
196 { return 0.5; }
197
199 const Scalar sigmaOmega1SST() const
200 { return 0.5; }
201
203 const Scalar sigmaOmega2() const
204 { return 0.856; }
205
207 const Scalar beta1BSL() const
208 { return 0.0750; }
209
211 const Scalar beta1SST() const
212 { return 0.0750; }
213
215 const Scalar beta2() const
216 { return 0.0820; }
217
219 const Scalar betaStar1BSL() const
220 { return 0.09; }
221
223 const Scalar betaStar1SST() const
224 { return 0.09; }
225
227 const Scalar betaStar2() const
228 { return 0.09; }
229
231 const Scalar kappa1BSL() const
232 { return 0.41; }
233
235 const Scalar kappa1SST() const
236 { return 0.41; }
237
239 const Scalar kappa2() const
240 { return 0.41; }
241
243 const Scalar gamma1BSL() const
244 { return (beta1BSL()/betaStar1BSL()) - ((sigmaOmega1BSL()*kappa1BSL()*kappa1BSL())/(std::sqrt(betaStar1BSL()))); }
245
247 const Scalar gamma1SST() const
248 { return (beta1SST()/betaStar1SST()) - ((sigmaOmega1SST()*kappa1SST()*kappa1SST())/(std::sqrt(betaStar1SST()))); }
249
251 const Scalar gamma2() const
252 { return (beta2()/betaStar2()) - ((sigmaOmega2()*kappa2()*kappa2())/(std::sqrt(betaStar2()))); }
253
255 const Scalar a1SST() const
256 { return 0.31; }
257
260 { return std::sqrt(2.0 * vorticityTensorScalarProduct()); }
261
263 Scalar F1() const
264 {
265 Scalar gradientProduct = 0.0;
266 for (unsigned int i = 0; i < Traits::ModelTraits::dim(); ++i){
268
269 Scalar positiveCrossDiffusion = 2.0 * RANSParentType::density() * sigmaOmega2() / storedDissipation() * gradientProduct;
270 positiveCrossDiffusion = std::max(positiveCrossDiffusion, 1e-20);
271
272 const Scalar possibleMin2 = (4.0 * RANSParentType::density() * sigmaOmega2() * storedTurbulentKineticEnergy())
273 / (positiveCrossDiffusion * wallDistance() * wallDistance());
274
275 const Scalar possibleMax1 = (std::sqrt(storedTurbulentKineticEnergy())) / (0.09 * storedDissipation() * wallDistance());
276 const Scalar possibleMax2 = (500.00 * kinematicViscosity()) / (wallDistance() * wallDistance() * storedDissipation());
277 const Scalar possibleMin1 = std::max(possibleMax1, possibleMax2);
278
279 const Scalar argument = std::min(possibleMin1,possibleMin2);
280
281 return tanh(argument * argument * argument * argument);
282 }
283
284
286 Scalar F2() const
287 {
288 const Scalar possibleMax1 = 2.0 * (std::sqrt(storedTurbulentKineticEnergy())) / (0.09 * storedDissipation() * wallDistance());
289 const Scalar possibleMax2 = (500.0 * kinematicViscosity()) / (wallDistance() * wallDistance() * storedDissipation());
290 const Scalar argument = std::max(possibleMax1, possibleMax2);
291
292 return tanh(argument * argument);
293 }
294
295 //------------------------Constants for SST--------------------------------
297 const Scalar sigmaKSST() const
298 { return F1()*sigmaK1SST() + (1-F1())*sigmaK2(); }
299
301 const Scalar sigmaOmegaSST() const
302 { return F1()*sigmaOmega1SST() + (1-F1())*sigmaOmega2(); }
303
305 const Scalar betaSST() const
306 { return F1()*beta1SST() + (1-F1())*beta2(); }
307
309 const Scalar betaStarSST() const
310 { return F1()*betaStar1SST() + (1-F1())*betaStar2(); }
311
313 const Scalar kappaSST() const
314 { return F1()*kappa1SST() + (1-F1())*kappa2(); }
315
317 const Scalar gammaSST() const
318 { return F1()*gamma1SST() + (1-F1())*gamma2(); }
319
320
321
322 //------------------------Constants for BSL--------------------------------
324 const Scalar sigmaKBSL() const
325 { return F1()*sigmaK1BSL() + (1-F1())*sigmaK2(); }
326
328 const Scalar sigmaOmegaBSL() const
329 { return F1()*sigmaOmega1BSL() + (1-F1())*sigmaOmega2(); }
330
332 const Scalar betaBSL() const
333 { return F1()*beta1BSL() + (1-F1())*beta2(); }
334
336 const Scalar betaStarBSL() const
337 { return F1()*betaStar1BSL() + (1-F1())*betaStar2(); }
338
340 const Scalar kappaBSL() const
341 { return F1()*kappa1BSL() + (1-F1())*kappa2(); }
342
344 const Scalar gammaBSL() const
345 { return F1()*gamma1BSL() + (1-F1())*gamma2(); }
346
347
348protected:
349 Scalar betaOmega_ = 0.0;
350
351 Scalar dissipation_ = 0.0;
352 Scalar storedDissipation_ = 0.0;
353 DimVector storedDissipationGradient_ = DimVector(0.0);
356 DimVector storedTurbulentKineticEnergyGradient_ = DimVector(0.0);
357
360 Scalar wallDistance_ = 0.0;
362};
363}
364
365#endif
Volume variables for the isothermal single-phase Reynolds-Averaged Navier-Stokes models.
Definition: freeflow/rans/volumevariables.hh:30
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
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:53
Scalar setDynamicEddyViscosity_(Scalar value)
Sets the dynamic eddy viscosity .
Definition: freeflow/rans/volumevariables.hh:254
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:73
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:108
Volume variables for the isothermal single-phase SST 2-Eq model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:30
const Scalar kappa1SST() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:235
Scalar storedDissipation_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:352
const Scalar sigmaK1SST() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:187
Scalar storedTurbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:132
const Scalar gamma1SST() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:247
const Scalar sigmaOmega1SST() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:199
const Scalar gamma1BSL() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:243
const Scalar gammaBSL() const
Returns the constant for the BSL-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:344
const Scalar sigmaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:175
Scalar wallDistance() const
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:159
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/sst/volumevariables.hh:69
const Scalar beta2() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:215
Scalar absoluteValueVorticity() const
Returns the absolute value of the vorticity .
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:259
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:38
Scalar vorticityTensorScalarProduct_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:359
const Scalar sigmaOmegaSST() const
Returns the constant for the SST-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:301
const Scalar sigmaK2() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:191
const Scalar betaStar1BSL() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:219
const Scalar betaStarSST() const
Returns the constant for the SST-model. is the same for all models.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:309
Scalar F1() const
Returns the transformation function for the constants of the BSL- and SST-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:263
const Scalar kappa1BSL() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:231
Scalar dissipation_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:351
const Scalar betaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:179
DimVector storedTurbulentKineticEnergyGradient() const
Returns the gradient of the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:140
const Scalar betaBSL() const
Returns the constant for the BSL-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:332
const Scalar kappa2() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:239
const Scalar betaSST() const
Returns the constant for the SST-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:305
const Scalar betaStar1SST() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:223
Scalar F2() const
Returns the transformation function for the eddy viscosity of the SST-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:286
const Scalar betaStar2() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:227
Scalar storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:355
DimVector storedDissipationGradient() const
Returns the gradient of the effective dissipation .
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:144
Scalar calculateEddyViscosity(const Problem &problem)
Returns the dynamic eddy viscosity for the SST-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:103
const Scalar kappaSST() const
Returns the constant for the SST-model. is the same for all models.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:313
Scalar turbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:124
const Scalar betaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:163
Scalar vorticityTensorScalarProduct() const
Returns the scalar product of the vorticity tensor.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:152
const Scalar sigmaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:171
const Scalar beta1BSL() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:207
Scalar betaOmega_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:349
const Scalar sigmaKBSL() const
Returns the constant for the BSL-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:324
Scalar kinematicViscosity() const
Returns the kinematic viscosity.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:156
Scalar dissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:128
Scalar kinematicViscosity_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:361
Scalar stressTensorScalarProduct() const
Returns the scalar product of the stress tensor.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:148
Scalar turbulentKineticEnergy_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:354
const Scalar a1SST() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:255
const Scalar sigmaK1BSL() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:183
Scalar storedDissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:136
const Scalar betaStarBSL() const
Returns the constant for the BSL-model. is the same for all models.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:336
Scalar stressTensorScalarProduct_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:358
const Scalar sigmaOmegaBSL() const
Returns the constant for the BSL-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:328
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/sst/volumevariables.hh:49
const Scalar sigmaOmega1BSL() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:195
const Scalar gammaSST() const
Returns the constant for the SST-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:317
DimVector storedTurbulentKineticEnergyGradient_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:356
const Scalar gamma2() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:251
const Scalar sigmaOmega2() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:203
const Scalar sigmaKSST() const
Returns the constant for the SST-model.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:297
const Scalar alpha() const
Returns the value.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:167
const Scalar kappaBSL() const
Returns the constant for the BSL-model. is the same for all models.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:340
const Scalar beta1SST() const
Returns the constant.
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:211
DimVector storedDissipationGradient_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:353
Scalar wallDistance_
Definition: freeflow/rans/twoeq/sst/volumevariables.hh:360
Defines all properties used in Dumux.
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The available free flow turbulence models in Dumux.