From 71493091ded1c2a1235262a34deee21a44ba5c49 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 1 Dec 2023 16:30:01 +0000 Subject: [PATCH] wallDist: Changed from TopoChangeableMeshObject to DeletableMeshObject The nearWallDist MeshObject is now deleted on mesh-change rather than updated which is more efficient for cases with multiple mesh changes, e.g. motion, stitching and mapping by avoiding unnecessary updates. As a consequence of this change the wallDist::y() volScalarField reference should not be cached across mesh changes so the turbulence models now obtain the y field as required from the new momentumTransportModel::y() function, the original near-wall distance function is now named momentumTransportModel::yb() to clarify that it is the wall distance of the boundary cells. --- ...allBoilingWallFunctionFvPatchScalarField.C | 2 +- .../RAS/LamBremhorstKE/LamBremhorstKE.C | 6 +- .../RAS/LamBremhorstKE/LamBremhorstKE.H | 5 -- .../RAS/LienCubicKE/LienCubicKE.C | 10 ++-- .../RAS/LienCubicKE/LienCubicKE.H | 5 -- .../RAS/LienLeschziner/LienLeschziner.C | 10 ++-- .../RAS/LienLeschziner/LienLeschziner.H | 5 -- .../incompressible/RAS/kkLOmega/kkLOmega.C | 13 +++-- .../incompressible/RAS/kkLOmega/kkLOmega.H | 5 -- .../Base/kOmegaSST/kOmegaSSTBase.C | 14 ++--- .../Base/kOmegaSST/kOmegaSSTBase.H | 5 -- .../SpalartAllmarasDDES/SpalartAllmarasDDES.C | 8 +-- .../SpalartAllmarasDES/SpalartAllmarasDES.C | 10 ++-- .../SpalartAllmarasDES/SpalartAllmarasDES.H | 7 +-- .../SpalartAllmarasIDDES.C | 8 +-- .../momentumTransportModels/RAS/LRR/LRR.C | 8 +-- .../RAS/SpalartAllmaras/SpalartAllmaras.C | 16 ++--- .../RAS/SpalartAllmaras/SpalartAllmaras.H | 7 +-- .../RAS/kOmegaSSTLM/kOmegaSSTLM.C | 8 +-- .../epsilonWallFunctionFvPatchScalarField.C | 4 +- .../fWallFunctionFvPatchScalarField.C | 2 +- .../kLowReWallFunctionFvPatchScalarField.C | 2 +- .../nutLowReWallFunctionFvPatchScalarField.C | 2 +- .../nutURoughWallFunctionFvPatchScalarField.C | 4 +- ...tUSpaldingWallFunctionFvPatchScalarField.C | 4 +- .../nutUWallFunctionFvPatchScalarField.C | 2 +- .../nutkRoughWallFunctionFvPatchScalarField.C | 2 +- .../nutkWallFunctionFvPatchScalarField.C | 4 +- .../omegaWallFunctionFvPatchScalarField.C | 4 +- .../v2WallFunctionFvPatchScalarField.C | 2 +- .../momentumTransportModel.C | 9 ++- .../momentumTransportModel.H | 5 +- .../RAS/kOmegaSSTSato/kOmegaSSTSato.C | 4 +- ...ayatillekeWallFunctionFvPatchScalarField.C | 2 +- ...tkAtmRoughWallFunctionFvPatchScalarField.C | 2 +- .../fvMesh/wallDist/wallDist/wallDist.C | 58 ++++--------------- .../fvMesh/wallDist/wallDist/wallDist.H | 16 +---- 37 files changed, 101 insertions(+), 179 deletions(-) diff --git a/applications/modules/multiphaseEuler/thermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/modules/multiphaseEuler/thermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index be76dfd623..46490c51e6 100644 --- a/applications/modules/multiphaseEuler/thermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/modules/multiphaseEuler/thermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -244,7 +244,7 @@ struct alphatWallBoilingWallFunctionFvPatchScalarField::boilingLiquidProperties ( pow025(nutw.Cmu()) *sqrt(ttm.momentumTransport().k()().boundaryField()[patchi()]) - *ttm.momentumTransport().y()[patchi()] + *ttm.momentumTransport().yb()[patchi()] /nuw ), P diff --git a/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C b/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C index 93e74118e2..7de529042e 100644 --- a/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C +++ b/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C @@ -64,7 +64,7 @@ tmp LamBremhorstKE::Rt() const tmp LamBremhorstKE::fMu(const volScalarField& Rt) const { - tmp Ry(sqrt(k_)*y_/nu()); + tmp Ry(sqrt(k_)*y()/nu()); return sqr(scalar(1) - exp(-0.0165*Ry))*(scalar(1) + 20.5/(Rt + small)); } @@ -181,9 +181,7 @@ LamBremhorstKE::LamBremhorstKE IOobject::AUTO_WRITE ), mesh_ - ), - - y_(wallDist::New(mesh_).y()) + ) { bound(k_, kMin_); bound(epsilon_, epsilonMin_); diff --git a/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H b/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H index 50ac9e1109..d49294a1d5 100644 --- a/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H +++ b/src/MomentumTransportModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H @@ -84,11 +84,6 @@ protected: volScalarField k_; volScalarField epsilon_; - //- Wall distance - // Note: different to wall distance in parent RASModel - // which is for near-wall cells only - const volScalarField& y_; - // Protected Member Functions diff --git a/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.C b/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.C index 397cbfbf53..a88d96e65d 100644 --- a/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.C +++ b/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.C @@ -58,7 +58,7 @@ addToRunTimeSelectionTable tmp LienCubicKE::fMu() const { - const volScalarField yStar(sqrt(k_)*y_/nu()); + const volScalarField yStar(sqrt(k_)*y()/nu()); return (scalar(1) - exp(-Anu_*yStar)) @@ -76,10 +76,10 @@ tmp LienCubicKE::f2() const tmp LienCubicKE::E(const volScalarField& f2) const { - const volScalarField yStar(sqrt(k_)*y_/nu()); + const volScalarField yStar(sqrt(k_)*y()/nu()); const volScalarField le ( - kappa_*y_/(scalar(1) + (2*kappa_/(pow(Cmu_, 0.75))/(yStar + small))) + kappa_*y()/(scalar(1) + (2*kappa_/(pow(Cmu_, 0.75))/(yStar + small))) ); return @@ -331,9 +331,7 @@ LienCubicKE::LienCubicKE IOobject::AUTO_WRITE ), mesh_ - ), - - y_(wallDist::New(mesh_).y()) + ) { bound(k_, kMin_); bound(epsilon_, epsilonMin_); diff --git a/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.H b/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.H index 00ddab84fe..0a131b5c5b 100644 --- a/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.H +++ b/src/MomentumTransportModels/incompressible/RAS/LienCubicKE/LienCubicKE.H @@ -109,11 +109,6 @@ protected: volScalarField k_; volScalarField epsilon_; - //- Wall distance - // Note: different to wall distance in parent RASModel - // which is for near-wall cells only - const volScalarField& y_; - // Protected Member Functions diff --git a/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.C b/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.C index a6fa426c05..a0a2810aed 100644 --- a/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.C +++ b/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.C @@ -58,7 +58,7 @@ addToRunTimeSelectionTable tmp LienLeschziner::fMu() const { - const volScalarField yStar(sqrt(k_)*y_/nu()); + const volScalarField yStar(sqrt(k_)*y()/nu()); return (scalar(1) - exp(-Anu_*yStar)) @@ -76,10 +76,10 @@ tmp LienLeschziner::f2() const tmp LienLeschziner::E(const volScalarField& f2) const { - const volScalarField yStar(sqrt(k_)*y_/nu()); + const volScalarField yStar(sqrt(k_)*y()/nu()); const volScalarField le ( - kappa_*y_*((scalar(1) + small) - exp(-Aeps_*yStar)) + kappa_*y()*((scalar(1) + small) - exp(-Aeps_*yStar)) ); return @@ -225,9 +225,7 @@ LienLeschziner::LienLeschziner IOobject::AUTO_WRITE ), mesh_ - ), - - y_(wallDist::New(mesh_).y()) + ) { bound(k_, kMin_); bound(epsilon_, epsilonMin_); diff --git a/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.H b/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.H index 964526c6b9..aae5ef4f31 100644 --- a/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.H +++ b/src/MomentumTransportModels/incompressible/RAS/LienLeschziner/LienLeschziner.H @@ -99,11 +99,6 @@ protected: volScalarField k_; volScalarField epsilon_; - //- Wall distance - // Note: different to wall distance in parent RASModel - // which is for near-wall cells only - const volScalarField& y_; - // Protected Member Functions diff --git a/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.C b/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.C index 773a2f391d..b7daa703f4 100644 --- a/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.C +++ b/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.C @@ -537,8 +537,7 @@ kkLOmega::kkLOmega mesh_ ), kt_*omega_ + D(kl_) + D(kt_) - ), - y_(wallDist::New(mesh_).y()) + ) { bound(kt_, kMin_); bound(kl_, kMin_); @@ -612,9 +611,11 @@ void kkLOmega::correct() return; } + volScalarField y(this->y()); + const volScalarField lambdaT(sqrt(kt_)/(omega_ + omegaMin_)); - const volScalarField lambdaEff(min(Clambda_*y_, lambdaT)); + const volScalarField lambdaEff(min(Clambda_*y, lambdaT)); const volScalarField fw ( @@ -644,7 +645,7 @@ void kkLOmega::correct() const volScalarField Pkt(this->GName(), nuts*S2); const volScalarField ktL(kt_ - ktS); - const volScalarField ReOmega(sqr(y_)*Omega/nu()); + const volScalarField ReOmega(sqr(y)*Omega/nu()); const volScalarField nutl ( @@ -674,7 +675,7 @@ void kkLOmega::correct() /(fw + fwMin) ); - const volScalarField fNatCrit(1 - exp(-Cnc_*sqrt(kl_)*y_/nu())); + const volScalarField fNatCrit(1 - exp(-Cnc_*sqrt(kl_)*y/nu())); // Natural source term divided by kl_ const volScalarField Rnat @@ -701,7 +702,7 @@ void kkLOmega::correct() - fvm::Sp(Cw2_*sqr(fw)*omega_, omega_) + ( Cw3_*fOmega(lambdaEff, lambdaT)*alphaTEff*sqr(fw)*sqrt(kt_) - )()()/pow3(y_()) + )()()/pow3(y()) ); omegaEqn.ref().relax(); diff --git a/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.H b/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.H index 0d47f37553..344a381177 100644 --- a/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.H +++ b/src/MomentumTransportModels/incompressible/RAS/kkLOmega/kkLOmega.H @@ -200,11 +200,6 @@ protected: volScalarField omega_; volScalarField epsilon_; - //- Wall distance - // Note: different to wall distance in parent RASModel - // which is for near-wall cells only - const volScalarField& y_; - // Protected Member Functions diff --git a/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.C b/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.C index 8505a386b2..e711cd6492 100644 --- a/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.C +++ b/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.C @@ -55,10 +55,10 @@ kOmegaSST::kOmegaSST::F1 ( max ( - (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*this->nu()/(sqr(y_)*omega_) + (scalar(1)/betaStar_)*sqrt(k_)/(omega_*this->y()), + scalar(500)*this->nu()/(sqr(this->y())*omega_) ), - (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_)) + (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(this->y())) ), scalar(10) ); @@ -75,8 +75,8 @@ F2() const ( max ( - (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*this->nu()/(sqr(y_)*omega_) + (scalar(2)/betaStar_)*sqrt(k_)/(omega_*this->y()), + scalar(500)*this->nu()/(sqr(this->y())*omega_) ), scalar(100) ); @@ -91,7 +91,7 @@ F3() const { tmp arg3 = min ( - 150*this->nu()/(omega_*sqr(y_)), + 150*this->nu()/(omega_*sqr(this->y())), scalar(10) ); @@ -354,8 +354,6 @@ kOmegaSST::kOmegaSST ) ), - y_(wallDist::New(this->mesh_).y()), - k_ ( IOobject diff --git a/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.H b/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.H index daa51543ce..75976ab577 100644 --- a/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.H +++ b/src/MomentumTransportModels/momentumTransportModels/Base/kOmegaSST/kOmegaSSTBase.H @@ -143,11 +143,6 @@ protected: // Fields - //- Wall distance - // Note: different to wall distance in parent RASModel - // which is for near-wall cells only - const volScalarField& y_; - volScalarField k_; volScalarField omega_; diff --git a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C index 80ae4378b6..d64afabb32 100644 --- a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C +++ b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,7 @@ SpalartAllmarasDDES::rd magGradU, dimensionedScalar(magGradU.dimensions(), small) ) - *sqr(this->kappa_*this->y_()) + *sqr(this->kappa_*this->y()()) ), scalar(10) ) @@ -92,11 +92,11 @@ SpalartAllmarasDDES::dTilda typedName("dTilda"), max ( - this->y_ + this->y() - fd(mag(gradU)) *max ( - this->y_() - this->CDES_*this->delta()(), + this->y()() - this->CDES_*this->delta()(), dimensionedScalar(dimLength, 0) ), dimensionedScalar(dimLength, small) diff --git a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C index c73c3d82fd..9e1e3831e0 100644 --- a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C +++ b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -175,7 +175,7 @@ SpalartAllmarasDES::dTilda return volScalarField::Internal::New ( typedName("dTilda"), - min(CDES_*this->delta()(), y_) + min(CDES_*this->delta()(), this->y()) ); } @@ -191,7 +191,7 @@ void SpalartAllmarasDES::cacheLESRegion volScalarField::Internal::New ( typedName("LESRegion"), - neg(dTilda - y_()) + neg(dTilda - this->y()()) ); } } @@ -344,9 +344,7 @@ SpalartAllmarasDES::SpalartAllmarasDES IOobject::AUTO_WRITE ), this->mesh_ - ), - - y_(wallDist::New(this->mesh_).y()) + ) { if (type == typeName) { diff --git a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.H b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.H index e68c53c5e1..1f28310236 100644 --- a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.H +++ b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,11 +85,6 @@ protected: volScalarField nuTilda_; - //- Wall distance - // Note: different to wall distance in parent RASModel - // which is for near-wall cells only - const volScalarField& y_; - // Protected Member Functions diff --git a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C index 00d4f025de..51095950ac 100644 --- a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C +++ b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,7 @@ SpalartAllmarasIDDES::IDDESalpha() const return volScalarField::Internal::New ( typedName("alpha"), - max(0.25 - this->y_()/IDDESDelta_.hmax(), scalar(-5)) + max(0.25 - this->y()()/IDDESDelta_.hmax(), scalar(-5)) ); } @@ -95,7 +95,7 @@ SpalartAllmarasIDDES::rd ( magGradU, dimensionedScalar(magGradU.dimensions(), small) - )*sqr(this->kappa_*this->y_()) + )*sqr(this->kappa_*this->y()()) ), scalar(10) ) @@ -205,7 +205,7 @@ SpalartAllmarasIDDES::dTilda max ( dimensionedScalar(dimLength, small), - fHyb*(1 + fRestore*Psi)*this->y_ + fHyb*(1 + fRestore*Psi)*this->y() + (1 - fHyb)*this->CDES_*Psi*this->delta() ) ); diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/LRR/LRR.C b/src/MomentumTransportModels/momentumTransportModels/RAS/LRR/LRR.C index 24bdba27b7..172c16d8c4 100644 --- a/src/MomentumTransportModels/momentumTransportModels/RAS/LRR/LRR.C +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/LRR/LRR.C @@ -365,8 +365,8 @@ void LRR::correct() // Optionally add wall-refection term if (wallReflection_) { - const volVectorField& n_(wallDist::New(this->mesh_).n()); - const volScalarField& y_(wallDist::New(this->mesh_).y()); + const volVectorField& n(wallDist::New(this->mesh_).n()); + const volScalarField& y(wallDist::New(this->mesh_).y()); const volSymmTensorField reflect ( @@ -374,8 +374,8 @@ void LRR::correct() ); REqn.ref() += - ((3*pow(Cmu_, 0.75)/kappa_)*(alpha*rho*sqrt(k_)/y_)) - *dev(symm((n_ & reflect)*n_)); + ((3*pow(Cmu_, 0.75)/kappa_)*(alpha*rho*sqrt(k_)/y)) + *dev(symm((n & reflect)*n)); } REqn.ref().relax(); diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.C b/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.C index de95ed388c..1cf121117c 100644 --- a/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.C +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,7 +92,7 @@ SpalartAllmaras::Stilda max ( Omega - + fv2(chi, fv1)*nuTilda_/sqr(kappa_*y_), + + fv2(chi, fv1)*nuTilda_/sqr(kappa_*this->y()()), Cs_*Omega ) ) @@ -118,7 +118,7 @@ tmp SpalartAllmaras::fw Stilda, dimensionedScalar(Stilda.dimensions(), small) ) - *sqr(kappa_*y_) + *sqr(kappa_*this->y()()) ), scalar(10.0) ) @@ -264,9 +264,7 @@ SpalartAllmaras::SpalartAllmaras IOobject::AUTO_WRITE ), this->mesh_ - ), - - y_(wallDist::New(this->mesh_).y()) + ) { if (type == typeName) { @@ -395,7 +393,11 @@ void SpalartAllmaras::correct() - Cb2_/sigmaNut_*alpha*rho*magSqr(fvc::grad(nuTilda_)) == Cb1_*alpha()*rho()*Stilda*nuTilda_() - - fvm::Sp(Cw1_*alpha()*rho()*fw(Stilda)*nuTilda_()/sqr(y_), nuTilda_) + - fvm::Sp + ( + Cw1_*alpha()*rho()*fw(Stilda)*nuTilda_()/sqr(this->y()()), + nuTilda_ + ) + fvModels.source(alpha, rho, nuTilda_) ); diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.H b/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.H index 3b376fed5b..ce1d6949dc 100644 --- a/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.H +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/SpalartAllmaras/SpalartAllmaras.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,11 +110,6 @@ protected: volScalarField nuTilda_; - //- Wall distance - // Note: different to wall distance in parent RASModel - // which is for near-wall cells only - const volScalarField::Internal& y_; - // Protected Member Functions diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/kOmegaSSTLM/kOmegaSSTLM.C b/src/MomentumTransportModels/momentumTransportModels/RAS/kOmegaSSTLM/kOmegaSSTLM.C index ffe39f2999..89d7e12d7d 100644 --- a/src/MomentumTransportModels/momentumTransportModels/RAS/kOmegaSSTLM/kOmegaSSTLM.C +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/kOmegaSSTLM/kOmegaSSTLM.C @@ -40,7 +40,7 @@ tmp kOmegaSSTLM::F1 const volScalarField& CDkOmega ) const { - const volScalarField Ry(this->y_*sqrt(this->k_)/this->nu()); + const volScalarField Ry(this->y()*sqrt(this->k_)/this->nu()); const volScalarField F3(exp(-pow(Ry/120.0, 8))); return max(kOmegaSST::F1(CDkOmega), F3); @@ -80,7 +80,7 @@ tmp kOmegaSSTLM::Fthetat ) const { const volScalarField::Internal& omega = this->omega_(); - const volScalarField::Internal& y = this->y_(); + const volScalarField::Internal& y = this->y()(); const volScalarField::Internal delta(375*Omega*nu*ReThetat_()*y/sqr(Us)); const volScalarField::Internal ReOmega(sqr(y)*omega/nu); @@ -156,7 +156,7 @@ tmp kOmegaSSTLM::Flength volScalarField::Internal& Flength = tFlength.ref(); const volScalarField::Internal& omega = this->omega_(); - const volScalarField::Internal& y = this->y_(); + const volScalarField::Internal& y = this->y()(); forAll(ReThetat_, celli) { @@ -496,7 +496,7 @@ void kOmegaSSTLM::correctReThetatGammaInt() const volScalarField& omega = this->omega_; const tmp tnu = this->nu(); const volScalarField::Internal& nu = tnu()(); - const volScalarField::Internal& y = this->y_(); + const volScalarField::Internal& y = this->y()(); const Foam::fvModels& fvModels(Foam::fvModels::New(this->mesh_)); const Foam::fvConstraints& fvConstraints ( diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 2ca93d843e..649b12d4f2 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -149,7 +149,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculateTurbulenceFields // Ask for the wall distance in advance. Some processes may not have any // corner weights, so we cannot allow functions inside the if statements // below to trigger the wall distance calculation. - turbModel.y(); + turbModel.yb(); // Accumulate all of the G and epsilon contributions forAll(cornerWeights_, patchi) @@ -191,7 +191,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate const nutWallFunctionFvPatchScalarField& nutw = nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C index 7fce412962..591fc57558 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -90,7 +90,7 @@ void fWallFunctionFvPatchScalarField::updateCoeffs() const nutWallFunctionFvPatchScalarField& nutw = nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C index 3aad77ec05..8be1ac93e1 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -88,7 +88,7 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs() const nutWallFunctionFvPatchScalarField& nutw = nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C index 2876ea883b..a59cfbf7c3 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C @@ -86,7 +86,7 @@ tmp nutLowReWallFunctionFvPatchScalarField::yPlus() const const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C index 04aafae92c..e296d7b4f0 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C @@ -43,7 +43,7 @@ tmp nutURoughWallFunctionFvPatchScalarField::nut() const const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); @@ -84,7 +84,7 @@ tmp nutURoughWallFunctionFvPatchScalarField::yPlus const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C index 7e85ec6469..b76e61479f 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C @@ -66,7 +66,7 @@ tmp nutUSpaldingWallFunctionFvPatchScalarField::calcUTau const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); @@ -164,7 +164,7 @@ tmp nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C index f4b485ed78..4f3af9de42 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C @@ -77,7 +77,7 @@ tmp nutUWallFunctionFvPatchScalarField::yPlus const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C index 54f9d8be1f..a74e0e58d1 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C @@ -73,7 +73,7 @@ tmp nutkRoughWallFunctionFvPatchScalarField::nut() const const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C index 6050d4ec21..9bb4ff4986 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C @@ -44,7 +44,7 @@ tmp nutkWallFunctionFvPatchScalarField::nut() const const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); const tmp tnuw = turbModel.nu(patchi); @@ -115,7 +115,7 @@ tmp nutkWallFunctionFvPatchScalarField::yPlus() const const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 3e3dac5431..1b78609d96 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -155,7 +155,7 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields // Ask for the wall distance in advance. Some processes may not have any // corner weights, so we cannot allow functions inside the if statements // below to trigger the wall distance calculation. - turbModel.y(); + turbModel.yb(); // accumulate all of the G and omega contributions forAll(cornerWeights_, patchi) @@ -197,7 +197,7 @@ void omegaWallFunctionFvPatchScalarField::calculate const nutWallFunctionFvPatchScalarField& nutw = nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C index 0496af7eb2..ccf5fff3c1 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -88,7 +88,7 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs() const nutWallFunctionFvPatchScalarField& nutw = nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); diff --git a/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C b/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C index e1f0df9ba9..d8df507a74 100644 --- a/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C +++ b/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C @@ -27,6 +27,7 @@ License #include "volFields.H" #include "surfaceFields.H" #include "wallFvPatch.H" +#include "wallDist.H" #include "nearWallDist.H" #include "fvcFlux.H" #include "fvmDiv.H" @@ -120,7 +121,13 @@ Foam::tmp Foam::momentumTransportModel::phi() const } -const Foam::volScalarField::Boundary& Foam::momentumTransportModel::y() const +const Foam::volScalarField& Foam::momentumTransportModel::y() const +{ + return wallDist::New(mesh_).y(); +} + + +const Foam::volScalarField::Boundary& Foam::momentumTransportModel::yb() const { return nearWallDist::New(mesh_).y(); } diff --git a/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.H b/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.H index 59bc543a91..4f15282d40 100644 --- a/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.H +++ b/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.H @@ -171,8 +171,11 @@ public: return viscosity_; } + //- Return the wall distance + const volScalarField& y() const; + //- Return the near wall distance - const volScalarField::Boundary& y() const; + const volScalarField::Boundary& yb() const; //- Return the laminar viscosity virtual tmp nu() const diff --git a/src/MomentumTransportModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C b/src/MomentumTransportModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C index 44b60f6c99..14076aeade 100644 --- a/src/MomentumTransportModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C +++ b/src/MomentumTransportModels/phaseCompressible/RAS/kOmegaSSTSato/kOmegaSSTSato.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -160,7 +160,7 @@ void kOmegaSSTSato::correctNut { volScalarField yPlus ( - pow(this->betaStar_, 0.25)*this->y_*sqrt(this->k_)/this->nu() + pow(this->betaStar_, 0.25)*this->y()*sqrt(this->k_)/this->nu() ); this->nut_ = diff --git a/src/ThermophysicalTransportModels/fluid/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/ThermophysicalTransportModels/fluid/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index 3bd490ef7e..4655a58419 100644 --- a/src/ThermophysicalTransportModels/fluid/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/ThermophysicalTransportModels/fluid/derivedFvPatchFields/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -153,7 +153,7 @@ tmp alphatJayatillekeWallFunctionFvPatchScalarField::alphat const scalar Cmu25 = pow025(nutw.Cmu()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); diff --git a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C index 02ad9272fc..638eee90ff 100644 --- a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C @@ -43,7 +43,7 @@ tmp nutkAtmRoughWallFunctionFvPatchScalarField::nut() const const momentumTransportModel& turbModel = db().lookupType(internalField().group()); - const scalarField& y = turbModel.y()[patchi]; + const scalarField& y = turbModel.yb()[patchi]; const tmp tk = turbModel.k(); const volScalarField& k = tk(); const tmp tnuw = turbModel.nu(patchi); diff --git a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C index 3258dacf24..b166bd545b 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C +++ b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C @@ -67,7 +67,7 @@ void Foam::wallDist::constructn() const Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName) : - DemandDrivenMeshObject(mesh), + DemandDrivenMeshObject(mesh), patchIDs_(mesh.boundaryMesh().findPatchIDs()), patchTypeName_(patchTypeName), pdm_ @@ -101,9 +101,12 @@ Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName) if (nRequired_) { constructn(); + pdm_->correct(y_, n_()); + } + else + { + pdm_->correct(y_); } - - movePoints(); } @@ -114,7 +117,7 @@ Foam::wallDist::wallDist const word& patchTypeName ) : - DemandDrivenMeshObject(mesh), + DemandDrivenMeshObject(mesh), patchIDs_(patchIDs), patchTypeName_(patchTypeName), pdm_ @@ -148,9 +151,12 @@ Foam::wallDist::wallDist if (nRequired_) { constructn(); + pdm_->correct(y_, n_()); + } + else + { + pdm_->correct(y_); } - - movePoints(); } @@ -180,44 +186,4 @@ const Foam::volVectorField& Foam::wallDist::n() const } -bool Foam::wallDist::movePoints() -{ - if (pdm_->movePoints()) - { - if (nRequired_) - { - return pdm_->correct(y_, n_()); - } - else - { - return pdm_->correct(y_); - } - } - else - { - return false; - } -} - - -void Foam::wallDist::topoChange(const polyTopoChangeMap& map) -{ - pdm_->topoChange(map); - movePoints(); -} - - -void Foam::wallDist::mapMesh(const polyMeshMap& map) -{ - pdm_->mapMesh(map); - movePoints(); -} - - -void Foam::wallDist::distribute(const polyDistributionMap& map) -{ - // The y and n fields are registered and distributed automatically -} - - // ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H index 5a2ff94b1c..7e5371ec4a 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H +++ b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H @@ -68,7 +68,7 @@ namespace Foam class wallDist : - public DemandDrivenMeshObject + public DemandDrivenMeshObject { // Private Data @@ -102,7 +102,7 @@ protected: friend class DemandDrivenMeshObject < fvMesh, - TopoChangeableMeshObject, + DeletableMeshObject, wallDist >; @@ -157,18 +157,6 @@ public: //- Return reference to cached normal-to-wall field const volVectorField& n() const; - //- Update the y-field when the mesh moves - virtual bool movePoints(); - - //- Update the y-field when the mesh changes - virtual void topoChange(const polyTopoChangeMap&); - - //- Update from another mesh using the given map - virtual void mapMesh(const polyMeshMap&); - - //- Redistribute or update using the given distribution map - virtual void distribute(const polyDistributionMap&); - // Member Operators