diff --git a/applications/utilities/postProcessing/wall/wallShearStress/Make/options b/applications/utilities/postProcessing/wall/wallShearStress/Make/options index 89632547e..c9f4bdaa6 100644 --- a/applications/utilities/postProcessing/wall/wallShearStress/Make/options +++ b/applications/utilities/postProcessing/wall/wallShearStress/Make/options @@ -1,10 +1,15 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/turbulenceModels \ - -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ + -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions \ + -I$(LIB_SRC)/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lbasicThermophysicalModels \ + -lspecie \ + -lcompressibleRASModels \ -lfiniteVolume diff --git a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C index 34f3d1899..f7779f642 100644 --- a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C +++ b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C @@ -25,23 +25,126 @@ Application wallShearStress Description - Calculates and writes the wall shear stress, for the specified times. + 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 "RASModel.H" +#include "incompressible/RAS/RASModel/RASModel.H" + +#include "basicPsiThermo.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 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 pThermo + ( + basicPsiThermo::New(mesh) + ); + basicPsiThermo& thermo = pThermo(); + + autoPtr 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::validOptions.insert("compressible",""); + #include "setRootCase.H" #include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); - #include "createMesh.H" + #include "createNamedMesh.H" + + bool compressible = args.optionFound("compressible"); + forAll(timeDirs, timeI) { @@ -49,10 +152,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << endl; mesh.readUpdate(); - #include "createFields.H" - - volSymmTensorField Reff(RASModel->devReff()); - volVectorField wallShearStress ( IOobject @@ -67,19 +166,41 @@ int main(int argc, char *argv[]) dimensionedVector ( "wallShearStress", - Reff.dimensions(), + sqr(dimLength)/sqr(dimTime), vector::zero ) ); - forAll(wallShearStress.boundaryField(), patchi) + IOobject UHeader + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (UHeader.headerOk()) { - wallShearStress.boundaryField()[patchi] = - ( - -mesh.Sf().boundaryField()[patchi] - /mesh.magSf().boundaryField()[patchi] - ) & Reff.boundaryField()[patchi]; + 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(); }