diff --git a/applications/utilities/postProcessing/wall/yPlus/Make/files b/applications/utilities/postProcessing/wall/yPlus/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..e52ae0b6aa81085b8ed314f996976510ca39dde4 --- /dev/null +++ b/applications/utilities/postProcessing/wall/yPlus/Make/files @@ -0,0 +1,3 @@ +yPlus.C + +EXE = $(FOAM_APPBIN)/yPlus diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/Make/options b/applications/utilities/postProcessing/wall/yPlus/Make/options similarity index 100% rename from applications/utilities/postProcessing/wall/yPlusRAS/Make/options rename to applications/utilities/postProcessing/wall/yPlus/Make/options diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C b/applications/utilities/postProcessing/wall/yPlus/yPlus.C similarity index 65% rename from applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C rename to applications/utilities/postProcessing/wall/yPlus/yPlus.C index dde81571e73fb2b7d1a8fc800f66fed6d070da36..9ff6c4905baf499870fc3983882da48f73d81086 100644 --- a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C +++ b/applications/utilities/postProcessing/wall/yPlus/yPlus.C @@ -22,14 +22,18 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application - yPlusRAS + yPlus Description - Calculates and reports yPlus for all wall patches, for the specified times - when using RAS turbulence models. + Calculates and reports yPlus for the near-wall cells of all wall patches, + for the specified times for laminar, LES and RAS. + + For walls at which wall-functions are applied the wall-function provides + the y+ values otherwise they are obtained directly from the near-wall + velocity gradient and effective and laminar viscosities. Default behaviour assumes operating in incompressible mode. - Use the -compressible option for compressible RAS cases. + Use the -compressible option for compressible cases. \*---------------------------------------------------------------------------*/ @@ -38,57 +42,93 @@ Description #include "turbulentTransportModel.H" #include "turbulentFluidThermoModel.H" #include "nutWallFunctionFvPatchScalarField.H" +#include "nearWallDist.H" +#include "wallFvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -void calcIncompressibleYPlus +template<class TurbulenceModel> +void calcYPlus ( + const TurbulenceModel& turbulenceModel, const fvMesh& mesh, const Time& runTime, const volVectorField& U, volScalarField& yPlus ) { - typedef nutWallFunctionFvPatchScalarField wallFunctionPatchField; + volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); - #include "createPhi.H" + const volScalarField::GeometricBoundaryField nutBf = + turbulenceModel->nut()().boundaryField(); - singlePhaseTransportModel laminarTransport(U, phi); + const volScalarField::GeometricBoundaryField nuEffBf = + turbulenceModel->nuEff()().boundaryField(); - autoPtr<incompressible::RASModel> RASModel - ( - incompressible::RASModel::New(U, phi, laminarTransport) - ); + const volScalarField::GeometricBoundaryField nuBf = + turbulenceModel->nu()().boundaryField(); - const volScalarField::GeometricBoundaryField nutPatches = - RASModel->nut()().boundaryField(); + const fvPatchList& patches = mesh.boundary(); - bool foundNutPatch = false; - forAll(nutPatches, patchi) + forAll(patches, patchi) { - if (isA<wallFunctionPatchField>(nutPatches[patchi])) + const fvPatch& patch = patches[patchi]; + + if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchi])) { - foundNutPatch = true; + const nutWallFunctionFvPatchScalarField& nutPf = + dynamic_cast<const nutWallFunctionFvPatchScalarField&> + ( + nutBf[patchi] + ); - const wallFunctionPatchField& nutPw = - dynamic_cast<const wallFunctionPatchField&> - (nutPatches[patchi]); + yPlus.boundaryField()[patchi] = nutPf.yPlus(); + const scalarField& Yp = yPlus.boundaryField()[patchi]; - yPlus.boundaryField()[patchi] = nutPw.yPlus(); + Info<< "Patch " << patchi + << " named " << nutPf.patch().name() + << ", wall-function " << nutPf.type() + << ", y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) + << " average: " << gAverage(Yp) << nl << endl; + } + else if (isA<wallFvPatch>(patch)) + { + yPlus.boundaryField()[patchi] = + d[patchi] + *sqrt + ( + nuEffBf[patchi] + *mag(U.boundaryField()[patchi].snGrad()) + )/nuBf[patchi]; const scalarField& Yp = yPlus.boundaryField()[patchi]; Info<< "Patch " << patchi - << " named " << nutPw.patch().name() + << " named " << patch.name() << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) << " average: " << gAverage(Yp) << nl << endl; } } +} - if (!foundNutPatch) - { - Info<< " no " << wallFunctionPatchField::typeName << " patches" - << endl; - } + +void calcIncompressibleYPlus +( + const fvMesh& mesh, + const Time& runTime, + const volVectorField& U, + volScalarField& yPlus +) +{ + #include "createPhi.H" + + singlePhaseTransportModel laminarTransport(U, phi); + + autoPtr<incompressible::turbulenceModel> turbulenceModel + ( + incompressible::turbulenceModel::New(U, phi, laminarTransport) + ); + + calcYPlus(turbulenceModel, mesh, runTime, U, yPlus); } @@ -100,8 +140,6 @@ void calcCompressibleYPlus volScalarField& yPlus ) { - typedef nutWallFunctionFvPatchScalarField wallFunctionPatchField; - IOobject rhoHeader ( "rho", @@ -122,15 +160,12 @@ void calcCompressibleYPlus #include "compressibleCreatePhi.H" - autoPtr<fluidThermo> pThermo - ( - fluidThermo::New(mesh) - ); + autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh)); fluidThermo& thermo = pThermo(); - autoPtr<compressible::RASModel> RASModel + autoPtr<compressible::turbulenceModel> turbulenceModel ( - compressible::RASModel::New + compressible::turbulenceModel::New ( rho, U, @@ -139,35 +174,7 @@ void calcCompressibleYPlus ) ); - const volScalarField::GeometricBoundaryField nutPatches = - RASModel->nut()().boundaryField(); - - bool foundNutPatch = false; - forAll(nutPatches, patchi) - { - if (isA<wallFunctionPatchField>(nutPatches[patchi])) - { - foundNutPatch = true; - - const wallFunctionPatchField& nutPw = - dynamic_cast<const wallFunctionPatchField&> - (nutPatches[patchi]); - - yPlus.boundaryField()[patchi] = nutPw.yPlus(); - const scalarField& Yp = yPlus.boundaryField()[patchi]; - - Info<< "Patch " << patchi - << " named " << nutPw.patch().name() - << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) - << " average: " << gAverage(Yp) << nl << endl; - } - } - - if (!foundNutPatch) - { - Info<< " no " << wallFunctionPatchField::typeName << " patches" - << endl; - } + calcYPlus(turbulenceModel, mesh, runTime, U, yPlus); } diff --git a/applications/utilities/postProcessing/wall/yPlusLES/Make/files b/applications/utilities/postProcessing/wall/yPlusLES/Make/files deleted file mode 100644 index 88490a7b288299814714e23b82ace8ab48a3c8e8..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/wall/yPlusLES/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -yPlusLES.C - -EXE = $(FOAM_APPBIN)/yPlusLES diff --git a/applications/utilities/postProcessing/wall/yPlusLES/Make/options b/applications/utilities/postProcessing/wall/yPlusLES/Make/options deleted file mode 100644 index a3e31c2203c10abcdb466204b074868fd381506c..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/wall/yPlusLES/Make/options +++ /dev/null @@ -1,14 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/transportModels \ - -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ - -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude - -EXE_LIBS = \ - -lturbulenceModels \ - -lincompressibleTurbulenceModels \ - -lincompressibleTransportModels \ - -lfiniteVolume \ - -lgenericPatchFields diff --git a/applications/utilities/postProcessing/wall/yPlusLES/createFields.H b/applications/utilities/postProcessing/wall/yPlusLES/createFields.H deleted file mode 100644 index 108aa9689fa22f8b03c5fa3eb0c4d1a4f931718b..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/wall/yPlusLES/createFields.H +++ /dev/null @@ -1,24 +0,0 @@ -Info<< "Reading field U\n" << endl; -volVectorField U -( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh -); - -#include "createPhi.H" - -singlePhaseTransportModel laminarTransport(U, phi); - -autoPtr<incompressible::LESModel> sgsModel -( - incompressible::LESModel::New(U, phi, laminarTransport) -); - -volScalarField::GeometricBoundaryField d(nearWallDist(mesh).y()); diff --git a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C b/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C deleted file mode 100644 index 731c6ea6b51d5bb954079c6e8b4995cd8a611d0d..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C +++ /dev/null @@ -1,136 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 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/>. - -Application - yPlusLES - -Description - Calculates and reports yPlus for all wall patches, for the specified times - when using LES turbulence models. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "singlePhaseTransportModel.H" -#include "turbulentTransportModel.H" -#include "nutWallFunctionFvPatchScalarField.H" - -#include "nearWallDist.H" -#include "wallFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - timeSelector::addOptions(); - #include "setRootCase.H" - #include "createTime.H" - instantList timeDirs = timeSelector::select0(runTime, args); - #include "createMesh.H" - - forAll(timeDirs, timeI) - { - runTime.setTime(timeDirs[timeI], timeI); - Info<< "Time = " << runTime.timeName() << endl; - mesh.readUpdate(); - - volScalarField yPlus - ( - IOobject - ( - "yPlus", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("yPlus", dimless, 0.0) - ); - - Info<< "Reading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh - ); - - #include "createPhi.H" - - singlePhaseTransportModel laminarTransport(U, phi); - - autoPtr<incompressible::LESModel> sgsModel - ( - incompressible::LESModel::New(U, phi, laminarTransport) - ); - - volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); - volScalarField nuEff(sgsModel->nuEff()); - - const fvPatchList& patches = mesh.boundary(); - - const volScalarField nuLam(sgsModel->nu()); - - forAll(patches, patchi) - { - const fvPatch& currPatch = patches[patchi]; - - if (isA<wallFvPatch>(currPatch)) - { - yPlus.boundaryField()[patchi] = - d[patchi] - *sqrt - ( - nuEff.boundaryField()[patchi] - *mag(U.boundaryField()[patchi].snGrad()) - ) - /nuLam.boundaryField()[patchi]; - const scalarField& Yp = yPlus.boundaryField()[patchi]; - - Info<< "Patch " << patchi - << " named " << currPatch.name() - << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) - << " average: " << gAverage(Yp) << nl << endl; - } - } - - Info<< "Writing yPlus to field " - << yPlus.name() << nl << endl; - - yPlus.write(); - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/Make/files b/applications/utilities/postProcessing/wall/yPlusRAS/Make/files deleted file mode 100644 index 2b65307843e33ebb4d47bf97ea8853087b13d3d9..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/wall/yPlusRAS/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -yPlusRAS.C - -EXE = $(FOAM_APPBIN)/yPlusRAS