diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.C b/src/turbulenceModels/compressible/LES/LESModel/LESModel.C index 3e68d95ada8813d96e5298ff5cd3a9cf14376714..e3ecd7ef7a0dc5d56022542865edad5fc942c242 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.C +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.C @@ -155,6 +155,7 @@ autoPtr<LESModel> LESModel::New void LESModel::correct(const tmp<volTensorField>&) { + turbulenceModel::correct(); delta_().correct(); } diff --git a/src/turbulenceModels/compressible/LES/Make/files b/src/turbulenceModels/compressible/LES/Make/files index 653eb2b28f1d8c7a5888f2e42bd3e6d8fac67d06..cc52d88433d2bc58b9549e147c01ed4bbfb5b098 100644 --- a/src/turbulenceModels/compressible/LES/Make/files +++ b/src/turbulenceModels/compressible/LES/Make/files @@ -11,14 +11,4 @@ SpalartAllmaras/SpalartAllmaras.C vanDriestDelta/vanDriestDelta.C -/* Wall functions */ -wallFunctions=derivedFvPatchFields/wallFunctions - -muSgsWallFunctions=$(wallFunctions)/muSgsWallFunctions -$(muSgsWallFunctions)/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.C - -alphaSgsWallFunctions=$(wallFunctions)/alphaSgsWallFunctions -$(alphaSgsWallFunctions)/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.C -$(alphaSgsWallFunctions)/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C - LIB = $(FOAM_LIBBIN)/libcompressibleLESModels diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C deleted file mode 100644 index 44ac46edc542130acdcfb502c6f94a86dfdf151f..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,341 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "alphaSgsJayatillekeWallFunctionFvPatchScalarField.H" -#include "LESModel.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" -#include "wallFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace LESModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::maxExp_ = 50.0; -scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::tolerance_ = 0.01; -label alphaSgsJayatillekeWallFunctionFvPatchScalarField::maxIters_ = 10; - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void alphaSgsJayatillekeWallFunctionFvPatchScalarField::checkType() -{ - if (!isA<wallFvPatch>(patch())) - { - FatalErrorIn - ( - "alphaSgsJayatillekeWallFunctionFvPatchScalarField::checkType()" - ) - << "Patch type for patch " << patch().name() << " must be wall\n" - << "Current patch type is " << patch().type() << nl - << exit(FatalError); - } -} - - -scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::Psmooth -( - const scalar Prat -) const -{ - return 9.24*(pow(Prat, 0.75) - 1.0)*(1.0 + 0.28*exp(-0.007*Prat)); -} - - -scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::yPlusTherm -( - const scalar P, - const scalar Prat -) const -{ - scalar ypt = 11.0; - - for (int i=0; i<maxIters_; i++) - { - scalar f = ypt - (log(E_*ypt)/kappa_ + P)/Prat; - scalar df = 1.0 - 1.0/(ypt*kappa_*Prat); - scalar yptNew = ypt - f/df; - - if (yptNew < VSMALL) - { - return 0; - } - else if (mag(yptNew - ypt) < tolerance_) - { - return yptNew; - } - else - { - ypt = yptNew; - } - } - - return ypt; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -alphaSgsJayatillekeWallFunctionFvPatchScalarField:: -alphaSgsJayatillekeWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(p, iF), - Prt_(0.85), - kappa_(0.41), - E_(9.8), - heName_("he") - -{ - checkType(); -} - - -alphaSgsJayatillekeWallFunctionFvPatchScalarField:: -alphaSgsJayatillekeWallFunctionFvPatchScalarField -( - const alphaSgsJayatillekeWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchScalarField(ptf, p, iF, mapper), - Prt_(ptf.Prt_), - kappa_(ptf.kappa_), - E_(ptf.E_), - heName_(ptf.heName_) - -{} - - -alphaSgsJayatillekeWallFunctionFvPatchScalarField:: -alphaSgsJayatillekeWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - fixedValueFvPatchScalarField(p, iF, dict), - Prt_(dict.lookupOrDefault<scalar>("Prt", 0.85)), - kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), - E_(dict.lookupOrDefault<scalar>("E", 9.8)), - heName_(dict.lookupOrDefault<word>("he", "he")) -{ - checkType(); -} - - -alphaSgsJayatillekeWallFunctionFvPatchScalarField:: -alphaSgsJayatillekeWallFunctionFvPatchScalarField -( - const alphaSgsJayatillekeWallFunctionFvPatchScalarField& awfpsf -) -: - fixedValueFvPatchScalarField(awfpsf), - Prt_(awfpsf.Prt_), - kappa_(awfpsf.kappa_), - E_(awfpsf.E_), - heName_(awfpsf.heName_) -{ - checkType(); -} - - -alphaSgsJayatillekeWallFunctionFvPatchScalarField:: -alphaSgsJayatillekeWallFunctionFvPatchScalarField -( - const alphaSgsJayatillekeWallFunctionFvPatchScalarField& awfpsf, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(awfpsf, iF), - Prt_(awfpsf.Prt_), - kappa_(awfpsf.kappa_), - E_(awfpsf.E_), - heName_(awfpsf.heName_) -{ - checkType(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void alphaSgsJayatillekeWallFunctionFvPatchScalarField::evaluate -( - const Pstream::commsTypes -) -{ - const LESModel& lesModel = db().lookupObject<LESModel>("LESProperties"); - - // Field data - const label patchI = patch().index(); - - const scalarField& muw = lesModel.mu().boundaryField()[patchI]; - const scalarField muSgsw(lesModel.muSgs()().boundaryField()[patchI]); - - const scalarField& alphaw = lesModel.alpha().boundaryField()[patchI]; - scalarField& alphaSgsw = *this; - - const fvPatchVectorField& Uw = lesModel.U().boundaryField()[patchI]; - const scalarField magUp(mag(Uw.patchInternalField() - Uw)); - const scalarField magGradUw(mag(Uw.snGrad())); - - const scalarField& rhow = lesModel.rho().boundaryField()[patchI]; - const fvPatchScalarField& hw = - patch().lookupPatchField<volScalarField, scalar>(heName_); - - const scalarField& ry = patch().deltaCoeffs(); - - // Heat flux [W/m2] - lagging alphaSgsw - const scalarField qDot((alphaw + alphaSgsw)*hw.snGrad()); - - // Populate boundary values - forAll(alphaSgsw, faceI) - { - // Calculate uTau using Newton-Raphson iteration - scalar uTau = - sqrt((muSgsw[faceI] + muw[faceI])/rhow[faceI]*magGradUw[faceI]); - - if (uTau > ROOTVSMALL) - { - label iter = 0; - scalar err = GREAT; - - do - { - scalar kUu = min(kappa_*magUp[faceI]/uTau, maxExp_); - scalar fkUu = exp(kUu) - 1.0 - kUu*(1.0 + 0.5*kUu); - - scalar f = - - uTau/(ry[faceI]*muw[faceI]/rhow[faceI]) - + magUp[faceI]/uTau - + 1.0/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu)); - - scalar df = - - 1.0/(ry[faceI]*muw[faceI]/rhow[faceI]) - - magUp[faceI]/sqr(uTau) - - 1.0/E_*kUu*fkUu/uTau; - - scalar uTauNew = uTau - f/df; - err = mag((uTau - uTauNew)/uTau); - uTau = uTauNew; - - } while (uTau>VSMALL && err>tolerance_ && ++iter<maxIters_); - - scalar yPlus = uTau/ry[faceI]/(muw[faceI]/rhow[faceI]); - - // Molecular Prandtl number - scalar Pr = muw[faceI]/alphaw[faceI]; - - // Molecular-to-turbulenbt Prandtl number ratio - scalar Prat = Pr/Prt_; - - // Thermal sublayer thickness - scalar P = Psmooth(Prat); - scalar yPlusTherm = this->yPlusTherm(P, Prat); - - // Evaluate new effective thermal diffusivity - scalar alphaEff = 0.0; - if (yPlus < yPlusTherm) - { - scalar A = qDot[faceI]*rhow[faceI]*uTau/ry[faceI]; - scalar B = qDot[faceI]*Pr*yPlus; - scalar C = Pr*0.5*rhow[faceI]*uTau*sqr(magUp[faceI]); - alphaEff = A/(B + C + VSMALL); - } - else - { - scalar A = qDot[faceI]*rhow[faceI]*uTau/ry[faceI]; - scalar B = qDot[faceI]*Prt_*(1.0/kappa_*log(E_*yPlus) + P); - scalar magUc = uTau/kappa_*log(E_*yPlusTherm) - mag(Uw[faceI]); - scalar C = - 0.5*rhow[faceI]*uTau - *(Prt_*sqr(magUp[faceI]) + (Pr - Prt_)*sqr(magUc)); - alphaEff = A/(B + C + VSMALL); - } - - // Update turbulent thermal diffusivity - alphaSgsw[faceI] = max(0.0, alphaEff - alphaw[faceI]); - - if (debug) - { - Info<< " uTau = " << uTau << nl - << " Pr = " << Pr << nl - << " Prt = " << Prt_ << nl - << " qDot = " << qDot[faceI] << nl - << " yPlus = " << yPlus << nl - << " yPlusTherm = " << yPlusTherm << nl - << " alphaEff = " << alphaEff << nl - << " alphaw = " << alphaw[faceI] << nl - << " alphaSgsw = " << alphaSgsw[faceI] << nl - << endl; - } - } - else - { - alphaSgsw[faceI] = 0.0; - } - } -} - - -void alphaSgsJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const -{ - fvPatchField<scalar>::write(os); - os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; - os.writeKeyword("he") << heName_ << token::END_STATEMENT << nl; - writeEntry("value", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - alphaSgsJayatillekeWallFunctionFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.H deleted file mode 100644 index c5d4d70241d76fba1ad16406f01edcbe4b8c61e3..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,197 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - alphaSgsJayatillekeWallFunctionFvPatchScalarField - -Description - Thermal wall function for turbulent thermal diffusivity based on the - Jayatilleke thermal wall function - -SourceFiles - alphaSgsJayatillekeWallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef alphaSgsJayatillekeWallFunctionFvPatchScalarField_H -#define alphaSgsJayatillekeWallFunctionFvPatchScalarField_H - -#include "fixedValueFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace LESModels -{ - -/*---------------------------------------------------------------------------*\ - Class alphaSgsJayatillekeWallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class alphaSgsJayatillekeWallFunctionFvPatchScalarField -: - public fixedValueFvPatchScalarField -{ - // Private data - - //- Turbulent Prandtl number - scalar Prt_; - - //- Von Karman constant - scalar kappa_; - - //- E coefficient - scalar E_; - - //- Name of (sensible/total) enthalpy field - word heName_; - - - // Solution parameters - - static scalar maxExp_; - static scalar tolerance_; - static label maxIters_; - - - // Private Member Functions - - //- Check the type of the patch - void checkType(); - - //- `P' function - scalar Psmooth(const scalar Prat) const; - - //- Calculate y+ at the edge of the thermal laminar sublayer - scalar yPlusTherm - ( - const scalar P, - const scalar Prat - ) const; - - -public: - - //- Runtime type information - TypeName("alphaSgsJayatillekeWallFunction"); - - - // Constructors - - //- Construct from patch and internal field - alphaSgsJayatillekeWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - alphaSgsJayatillekeWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given an - // alphaSgsJayatillekeWallFunctionFvPatchScalarField - // onto a new patch - alphaSgsJayatillekeWallFunctionFvPatchScalarField - ( - const alphaSgsJayatillekeWallFunctionFvPatchScalarField&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - alphaSgsJayatillekeWallFunctionFvPatchScalarField - ( - const alphaSgsJayatillekeWallFunctionFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new alphaSgsJayatillekeWallFunctionFvPatchScalarField(*this) - ); - } - - //- Construct as copy setting internal field reference - alphaSgsJayatillekeWallFunctionFvPatchScalarField - ( - const alphaSgsJayatillekeWallFunctionFvPatchScalarField&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchScalarField> clone - ( - const DimensionedField<scalar, volMesh>& iF - ) const - { - return tmp<fvPatchScalarField> - ( - new alphaSgsJayatillekeWallFunctionFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member functions - - // Evaluation functions - - //- Evaluate the patchField - virtual void evaluate - ( - const Pstream::commsTypes commsType=Pstream::Pstream::blocking - ); - - - // I-O - - //- Write - void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.C deleted file mode 100644 index 181c8022a73e34d85704552dbba7f5c3599f783b..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,164 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "alphaSgsWallFunctionFvPatchScalarField.H" -#include "LESModel.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" -#include "wallFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace LESModels -{ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void alphaSgsWallFunctionFvPatchScalarField::checkType() -{ - if (!isA<wallFvPatch>(patch())) - { - FatalErrorIn - ( - "alphaSgsWallFunctionFvPatchScalarField::checkType()" - ) - << "Patch type for patch " << patch().name() << " must be wall\n" - << "Current patch type is " << patch().type() << nl - << exit(FatalError); - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -alphaSgsWallFunctionFvPatchScalarField:: -alphaSgsWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(p, iF), - Prt_(0.85) -{ - checkType(); -} - - -alphaSgsWallFunctionFvPatchScalarField:: -alphaSgsWallFunctionFvPatchScalarField -( - const alphaSgsWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchScalarField(ptf, p, iF, mapper), - Prt_(ptf.Prt_) -{} - - -alphaSgsWallFunctionFvPatchScalarField:: -alphaSgsWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - fixedValueFvPatchScalarField(p, iF, dict), - Prt_(dict.lookupOrDefault<scalar>("Prt", 0.85)) -{ - checkType(); -} - - -alphaSgsWallFunctionFvPatchScalarField:: -alphaSgsWallFunctionFvPatchScalarField -( - const alphaSgsWallFunctionFvPatchScalarField& awfpsf -) -: - fixedValueFvPatchScalarField(awfpsf), - Prt_(awfpsf.Prt_) -{ - checkType(); -} - - -alphaSgsWallFunctionFvPatchScalarField:: -alphaSgsWallFunctionFvPatchScalarField -( - const alphaSgsWallFunctionFvPatchScalarField& awfpsf, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(awfpsf, iF), - Prt_(awfpsf.Prt_) - -{ - checkType(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void alphaSgsWallFunctionFvPatchScalarField::evaluate -( - const Pstream::commsTypes -) -{ - const LESModel& lesModel = db().lookupObject<LESModel>("LESProperties"); - - const scalarField muSgsw - ( - lesModel.muSgs()().boundaryField()[patch().index()] - ); - - operator==(muSgsw/Prt_); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - alphaSgsWallFunctionFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.C deleted file mode 100644 index e6de9e18132526e8d3f5871a3fdb8d7ae91e3ab2..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,223 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "muSgsUSpaldingWallFunctionFvPatchScalarField.H" -#include "LESModel.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace LESModels -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -muSgsUSpaldingWallFunctionFvPatchScalarField:: -muSgsUSpaldingWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(p, iF), - UName_("U"), - rhoName_("rho"), - muName_("mu"), - kappa_(0.41), - E_(9.8) -{} - - -muSgsUSpaldingWallFunctionFvPatchScalarField:: -muSgsUSpaldingWallFunctionFvPatchScalarField -( - const muSgsUSpaldingWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchScalarField(ptf, p, iF, mapper), - UName_(ptf.UName_), - rhoName_(ptf.rhoName_), - muName_(ptf.muName_), - kappa_(ptf.kappa_), - E_(ptf.E_) -{} - - -muSgsUSpaldingWallFunctionFvPatchScalarField:: -muSgsUSpaldingWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - fixedValueFvPatchScalarField(p, iF, dict), - UName_(dict.lookupOrDefault<word>("U", "U")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")), - muName_(dict.lookupOrDefault<word>("mu", "mu")), - kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), - E_(dict.lookupOrDefault<scalar>("E", 9.8)) -{} - - -muSgsUSpaldingWallFunctionFvPatchScalarField:: -muSgsUSpaldingWallFunctionFvPatchScalarField -( - const muSgsUSpaldingWallFunctionFvPatchScalarField& mwfpsf -) -: - fixedValueFvPatchScalarField(mwfpsf), - UName_(mwfpsf.UName_), - rhoName_(mwfpsf.rhoName_), - muName_(mwfpsf.muName_), - kappa_(mwfpsf.kappa_), - E_(mwfpsf.E_) -{} - - -muSgsUSpaldingWallFunctionFvPatchScalarField:: -muSgsUSpaldingWallFunctionFvPatchScalarField -( - const muSgsUSpaldingWallFunctionFvPatchScalarField& mwfpsf, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(mwfpsf, iF), - UName_(mwfpsf.UName_), - rhoName_(mwfpsf.rhoName_), - muName_(mwfpsf.muName_), - kappa_(mwfpsf.kappa_), - E_(mwfpsf.E_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void muSgsUSpaldingWallFunctionFvPatchScalarField::evaluate -( - const Pstream::commsTypes -) -{ - const scalarField& ry = patch().deltaCoeffs(); - - const fvPatchVectorField& U = - patch().lookupPatchField<volVectorField, vector>(UName_); - - const scalarField magUp(mag(U.patchInternalField() - U)); - - const scalarField& muw = - patch().lookupPatchField<volScalarField, scalar>(muName_); - - const scalarField& rhow = - patch().lookupPatchField<volScalarField, scalar>(rhoName_); - - scalarField& muSgsw = *this; - - const scalarField magFaceGradU(mag(U.snGrad())); - - forAll(muSgsw, facei) - { - scalar magUpara = magUp[facei]; - - scalar utau = - sqrt((muSgsw[facei] + muw[facei])*magFaceGradU[facei]/rhow[facei]); - - if (utau > 0) - { - int iter = 0; - scalar err = GREAT; - - do - { - scalar kUu = kappa_*magUpara/utau; - scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu); - - scalar f = - - utau/(ry[facei]*muw[facei]/rhow[facei]) - + magUpara/utau - + 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu)); - - scalar df = - - 1.0/(ry[facei]*muw[facei]/rhow[facei]) - - magUpara/sqr(utau) - - 1/E_*kUu*fkUu/utau; - - scalar utauNew = utau - f/df; - err = mag((utau - utauNew)/utau); - utau = utauNew; - - } while (utau > VSMALL && err > 0.01 && ++iter < 10); - - muSgsw[facei] = - max - ( - rhow[facei]*sqr(utau)/magFaceGradU[facei] - muw[facei], - 0.0 - ); - } - else - { - muSgsw[facei] = 0; - } - } -} - - -void muSgsUSpaldingWallFunctionFvPatchScalarField::write(Ostream& os) const -{ - fvPatchField<scalar>::write(os); - writeEntryIfDifferent<word>(os, "U", "U", UName_); - writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); - writeEntryIfDifferent<word>(os, "mu", "mu", muName_); - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; - writeEntry("value", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - muSgsUSpaldingWallFunctionFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.H deleted file mode 100644 index 9d8adf869c31115e21e1552aafe001ea1df798d2..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,173 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::compressible::LESModels:: - muSgsUSpaldingWallFunctionFvPatchScalarField - -Description - Wall function boundary condition for walls, based on velocity, using - Spaldings law to give a continuous muSgs profile to the wall (y+ = 0). - -SourceFiles - muSgsUSpaldingWallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef muSgsUSpaldingWallFunctionFvPatchScalarField_H -#define muSgsUSpaldingWallFunctionFvPatchScalarField_H - -#include "fixedValueFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace LESModels -{ - -/*---------------------------------------------------------------------------*\ - Class muSgsUSpaldingWallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class muSgsUSpaldingWallFunctionFvPatchScalarField -: - public fixedValueFvPatchScalarField -{ - // Private data - - //- Name of velocity field - word UName_; - - //- Name of density field - word rhoName_; - - //- Name of laminar viscosity field - word muName_; - - //- Von Karman constant - scalar kappa_; - - //- E coefficient - scalar E_; - - -public: - - //- Runtime type information - TypeName("muSgsUSpaldingWallFunction"); - - - // Constructors - - //- Construct from patch and internal field - muSgsUSpaldingWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - muSgsUSpaldingWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given - // muSgsUSpaldingWallFunctionFvPatchScalarField - // onto a new patch - muSgsUSpaldingWallFunctionFvPatchScalarField - ( - const muSgsUSpaldingWallFunctionFvPatchScalarField&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - muSgsUSpaldingWallFunctionFvPatchScalarField - ( - const muSgsUSpaldingWallFunctionFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new muSgsUSpaldingWallFunctionFvPatchScalarField(*this) - ); - } - - //- Construct as copy setting internal field reference - muSgsUSpaldingWallFunctionFvPatchScalarField - ( - const muSgsUSpaldingWallFunctionFvPatchScalarField&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchScalarField> clone - ( - const DimensionedField<scalar, volMesh>& iF - ) const - { - return tmp<fvPatchScalarField> - ( - new muSgsUSpaldingWallFunctionFvPatchScalarField(*this, iF) - ); - } - - - // Member functions - - // Evaluation functions - - //- Evaluate the patchField - virtual void evaluate - ( - const Pstream::commsTypes commsType=Pstream::blocking - ); - - // I-O - - //- Write - void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/Make/files b/src/turbulenceModels/compressible/RAS/Make/files index a6ae97b5a8234cc7c2de40fc20d687fab02576f3..524f89b653b19e0b5f66cd04b8c5f56878ce8840 100644 --- a/src/turbulenceModels/compressible/RAS/Make/files +++ b/src/turbulenceModels/compressible/RAS/Make/files @@ -18,11 +18,14 @@ $(alphatWallFunctions)/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C $(alphatWallFunctions)/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C mutWallFunctions = $(wallFunctions)/mutWallFunctions -$(mutWallFunctions)/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C +$(mutWallFunctions)/mutWallFunction/mutWallFunctionFvPatchScalarField.C + $(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C +$(mutWallFunctions)/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C + +$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C $(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C $(mutWallFunctions)/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C -$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C $(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions @@ -35,7 +38,7 @@ kqRWallFunctions = $(wallFunctions)/kqRWallFunctions $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C /* Patch fields */ -derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C +derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C index a3e7d7281cadf81de63e42635eddfdfcc6743fc0..b5e53288a1303ea26cc6612ee3d4804894627df6 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C @@ -83,9 +83,7 @@ RASModel::RASModel kMin_("kMin", sqr(dimVelocity), SMALL), epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL), - omegaMin_("omegaMin", dimless/dimTime, SMALL), - - y_(mesh_) + omegaMin_("omegaMin", dimless/dimTime, SMALL) { kMin_.readIfPresent(*this); epsilonMin_.readIfPresent(*this); @@ -159,57 +157,9 @@ autoPtr<RASModel> RASModel::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const -{ - scalar ypl = 11.0; - - for (int i=0; i<10; i++) - { - ypl = log(max(E*ypl, 1))/kappa; - } - - return ypl; -} - - -tmp<scalarField> RASModel::yPlus(const label patchNo, const scalar Cmu) const -{ - const fvPatch& curPatch = mesh_.boundary()[patchNo]; - - tmp<scalarField> tYp(new scalarField(curPatch.size())); - scalarField& Yp = tYp(); - - if (isA<wallFvPatch>(curPatch)) - { - Yp = pow025(Cmu) - *y_[patchNo] - *sqrt(k()().boundaryField()[patchNo].patchInternalField()) - /( - mu().boundaryField()[patchNo].patchInternalField() - /rho_.boundaryField()[patchNo] - ); - } - else - { - WarningIn - ( - "tmp<scalarField> RASModel::yPlus(const label patchNo) const" - ) << "Patch " << patchNo << " is not a wall. Returning null field" - << nl << endl; - - Yp.setSize(0); - } - - return tYp; -} - - void RASModel::correct() { - if (mesh_.changing()) - { - y_.correct(); - } + turbulenceModel::correct(); } diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H index 6251da74fee5ce769489ea86130cb04bd23ee92c..1a24cb78ee5e257b6d3e318d76733519feee806f 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H @@ -46,7 +46,6 @@ SourceFiles #include "compressible/turbulenceModel/turbulenceModel.H" #include "volFields.H" #include "surfaceFields.H" -#include "nearWallDist.H" #include "fvm.H" #include "fvc.H" #include "fvMatrices.H" @@ -96,9 +95,6 @@ protected: //- Lower limit for omega dimensionedScalar omegaMin_; - //- Near wall distance boundary field - nearWallDist y_; - // Protected Member Functions @@ -213,15 +209,6 @@ public: return omegaMin_; } - //- Return the near wall distances - const nearWallDist& y() const - { - return y_; - } - - //- Calculate y+ at the edge of the laminar sublayer - scalar yPlusLam(const scalar kappa, const scalar E) const; - //- Const access to the coefficients dictionary const dictionary& coeffDict() const { @@ -264,13 +251,6 @@ public: thermo().alphaEff(alphat()().boundaryField()[patchI], patchI); } - //- Return yPlus for the given patch - virtual tmp<scalarField> yPlus - ( - const label patchI, - const scalar Cmu - ) const; - //- Solve the turbulence equations and correct the turbulence viscosity virtual void correct(); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index b4820095ccc21b844cc322988b93215413fdccee..5db232e85eae14d90291788034448a1a523f3b06 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -199,34 +199,35 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() return; } - const label patchI = patch().index(); + const label patchi = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu25 = pow025(Cmu_); - const scalarField& y = rasModel.y()[patchI]; + const scalarField& y = turbModel.y()[patchi]; - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; - const scalarField& alphaw = rasModel.alpha().boundaryField()[patchI]; + const scalarField& alphaw = turbModel.alpha().boundaryField()[patchi]; scalarField& alphatw = *this; - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magGradUw(mag(Uw.snGrad())); - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const scalarField& rhow = turbModel.rho().boundaryField()[patchi]; const fvPatchScalarField& hew = - rasModel.thermo().he().boundaryField()[patchI]; + turbModel.thermo().he().boundaryField()[patchi]; // Heat flux [W/m2] - lagging alphatw const scalarField qDot ( - rasModel.thermo().alphaEff(alphatw, patchI)*hew.snGrad() + turbModel.thermo().alphaEff(alphatw, patchi)*hew.snGrad() ); // Populate boundary values diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 1c0e11d7893d2503e3858764017303da73b62015..dac735f160fa04408ac55801dd6660542e6fd48f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -28,6 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" +#include "mutWallFunctionFvPatchScalarField.H" #include "wallFvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,23 +56,6 @@ void epsilonWallFunctionFvPatchScalarField::checkType() } -scalar epsilonWallFunctionFvPatchScalarField::calcYPlusLam -( - const scalar kappa, - const scalar E -) const -{ - scalar ypl = 11.0; - - for (int i=0; i<10; i++) - { - ypl = log(E*ypl)/kappa; - } - - return ypl; -} - - void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_); @@ -94,7 +78,7 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField Cmu_(0.09), kappa_(0.41), E_(9.8), - yPlusLam_(calcYPlusLam(kappa_, E_)) + yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)) { @@ -134,7 +118,7 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)), - yPlusLam_(calcYPlusLam(kappa_, E_)) + yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)) { checkType(); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index ff7447a2e5b81984eef6d1c1465d20e262129ebc..f473bc3c4c99f459173aacf40e7ef221d44c654d 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H @@ -81,9 +81,6 @@ protected: //- Check the type of the patch virtual void checkType(); - //- Calculate the Y+ at the edge of the laminar sublayer - virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const; - //- Write local wall function variables virtual void writeLocalEntries(Ostream&) const; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C index 770fd54a81b65f350f301f5e2e3b553b80ac199f..6cab8e9f378b385e52c127593a94af92fde46a98 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C @@ -54,7 +54,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(p, iF) + mutWallFunctionFvPatchScalarField(p, iF) {} @@ -66,7 +66,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper) + mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper) {} @@ -77,7 +77,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField const dictionary& dict ) : - mutkWallFunctionFvPatchScalarField(p, iF, dict) + mutWallFunctionFvPatchScalarField(p, iF, dict) {} @@ -86,7 +86,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField const mutLowReWallFunctionFvPatchScalarField& mlrwfpsf ) : - mutkWallFunctionFvPatchScalarField(mlrwfpsf) + mutWallFunctionFvPatchScalarField(mlrwfpsf) {} @@ -96,10 +96,29 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(mlrwfpsf, iF) + mutWallFunctionFvPatchScalarField(mlrwfpsf, iF) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp<scalarField> mutLowReWallFunctionFvPatchScalarField::yPlus() const +{ + const label patchi = patch().index(); + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbModel.y()[patchi]; + const scalarField nuw + ( + turbModel.mu().boundaryField()[patchi] + /turbModel.rho().boundaryField()[patchi] + ); + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + + return y*sqrt(nuw*mag(Uw.snGrad()))/nuw; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H index cffec80fb30c200bdf5f706db52cb5df11270992..027e5d8b0b0c3f490dcdbc6ddb4a93b0b7a45e4d 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H @@ -38,7 +38,7 @@ SourceFiles #ifndef compressibleMutLowReWallFunctionFvPatchScalarField_H #define compressibleMutLowReWallFunctionFvPatchScalarField_H -#include "mutkWallFunctionFvPatchScalarField.H" +#include "mutWallFunctionFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,7 +55,7 @@ namespace RASModels class mutLowReWallFunctionFvPatchScalarField : - public mutkWallFunctionFvPatchScalarField + public mutWallFunctionFvPatchScalarField { protected: @@ -132,6 +132,14 @@ public: new mutLowReWallFunctionFvPatchScalarField(*this, iF) ); } + + + // Member functions + + // Evaluation functions + + //- Calculate and return the yPlus at the boundary + virtual tmp<scalarField> yPlus() const; }; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C index a90cf4868635e94104e3ebf3fc79bbae0893f940..a6ef3c41b3efc193cc67f04c95aab6a087d935ac 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C @@ -45,12 +45,14 @@ tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::calcYPlus const scalarField& magUp ) const { - const label patchI = patch().index(); + const label patchi = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; - const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI]; + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + + const scalarField& y = turbModel.y()[patchi]; + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; + const fvPatchScalarField& rho = turbModel.rho().boundaryField()[patchi]; tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0)); scalarField& yPlus = tyPlus(); @@ -170,13 +172,15 @@ tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::calcYPlus tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::calcMut() const { - const label patchI = patch().index(); + const label patchi = patch().index(); + + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; - const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI]; + const scalarField& y = turbModel.y()[patchi]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; + const fvPatchScalarField& rho = turbModel.rho().boundaryField()[patchi]; scalarField magUp(mag(Uw.patchInternalField() - Uw)); @@ -208,7 +212,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(p, iF), + mutWallFunctionFvPatchScalarField(p, iF), roughnessHeight_(pTraits<scalar>::zero), roughnessConstant_(pTraits<scalar>::zero), roughnessFactor_(pTraits<scalar>::zero) @@ -223,7 +227,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper), roughnessHeight_(ptf.roughnessHeight_), roughnessConstant_(ptf.roughnessConstant_), roughnessFactor_(ptf.roughnessFactor_) @@ -237,7 +241,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField const dictionary& dict ) : - mutkWallFunctionFvPatchScalarField(p, iF, dict), + mutWallFunctionFvPatchScalarField(p, iF, dict), roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))), roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))), roughnessFactor_(readScalar(dict.lookup("roughnessFactor"))) @@ -249,7 +253,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField const mutURoughWallFunctionFvPatchScalarField& rwfpsf ) : - mutkWallFunctionFvPatchScalarField(rwfpsf), + mutWallFunctionFvPatchScalarField(rwfpsf), roughnessHeight_(rwfpsf.roughnessHeight_), roughnessConstant_(rwfpsf.roughnessConstant_), roughnessFactor_(rwfpsf.roughnessFactor_) @@ -262,7 +266,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(rwfpsf, iF), + mutWallFunctionFvPatchScalarField(rwfpsf, iF), roughnessHeight_(rwfpsf.roughnessHeight_), roughnessConstant_(rwfpsf.roughnessConstant_), roughnessFactor_(rwfpsf.roughnessFactor_) @@ -273,10 +277,11 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::yPlus() const { - const label patchI = patch().index(); + const label patchi = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); return calcYPlus(magUp); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H index 74596ff781a4510246149ed6b717be5d52c71964..52dac81fbd25d3a3459b99dd12b152783bbe7c4f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H @@ -35,7 +35,7 @@ SourceFiles #ifndef compressibleMutURoughWallFunctionFvPatchScalarField_H #define compressibleMutURoughWallFunctionFvPatchScalarField_H -#include "mutkWallFunctionFvPatchScalarField.H" +#include "mutWallFunctionFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,7 +52,7 @@ namespace RASModels class mutURoughWallFunctionFvPatchScalarField : - public mutkWallFunctionFvPatchScalarField + public mutWallFunctionFvPatchScalarField { protected: diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C index 4e24d39e06ebb1339abebf7ad18acb5911664d49..b8f9a7beee3b714192c6ff1f0e35a287dd8b26ee 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C @@ -45,19 +45,21 @@ tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::calcUTau const scalarField& magGradU ) const { - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patch().index()]; + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + + const scalarField& y = turbModel.y()[patch().index()]; const fvPatchVectorField& Uw = - rasModel.U().boundaryField()[patch().index()]; + turbModel.U().boundaryField()[patch().index()]; scalarField magUp(mag(Uw.patchInternalField() - Uw)); const fvPatchScalarField& rhow = - rasModel.rho().boundaryField()[patch().index()]; + turbModel.rho().boundaryField()[patch().index()]; const fvPatchScalarField& muw = - rasModel.mu().boundaryField()[patch().index()]; + turbModel.mu().boundaryField()[patch().index()]; const scalarField& mutw = *this; tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0)); @@ -104,13 +106,15 @@ tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::calcUTau tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::calcMut() const { - const label patchI = patch().index(); + const label patchi = patch().index(); + + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magGradU(mag(Uw.snGrad())); - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& rhow = turbModel.rho().boundaryField()[patchi]; + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; return max ( @@ -129,7 +133,7 @@ mutUSpaldingWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(p, iF) + mutWallFunctionFvPatchScalarField(p, iF) {} @@ -142,7 +146,7 @@ mutUSpaldingWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper) + mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper) {} @@ -154,7 +158,7 @@ mutUSpaldingWallFunctionFvPatchScalarField const dictionary& dict ) : - mutkWallFunctionFvPatchScalarField(p, iF, dict) + mutWallFunctionFvPatchScalarField(p, iF, dict) {} @@ -164,7 +168,7 @@ mutUSpaldingWallFunctionFvPatchScalarField const mutUSpaldingWallFunctionFvPatchScalarField& wfpsf ) : - mutkWallFunctionFvPatchScalarField(wfpsf) + mutWallFunctionFvPatchScalarField(wfpsf) {} @@ -175,7 +179,7 @@ mutUSpaldingWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(wfpsf, iF) + mutWallFunctionFvPatchScalarField(wfpsf, iF) {} @@ -183,13 +187,15 @@ mutUSpaldingWallFunctionFvPatchScalarField tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::yPlus() const { - const label patchI = patch().index(); + const label patchi = patch().index(); + + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& y = turbModel.y()[patchi]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + const scalarField& rhow = turbModel.rho().boundaryField()[patchi]; + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H index 4070203552392c93970ebd278686965e6b45e136..a014036ca016a508d243d0a7dbf6e6ba3c129a96 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H @@ -35,7 +35,7 @@ SourceFiles #ifndef compressibleMutUSpaldingWallFunctionFvPatchScalarField_H #define compressibleMutUSpaldingWallFunctionFvPatchScalarField_H -#include "mutkWallFunctionFvPatchScalarField.H" +#include "mutWallFunctionFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,7 +52,7 @@ namespace RASModels class mutUSpaldingWallFunctionFvPatchScalarField : - public mutkWallFunctionFvPatchScalarField + public mutWallFunctionFvPatchScalarField { protected: diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C index 725c7794a50dc0959e66c95b03fbe78b18ec8b72..a1f91801eb08778434dbc4fdb80ef5669a8d272c 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C @@ -45,12 +45,14 @@ tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcYPlus const scalarField& magUp ) const { - const label patchI = patch().index(); + const label patchi = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI]; - const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI]; + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + + const scalarField& y = turbModel.y()[patchi]; + const fvPatchScalarField& rhow = turbModel.rho().boundaryField()[patchi]; + const fvPatchScalarField& muw = turbModel.mu().boundaryField()[patchi]; tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0)); scalarField& yPlus = tyPlus(); @@ -81,12 +83,14 @@ tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcYPlus tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcMut() const { - const label patchI = patch().index(); + const label patchi = patch().index(); + + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); - const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI]; + const fvPatchScalarField& muw = turbModel.mu().boundaryField()[patchi]; tmp<scalarField> tyPlus = calcYPlus(magUp); scalarField& yPlus = tyPlus(); @@ -115,7 +119,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(p, iF) + mutWallFunctionFvPatchScalarField(p, iF) {} @@ -127,7 +131,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper) + mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper) {} @@ -138,7 +142,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField const dictionary& dict ) : - mutkWallFunctionFvPatchScalarField(p, iF, dict) + mutWallFunctionFvPatchScalarField(p, iF, dict) {} @@ -147,7 +151,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField const mutUWallFunctionFvPatchScalarField& sawfpsf ) : - mutkWallFunctionFvPatchScalarField(sawfpsf) + mutWallFunctionFvPatchScalarField(sawfpsf) {} @@ -157,7 +161,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - mutkWallFunctionFvPatchScalarField(sawfpsf, iF) + mutWallFunctionFvPatchScalarField(sawfpsf, iF) {} @@ -165,9 +169,10 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField tmp<scalarField> mutUWallFunctionFvPatchScalarField::yPlus() const { - const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const label patchi = patch().index(); + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); return calcYPlus(magUp); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H index 882725186bfbb4103d699811b0b15e15eb358e1b..4ac788632959b8af70f2530a5988e4fd7c3eebcc 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H @@ -35,7 +35,7 @@ SourceFiles #ifndef compressibleMutUWallFunctionFvPatchScalarField_H #define compressibleMutUWallFunctionFvPatchScalarField_H -#include "mutkWallFunctionFvPatchScalarField.H" +#include "mutWallFunctionFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,7 +52,7 @@ namespace RASModels class mutUWallFunctionFvPatchScalarField : - public mutkWallFunctionFvPatchScalarField + public mutWallFunctionFvPatchScalarField { protected: diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..9825f014c1ad57a6b089d19543d523c99e92f6d7 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C @@ -0,0 +1,191 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "mutWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "wallFvPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defineTypeNameAndDebug(mutWallFunctionFvPatchScalarField, 0); + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void mutWallFunctionFvPatchScalarField::checkType() +{ + if (!isA<wallFvPatch>(patch())) + { + FatalErrorIn("mutWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +void mutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const +{ + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField +( + const mutWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{} + + +mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), + kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + E_(dict.lookupOrDefault<scalar>("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField +( + const mutWallFunctionFvPatchScalarField& wfpsf +) +: + fixedValueFvPatchScalarField(wfpsf), + Cmu_(wfpsf.Cmu_), + kappa_(wfpsf.kappa_), + E_(wfpsf.E_), + yPlusLam_(wfpsf.yPlusLam_) +{} + + +mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField +( + const mutWallFunctionFvPatchScalarField& wfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(wfpsf, iF), + Cmu_(wfpsf.Cmu_), + kappa_(wfpsf.kappa_), + E_(wfpsf.E_), + yPlusLam_(wfpsf.yPlusLam_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +scalar mutWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +void mutWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + operator==(calcMut()); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void mutWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField<scalar>::write(os); + writeLocalEntries(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H similarity index 58% rename from src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.H rename to src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H index 95de3d023052554435a3669f01f26fa6ee6ddc8f..fb40664570dae13826ea0ebd6c222fba11c169fb 100644 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H @@ -22,19 +22,20 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - alphaSgsWallFunctionFvPatchScalarField + Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField Description - Boundary condition for thermal diffusivity when using wall functions + Boundary condition for turbulent (kinematic) viscosity when using wall + functions, based on turbulence kinetic energy. - replicates OpenFOAM v1.5 (and earlier) behaviour SourceFiles - alphaSgsWallFunctionFvPatchScalarField.C + mutWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef alphaSgsWallFunctionFvPatchScalarField_H -#define alphaSgsWallFunctionFvPatchScalarField_H +#ifndef compressibleMutWallFunctionFvPatchScalarField_H +#define compressibleMutWallFunctionFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -44,112 +45,119 @@ namespace Foam { namespace compressible { -namespace LESModels +namespace RASModels { /*---------------------------------------------------------------------------*\ - Class alphaSgsWallFunctionFvPatchScalarField Declaration + Class mutWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class alphaSgsWallFunctionFvPatchScalarField +class mutWallFunctionFvPatchScalarField : public fixedValueFvPatchScalarField { - // Private data +protected: - //- Turbulent Prandtl number - scalar Prt_; + // Protected data + //- Cmu coefficient + scalar Cmu_; - // Private Member Functions + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions //- Check the type of the patch - void checkType(); + virtual void checkType(); + + //- Calculate the turbulence viscosity + virtual tmp<scalarField> calcMut() const = 0; + + //- Write local wall function variables + virtual void writeLocalEntries(Ostream&) const; public: //- Runtime type information - TypeName("alphaSgsWallFunction"); + TypeName("mutWallFunction"); // Constructors //- Construct from patch and internal field - alphaSgsWallFunctionFvPatchScalarField + mutWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField<scalar, volMesh>& ); //- Construct from patch, internal field and dictionary - alphaSgsWallFunctionFvPatchScalarField + mutWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField<scalar, volMesh>&, const dictionary& ); - //- Construct by mapping given alphaSgsWallFunctionFvPatchScalarField + //- Construct by mapping given + // mutWallFunctionFvPatchScalarField // onto a new patch - alphaSgsWallFunctionFvPatchScalarField + mutWallFunctionFvPatchScalarField ( - const alphaSgsWallFunctionFvPatchScalarField&, + const mutWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField<scalar, volMesh>&, const fvPatchFieldMapper& ); //- Construct as copy - alphaSgsWallFunctionFvPatchScalarField + mutWallFunctionFvPatchScalarField ( - const alphaSgsWallFunctionFvPatchScalarField& + const mutWallFunctionFvPatchScalarField& ); - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new alphaSgsWallFunctionFvPatchScalarField(*this) - ); - } - //- Construct as copy setting internal field reference - alphaSgsWallFunctionFvPatchScalarField + mutWallFunctionFvPatchScalarField ( - const alphaSgsWallFunctionFvPatchScalarField&, + const mutWallFunctionFvPatchScalarField&, const DimensionedField<scalar, volMesh>& ); - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchScalarField> clone - ( - const DimensionedField<scalar, volMesh>& iF - ) const - { - return tmp<fvPatchScalarField> - ( - new alphaSgsWallFunctionFvPatchScalarField(*this, iF) - ); - } - // Member functions + //- Calculate the Y+ at the edge of the laminar sublayer + static scalar yPlusLam(const scalar kappa, const scalar E); + + //- Calculate and return the yPlus at the boundary + virtual tmp<scalarField> yPlus() const = 0; + + // Evaluation functions - //- Evaluate the patchField - virtual void evaluate - ( - const Pstream::commsTypes commsType=Pstream::Pstream::blocking - ); + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace LESModels +} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C index 62458f329b7b643db5901a0ec304f661f8829ce0..222c90ab8ad8af40afdd7d4aca5365aca07b7b7c 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C @@ -65,14 +65,16 @@ scalar mutkRoughWallFunctionFvPatchScalarField::fnRough tmp<scalarField> mutkRoughWallFunctionFvPatchScalarField::calcMut() const { - const label patchI = patch().index(); + const label patchi = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + + const scalarField& y = turbModel.y()[patchi]; + const scalarField& rhow = turbModel.rho().boundaryField()[patchi]; + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; const scalar Cmu25 = pow025(Cmu_); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C index 5f303b07218afbd3784cdcba7351264497ac29a9..e57efb039bb199ed369223eb45a240e542aca487 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C @@ -41,46 +41,16 @@ namespace RASModels // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void mutkWallFunctionFvPatchScalarField::checkType() -{ - if (!isA<wallFvPatch>(patch())) - { - FatalErrorIn("mutkWallFunctionFvPatchScalarField::checkType()") - << "Invalid wall function specification" << nl - << " Patch type for patch " << patch().name() - << " must be wall" << nl - << " Current patch type is " << patch().type() << nl << endl - << abort(FatalError); - } -} - - -scalar mutkWallFunctionFvPatchScalarField::calcYPlusLam -( - const scalar kappa, - const scalar E -) const -{ - scalar ypl = 11.0; - - for (int i=0; i<10; i++) - { - ypl = log(E*ypl)/kappa; - } - - return ypl; -} - - tmp<scalarField> mutkWallFunctionFvPatchScalarField::calcMut() const { - const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const label patchi = patch().index(); + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbModel.y()[patchi]; + const scalarField& rhow = turbModel.rho().boundaryField()[patchi]; + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; const scalar Cmu25 = pow025(Cmu_); @@ -104,14 +74,6 @@ tmp<scalarField> mutkWallFunctionFvPatchScalarField::calcMut() const } -void mutkWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const -{ - os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField @@ -120,11 +82,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchScalarField(p, iF), - Cmu_(0.09), - kappa_(0.41), - E_(9.8), - yPlusLam_(calcYPlusLam(kappa_, E_)) + mutWallFunctionFvPatchScalarField(p, iF) {} @@ -136,11 +94,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchScalarField(ptf, p, iF, mapper), - Cmu_(ptf.Cmu_), - kappa_(ptf.kappa_), - E_(ptf.E_), - yPlusLam_(ptf.yPlusLam_) + mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper) {} @@ -151,11 +105,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict), - Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), - kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), - E_(dict.lookupOrDefault<scalar>("E", 9.8)), - yPlusLam_(calcYPlusLam(kappa_, E_)) + mutWallFunctionFvPatchScalarField(p, iF, dict) {} @@ -164,11 +114,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField const mutkWallFunctionFvPatchScalarField& wfpsf ) : - fixedValueFvPatchScalarField(wfpsf), - Cmu_(wfpsf.Cmu_), - kappa_(wfpsf.kappa_), - E_(wfpsf.E_), - yPlusLam_(wfpsf.yPlusLam_) + mutWallFunctionFvPatchScalarField(wfpsf) {} @@ -178,54 +124,30 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchScalarField(wfpsf, iF), - Cmu_(wfpsf.Cmu_), - kappa_(wfpsf.kappa_), - E_(wfpsf.E_), - yPlusLam_(wfpsf.yPlusLam_) + mutWallFunctionFvPatchScalarField(wfpsf, iF) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void mutkWallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - operator==(calcMut()); - - fixedValueFvPatchScalarField::updateCoeffs(); -} - - tmp<scalarField> mutkWallFunctionFvPatchScalarField::yPlus() const { - const label patchI = patch().index(); + const label patchi = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbModel = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbModel.y()[patchi]; - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const scalarField kwc(k.boundaryField()[patchI].patchInternalField()); - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const scalarField kwc(k.boundaryField()[patchi].patchInternalField()); + const scalarField& muw = turbModel.mu().boundaryField()[patchi]; + const scalarField& rhow = turbModel.rho().boundaryField()[patchi]; return pow025(Cmu_)*y*sqrt(kwc)/(muw/rhow); } -void mutkWallFunctionFvPatchScalarField::write(Ostream& os) const -{ - fvPatchField<scalar>::write(os); - writeLocalEntries(os); - writeEntry("value", os); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField @@ -234,6 +156,7 @@ makePatchTypeField mutkWallFunctionFvPatchScalarField ); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace RASModels diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H index 9a686f8ad617b5d94767cbd300043eb930f97be8..07bf997392688937646782095170f62cbd217ceb 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H @@ -37,7 +37,7 @@ SourceFiles #ifndef compressibleMutkWallFunctionFvPatchScalarField_H #define compressibleMutkWallFunctionFvPatchScalarField_H -#include "fixedValueFvPatchFields.H" +#include "mutWallFunctionFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,39 +54,15 @@ namespace RASModels class mutkWallFunctionFvPatchScalarField : - public fixedValueFvPatchScalarField + public mutWallFunctionFvPatchScalarField { protected: - // Protected data - - //- Cmu coefficient - scalar Cmu_; - - //- Von Karman constant - scalar kappa_; - - //- E coefficient - scalar E_; - - //- Y+ at the edge of the laminar sublayer - scalar yPlusLam_; - - // Protected Member Functions - //- Check the type of the patch - virtual void checkType(); - - //- Calculate the Y+ at the edge of the laminar sublayer - virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const; - //- Calculate the turbulence viscosity virtual tmp<scalarField> calcMut() const; - //- Write local wall function variables - virtual void writeLocalEntries(Ostream&) const; - public: @@ -163,15 +139,6 @@ public: //- Calculate and return the yPlus at the boundary virtual tmp<scalarField> yPlus() const; - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - - // I-O - - //- Write - virtual void write(Ostream&) const; }; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index c8f5085445df3b9ac23abd2cf75fb6bff0a434b2..d681b7af729964037a6aa4fdbbdbcae71945e2a4 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -28,6 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" +#include "mutWallFunctionFvPatchScalarField.H" #include "wallFvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,23 +56,6 @@ void omegaWallFunctionFvPatchScalarField::checkType() } -scalar omegaWallFunctionFvPatchScalarField::calcYPlusLam -( - const scalar kappa, - const scalar E -) const -{ - scalar ypl = 11.0; - - for (int i=0; i<10; i++) - { - ypl = log(E*ypl)/kappa; - } - - return ypl; -} - - void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_); @@ -96,7 +80,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField kappa_(0.41), E_(9.8), beta1_(0.075), - yPlusLam_(calcYPlusLam(kappa_, E_)) + yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)) { checkType(); @@ -136,7 +120,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)), beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)), - yPlusLam_(calcYPlusLam(kappa_, E_)) + yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)) { checkType(); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index 64faf11f645389793888126ed05ff32c4aa54483..9e9dc6f8931f9bb2436e6c726ab0bbec7cbdcac5 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -98,9 +98,6 @@ protected: //- Check the type of the patch virtual void checkType(); - //- Calculate the Y+ at the edge of the laminar sublayer - virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const; - //- Write local wall function variables virtual void writeLocalEntries(Ostream&) const; diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C index 6d998d74a442c39625226ace7aab24d75e862b37..4adcfb723e7bd2e5fe1185953ac1cff8281cadff 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C @@ -68,7 +68,9 @@ turbulenceModel::turbulenceModel rho_(rho), U_(U), phi_(phi), - thermophysicalModel_(thermophysicalModel) + thermophysicalModel_(thermophysicalModel), + + y_(mesh_) {} @@ -137,7 +139,12 @@ tmp<volScalarField> turbulenceModel::rhoEpsilonEff() const void turbulenceModel::correct() -{} +{ + if (mesh_.changing()) + { + y_.correct(); + } +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H index 464b70d85ec6da53dab01562335daaebe32d05af..790e6e99e44a02a7669c2a9050e2c89f1478b50d 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H @@ -49,6 +49,7 @@ SourceFiles #include "surfaceFieldsFwd.H" #include "fvMatricesFwd.H" #include "basicThermo.H" +#include "nearWallDist.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" @@ -85,6 +86,9 @@ protected: const basicThermo& thermophysicalModel_; + //- Near wall distance boundary field + nearWallDist y_; + private: @@ -178,6 +182,12 @@ public: return thermophysicalModel_; } + //- Return the near wall distances + const nearWallDist& y() const + { + return y_; + } + //- Return the laminar viscosity const volScalarField& mu() const { diff --git a/tutorials/combustion/XiFoam/les/pitzDaily/0/alphaSgs b/tutorials/combustion/XiFoam/les/pitzDaily/0/alphaSgs index 16b4384a8e4d782f4b00fe59820b5f0fd29799d1..c417948180611ece6dd697ac08455a49d3c34da8 100644 --- a/tutorials/combustion/XiFoam/les/pitzDaily/0/alphaSgs +++ b/tutorials/combustion/XiFoam/les/pitzDaily/0/alphaSgs @@ -32,14 +32,14 @@ boundaryField upperWall { - type alphaSgsJayatillekeWallFunction; + type alphatJayatillekeWallFunction; he ha; value uniform 0; } lowerWall { - type alphaSgsJayatillekeWallFunction; + type alphatJayatillekeWallFunction; he ha; value uniform 0; } diff --git a/tutorials/combustion/XiFoam/les/pitzDaily/0/muSgs b/tutorials/combustion/XiFoam/les/pitzDaily/0/muSgs index a6e489dcf1df0296b1a382845251e96ba98d1b62..cec3a41ed65ddcb0052cfdb2014c2f1eed21043d 100644 --- a/tutorials/combustion/XiFoam/les/pitzDaily/0/muSgs +++ b/tutorials/combustion/XiFoam/les/pitzDaily/0/muSgs @@ -32,13 +32,13 @@ boundaryField upperWall { - type muSgsUSpaldingWallFunction; + type mutUSpaldingWallFunction; value uniform 0; } lowerWall { - type muSgsUSpaldingWallFunction; + type mutUSpaldingWallFunction; value uniform 0; } diff --git a/tutorials/combustion/XiFoam/les/pitzDaily3D/0/alphaSgs b/tutorials/combustion/XiFoam/les/pitzDaily3D/0/alphaSgs index 1a913f8b784e83f2d845ec0cdd61d03febd0cbc1..07d5fba6deb5e2e2868c4dadc5e7296163c325a7 100644 --- a/tutorials/combustion/XiFoam/les/pitzDaily3D/0/alphaSgs +++ b/tutorials/combustion/XiFoam/les/pitzDaily3D/0/alphaSgs @@ -31,13 +31,13 @@ boundaryField } upperWall { - type alphaSgsJayatillekeWallFunction; + type alphatJayatillekeWallFunction; he ha; value uniform 0; } lowerWall { - type alphaSgsJayatillekeWallFunction; + type alphatJayatillekeWallFunction; he ha; value uniform 0; } diff --git a/tutorials/combustion/XiFoam/les/pitzDaily3D/0/muSgs b/tutorials/combustion/XiFoam/les/pitzDaily3D/0/muSgs index 127f76d8cbdf6df42e964a0a7ff3cd75637734f2..684139326dd45482f51976aa674b92703b4e5b39 100644 --- a/tutorials/combustion/XiFoam/les/pitzDaily3D/0/muSgs +++ b/tutorials/combustion/XiFoam/les/pitzDaily3D/0/muSgs @@ -31,12 +31,12 @@ boundaryField } upperWall { - type muSgsUSpaldingWallFunction; + type mutUSpaldingWallFunction; value uniform 0; } lowerWall { - type muSgsUSpaldingWallFunction; + type mutUSpaldingWallFunction; value uniform 0; } front diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/alphaSgs b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/alphaSgs index 4da8c755f205b9405d30b2beaf03c64d522c3c74..f50fb4a4811acc8bb419841df6b4892266e0cf5c 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/alphaSgs +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/alphaSgs @@ -23,7 +23,7 @@ boundaryField { ground { - type alphaSgsWallFunction; + type alphatWallFunction; value uniform 0; } @@ -44,7 +44,7 @@ boundaryField "(region0_to.*)" { - type alphaSgsWallFunction; + type alphatWallFunction; value uniform 0; } } diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/muSgs b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/muSgs index 16cb59208153367ab36345fb5ced7dd5334539fa..cf1d5513646262a7ddf209706ffa07d9f9d5a83f 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/muSgs +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/muSgs @@ -43,7 +43,7 @@ boundaryField "(region0_to.*)" { - type muSgsUSpaldingWallFunction; + type mutUSpaldingWallFunction; value uniform 0; } }