Add the OpenFOAM source tree
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
wallGradU.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/wallGradU
|
||||
@ -0,0 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields
|
||||
114
applications/utilities/postProcessing/wall/wallGradU/wallGradU.C
Normal file
114
applications/utilities/postProcessing/wall/wallGradU/wallGradU.C
Normal file
@ -0,0 +1,114 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
wallGradU
|
||||
|
||||
Description
|
||||
Calculates and writes the gradient of U at the wall.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.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;
|
||||
|
||||
IOobject Uheader
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
// Check U exists
|
||||
if (Uheader.headerOk())
|
||||
{
|
||||
mesh.readUpdate();
|
||||
|
||||
Info<< " Reading U" << endl;
|
||||
volVectorField U(Uheader, mesh);
|
||||
|
||||
Info<< " Calculating wallGradU" << endl;
|
||||
|
||||
volVectorField wallGradU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wallGradU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector
|
||||
(
|
||||
"wallGradU",
|
||||
U.dimensions()/dimLength,
|
||||
vector::zero
|
||||
)
|
||||
);
|
||||
|
||||
const fvPatchList& patches = mesh.boundary();
|
||||
|
||||
forAll(wallGradU.boundaryField(), patchi)
|
||||
{
|
||||
const fvPatch& currPatch = patches[patchi];
|
||||
|
||||
if (isA<wallFvPatch>(currPatch))
|
||||
{
|
||||
wallGradU.boundaryField()[patchi] =
|
||||
-U.boundaryField()[patchi].snGrad();
|
||||
}
|
||||
}
|
||||
|
||||
wallGradU.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " No U" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
wallHeatFlux.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/wallHeatFlux
|
||||
@ -0,0 +1,20 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels \
|
||||
-lLESdeltas \
|
||||
-lreactionThermophysicalModels \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields \
|
||||
-lspecie \
|
||||
-lfluidThermophysicalModels \
|
||||
-lsolidThermo
|
||||
@ -0,0 +1,56 @@
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
const volScalarField& h = thermo->he();
|
||||
|
||||
// Register copy of thermo density
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
thermo->rho()
|
||||
);
|
||||
|
||||
// Construct turbulence model (if fluid)
|
||||
autoPtr<volVectorField> UPtr;
|
||||
autoPtr<surfaceScalarField> phiPtr;
|
||||
autoPtr<compressible::turbulenceModel> turbulence;
|
||||
|
||||
if (isA<fluidThermo>(thermo()))
|
||||
{
|
||||
UPtr.reset
|
||||
(
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
const volVectorField& U = UPtr();
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
// Copy phi to autoPtr. Rename to make sure copy is now registered as 'phi'.
|
||||
phi.rename("phiFluid");
|
||||
phiPtr.reset(new surfaceScalarField("phi", phi));
|
||||
|
||||
turbulence = compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phiPtr(),
|
||||
refCast<const fluidThermo>(thermo())
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
wallHeatFlux
|
||||
|
||||
Description
|
||||
Calculates and writes the heat flux for all patches as the boundary field
|
||||
of a volScalarField and also prints the integrated flux for all wall
|
||||
patches.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "solidThermo.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
mesh.readUpdate();
|
||||
|
||||
#include "createFields.H"
|
||||
|
||||
surfaceScalarField heatFlux
|
||||
(
|
||||
fvc::interpolate
|
||||
(
|
||||
(
|
||||
turbulence.valid()
|
||||
? turbulence->alphaEff()()
|
||||
: thermo->alpha()
|
||||
)
|
||||
)*fvc::snGrad(h)
|
||||
);
|
||||
|
||||
const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =
|
||||
heatFlux.boundaryField();
|
||||
|
||||
Info<< "\nWall heat fluxes [W]" << endl;
|
||||
forAll(patchHeatFlux, patchi)
|
||||
{
|
||||
if (isA<wallFvPatch>(mesh.boundary()[patchi]))
|
||||
{
|
||||
Info<< mesh.boundary()[patchi].name()
|
||||
<< " "
|
||||
<< gSum
|
||||
(
|
||||
mesh.magSf().boundaryField()[patchi]
|
||||
*patchHeatFlux[patchi]
|
||||
)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
volScalarField wallHeatFlux
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wallHeatFlux",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("wallHeatFlux", heatFlux.dimensions(), 0.0)
|
||||
);
|
||||
|
||||
forAll(wallHeatFlux.boundaryField(), patchi)
|
||||
{
|
||||
wallHeatFlux.boundaryField()[patchi] = patchHeatFlux[patchi];
|
||||
}
|
||||
|
||||
wallHeatFlux.write();
|
||||
}
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
wallShearStress.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/wallShearStress
|
||||
@ -0,0 +1,14 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleRASModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleRASModels \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields
|
||||
@ -0,0 +1,215 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
wallShearStress
|
||||
|
||||
Description
|
||||
Calculates and reports wall shear stress for all patches, for the
|
||||
specified times when using RAS turbulence models.
|
||||
|
||||
Default behaviour assumes operating in incompressible mode.
|
||||
Use the -compressible option for compressible RAS cases.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "incompressible/RAS/RASModel/RASModel.H"
|
||||
|
||||
#include "fluidThermo.H"
|
||||
#include "compressible/RAS/RASModel/RASModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void calcIncompressible
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volVectorField& U,
|
||||
volVectorField& wallShearStress
|
||||
)
|
||||
{
|
||||
#include "createPhi.H"
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
autoPtr<incompressible::RASModel> model
|
||||
(
|
||||
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
const volSymmTensorField Reff(model->devReff());
|
||||
|
||||
forAll(wallShearStress.boundaryField(), patchI)
|
||||
{
|
||||
wallShearStress.boundaryField()[patchI] =
|
||||
(
|
||||
-mesh.Sf().boundaryField()[patchI]
|
||||
/mesh.magSf().boundaryField()[patchI]
|
||||
) & Reff.boundaryField()[patchI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void calcCompressible
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volVectorField& U,
|
||||
volVectorField& wallShearStress
|
||||
)
|
||||
{
|
||||
IOobject rhoHeader
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (!rhoHeader.headerOk())
|
||||
{
|
||||
Info<< " no rho field" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Info<< "Reading field rho\n" << endl;
|
||||
volScalarField rho(rhoHeader, mesh);
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh));
|
||||
fluidThermo& thermo = pThermo();
|
||||
|
||||
autoPtr<compressible::RASModel> model
|
||||
(
|
||||
compressible::RASModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
const volSymmTensorField Reff(model->devRhoReff());
|
||||
|
||||
forAll(wallShearStress.boundaryField(), patchI)
|
||||
{
|
||||
wallShearStress.boundaryField()[patchI] =
|
||||
(
|
||||
-mesh.Sf().boundaryField()[patchI]
|
||||
/mesh.magSf().boundaryField()[patchI]
|
||||
) & Reff.boundaryField()[patchI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
#include "addRegionOption.H"
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"compressible",
|
||||
"calculate compressible wall shear stress"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
const bool compressible = args.optionFound("compressible");
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
mesh.readUpdate();
|
||||
|
||||
volVectorField wallShearStress
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wallShearStress",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector
|
||||
(
|
||||
"wallShearStress",
|
||||
sqr(dimLength)/sqr(dimTime),
|
||||
vector::zero
|
||||
)
|
||||
);
|
||||
|
||||
IOobject UHeader
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (UHeader.headerOk())
|
||||
{
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U(UHeader, mesh);
|
||||
|
||||
if (compressible)
|
||||
{
|
||||
calcCompressible(mesh, runTime, U, wallShearStress);
|
||||
}
|
||||
else
|
||||
{
|
||||
calcIncompressible(mesh, runTime, U, wallShearStress);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " no U field" << endl;
|
||||
}
|
||||
|
||||
Info<< "Writing wall shear stress to field " << wallShearStress.name()
|
||||
<< nl << endl;
|
||||
|
||||
wallShearStress.write();
|
||||
}
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
yPlusLES.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/yPlusLES
|
||||
@ -0,0 +1,13 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/LES/LESModel \
|
||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleLESModels \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields
|
||||
@ -0,0 +1,24 @@
|
||||
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());
|
||||
146
applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C
Normal file
146
applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C
Normal file
@ -0,0 +1,146 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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 "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "LESModel.H"
|
||||
#include "nearWallDist.H"
|
||||
#include "wallDist.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;
|
||||
fvMesh::readUpdateState state = mesh.readUpdate();
|
||||
|
||||
// Wall distance
|
||||
if (timeI == 0 || state != fvMesh::UNCHANGED)
|
||||
{
|
||||
Info<< "Calculating wall distance\n" << endl;
|
||||
wallDist y(mesh, true);
|
||||
Info<< "Writing wall distance to field "
|
||||
<< y.name() << nl << endl;
|
||||
y.write();
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
yPlusRAS.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/yPlusRAS
|
||||
@ -0,0 +1,19 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleRASModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleRASModels \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
269
applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C
Normal file
269
applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C
Normal file
@ -0,0 +1,269 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
yPlusRAS
|
||||
|
||||
Description
|
||||
Calculates and reports yPlus for all wall patches, for the specified times
|
||||
when using RAS turbulence models.
|
||||
|
||||
Default behaviour assumes operating in incompressible mode.
|
||||
Use the -compressible option for compressible RAS cases.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "incompressible/RAS/RASModel/RASModel.H"
|
||||
#include "nutWallFunction/nutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
#include "fluidThermo.H"
|
||||
#include "compressible/RAS/RASModel/RASModel.H"
|
||||
#include "mutWallFunction/mutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
#include "wallDist.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void calcIncompressibleYPlus
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volVectorField& U,
|
||||
volScalarField& yPlus
|
||||
)
|
||||
{
|
||||
typedef incompressible::nutWallFunctionFvPatchScalarField
|
||||
wallFunctionPatchField;
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
autoPtr<incompressible::RASModel> RASModel
|
||||
(
|
||||
incompressible::RASModel::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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void calcCompressibleYPlus
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volVectorField& U,
|
||||
volScalarField& yPlus
|
||||
)
|
||||
{
|
||||
typedef compressible::mutWallFunctionFvPatchScalarField
|
||||
wallFunctionPatchField;
|
||||
|
||||
IOobject rhoHeader
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (!rhoHeader.headerOk())
|
||||
{
|
||||
Info<< " no rho field" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Info<< "Reading field rho\n" << endl;
|
||||
volScalarField rho(rhoHeader, mesh);
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
autoPtr<fluidThermo> pThermo
|
||||
(
|
||||
fluidThermo::New(mesh)
|
||||
);
|
||||
fluidThermo& thermo = pThermo();
|
||||
|
||||
autoPtr<compressible::RASModel> RASModel
|
||||
(
|
||||
compressible::RASModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
const volScalarField::GeometricBoundaryField mutPatches =
|
||||
RASModel->mut()().boundaryField();
|
||||
|
||||
bool foundMutPatch = false;
|
||||
forAll(mutPatches, patchi)
|
||||
{
|
||||
if (isA<wallFunctionPatchField>(mutPatches[patchi]))
|
||||
{
|
||||
foundMutPatch = true;
|
||||
|
||||
const wallFunctionPatchField& mutPw =
|
||||
dynamic_cast<const wallFunctionPatchField&>
|
||||
(mutPatches[patchi]);
|
||||
|
||||
yPlus.boundaryField()[patchi] = mutPw.yPlus();
|
||||
const scalarField& Yp = yPlus.boundaryField()[patchi];
|
||||
|
||||
Info<< "Patch " << patchi
|
||||
<< " named " << mutPw.patch().name()
|
||||
<< " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp)
|
||||
<< " average: " << gAverage(Yp) << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundMutPatch)
|
||||
{
|
||||
Info<< " no " << wallFunctionPatchField::typeName << " patches"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
#include "addRegionOption.H"
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"compressible",
|
||||
"calculate compressible y+"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
const bool compressible = args.optionFound("compressible");
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
fvMesh::readUpdateState state = mesh.readUpdate();
|
||||
|
||||
// Wall distance
|
||||
if (timeI == 0 || state != fvMesh::UNCHANGED)
|
||||
{
|
||||
Info<< "Calculating wall distance\n" << endl;
|
||||
wallDist y(mesh, true);
|
||||
Info<< "Writing wall distance to field " << y.name() << nl << endl;
|
||||
y.write();
|
||||
}
|
||||
|
||||
volScalarField yPlus
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"yPlus",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("yPlus", dimless, 0.0)
|
||||
);
|
||||
|
||||
IOobject UHeader
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (UHeader.headerOk())
|
||||
{
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U(UHeader, mesh);
|
||||
|
||||
if (compressible)
|
||||
{
|
||||
calcCompressibleYPlus(mesh, runTime, U, yPlus);
|
||||
}
|
||||
else
|
||||
{
|
||||
calcIncompressibleYPlus(mesh, runTime, U, yPlus);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " no U field" << endl;
|
||||
}
|
||||
|
||||
Info<< "Writing yPlus to field " << yPlus.name() << nl << endl;
|
||||
|
||||
yPlus.write();
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user