Commit 19d951ce authored by Mark Olesen's avatar Mark Olesen
Browse files

minor cleanup of turbulence models

- added constructor dictionary(const dictionary*) that also handles NULL
  pointers and makes it convenient to construct from a possibly nonexistent
  sub-dictionary:
  eg,
      dictionary dict2(dict1.subDictPtr("someDict"));

- make some of the turbulence Coeffs sub-dictionary optional.
  Their contents are all 'lookupOrAddDefault' anyhow.

- in turbulentMixingLength BCs, skip namespace qualifier in template
  (eg, <RASModel> vs. <compressible::RASModel>)

- change comments from 'turbulenceProperties' to RASProperties/LESProperties

- consistency between compressible/incompressible - no separate file for
  'New' selector etc

- consistency in accessing the model coefficients.
  Use method coeffDict() for const access.
  Use protected data member coeffDict_ for read/write access.

- document model coefficients in etc/constant/RASProperties.
  Need the same for LESProperties before we can prune these from the
  tutorials.
parent 1c101ec1
......@@ -52,10 +52,17 @@ int main(int argc, char *argv[])
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc() << endl;
// copy back
dict1 = dict2;
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << endl;
dictionary dict3(dict2.subDictPtr("boundaryField"));
dictionary dict4(dict2.subDictPtr("NONEXISTENT"));
Info<< "dictionary construct from pointer" << nl
<< "ok = " << dict3.name() << " " << dict3.toc() << nl
<< "no = " << dict4.name() << " " << dict4.toc() << endl;
}
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "default coefficients for RAS models";
location "constant";
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
wallFunctionCoeffs
{
kappa 0.4187;
E 9;
}
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
C3 -0.33; // only for compressible
alphak 1.0; // only for compressible
alphaEps 0.76923;
alphah 1.0; // only for compressible
}
RNGkEpsilonCoeffs
{
Cmu 0.0845;
C1 1.42;
C2 1.68;
C3 -0.33; // only for compressible
alphak 1.39;
alphaEps 1.39;
alphah 1.0; // only for compressible
eta0 4.38;
beta 0.012;
}
realizableKECoeffs
{
Cmu 0.09;
A0 4.0;
C2 1.9;
alphak 1.0;
alphaEps 0.833333;
alphah 1.0; // only for compressible
}
kOmegaSSTCoeffs
{
alphaK1 0.85034;
alphaK2 1.0;
alphaOmega1 0.5;
alphaOmega2 0.85616;
alphah 1.0; // only for compressible
beta1 0.075;
beta2 0.0828;
betaStar 0.09;
gamma1 0.5532;
gamma2 0.4403;
a1 0.31;
c1 10.0;
}
LaunderGibsonRSTMCoeffs
{
Cmu 0.09;
Clg1 1.8;
Clg2 0.6;
C1 1.44;
C2 1.92;
C1Ref 0.5;
C2Ref 0.3;
Cs 0.25;
Ceps 0.15;
alphah 1.0; // only for compressible
alphaEps 0.76923;
alphaR 1.22;
couplingFactor 0.0;
}
LaunderSharmaKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
C3 -0.33;
alphah 1.0; // only for compressible
alphahk 1.0; // only for compressible
alphaEps 0.76923;
}
LRRCoeffs
{
Cmu 0.09;
Clrr1 1.8;
Clrr2 0.6;
C1 1.44;
C2 1.92;
Cs 0.25;
Ceps 0.15;
alphah 1.0; // only for compressible
alphaEps 0.76923;
alphaR 1.22; // only for compressible
couplingFactor 0.0; // only for incompressible
}
SpalartAllmarasCoeffs
{
Cb1 0.1355;
Cb2 0.622;
Cw2 0.3;
Cw3 2.0;
Cv1 7.1;
Cv2 5.0;
alphaNut 1.5;
alphah 1.0; // only for compressible
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// incompressible only:
kOmegaCoeffs
{
betaStar 0.09;
alpha 0.52;
beta 0.072;
alphak 0.5;
alphaOmega 0.5;
Cmu $betaStar; // equivalent to betaStar
}
LamBremhorstKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
LienCubicKECoeffs
{
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
LienCubicKELowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
LienLeschzinerLowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
NonlinearKEShihCoeffs
{
Cmu 0.09; // only for boundary conditions?
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76932;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
QZetaCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaZeta 0.76923;
anisotropic false;
}
// ************************************************************************* //
......@@ -160,6 +160,20 @@ Foam::dictionary::dictionary
}
Foam::dictionary::dictionary
(
const dictionary* dictPtr
)
:
parent_(dictionary::null)
{
if (dictPtr)
{
operator=(*dictPtr);
}
}
Foam::dictionary::dictionary
(
const dictionary& parentDict,
......
......@@ -168,6 +168,10 @@ public:
//- Construct top-level dictionary as copy
dictionary(const dictionary&);
//- Construct top-level dictionary as copy from pointer to dictionary.
// A null pointer is treated like an empty dictionary.
dictionary(const dictionary*);
//- Construct by transferring parameter contents given parent dictionary
dictionary(const dictionary& parentDict, const Xfer<dictionary>&);
......
......@@ -59,6 +59,35 @@ LESdelta::LESdelta(const word& name, const fvMesh& mesh)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<LESdelta> LESdelta::New
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
{
word deltaType(dict.lookup("delta"));
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(deltaType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESdelta::New(const fvMesh&, const dictionary&)"
) << "Unknown LESdelta type " << deltaType << endl << endl
<< "Valid LESdelta types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESdelta>(cstrIter()(name, mesh, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -50,7 +50,7 @@ namespace Foam
class fvMesh;
/*---------------------------------------------------------------------------*\
Class LESdelta Declaration
Class LESdelta Declaration
\*---------------------------------------------------------------------------*/
class LESdelta
......@@ -99,7 +99,7 @@ public:
// Constructors
//- Construct from name and mesh
LESdelta(const word& name, const fvMesh& mesh);
LESdelta(const word& name, const fvMesh&);
// Selectors
......@@ -108,8 +108,8 @@ public:
static autoPtr<LESdelta> New
(
const word& name,
const fvMesh& mesh,
const dictionary& LESdeltaDict
const fvMesh&,
const dictionary&
);
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESdelta.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<LESdelta> LESdelta::New
(
const word& name,
const fvMesh& mesh,
const dictionary& LESdeltaDict
)
{
word LESdeltaType
(
LESdeltaDict.lookup("delta")
);
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(LESdeltaType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESdelta::New(const fvMesh& mesh, dictionary LESdeltaDict)"
) << "Unknown LESdelta type " << LESdeltaType << endl << endl
<< "Valid LESdelta types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESdelta>(cstrIter()(name, mesh, LESdeltaDict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
LESdelta/LESdelta.C
LESdelta/newDelta.C
cubeRootVolDelta/cubeRootVolDelta.C
PrandtlDelta/PrandtlDelta.C
smoothDelta/smoothDelta.C
......
......@@ -38,8 +38,37 @@ namespace Foam
defineTypeNameAndDebug(LESfilter, 0);
defineRunTimeSelectionTable(LESfilter, dictionary);
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<LESfilter> LESfilter::New
(
const fvMesh& mesh,
const dictionary& dict
)
{
word filterType(dict.lookup("filter"));
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(filterType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESfilter::New(const fvMesh&, const dictionary&)"
) << "Unknown LESfilter type " << filterType << endl << endl
<< "Valid LESfilter types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESfilter>(cstrIter()(mesh, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -102,8 +102,8 @@ public:
//- Return a reference to the selected LES filter
static autoPtr<LESfilter> New
(
const fvMesh& mesh,
const dictionary& LESfilterDict
const fvMesh&,
const dictionary&
);
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<LESfilter> LESfilter::New
(
const fvMesh& mesh,
const dictionary& LESfilterDict
)
{
word LESfilterType
(
LESfilterDict.lookup("filter")
);
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(LESfilterType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESfilter::New(const fvMesh& mesh, dictionary LESfilterDict)"
) << "Unknown LESfilter type " << LESfilterType << endl << endl
<< "Valid LESfilter types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<LESfilter>(cstrIter()(mesh, LESfilterDict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
LESfilter/LESfilter.C
LESfilter/newFilter.C
simpleFilter/simpleFilter.C
laplaceFilter/laplaceFilter.C
anisotropicFilter/anisotropicFilter.C
anisotropicFilter/anisotropicFilter.C
LIB = $(FOAM_LIBBIN)/libLESfilters
......@@ -69,7 +69,7 @@ DeardorffDiffStress::DeardorffDiffStress
dimensioned<scalar>::lookupOrAddToDict
(
"ck",
coeffDict(),
coeffDict_,
0.094
)
),
......@@ -78,7 +78,7 @@ DeardorffDiffStress::DeardorffDiffStress
dimensioned<scalar>::lookupOrAddToDict
(
"cm",
coeffDict(),
coeffDict_,
4.13
)
)
......
......@@ -125,7 +125,7 @@ public:
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
//- Read LESProperties dictionary
virtual bool read();
};
......
......@@ -55,7 +55,7 @@ GenEddyVisc::GenEddyVisc
dimensioned<scalar>::lookupOrAddToDict
(