Updated the whole of OpenFOAM to use the new templated TurbulenceModels library

The old separate incompressible and compressible libraries have been removed.

Most of the commonly used RANS and LES models have been upgraded to the
new framework but there are a few missing which will be added over the
next few days, in particular the realizable k-epsilon model.  Some of
the less common incompressible RANS models have been introduced into the
new library instantiated for incompressible flow only.  If they prove to
be generally useful they can be templated for compressible and
multiphase application.

The Spalart-Allmaras DDES and IDDES models have been thoroughly
debugged, removing serious errors concerning the use of S rather than
Omega.

The compressible instances of the models have been augmented by a simple
backward-compatible eddyDiffusivity model for thermal transport based on
alphat and alphaEff.  This will be replaced with a separate run-time
selectable thermal transport model framework in a few weeks.

For simplicity and ease of maintenance and further development the
turbulent transport and wall modeling is based on nut/nuEff rather than
mut/muEff for compressible models so that all forms of turbulence models
can use the same wall-functions and other BCs.

All turbulence model selection made in the constant/turbulenceProperties
dictionary with RAS and LES as sub-dictionaries rather than in separate
files which added huge complexity for multiphase.

All tutorials have been updated so study the changes and update your own
cases by comparison with similar cases provided.

Sorry for the inconvenience in the break in backward-compatibility but
this update to the turbulence modeling is an essential step in the
future of OpenFOAM to allow more models to be added and maintained for a
wider range of cases and physics.  Over the next weeks and months more
turbulence models will be added of single and multiphase flow, more
additional sub-models and further development and testing of existing
models.  I hope this brings benefits to all OpenFOAM users.

Henry G. Weller
This commit is contained in:
Henry
2015-01-21 19:21:39 +00:00
parent 2d4d5e93ce
commit 2aec249647
1102 changed files with 9087 additions and 54729 deletions

View File

@ -4,7 +4,9 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lfluidThermophysicalModels \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume \
-lcompressibleRASModels
-lfiniteVolume

View File

@ -6,9 +6,7 @@ EXE_LIBS = \
-lblockMesh \
-lchemistryModel \
-lcoalCombustion \
-lcompressibleLESModels \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-lcompressibleTurbulenceModels \
-lconversion \
-ldecompositionMethods \
-ldistributed \
@ -25,27 +23,21 @@ EXE_LIBS = \
-lforces \
-lfvMotionSolvers \
-lgenericPatchFields \
-lincompressibleLESModels \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleTurbulenceModels \
-linterfaceProperties \
-lIOFunctionObjects \
-ljobControl \
-llagrangian \
-llagrangianIntermediate \
-llaminarFlameSpeedModels \
-lLESdeltas \
-lLESfilters \
-lliquidMixtureProperties \
-lliquidProperties \
-lmeshTools \
-lmolecularMeasurements \
-lmolecule \
/* -lmultiphaseInterFoam */ \
-lODE \
-lOpenFOAM \
/* -lphaseModel */ \
-lpotential \
-lradiationModels \
-lrandomProcesses \
@ -63,5 +55,6 @@ EXE_LIBS = \
-lthermophysicalFunctions \
-ltopoChangerFvMesh \
-ltriSurface \
-lturbulenceModels \
-ltwoPhaseProperties \
-lutilityFunctionObjects

View File

@ -5,11 +5,8 @@ EXE_INC = \
EXE_LIBS = \
-lhelpTypes \
-lfiniteVolume \
-lincompressibleTurbulenceModel \
-lcompressibleTurbulenceModel \
-lincompressibleRASModels \
-lcompressibleRASModels \
-lincompressibleLESModels \
-lcompressibleLESModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lradiationModels \
-lfluidThermophysicalModels

View File

@ -3,11 +3,8 @@ EXE_INC = \
LIB_LIBS = \
-lfiniteVolume \
-lincompressibleTurbulenceModel \
-lcompressibleTurbulenceModel \
-lincompressibleRASModels \
-lcompressibleRASModels \
-lincompressibleLESModels \
-lcompressibleLESModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lradiationModels \
-lfluidThermophysicalModels

View File

@ -1,7 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
@ -9,13 +10,12 @@ EXE_INC = \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lfluidThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,13 +46,8 @@ Description
#include "fvIOoptionList.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
#include "incompressible/LES/LESModel/LESModel.H"
#include "fluidThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
#include "compressible/LES/LESModel/LESModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
using namespace Foam;

View File

@ -1,10 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/transportModels
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lincompressibleTransportModels \
-lfiniteVolume \
-lgenericPatchFields \
-lincompressibleRASModels \
-lincompressibleTransportModels
-lgenericPatchFields

View File

@ -1,18 +1,19 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/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
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lincompressibleRASModels \
-lfluidThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume \
-lgenericPatchFields \
-lmeshTools \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,11 +30,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "fluidThermo.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,11 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lincompressibleRASModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lgenericPatchFields
-lgenericPatchFields \
-lfiniteVolume

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,8 +35,8 @@ Source files:
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "RASModel.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -133,4 +133,3 @@ int main(int argc, char *argv[])
// ************************************************************************* //

View File

@ -1,21 +1,21 @@
EXE_INC = \
-I$(LIB_SRC)/postProcessing/postCalc \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
$(FOAM_LIBBIN)/postCalc.o \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lfluidThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lgenericPatchFields \
-lmeshTools

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,12 +36,9 @@ Description
#include "calc.H"
#include "fvc.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
#include "incompressible/LES/LESModel/LESModel.H"
#include "fluidThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
#include "compressible/LES/LESModel/LESModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,6 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
@ -8,10 +8,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lLESdeltas \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lreactionThermophysicalModels \
-lfiniteVolume \
-lgenericPatchFields \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "turbulenceModel.H"
#include "turbulentFluidThermoModel.H"
#include "solidThermo.H"
#include "wallFvPatch.H"

View File

@ -1,14 +1,18 @@
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lincompressibleRASModels \
-lfluidThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume \
-lgenericPatchFields

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,12 +34,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
#include "fluidThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,13 +1,14 @@
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
-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 = \
-lincompressibleLESModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lgenericPatchFields

View File

@ -31,8 +31,10 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "LESModel.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "nearWallDist.H"
#include "wallFvPatch.H"
@ -50,7 +52,7 @@ int main(int argc, char *argv[])
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate();
mesh.readUpdate();
volScalarField yPlus
(

View File

@ -1,18 +1,20 @@
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)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lincompressibleRASModels \
-lfluidThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume \
-lgenericPatchFields \
-lmeshTools \

View File

@ -34,14 +34,10 @@ Description
\*---------------------------------------------------------------------------*/
#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 "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,8 +49,7 @@ void calcIncompressibleYPlus
volScalarField& yPlus
)
{
typedef incompressible::nutWallFunctionFvPatchScalarField
wallFunctionPatchField;
typedef nutWallFunctionFvPatchScalarField wallFunctionPatchField;
#include "createPhi.H"
@ -105,8 +100,7 @@ void calcCompressibleYPlus
volScalarField& yPlus
)
{
typedef compressible::mutWallFunctionFvPatchScalarField
wallFunctionPatchField;
typedef nutWallFunctionFvPatchScalarField wallFunctionPatchField;
IOobject rhoHeader
(
@ -145,31 +139,31 @@ void calcCompressibleYPlus
)
);
const volScalarField::GeometricBoundaryField mutPatches =
RASModel->mut()().boundaryField();
const volScalarField::GeometricBoundaryField nutPatches =
RASModel->nut()().boundaryField();
bool foundMutPatch = false;
forAll(mutPatches, patchi)
bool foundNutPatch = false;
forAll(nutPatches, patchi)
{
if (isA<wallFunctionPatchField>(mutPatches[patchi]))
if (isA<wallFunctionPatchField>(nutPatches[patchi]))
{
foundMutPatch = true;
foundNutPatch = true;
const wallFunctionPatchField& mutPw =
const wallFunctionPatchField& nutPw =
dynamic_cast<const wallFunctionPatchField&>
(mutPatches[patchi]);
(nutPatches[patchi]);
yPlus.boundaryField()[patchi] = mutPw.yPlus();
yPlus.boundaryField()[patchi] = nutPw.yPlus();
const scalarField& Yp = yPlus.boundaryField()[patchi];
Info<< "Patch " << patchi
<< " named " << mutPw.patch().name()
<< " named " << nutPw.patch().name()
<< " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp)
<< " average: " << gAverage(Yp) << nl << endl;
}
}
if (!foundMutPatch)
if (!foundNutPatch)
{
Info<< " no " << wallFunctionPatchField::typeName << " patches"
<< endl;
@ -200,7 +194,7 @@ int main(int argc, char *argv[])
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate();
mesh.readUpdate();
volScalarField yPlus
(

View File

@ -1,15 +1,15 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lgenericPatchFields \
-lfiniteVolume \
-lmeshTools

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,7 +37,7 @@ Description
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "turbulentTransportModel.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,3 +0,0 @@
applyWallFunctionBoundaryConditions.C
EXE = $(FOAM_APPBIN)/applyWallFunctionBoundaryConditions

View File

@ -1,13 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
EXE_LIBS = \
-lincompressibleRASModels \
-lfluidThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume \
-lgenericPatchFields

View File

@ -1,363 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
applyWallFunctionBounaryConditions
Description
Updates OpenFOAM RAS cases to use the new (v1.6) wall function framework.
Attempts to determine whether case is compressible or incompressible, or
can be supplied with -compressible command line argument.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "fvMesh.H"
#include "Time.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "wallPolyPatch.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool caseIsCompressible(const fvMesh& mesh)
{
// Attempt flux field
IOobject phiHeader
(
"phi",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (phiHeader.headerOk())
{
surfaceScalarField phi(phiHeader, mesh);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
return true;
}
}
// Attempt density field
IOobject rhoHeader
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (rhoHeader.headerOk())
{
volScalarField rho(rhoHeader, mesh);
if (rho.dimensions() == dimDensity)
{
return true;
}
}
// Attempt pressure field
IOobject pHeader
(
"p",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (pHeader.headerOk())
{
volScalarField p(pHeader, mesh);
if (p.dimensions() == dimMass/sqr(dimTime)/dimLength)
{
return true;
}
}
// If none of the above are true, assume that the case is incompressible
return false;
}
void createVolScalarField
(
const fvMesh& mesh,
const word& fieldName,
const dimensionSet& dims
)
{
IOobject fieldHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (!fieldHeader.headerOk())
{
Info<< "Creating field " << fieldName << nl << endl;
volScalarField field
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dims, 0.0)
);
field.write();
}
}
void replaceBoundaryType
(
const fvMesh& mesh,
const word& fieldName,
const word& boundaryType,
const string& boundaryValue
)
{
IOobject header
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (!header.headerOk())
{
return;
}
Info<< "Updating boundary types for field " << header.name() << endl;
const word oldTypeName = IOdictionary::typeName;
const_cast<word&>(IOdictionary::typeName) = word::null;
IOdictionary dict(header);
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
const_cast<word&>(dict.type()) = dict.headerClassName();
// Make a backup of the old file
if (mvBak(dict.objectPath(), "old"))
{
Info<< " Backup original file to "
<< (dict.objectPath() + ".old") << endl;
}
// Loop through boundary patches and update
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
dictionary& boundaryDict = dict.subDict("boundaryField");
forAll(bMesh, patchI)
{
if (isA<wallPolyPatch>(bMesh[patchI]))
{
word patchName = bMesh[patchI].name();
dictionary& oldPatch = boundaryDict.subDict(patchName);
dictionary newPatch(dictionary::null);
newPatch.add("type", boundaryType);
newPatch.add("value", ("uniform " + boundaryValue).c_str());
oldPatch = newPatch;
}
}
Info<< " writing updated " << dict.name() << nl << endl;
dict.regIOobject::write();
}
void updateCompressibleCase(const fvMesh& mesh)
{
Info<< "Case treated as compressible" << nl << endl;
createVolScalarField
(
mesh,
"mut",
dimArea/dimTime*dimDensity
);
replaceBoundaryType
(
mesh,
"mut",
compressible::mutkWallFunctionFvPatchScalarField::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"epsilon",
compressible::epsilonWallFunctionFvPatchScalarField::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"omega",
compressible::omegaWallFunctionFvPatchScalarField::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"k",
compressible::kqRWallFunctionFvPatchField<scalar>::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"q",
compressible::kqRWallFunctionFvPatchField<scalar>::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"R",
compressible::kqRWallFunctionFvPatchField<symmTensor>::
typeName,
"(0 0 0 0 0 0)"
);
}
void updateIncompressibleCase(const fvMesh& mesh)
{
Info<< "Case treated as incompressible" << nl << endl;
createVolScalarField(mesh, "nut", dimArea/dimTime);
replaceBoundaryType
(
mesh,
"nut",
incompressible::nutkWallFunctionFvPatchScalarField::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"epsilon",
incompressible::epsilonWallFunctionFvPatchScalarField::
typeName,
"0"
);
replaceBoundaryType
(
mesh,
"omega",
incompressible::omegaWallFunctionFvPatchScalarField::
typeName,
"0"
);
replaceBoundaryType
(
mesh,
"k",
incompressible::kqRWallFunctionFvPatchField<scalar>::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"q",
incompressible::kqRWallFunctionFvPatchField<scalar>::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"R",
incompressible::kqRWallFunctionFvPatchField<symmTensor>::typeName,
"(0 0 0 0 0 0)"
);
}
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::addBoolOption
(
"compressible",
"force use of compressible wall functions. Default is auto-detect."
);
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
const bool compressible = args.optionFound("compressible");
Info<< "Updating turbulence fields to operate using new run time "
<< "selectable" << nl << "wall functions"
<< nl << endl;
if (compressible || caseIsCompressible(mesh))
{
updateCompressibleCase(mesh);
}
else
{
updateIncompressibleCase(mesh);
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -3,4 +3,5 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lcompressibleTurbulenceModel
-lturbulenceModels \
-lcompressibleTurbulenceModels

View File

@ -4,7 +4,6 @@ EXE_INC = \
-I$(LIB_SRC)/fvAgglomerationMethods/pairPatchAgglomeration/lnInclude
EXE_LIBS = \
-lOpenFOAM \
-lfiniteVolume \
-lpairPatchAgglomeration \
-ltriSurface \

View File

@ -8,7 +8,6 @@ EXE_INC = \
EXE_LIBS = \
-lmeshTools \
-lfiniteVolume \
-lOpenFOAM \
-lmeshTools \
-ltriSurface \
-ldistributed \