utilities/postProcessing: Automate the selection of incompressible/compressible modes

This commit is contained in:
Henry Weller
2015-06-24 10:44:02 +01:00
parent 0b5082b8c7
commit 7a624425cb
3 changed files with 37 additions and 37 deletions

View File

@ -27,6 +27,10 @@ Application
Description Description
Calculates and writes the Reynolds stress R for the current time step. Calculates and writes the Reynolds stress R for the current time step.
Compressible modes is automatically selected based on the existence of the
"thermophysicalProperties" dictionary required to construct the
thermodynamics package.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
@ -108,22 +112,12 @@ void calcCompressibleR
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(); timeSelector::addOptions();
#include "addRegionOption.H" #include "addRegionOption.H"
argList::addBoolOption
(
"compressible",
"calculate compressible R"
);
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"
const bool compressible = args.optionFound("compressible");
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {
runTime.setTime(timeDirs[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
@ -143,7 +137,15 @@ int main(int argc, char *argv[])
Info<< "Reading field " << UHeader.name() << nl << endl; Info<< "Reading field " << UHeader.name() << nl << endl;
volVectorField U(UHeader, mesh); volVectorField U(UHeader, mesh);
if (compressible) if
(
IOobject
(
basicThermo::dictName,
runTime.constant(),
mesh
).headerOk()
)
{ {
calcCompressibleR(mesh, runTime, U); calcCompressibleR(mesh, runTime, U);
} }

View File

@ -28,8 +28,9 @@ Description
Calculates and reports wall shear stress for all patches, for the Calculates and reports wall shear stress for all patches, for the
specified times when using RAS turbulence models. specified times when using RAS turbulence models.
Default behaviour assumes operating in incompressible mode. Compressible modes is automatically selected based on the existence of the
Use the -compressible option for compressible RAS cases. "thermophysicalProperties" dictionary required to construct the
thermodynamics package.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -128,22 +129,12 @@ void calcCompressible
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(); timeSelector::addOptions();
#include "addRegionOption.H" #include "addRegionOption.H"
argList::addBoolOption
(
"compressible",
"calculate compressible wall shear stress"
);
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"
const bool compressible = args.optionFound("compressible");
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {
runTime.setTime(timeDirs[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
@ -183,7 +174,15 @@ int main(int argc, char *argv[])
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U(UHeader, mesh); volVectorField U(UHeader, mesh);
if (compressible) if
(
IOobject
(
basicThermo::dictName,
runTime.constant(),
mesh
).headerOk()
)
{ {
calcCompressible(mesh, runTime, U, wallShearStress); calcCompressible(mesh, runTime, U, wallShearStress);
} }

View File

@ -32,8 +32,9 @@ Description
the y+ values otherwise they are obtained directly from the near-wall the y+ values otherwise they are obtained directly from the near-wall
velocity gradient and effective and laminar viscosities. velocity gradient and effective and laminar viscosities.
Default behaviour assumes operating in incompressible mode. Compressible modes is automatically selected based on the existence of the
Use the -compressible option for compressible cases. "thermophysicalProperties" dictionary required to construct the
thermodynamics package.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -180,22 +181,12 @@ void calcCompressibleYPlus
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(); timeSelector::addOptions();
#include "addRegionOption.H" #include "addRegionOption.H"
argList::addBoolOption
(
"compressible",
"calculate compressible y+"
);
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select(runTime, args, "yPlus"); instantList timeDirs = timeSelector::select(runTime, args, "yPlus");
#include "createNamedMesh.H" #include "createNamedMesh.H"
const bool compressible = args.optionFound("compressible");
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {
runTime.setTime(timeDirs[timeI], timeI); runTime.setTime(timeDirs[timeI], timeI);
@ -230,7 +221,15 @@ int main(int argc, char *argv[])
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U(UHeader, mesh); volVectorField U(UHeader, mesh);
if (compressible) if
(
IOobject
(
basicThermo::dictName,
runTime.constant(),
mesh
).headerOk()
)
{ {
calcCompressibleYPlus(mesh, runTime, U, yPlus); calcCompressibleYPlus(mesh, runTime, U, yPlus);
} }