Combine yPlusRAS and yPlusLES into the single utility yPlus
which provides y+ values for the near-wall cells for laminar, LES and RAS
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
yPlus.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/yPlus
|
||||
@ -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,9 +42,75 @@ Description
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "nutWallFunctionFvPatchScalarField.H"
|
||||
#include "nearWallDist.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TurbulenceModel>
|
||||
void calcYPlus
|
||||
(
|
||||
const TurbulenceModel& turbulenceModel,
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volVectorField& U,
|
||||
volScalarField& yPlus
|
||||
)
|
||||
{
|
||||
volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
|
||||
|
||||
const volScalarField::GeometricBoundaryField nutBf =
|
||||
turbulenceModel->nut()().boundaryField();
|
||||
|
||||
const volScalarField::GeometricBoundaryField nuEffBf =
|
||||
turbulenceModel->nuEff()().boundaryField();
|
||||
|
||||
const volScalarField::GeometricBoundaryField nuBf =
|
||||
turbulenceModel->nu()().boundaryField();
|
||||
|
||||
const fvPatchList& patches = mesh.boundary();
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const fvPatch& patch = patches[patchi];
|
||||
|
||||
if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchi]))
|
||||
{
|
||||
const nutWallFunctionFvPatchScalarField& nutPf =
|
||||
dynamic_cast<const nutWallFunctionFvPatchScalarField&>
|
||||
(
|
||||
nutBf[patchi]
|
||||
);
|
||||
|
||||
yPlus.boundaryField()[patchi] = nutPf.yPlus();
|
||||
const scalarField& Yp = yPlus.boundaryField()[patchi];
|
||||
|
||||
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 " << patch.name()
|
||||
<< " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp)
|
||||
<< " average: " << gAverage(Yp) << nl << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void calcIncompressibleYPlus
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
@ -49,46 +119,16 @@ void calcIncompressibleYPlus
|
||||
volScalarField& yPlus
|
||||
)
|
||||
{
|
||||
typedef nutWallFunctionFvPatchScalarField wallFunctionPatchField;
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
autoPtr<incompressible::RASModel> RASModel
|
||||
autoPtr<incompressible::turbulenceModel> turbulenceModel
|
||||
(
|
||||
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
yPlusLES.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/yPlusLES
|
||||
@ -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
|
||||
@ -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());
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +0,0 @@
|
||||
yPlusRAS.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/yPlusRAS
|
||||
Reference in New Issue
Block a user