From 82ccde3269a33a695ca50db326a35a6866d9b6b8 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 1 Dec 2015 10:07:00 +0000 Subject: [PATCH] TurbulenceModels: Added validate function Moved correctNut call from constructors to the new validate function to avoid problems with construction order and field availability for the calculation of nut. To ensure nut is physical and consistent with the turbulence fields the validate function should be called after the construction of the turbulence model, fvOptions and any other fields that the calculation of nut might depend on. --- .../RAS/buoyantKEpsilon/buoyantKEpsilon.C | 1 - .../RAS/LamBremhorstKE/LamBremhorstKE.C | 8 -------- .../RAS/LienCubicKE/LienCubicKE.C | 8 -------- .../RAS/LienLeschziner/LienLeschziner.C | 8 -------- .../RAS/ShihQuadraticKE/ShihQuadraticKE.C | 8 -------- .../RAS/kkLOmega/kkLOmega.C | 4 ++++ .../RAS/kkLOmega/kkLOmega.H | 4 ++++ .../RAS/qZeta/qZeta.C | 8 -------- .../phaseCompressible/LES/Niceno/NicenoKEqn.C | 3 --- .../LES/SmagorinskyZhang/SmagorinskyZhang.C | 3 --- .../LES/continuousGasKEqn/continuousGasKEqn.C | 1 - .../RAS/LaheyKEpsilon/LaheyKEpsilon.C | 3 --- .../continuousGasKEpsilon.C | 2 -- .../RAS/kOmegaSSTSato/kOmegaSSTSato.C | 2 -- .../DeardorffDiffStress/DeardorffDiffStress.C | 8 -------- .../LES/Smagorinsky/Smagorinsky.C | 8 -------- .../SpalartAllmarasDES/SpalartAllmarasDES.C | 8 -------- .../turbulenceModels/LES/WALE/WALE.C | 8 -------- .../LES/dynamicKEqn/dynamicKEqn.C | 8 -------- .../LES/dynamicLagrangian/dynamicLagrangian.C | 8 -------- .../turbulenceModels/LES/kEqn/kEqn.C | 8 -------- .../turbulenceModels/RAS/LRR/LRR.C | 8 -------- .../RAS/LaunderSharmaKE/LaunderSharmaKE.C | 8 -------- .../RAS/RNGkEpsilon/RNGkEpsilon.C | 8 -------- .../turbulenceModels/RAS/SSG/SSG.C | 8 -------- .../RAS/SpalartAllmaras/SpalartAllmaras.C | 8 -------- .../turbulenceModels/RAS/kEpsilon/kEpsilon.C | 19 ++++++++++--------- .../turbulenceModels/RAS/kOmega/kOmega.C | 8 -------- .../RAS/kOmegaSST/kOmegaSST.C | 8 -------- .../RAS/realizableKE/realizableKE.C | 8 -------- .../turbulenceModels/RAS/v2f/v2f.C | 8 -------- .../ReynoldsStress/ReynoldsStress.C | 7 +++++++ .../ReynoldsStress/ReynoldsStress.H | 4 ++++ .../eddyViscosity/eddyViscosity.C | 7 +++++++ .../eddyViscosity/eddyViscosity.H | 4 ++++ .../turbulenceModels/turbulenceModel.C | 6 +++++- .../turbulenceModels/turbulenceModel.H | 4 ++++ 37 files changed, 49 insertions(+), 193 deletions(-) diff --git a/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C b/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C index 2f7bdb1617..b78dddf279 100644 --- a/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C +++ b/src/TurbulenceModels/compressible/RAS/buoyantKEpsilon/buoyantKEpsilon.C @@ -74,7 +74,6 @@ buoyantKEpsilon::buoyantKEpsilon { if (type == typeName) { - kEpsilon::correctNut(); this->printCoeffs(type); } } diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C index d2417a8530..245a0ff55c 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C @@ -181,14 +181,6 @@ LamBremhorstKE::LamBremhorstKE if (type == typeName) { printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C index 440517134f..cc58aabc78 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C @@ -331,14 +331,6 @@ LienCubicKE::LienCubicKE if (type == typeName) { printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C index 29b5aa0114..0b1ec73202 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C @@ -225,14 +225,6 @@ LienLeschziner::LienLeschziner if (type == typeName) { printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C index 38dc7ab62b..c2d22054c2 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C @@ -223,14 +223,6 @@ ShihQuadraticKE::ShihQuadraticKE if (type == typeName) { printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C index cc59e63e59..58a84fc148 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C @@ -593,6 +593,10 @@ bool kkLOmega::read() } +void kkLOmega::validate() +{} + + void kkLOmega::correct() { eddyViscosity::correct(); diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.H b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.H index 68ba379380..53bd64e7f8 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.H +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.H @@ -301,6 +301,10 @@ public: return epsilon_; } + //- Validate the turbulence fields after construction + // Update turbulence viscosity and other derived fields as requires + virtual void validate(); + //- Solve the turbulence equations and correct the turbulence viscosity virtual void correct(); }; diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/qZeta/qZeta.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/qZeta/qZeta.C index bc57fd4200..44a5c33121 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/qZeta/qZeta.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/qZeta/qZeta.C @@ -208,14 +208,6 @@ qZeta::qZeta if (type == typeName) { printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/phaseCompressible/LES/Niceno/NicenoKEqn.C b/src/TurbulenceModels/phaseCompressible/LES/Niceno/NicenoKEqn.C index 2d3ee8421b..44eb97019b 100644 --- a/src/TurbulenceModels/phaseCompressible/LES/Niceno/NicenoKEqn.C +++ b/src/TurbulenceModels/phaseCompressible/LES/Niceno/NicenoKEqn.C @@ -96,9 +96,6 @@ NicenoKEqn::NicenoKEqn { if (type == typeName) { - // Cannot correct nut yet: construction of the phases is not complete - // correctNut(); - this->printCoeffs(type); } } diff --git a/src/TurbulenceModels/phaseCompressible/LES/SmagorinskyZhang/SmagorinskyZhang.C b/src/TurbulenceModels/phaseCompressible/LES/SmagorinskyZhang/SmagorinskyZhang.C index 4eb3187d95..f7bfe4fbf6 100644 --- a/src/TurbulenceModels/phaseCompressible/LES/SmagorinskyZhang/SmagorinskyZhang.C +++ b/src/TurbulenceModels/phaseCompressible/LES/SmagorinskyZhang/SmagorinskyZhang.C @@ -73,9 +73,6 @@ SmagorinskyZhang::SmagorinskyZhang { if (type == typeName) { - // Cannot correct nut yet: construction of the phases is not complete - // correctNut(); - this->printCoeffs(type); } } diff --git a/src/TurbulenceModels/phaseCompressible/LES/continuousGasKEqn/continuousGasKEqn.C b/src/TurbulenceModels/phaseCompressible/LES/continuousGasKEqn/continuousGasKEqn.C index 6bfec32e68..00e23e7c32 100644 --- a/src/TurbulenceModels/phaseCompressible/LES/continuousGasKEqn/continuousGasKEqn.C +++ b/src/TurbulenceModels/phaseCompressible/LES/continuousGasKEqn/continuousGasKEqn.C @@ -75,7 +75,6 @@ continuousGasKEqn::continuousGasKEqn { if (type == typeName) { - kEqn::correctNut(); this->printCoeffs(type); } } diff --git a/src/TurbulenceModels/phaseCompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C b/src/TurbulenceModels/phaseCompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C index c7d0d22e44..843ecc015d 100644 --- a/src/TurbulenceModels/phaseCompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C +++ b/src/TurbulenceModels/phaseCompressible/RAS/LaheyKEpsilon/LaheyKEpsilon.C @@ -107,9 +107,6 @@ LaheyKEpsilon::LaheyKEpsilon if (type == typeName) { this->printCoeffs(type); - - // Cannot correct nut yet: construction of the phases is not complete - // correctNut(); } } diff --git a/src/TurbulenceModels/phaseCompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C b/src/TurbulenceModels/phaseCompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C index 3f4798e515..86d6a7f334 100644 --- a/src/TurbulenceModels/phaseCompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C +++ b/src/TurbulenceModels/phaseCompressible/RAS/continuousGasKEpsilon/continuousGasKEpsilon.C @@ -89,8 +89,6 @@ continuousGasKEpsilon::continuousGasKEpsilon { if (type == typeName) { - // Cannot correct nut yet: construction of the phases is not complete - // kEpsilon::correctNut(); this->printCoeffs(type); } } diff --git a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C index 7e5114d828..76d7e4d0be 100644 --- a/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C +++ b/src/TurbulenceModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C @@ -76,8 +76,6 @@ kOmegaSSTSato::kOmegaSSTSato { if (type == typeName) { - // Cannot correct nut yet: construction of the phases is not complete - // correctNut(); this->printCoeffs(type); } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/DeardorffDiffStress/DeardorffDiffStress.C b/src/TurbulenceModels/turbulenceModels/LES/DeardorffDiffStress/DeardorffDiffStress.C index 5a00433a34..e958e93324 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/DeardorffDiffStress/DeardorffDiffStress.C +++ b/src/TurbulenceModels/turbulenceModels/LES/DeardorffDiffStress/DeardorffDiffStress.C @@ -112,14 +112,6 @@ DeardorffDiffStress::DeardorffDiffStress { this->printCoeffs(type); this->boundNormalStress(this->R_); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C b/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C index 7de1f91f1e..9827f76063 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C +++ b/src/TurbulenceModels/turbulenceModels/LES/Smagorinsky/Smagorinsky.C @@ -114,14 +114,6 @@ Smagorinsky::Smagorinsky if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C b/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C index fa6ddc86e3..ed5cae80da 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C +++ b/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C @@ -319,14 +319,6 @@ SpalartAllmarasDES::SpalartAllmarasDES if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/WALE/WALE.C b/src/TurbulenceModels/turbulenceModels/LES/WALE/WALE.C index 3879d5fffe..49a353ba1d 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/WALE/WALE.C +++ b/src/TurbulenceModels/turbulenceModels/LES/WALE/WALE.C @@ -144,14 +144,6 @@ WALE::WALE if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/dynamicKEqn/dynamicKEqn.C b/src/TurbulenceModels/turbulenceModels/LES/dynamicKEqn/dynamicKEqn.C index 7fd4000183..ac076991e8 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/dynamicKEqn/dynamicKEqn.C +++ b/src/TurbulenceModels/turbulenceModels/LES/dynamicKEqn/dynamicKEqn.C @@ -186,14 +186,6 @@ dynamicKEqn::dynamicKEqn if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/dynamicLagrangian/dynamicLagrangian.C b/src/TurbulenceModels/turbulenceModels/LES/dynamicLagrangian/dynamicLagrangian.C index 7c5c403fcc..6a6fb02b93 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/dynamicLagrangian/dynamicLagrangian.C +++ b/src/TurbulenceModels/turbulenceModels/LES/dynamicLagrangian/dynamicLagrangian.C @@ -123,14 +123,6 @@ dynamicLagrangian::dynamicLagrangian if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.C b/src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.C index c02556ea03..ef2b2b8535 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.C +++ b/src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.C @@ -114,14 +114,6 @@ kEqn::kEqn if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C b/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C index fe33923d19..2b8be52762 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C @@ -205,14 +205,6 @@ LRR::LRR this->boundNormalStress(this->R_); bound(epsilon_, this->epsilonMin_); k_ = 0.5*tr(this->R_); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/TurbulenceModels/turbulenceModels/RAS/LaunderSharmaKE/LaunderSharmaKE.C index e5ef40222a..d3fca3307b 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/LaunderSharmaKE/LaunderSharmaKE.C @@ -205,14 +205,6 @@ LaunderSharmaKE::LaunderSharmaKE if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C index 18d2224927..1eec3da8a9 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -206,14 +206,6 @@ RNGkEpsilon::RNGkEpsilon if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C b/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C index 34798924b6..9f9cc53464 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C @@ -214,14 +214,6 @@ SSG::SSG this->boundNormalStress(this->R_); bound(epsilon_, this->epsilonMin_); k_ = 0.5*tr(this->R_); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.C b/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.C index 50f9a989f0..a029db7ad3 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.C @@ -256,14 +256,6 @@ SpalartAllmaras::SpalartAllmaras if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C b/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C index 1deb554d1c..75d9a3d1b8 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C @@ -42,6 +42,16 @@ void kEpsilon::correctNut() this->nut_ = Cmu_*sqr(k_)/epsilon_; this->nut_.correctBoundaryConditions(); + // const_cast needed because the operators and functions of fvOptions + // are currently non-const. + fv::optionList& fvOptions = const_cast + ( + this->mesh_.objectRegistry::template + lookupObject("fvOptions") + ); + + fvOptions.correct(this->nut_); + BasicTurbulenceModel::correctNut(); } @@ -189,14 +199,6 @@ kEpsilon::kEpsilon if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } @@ -300,7 +302,6 @@ void kEpsilon::correct() bound(k_, this->kMin_); correctNut(); - fvOptions.correct(nut); } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C b/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C index 4578b5811f..5f5e76c03f 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C @@ -148,14 +148,6 @@ kOmega::kOmega if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSST/kOmegaSST.C b/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSST/kOmegaSST.C index f634aa65be..223492ba88 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSST/kOmegaSST.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSST/kOmegaSST.C @@ -351,14 +351,6 @@ kOmegaSST::kOmegaSST if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C b/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C index c3428a64c9..81212cb410 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C @@ -227,14 +227,6 @@ realizableKE::realizableKE if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.C b/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.C index 95cb209a45..4a76ee1870 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.C @@ -239,14 +239,6 @@ v2f::v2f if (type == typeName) { this->printCoeffs(type); - - // Correct nut for single-phase solvers only. - // For multiphase solvers the phase construction is not complete - // at this point. - if (isType(alpha)) - { - correctNut(); - } } } diff --git a/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.C b/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.C index 63dc8d581e..55001003da 100644 --- a/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.C +++ b/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.C @@ -295,6 +295,13 @@ Foam::ReynoldsStress::divDevRhoReff } +template +void Foam::ReynoldsStress::validate() +{ + correctNut(); +} + + template void Foam::ReynoldsStress::correct() { diff --git a/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.H b/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.H index b27468b5a3..0beb0f5885 100644 --- a/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.H +++ b/src/TurbulenceModels/turbulenceModels/ReynoldsStress/ReynoldsStress.H @@ -140,6 +140,10 @@ public: volVectorField& U ) const; + //- Validate the turbulence fields after construction + // Update turbulence viscosity and other derived fields as requires + virtual void validate(); + //- Solve the turbulence equations and correct the turbulence viscosity virtual void correct() = 0; }; diff --git a/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.C b/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.C index 641f012bee..82a0da7719 100644 --- a/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.C +++ b/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.C @@ -121,6 +121,13 @@ Foam::eddyViscosity::R() const } +template +void Foam::eddyViscosity::validate() +{ + correctNut(); +} + + template void Foam::eddyViscosity::correct() { diff --git a/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.H b/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.H index e46543864b..3a26fac199 100644 --- a/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.H +++ b/src/TurbulenceModels/turbulenceModels/eddyViscosity/eddyViscosity.H @@ -127,6 +127,10 @@ public: //- Return the Reynolds stress tensor virtual tmp R() const; + //- Validate the turbulence fields after construction + // Update turbulence viscosity and other derived fields as requires + virtual void validate(); + //- Solve the turbulence equations and correct the turbulence viscosity virtual void correct() = 0; }; diff --git a/src/TurbulenceModels/turbulenceModels/turbulenceModel.C b/src/TurbulenceModels/turbulenceModels/turbulenceModel.C index 0cee043768..58a1c34ebd 100644 --- a/src/TurbulenceModels/turbulenceModels/turbulenceModel.C +++ b/src/TurbulenceModels/turbulenceModels/turbulenceModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,6 +84,10 @@ bool Foam::turbulenceModel::read() } +void Foam::turbulenceModel::validate() +{} + + void Foam::turbulenceModel::correct() { if (mesh_.changing()) diff --git a/src/TurbulenceModels/turbulenceModels/turbulenceModel.H b/src/TurbulenceModels/turbulenceModels/turbulenceModel.H index a634cedcbe..43b848b23f 100644 --- a/src/TurbulenceModels/turbulenceModels/turbulenceModel.H +++ b/src/TurbulenceModels/turbulenceModels/turbulenceModel.H @@ -205,6 +205,10 @@ public: //- Return the Reynolds stress tensor virtual tmp R() const = 0; + //- Validate the turbulence fields after construction + // Update derived fields as required + virtual void validate(); + //- Solve the turbulence equations and correct the turbulence viscosity virtual void correct() = 0; };