Merge branch 'feature-elliptic-blending-reynolds-stress-model' into 'develop'

ENH: EBRSM: new elliptic-blending Reynolds-stress turbulence model

See merge request Development/openfoam!544
This commit is contained in:
Andrew Heather
2022-06-08 10:41:00 +00:00
36 changed files with 3096 additions and 6 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -86,6 +87,9 @@ makeRASModel(buoyantKEpsilon);
#include "LaunderSharmaKE.H"
makeRASModel(LaunderSharmaKE);
#include "kEpsilonPhitF.H"
makeRASModel(kEpsilonPhitF);
#include "kOmega.H"
makeRASModel(kOmega);
@ -104,8 +108,8 @@ makeRASModel(LRR);
#include "SSG.H"
makeRASModel(SSG);
#include "kEpsilonPhitF.H"
makeRASModel(kEpsilonPhitF);
#include "EBRSM.H"
makeRASModel(EBRSM);
// -------------------------------------------------------------------------- //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -81,6 +82,9 @@ makeRASModel(realizableKE);
#include "LaunderSharmaKE.H"
makeRASModel(LaunderSharmaKE);
#include "kEpsilonPhitF.H"
makeRASModel(kEpsilonPhitF);
#include "kOmega.H"
makeRASModel(kOmega);
@ -99,8 +103,8 @@ makeRASModel(LRR);
#include "SSG.H"
makeRASModel(SSG);
#include "kEpsilonPhitF.H"
makeRASModel(kEpsilonPhitF);
#include "EBRSM.H"
makeRASModel(EBRSM);
// -------------------------------------------------------------------------- //

View File

@ -0,0 +1,637 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
#include "EBRSM.H"
#include "fvOptions.H"
#include "bound.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace RASModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel>
tmp<volScalarField> EBRSM<BasicTurbulenceModel>::calcL() const
{
// (M:Eq. C.13)
return
Cl_*max
(
pow(k_, 1.5)/epsilon_,
Ceta_*pow025
(
pow3
(
max
(
this->nu(),
dimensionedScalar(this->nu()().dimensions(), Zero)
)
)/epsilon_
)
);
}
template<class BasicTurbulenceModel>
tmp<volVectorField> EBRSM<BasicTurbulenceModel>::calcN() const
{
const volVectorField gradf(fvc::grad(f_));
// (M:Eq. C.9)
return gradf/max(mag(gradf), dimensionedScalar(dimless/dimLength, SMALL));
}
template<class BasicTurbulenceModel>
tmp<volScalarField> EBRSM<BasicTurbulenceModel>::calcTau() const
{
// (M:Eq. C.12)
return
max
(
k_/epsilon_,
Ct_*sqrt
(
max
(
this->nu(),
dimensionedScalar(this->nu()().dimensions(), Zero)
)/epsilon_
)
);
}
template<class BasicTurbulenceModel>
tmp<volSymmTensorField> EBRSM<BasicTurbulenceModel>::D
(
const volScalarField& tau,
const dimensionedScalar& sigma
) const
{
// (M:Eq. C.10, C.14)
return (Cmu_/sigma*tau)*this->R_ + this->nu()*I;
}
template<class BasicTurbulenceModel>
tmp<volScalarField> EBRSM<BasicTurbulenceModel>::D
(
const dimensionedScalar& sigma
) const
{
// (LM:p. 2)
return this->nut_/sigma + this->nu();
}
template<class BasicTurbulenceModel>
tmp<volScalarField> EBRSM<BasicTurbulenceModel>::Ceps1Prime
(
const volScalarField& G
) const
{
// (M:Eq. C.15)
return Ceps1_*(scalar(1) + A1_*(scalar(1) - pow3(f_))*G/this->epsilon_);
}
template<class BasicTurbulenceModel>
void EBRSM<BasicTurbulenceModel>::correctNut()
{
this->nut_ = Cmu_*k_*calcTau();
this->nut_.correctBoundaryConditions();
fv::options::New(this->mesh_).correct(this->nut_);
BasicTurbulenceModel::correctNut();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
EBRSM<BasicTurbulenceModel>::EBRSM
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName,
const word& type
)
:
ReynoldsStress<RASModel<BasicTurbulenceModel>>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
simpleGradientDiffusion_
(
Switch::getOrAddToDict
(
"simpleGradientDiffusion",
this->coeffDict_,
false
)
),
g1_
(
dimensioned<scalar>::getOrAddToDict
(
"g1",
this->coeffDict_,
3.4
)
),
g1star_
(
dimensioned<scalar>::getOrAddToDict
(
"g1star",
this->coeffDict_,
1.8
)
),
g3_
(
dimensioned<scalar>::getOrAddToDict
(
"g3",
this->coeffDict_,
0.8
)
),
g3star_
(
dimensioned<scalar>::getOrAddToDict
(
"g3star",
this->coeffDict_,
1.3
)
),
g4_
(
dimensioned<scalar>::getOrAddToDict
(
"g4",
this->coeffDict_,
1.25
)
),
g5_
(
dimensioned<scalar>::getOrAddToDict
(
"g5",
this->coeffDict_,
0.2
)
),
Cmu_
(
dimensioned<scalar>::getOrAddToDict
(
"Cmu",
this->coeffDict_,
0.21
)
),
Ceps1_
(
dimensioned<scalar>::getOrAddToDict
(
"Ceps1",
this->coeffDict_,
1.44
)
),
Ceps2_
(
dimensioned<scalar>::getOrAddToDict
(
"Ceps2",
this->coeffDict_,
1.83
)
),
sigmaK_
(
dimensioned<scalar>::getOrAddToDict
(
"sigmaK",
this->coeffDict_,
1.0
)
),
sigmaEps_
(
dimensioned<scalar>::getOrAddToDict
(
"sigmaEps",
this->coeffDict_,
1.15
)
),
A1_
(
dimensioned<scalar>::getOrAddToDict
(
"A1",
this->coeffDict_,
0.065
)
),
Ct_
(
dimensioned<scalar>::getOrAddToDict
(
"Ct",
this->coeffDict_,
6.0
)
),
Cl_
(
dimensioned<scalar>::getOrAddToDict
(
"Cl",
this->coeffDict_,
0.133
)
),
Ceta_
(
dimensioned<scalar>::getOrAddToDict
(
"Ceta",
this->coeffDict_,
80.0
)
),
Cstability_
(
dimensioned<scalar>::getOrAddToDict
(
"Cstability",
this->coeffDict_,
sqr(dimLength)/pow3(dimTime),
10.0
)
),
f_
(
IOobject
(
IOobject::groupName("f", alphaRhoPhi.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
this->mesh_
),
k_
(
IOobject
(
IOobject::groupName("k", alphaRhoPhi.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
0.5*tr(this->R_)
),
epsilon_
(
IOobject
(
IOobject::groupName("epsilon", alphaRhoPhi.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
this->mesh_
)
{
this->boundNormalStress(this->R_);
bound(epsilon_, this->epsilonMin_);
bound(k_, this->kMin_);
if (type == typeName)
{
this->printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool EBRSM<BasicTurbulenceModel>::read()
{
if (ReynoldsStress<RASModel<BasicTurbulenceModel>>::read())
{
simpleGradientDiffusion_.readIfPresent
(
"simpleGradientDiffusion",
this->coeffDict()
);
g1_.readIfPresent(this->coeffDict());
g1star_.readIfPresent(this->coeffDict());
g3_.readIfPresent(this->coeffDict());
g3star_.readIfPresent(this->coeffDict());
g4_.readIfPresent(this->coeffDict());
g5_.readIfPresent(this->coeffDict());
Cmu_.readIfPresent(this->coeffDict());
Ceps1_.readIfPresent(this->coeffDict());
Ceps2_.readIfPresent(this->coeffDict());
sigmaK_.readIfPresent(this->coeffDict());
sigmaEps_.readIfPresent(this->coeffDict());
A1_.readIfPresent(this->coeffDict());
Ct_.readIfPresent(this->coeffDict());
Cl_.readIfPresent(this->coeffDict());
Ceta_.readIfPresent(this->coeffDict());
Cstability_.readIfPresent(this->coeffDict());
return true;
}
return false;
}
template<class BasicTurbulenceModel>
void EBRSM<BasicTurbulenceModel>::correct()
{
if (!this->turbulence_)
{
return;
}
// Construct local convenience references
const alphaField& alpha = this->alpha_;
const rhoField& rho = this->rho_;
const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_;
const volVectorField& U = this->U_;
volSymmTensorField& R = this->R_;
fv::options& fvOptions(fv::options::New(this->mesh_));
ReynoldsStress<RASModel<BasicTurbulenceModel>>::correct();
// Calculate the velocity gradient tensor in Hessian form (delta_i u_j)
// Tranpose of the classical Jacobian form (delta_j u_i)
tmp<volTensorField> tgradU = fvc::grad(U);
const volTensorField& gradU = tgradU.cref();
// Calculate the production tensor
tmp<volSymmTensorField> tP = -twoSymm(R & gradU);
const volSymmTensorField& P = tP.cref();
// Calculate turbulent kinetic energy production rate
const volScalarField G(this->GName(), 0.5*mag(tr(P)));
// Calculate elliptic blending function
// between near-wall and weakly-inhomogeneous regions
{
// (M:Eq. C.13)
tmp<volScalarField> tinvLsqr = scalar(1)/sqr(calcL());
const volScalarField& invLsqr = tinvLsqr.cref();
// (M:Eq. C.8)
tmp<fvScalarMatrix> fEqn
(
fvm::Sp(invLsqr, f_)
- fvm::laplacian(f_)
==
invLsqr
);
tinvLsqr.clear();
fEqn.ref().relax();
solve(fEqn);
}
// Calculate approximate wall-normal vector field (M:Eq. C.9)
tmp<volVectorField> tn = calcN();
const volVectorField& n = tn.cref();
// Calculate turbulent time scale (M:Eq. C.12)
tmp<volScalarField> ttau = calcTau();
const volScalarField& tau = ttau.cref();
// Calculate turbulent dissipation rate field
{
// Dissipation-production stimulator in the buffer layer (M:Eq. C.15)
tmp<volScalarField> tCeps1Prime = Ceps1Prime(G);
const volScalarField& Ceps1Prime = tCeps1Prime.cref();
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// (M:Eq. C.14)
tmp<fvScalarMatrix> epsEqn
(
fvm::ddt(alpha, rho, epsilon_)
+ fvm::div(alphaRhoPhi, epsilon_)
- (
simpleGradientDiffusion_
? fvm::laplacian(alpha*rho*D(sigmaEps_), epsilon_)
: fvm::laplacian(alpha*rho*D(tau, sigmaEps_), epsilon_)
)
+ fvm::Sp(Cstability_/k_, epsilon_)
==
alpha()*rho()*Ceps1Prime()*G()/tau()
- fvm::Sp(alpha*rho*Ceps2_/tau, epsilon_)
+ Cstability_*epsilon_()/k_()
+ fvOptions(alpha, rho, epsilon_)
);
tCeps1Prime.clear();
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryFieldRef());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
}
// Calculate Reynolds-stress field
{
// Homogeneous form of the redistribution term (M:Eq. C.3)
tmp<volSymmTensorField> tPhiH;
{
// Reynolds stress anisotropy tensor (M:Eq. C.4)
const volSymmTensorField B(R/(scalar(2)*k_) - oneThirdI);
// Rate-of-strain tensor (M:Eq. C.5)
const volSymmTensorField S(symm(gradU));
// Rate-of-rotation tensor (M:Eq. C.6)
// Note the Hessian form of gradient
const volTensorField W(gradU.T() - gradU);
tPhiH =
k_
*(
(g3_ - g3star_*mag(B))*S
+ g4_*dev(twoSymm(B & S))
+ g5_*twoSymm(B & W.T())
);
}
// Near-wall form of the redistribution model (M:Eq. C.7)
tmp<volSymmTensorField> tPhiW;
{
tmp<volSymmTensorField> tnn = symm(n*n);
const volSymmTensorField& nn = tnn.cref();
tn.clear();
tPhiW =
- scalar(5)*epsilon_/k_*
(
twoSymm(R & nn)
- 0.5*(R && nn)*(nn + I)
);
}
tmp<fvSymmTensorMatrix> REqn;
{
const volScalarField fCube(pow3(f_));
// Velocity-pressure gradient correlation (M:Eq. C.2)
const volSymmTensorField Phi
(
(scalar(1) - fCube)*tPhiW + fCube*tPhiH
);
// Near-wall part of the dissipation tensor (M:Eq. C.11)
const volScalarField epsilonW
(
(scalar(1) - fCube)*epsilon_/k_
);
// Homogeneous part of the dissipation tensor (M:Eq. C.11)
const volSphericalTensorField epsilonH
(
fCube*epsilon_*twoThirdsI
);
// Implicit part of the g1-term (M:Eq. C.3)
const volScalarField Phi1Implicit
(
fCube*(g1_*epsilon_ + g1star_*G)/(scalar(2)*k_)
);
// Explicit part of the g1-term (M:Eq. C.3)
const volSphericalTensorField Phi1Explicit
(
fCube*(g1_*epsilon_ + g1star_*G)*oneThirdI
);
// (M:Eq. C.1)
REqn =
(
fvm::ddt(alpha, rho, R)
+ fvm::div(alphaRhoPhi, R)
- (
simpleGradientDiffusion_
? fvm::laplacian(alpha*rho*D(sigmaK_), R)
: fvm::laplacian(alpha*rho*D(tau, sigmaK_), R)
)
+ fvm::Sp(alpha*rho*Phi1Implicit, R)
+ fvm::Sp(alpha*rho*epsilonW, R)
==
alpha()*rho()*
(
P()
+ Phi()
+ Phi1Explicit()
- epsilonH()
)
+ fvOptions(alpha, rho, R)
);
ttau.clear();
tP.clear();
}
REqn.ref().relax();
fvOptions.constrain(REqn.ref());
solve(REqn);
fvOptions.correct(R);
this->boundNormalStress(R);
#ifdef FULLDEBUG
this->checkRealizabilityConditions(R);
#endif
k_ == 0.5*tr(R);
bound(k_, this->kMin_);
}
correctNut();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,248 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
Class
Foam::RASModels::EBRSM
Group
grpRASTurbulence
Description
Manceau (2015)'s elliptic-blending Reynolds-stress turbulence model
for incompressible and compressible flows.
References:
\verbatim
Standard model (tag:M):
Manceau, R. (2015).
Recent progress in the development of the elliptic
blending Reynolds-stress model.
International Journal of Heat and Fluid Flow, 51, 195-220.
DOI:10.1016/j.ijheatfluidflow.2014.09.002
Simple gradient diffusion hypothesis (tag:LM):
Lardeau, S., & Manceau, R. (2014).
Computations of complex flow configurations using
a modified elliptic-blending Reynolds-stress model.
10th International ERCOFTAC Symposium on Engineering
Turbulence Modelling and Measurements. Marbella, Spain.
https://hal.archives-ouvertes.fr/hal-01051799
\endverbatim
The default model coefficients are (M:p. 219):
\verbatim
EBRSMCoeffs
{
g1 3.4;
g1star 1.8;
g3 0.8;
g3star 1.3;
g4 1.25;
g5 0.2;
Cmu 0.21;
Ceps1 1.44;
Ceps2 1.83;
sigmaK 1.0;
sigmaEps 1.15;
A1 0.065;
Ct 6.0;
Cl 0.133;
Ceta 80.0;
Cstability 10.0;
simpleGradientDiffusion false;
}
\endverbatim
Note
- \c g5 coefficient has been changed from its original value of 0.4 to 0.2
after obtaining better results in smooth-wall plane channel flow cases.
SourceFiles
EBRSM.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_RASModels_EBRSM_H
#define Foam_RASModels_EBRSM_H
#include "RASModel.H"
#include "ReynoldsStress.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class EBRSM Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class EBRSM
:
public ReynoldsStress<RASModel<BasicTurbulenceModel>>
{
// Private Data
Switch simpleGradientDiffusion_;
// Coefficients
dimensionedScalar g1_;
dimensionedScalar g1star_;
dimensionedScalar g3_;
dimensionedScalar g3star_;
dimensionedScalar g4_;
dimensionedScalar g5_;
dimensionedScalar Cmu_;
dimensionedScalar Ceps1_;
dimensionedScalar Ceps2_;
dimensionedScalar sigmaK_;
dimensionedScalar sigmaEps_;
dimensionedScalar A1_;
dimensionedScalar Ct_;
dimensionedScalar Cl_;
dimensionedScalar Ceta_;
dimensionedScalar Cstability_;
// Fields
//- Elliptic blending factor [-]
volScalarField f_;
//- Turbulent kinetic energy [m2/s2]
volScalarField k_;
//- Turbulent kinetic energy dissipation rate [m2/s3]
volScalarField epsilon_;
// Private Member Functions
//- Return the Durbin-limited length-scale field
// Thickness of region of influence of near-wall model
tmp<volScalarField> calcL() const;
//- Return the approximate wall-normal vector field
tmp<volVectorField> calcN() const;
//- Return the turbulent time scale bounded by Kolmogorov time scale
tmp<volScalarField> calcTau() const;
//- Return the effective diffusivity for epsilon or R
//- by using the generalised gradient diffusion hypothesis
tmp<volSymmTensorField> D
(
const volScalarField& tau,
const dimensionedScalar& sigma
) const;
//- Return the effective diffusivity for epsilon or R
//- by using the simple gradient diffusion hypothesis
tmp<volScalarField> D
(
const dimensionedScalar& sigma
) const;
//- Return dissipation-production stimulator in the buffer layer
tmp<volScalarField> Ceps1Prime(const volScalarField& G) const;
//- Update the eddy-viscosity
virtual void correctNut();
//- No copy construct
EBRSM(const EBRSM&) = delete;
//- No copy assignment
void operator=(const EBRSM&) = delete;
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
//- Runtime type information
TypeName("EBRSM");
// Constructors
//- Construct from components
EBRSM
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
//- Destructor
virtual ~EBRSM() = default;
// Member Functions
//- Return the turbulence kinetic energy dissipation rate
virtual tmp<volScalarField> epsilon() const
{
return epsilon_;
}
//- Re-read model coefficients if they have changed
virtual bool read();
//- Solve the transport equations and correct the turbulent viscosity
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "EBRSM.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -105,6 +105,65 @@ void Foam::ReynoldsStress<BasicTurbulenceModel>::correctWallShearStress
}
template<class BasicTurbulenceModel>
void Foam::ReynoldsStress<BasicTurbulenceModel>::checkRealizabilityConditions
(
const volSymmTensorField& R
) const
{
const label maxDiffs = 5;
label nDiffs = 0;
// (S:Eq. 4a-4c)
forAll(R, celli)
{
bool diff = false;
if (maxDiffs < nDiffs)
{
Info<< "More than " << maxDiffs << " times"
<< " Reynolds-stress realizability checks failed."
<< " Skipping further comparisons." << endl;
return;
}
const symmTensor& r = R[celli];
if (r.xx() < 0)
{
WarningInFunction
<< "Reynolds stress " << r << " at cell " << celli
<< " does not obey the constraint: Rxx >= 0"
<< endl;
diff = true;
}
if (r.xx()*r.yy() - sqr(r.xy()) < 0)
{
WarningInFunction
<< "Reynolds stress " << r << " at cell " << celli
<< " does not obey the constraint: Rxx*Ryy - sqr(Rxy) >= 0"
<< endl;
diff = true;
}
if (det(r) < 0)
{
WarningInFunction
<< "Reynolds stress " << r << " at cell " << celli
<< " does not obey the constraint: det(R) >= 0"
<< endl;
diff = true;
}
if (diff)
{
++nDiffs;
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,6 +33,15 @@ Group
Description
Reynolds-stress turbulence model base class
Reference:
\verbatim
Realizability conditions (tag:S):
Schumann, U. (1977).
Realizability of Reynoldsstress turbulence models.
The Physics of Fluids, 20(5), 721-725.
DOI:10.1063/1.861942
\endverbatim
SourceFiles
ReynoldsStress.C
@ -74,6 +83,7 @@ protected:
void boundNormalStress(volSymmTensorField& R) const;
void correctWallShearStress(volSymmTensorField& R) const;
void checkRealizabilityConditions(const volSymmTensorField& R) const;
//- Update the eddy-viscosity
virtual void correctNut() = 0;

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
rm -rf setups
rm -rf results
rm -rf plots
#------------------------------------------------------------------------------

View File

@ -0,0 +1,171 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# settings
# operand setups
setups="
EBRSM
kOmegaSST
"
# flag to enable computations
run=true
# flag to enable computations in parallel mode
parallel=false
# flag to enable to use a common mesh
common_mesh=true
# flag to enable to use a common dynamic code
common_dynamic_code=true
#------------------------------------------------------------------------------
#######################################
# Create the given setup
# Arguments:
# $1 = Path to create the setup
# Outputs:
# Writes info to stdout
#######################################
dry_run_setup() {
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
setup="$1"
dirSetup="setups/$setup"
dirSetupOrig="setups.orig/$setup"
dirOrig="$dirSetupOrig/0.orig"
dirConstant="$dirSetupOrig/constant"
dirSystem="$dirSetupOrig/system"
printf "\n# Create the setup: %s\n" "$setup"
if [ ! -d "$dirSetup" ]
then
mkdir -p "$dirSetup"
cp -aRfL "setups.orig/common/." "$dirSetup"
cp -afL "$dirSetupOrig"/All* "$dirSetup" 2>/dev/null || :
[ -d "$dirOrig" ] && cp -aRfL "$dirOrig/." "$dirSetup/0.orig"
[ -d "$dirConstant" ] && cp -aRfL "$dirConstant/." "$dirSetup/constant"
[ -d "$dirSystem" ] && cp -aRfL "$dirSystem/." "$dirSetup/system"
else
printf "\n # Directory %s already exists\n" "$dirSetup"
printf " # Skipping the creation of a new setup\n"
fi
}
#######################################
# Run the given setup
# Arguments:
# $1 = Path to the setup to run
# Outputs:
# Writes info to stdout
#######################################
run_setup() {
[ $# -eq 0 ] && { echo "Usage error: $0"; exit 1; }
setup="$1"
dirSetup="setups/$setup"
dirResult="results/$setup"
dry_run_setup "$setup"
[ -d results ] || mkdir -p results
printf "\n# Run the setup: %s\n\n" "$setup"
if [ ! -d "$dirResult" ]
then
cp -Rf "$dirSetup" "$dirResult"
if [ "$common_mesh" = true ]
then
if [ -d results/mesh ]
then
printf "## Copy the common mesh to the setup: %s\n\n" "$setup"
cp -Rf results/mesh/polyMesh "$dirResult"/constant/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ -d results/dynamicCode ]
then
printf "## Copy the common dynamic code to the setup: %s\n\n" "$setup"
cp -Rf results/dynamicCode "$dirResult"/.
fi
fi
if [ "$parallel" = true ]
then
( cd "$dirResult" && ./Allrun-parallel )
else
( cd "$dirResult" && ./Allrun )
fi
if [ "$common_mesh" = true ]
then
if [ ! -d results/mesh ]
then
printf "\n## Store the mesh of %s as the common mesh\n\n" "$setup"
mkdir -p results/mesh
cp -Rf "$dirResult"/constant/polyMesh results/mesh/.
fi
fi
if [ "$common_dynamic_code" = true ]
then
if [ ! -d results/dynamicCode ] && [ -d "$dirResult"/dynamicCode ]
then
printf "\n## Store the dynamic code of %s as the common dynamic code\n\n" "$setup"
cp -Rf "$dirResult"/dynamicCode results/.
fi
fi
else
printf " # Directory %s already exists\n" "$dirResult"
printf " # Skipping the computation of the given setup\n"
fi
}
#------------------------------------------------------------------------------
for setup in $setups
do
dirSetupOrig="setups.orig/$setup"
if [ ! -d "$dirSetupOrig" ]
then
echo "Setup directory: $dirSetupOrig" \
"could not be found - skipping execution" 1>&2
continue
fi
if [ "$run" = true ]
then
run_setup "$setup"
else
dry_run_setup "$setup"
fi
done
if notTest "$@" && [ "$run" = true ]
then
./plot
fi
#------------------------------------------------------------------------------

View File

@ -0,0 +1,707 @@
#!/bin/bash
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# settings
# operand setups
setups="
EBRSM
kOmegaSST
"
#------------------------------------------------------------------------------
plot_initial_iteration_residuals() {
setup="$1"
echo "## Plots the initial-iteration residuals"
sampleFile="results/$setup/logs"
image="plots/$setup/initial-iteration-residuals.png"
gnuplot<<PLT_IRES
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
set yrange [1e-16:1]
set logscale y
set key right top
set key samplen 2
set key spacing 0.75
set xlabel "Iterations"
set ylabel "Initial-iteration residuals"
set offset .2, .05
set output "$image"
set title "Setup: $setup"
file_exists(file) = system("[ -f '".file."' ] && echo '1' || echo '0'") + 0
# OpenFOAM
Ux="$sampleFile/Ux_0"
p="$sampleFile/p_0"
k="$sampleFile/k_0"
omega="$sampleFile/omega_0"
epsilon="$sampleFile/epsilon_0"
Rxx="$sampleFile/Rxx_0"
Ryy="$sampleFile/Ryy_0"
Rzz="$sampleFile/Rzz_0"
Rxy="$sampleFile/Rxy_0"
nuTilda="$sampleFile/nuTilda_0"
gammaInt="$sampleFile/gammaInt_0"
ReThetat="$sampleFile/ReThetat_0"
if ( file_exists(Rxx) ) {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
epsilon u 1:2 t "epsilon" w l lw 2 lc rgb "#D55E00", \
Rxx u 1:2 t "Rxx" w l lw 2 lc rgb "#0072B2", \
Ryy u 1:2 t "Ryy" w l lw 2 lc rgb "#CC79A7", \
Rzz u 1:2 t "Rzz" w l lw 2 lc rgb "#440154", \
Rxy u 1:2 t "Rxy" w l lw 2 lc rgb "#4169e1"
}
if ( file_exists(k) ) {
if ( ! file_exists(gammaInt) ) {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00"
} else {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00", \
gammaInt u 1:2 t "gammaInt" w l lw 2 lc rgb "#CC79A7", \
ReThetat u 1:2 t "ReThetat" w l lw 2 lc rgb "#440154"
}
}
if ( file_exists(nuTilda) ) {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
nuTilda u 1:2 t "nuTilda" w l lw 2 lc rgb "#0072B2"
}
PLT_IRES
}
plot_final_iteration_residuals() {
setup="$1"
echo "## Plots the final-iteration residuals"
sampleFile="results/$setup/logs"
image="plots/$setup/final-iteration-residuals.png"
gnuplot<<PLT_FRES
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
set yrange [1e-16:1]
set logscale y
set key right top
set key samplen 2
set key spacing 0.75
set xlabel "Iterations"
set ylabel "Final-iteration residuals"
set offset .2, .05
set output "$image"
set title "Setup: $setup"
file_exists(file) = system("[ -f '".file."' ] && echo '1' || echo '0'") + 0
# OpenFOAM
Ux="$sampleFile/UxFinalRes_0"
p="$sampleFile/pFinalRes_0"
k="$sampleFile/kFinalRes_0"
omega="$sampleFile/omegaFinalRes_0"
epsilon="$sampleFile/epsilonFinalRes_0"
Rxx="$sampleFile/RxxFinalRes_0"
Ryy="$sampleFile/RyyFinalRes_0"
Rzz="$sampleFile/RzzFinalRes_0"
Rxy="$sampleFile/RxyFinalRes_0"
nuTilda="$sampleFile/nuTildaFinalRes_0"
gammaInt="$sampleFile/gammaIntFinalRes_0"
ReThetat="$sampleFile/ReThetatFinalRes_0"
if ( file_exists(Rxx) ) {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
epsilon u 1:2 t "epsilon" w l lw 2 lc rgb "#D55E00", \
Rxx u 1:2 t "Rxx" w l lw 2 lc rgb "#0072B2", \
Ryy u 1:2 t "Ryy" w l lw 2 lc rgb "#CC79A7", \
Rzz u 1:2 t "Rzz" w l lw 2 lc rgb "#440154", \
Rxy u 1:2 t "Rxy" w l lw 2 lc rgb "#4169e1"
}
if ( file_exists(k) ) {
if ( ! file_exists(gammaInt) ) {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00"
} else {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
k u 1:2 t "k" w l lw 2 lc rgb "#0072B2", \
omega u 1:2 t "omega" w l lw 2 lc rgb "#D55E00", \
gammaInt u 1:2 t "gammaInt" w l lw 2 lc rgb "#CC79A7", \
ReThetat u 1:2 t "ReThetat" w l lw 2 lc rgb "#440154"
}
}
if ( file_exists(nuTilda) ) {
plot \
Ux u 1:2 t "Ux" w l lw 2 lc rgb "#009E73", \
p u 1:2 t "p" w l lw 2 lc rgb "#F0E440", \
nuTilda u 1:2 t "nuTilda" w l lw 2 lc rgb "#0072B2"
}
PLT_FRES
}
plot_yPlus_vs_uPlus() {
setup="$1"
endTime="$2"
nu="$3"
uTau="$4"
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.means"
sampleFile="results/$setup/postProcessing/sampleU/$endTime/y_U.xy"
image="plots/$setup/yPlus_vs_uPlus.png"
gnuplot<<PLT_Y_VS_U
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:20]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "u^+"
set output "$image"
set title "Setup: $setup" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
samples="$sampleFile"
plot \
benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(\$2/$uTau) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
PLT_Y_VS_U
}
plot_yPlus_vs_R() {
setup="$1"
endTime="$2"
nu="$3"
uTau="$4"
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.reystress"
sampleFile="results/$setup/postProcessing/sampleR/$endTime/y_turbulenceProperties:R.xy"
sampleFileK="results/$setup/postProcessing/sampleK/$endTime/y_turbulenceProperties:k.xy"
imageUU="plots/$setup/yPlus_vs_Ruu.png"
imageVV="plots/$setup/yPlus_vs_Rvv.png"
imageWW="plots/$setup/yPlus_vs_Rww.png"
imageUV="plots/$setup/yPlus_vs_Ruv.png"
imageK0="plots/$setup/yPlus_vs_kPlus0.png"
imageK1="plots/$setup/yPlus_vs_kPlus1.png"
gnuplot<<PLT_Y_VS_R
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:1]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "(uu)^+"
set output "$imageUU"
set title "Setup: $setup" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
samples="$sampleFile"
samplesK="$sampleFileK"
plot \
benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(\$2/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
set output "$imageVV"
set ylabel "(vv)^+"
plot \
benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(\$5/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
set output "$imageWW"
set ylabel "(ww)^+"
plot \
benchmark u 2:5 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(\$7/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
set output "$imageUV"
set ylabel "(uv)^+"
plot \
benchmark u 2:(\$6*-1) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(-\$3/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
set output "$imageK0"
set ylabel "k^+"
plot \
benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(0.5*(\$2 + \$5 + \$7)/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
set output "$imageK1"
set ylabel "k^+"
plot \
benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samplesK u (\$1*$uTau/$nu):(\$2/$uTau**2) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
PLT_Y_VS_R
}
plot_yPlus_vs_epsilonPlus() {
setup="$1"
endTime="$2"
nu="$3"
uTau="$4"
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.kbal"
sampleFile="results/$setup/postProcessing/sampleEpsilon/$endTime/y_turbulenceProperties:epsilon.xy"
image="plots/$setup/yPlus_vs_epsilonPlus.png"
gnuplot<<PLT_Y_VS_EPSILON
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:20]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "{/Symbol e}^+"
set output "$image"
set title "Setup: $setup" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
samples="$sampleFile"
plot \
benchmark u 2:(-\$3) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(\$2*$nu/$uTau**4) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
PLT_Y_VS_EPSILON
}
plot_yPlus_vs_productionRatePlus() {
setup="$1"
endTime="$2"
nu="$3"
uTau="$4"
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.kbal"
sampleFile="results/$setup/postProcessing/sampleG/$endTime/y_productionRate.xy"
image="plots/$setup/yPlus_vs_productionRatePlus.png"
gnuplot<<PLT_Y_VS_PRODUCTION_RATE
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:20]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "P^+"
set output "$image"
set title "Setup: $setup" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
samples="$sampleFile"
plot \
benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
samples u (\$1*$uTau/$nu):(\$2*$nu/$uTau**4) t "OpenFOAM" w l lw 2 lc rgb "#4169e1"
PLT_Y_VS_PRODUCTION_RATE
}
plot_yPlus_vs_uPlus_all_setups() {
setups=$@
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.means"
n=0
for setup in $setups
do
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sampleU/$endTime/y_U.xy"
nus[$n]="$nu"
uTaus[$n]="$uTau"
n=$(($n+1))
done
image="plots/all_setups_yPlus_vs_uPlus.png"
gnuplot<<PLT_Y_VS_U_ALL_SETUPS
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:20]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "u^+"
set output "$image"
set title "Ground-normal profile" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
models="${setups[*]}"
samples="${sampleFiles[*]}"
nus="${nus[*]}"
uTaus="${uTaus[*]}"
plot \
benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(\$2/word(uTaus, i)) \
t word(models, i) w l lw 2
PLT_Y_VS_U_ALL_SETUPS
}
plot_yPlus_vs_R_all_setups() {
setups=$@
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.reystress"
n=0
for setup in $setups
do
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sampleR/$endTime/y_turbulenceProperties:R.xy"
sampleFilesK[$n]="results/$setup/postProcessing/sampleK/$endTime/y_turbulenceProperties:k.xy"
nus[$n]="$nu"
uTaus[$n]="$uTau"
n=$(($n+1))
done
imageUU="plots/all_setups_yPlus_vs_Ruu.png"
imageVV="plots/all_setups_yPlus_vs_Rvv.png"
imageWW="plots/all_setups_yPlus_vs_Rww.png"
imageUV="plots/all_setups_yPlus_vs_Ruv.png"
imageK0="plots/all_setups_yPlus_vs_kPlus0.png"
imageK1="plots/all_setups_yPlus_vs_kPlus1.png"
gnuplot<<PLT_Y_VS_R
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:1]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "(uu)^+"
set output "$imageUU"
set title "Ground-normal profile" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
models="${setups[*]}"
samples="${sampleFiles[*]}"
samplesK="${sampleFilesK[*]}"
nus="${nus[*]}"
uTaus="${uTaus[*]}"
plot \
benchmark u 2:3 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(\$2/word(uTaus, i)**2) \
t word(models, i) w l lw 2
set output "$imageVV"
set ylabel "(vv)^+"
plot \
benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(\$5/word(uTaus, i)**2) \
t word(models, i) w l lw 2
set output "$imageWW"
set ylabel "(ww)^+"
plot \
benchmark u 2:5 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(\$7/word(uTaus, i)**2) \
t word(models, i) w l lw 2
set output "$imageUV"
set ylabel "(uv)^+"
plot \
benchmark u 2:(\$6*-1) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(-\$3/word(uTaus, i)**2) \
t word(models, i) w l lw 2
set output "$imageK0"
set ylabel "k^+"
plot \
benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(0.5*(\$2 + \$5 + \$7)/word(uTaus, i)**2) \
t word(models, i) w l lw 2
set output "$imageK1"
set ylabel "k^+"
plot \
benchmark u 2:(0.5*(\$3 + \$4 + \$5)) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samplesK)] word(samplesK, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(\$2/word(uTaus, i)**2) \
t word(models, i) w l lw 2
PLT_Y_VS_R
}
plot_yPlus_vs_epsilonPlus_all_setups() {
setups=$@
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.kbal"
n=0
for setup in $setups
do
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sampleEpsilon/$endTime/y_turbulenceProperties:epsilon.xy"
nus[$n]="$nu"
uTaus[$n]="$uTau"
n=$(($n+1))
done
image="plots/all_setups_yPlus_vs_epsilonPlus.png"
gnuplot<<PLT_Y_VS_EPSILON_ALL_SETUPS
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:20]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "{/Symbol e}^+"
set output "$image"
set title "Ground-normal profile" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
models="${setups[*]}"
samples="${sampleFiles[*]}"
nus="${nus[*]}"
uTaus="${uTaus[*]}"
plot \
benchmark u 2:(-\$3) t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(\$2*word(nus, i)/word(uTaus, i)**4) \
t word(models, i) w l lw 2
PLT_Y_VS_EPSILON_ALL_SETUPS
}
plot_yPlus_vs_productionRatePlus_all_setups() {
setups=$@
benchmarkDir="$FOAM_TUTORIALS/verificationAndValidation/turbulentInflow/oneCellThickPlaneChannel"
benchmarkFile="$benchmarkDir/resources/dataset/chan395.kbal"
n=0
for setup in $setups
do
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sampleG/$endTime/y_productionRate.xy"
nus[$n]="$nu"
uTaus[$n]="$uTau"
n=$(($n+1))
done
image="plots/all_setups_yPlus_vs_productionRatePlus.png"
gnuplot<<PLT_Y_VS_PRODUCTION_RATE_ALL_SETUPS
set terminal pngcairo font "helvetica,20" size 1000, 1000
set grid
#set xrange [0:200]
#set yrange [0:20]
set logscale x
set key left top reverse
set key samplen 2
set key spacing 0.75
set xlabel "y^+"
set ylabel "P^+"
set output "$image"
set title "Ground-normal profile" noenhanced
# Benchmark
benchmark="$benchmarkFile"
# OpenFOAM
models="${setups[*]}"
samples="${sampleFiles[*]}"
nus="${nus[*]}"
uTaus="${uTaus[*]}"
plot \
benchmark u 2:4 t "DNS" w p ps 2 pt 7 lc rgb "#ffc020", \
for [i=1:words(samples)] word(samples, i) \
u (\$1*word(uTaus, i)/word(nus, i)):(\$2*word(nus, i)/word(uTaus, i)**4) \
t word(models, i) w l lw 2
PLT_Y_VS_PRODUCTION_RATE_ALL_SETUPS
}
#------------------------------------------------------------------------------
# Requires gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
# Requires awk
command -v awk >/dev/null || {
echo "awk not found - skipping graph creation" 1>&2
exit 1
}
# Check "results" directory
[ -d "results" ] || {
echo "No results directory found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
for setup in $setups
do
echo ""
echo "# Plots for the setup: $setup"
echo ""
[ -d "results/$setup" ] || {
echo "No results/$setup directory found - skipping graph creation" 1>&2
continue
}
dirPlots="plots/$setup"
[ -d "$dirPlots" ] || mkdir -p "$dirPlots"
# few manipulations
RASModel=$(foamDictionary results/$setup/constant/turbulenceProperties -entry RAS.RASModel -value)
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
plot_initial_iteration_residuals "$setup"
plot_final_iteration_residuals "$setup"
plot_yPlus_vs_uPlus "$setup" "$endTime" "$nu" "$uTau"
plot_yPlus_vs_R "$setup" "$endTime" "$nu" "$uTau"
plot_yPlus_vs_epsilonPlus "$setup" "$endTime" "$nu" "$uTau"
plot_yPlus_vs_productionRatePlus "$setup" "$endTime" "$nu" "$uTau"
done
plot_yPlus_vs_uPlus_all_setups $setups
plot_yPlus_vs_R_all_setups $setups
plot_yPlus_vs_epsilonPlus_all_setups $setups
plot_yPlus_vs_productionRatePlus_all_setups $setups
#------------------------------------------------------------------------------

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volSymmTensorField;
object R;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform (1.718 0 0 1.718 0 1.718); // 2*k/3
boundaryField
{
"(bottom|top)"
{
type fixedValue;
value uniform (1e-16 1e-16 1e-16 1e-16 1e-16 1e-16);
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -3 0 0 0 0 ];
internalField uniform 33.6; // Lardeau14-Coel Eq. 21
boundaryField
{
"(bottom|top)"
{
type epsilonWallFunction;
lowReCorrection true;
value uniform 0;
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object f;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 0 0 0 0 0 0 ];
internalField uniform 1;
boundaryField
{
"(bottom|top)"
{
type fixedValue;
value uniform 0;
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 2.577; // Lardeau14-Coel Eq. 21
boundaryField
{
"(bottom|top)"
{
type fixedValue;
value uniform 1e-10;
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel EBRSM;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (17.54519653746177 0 0);
boundaryField
{
"(bottom|top)"
{
type fixedValue;
value uniform (0 0 0);
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
"(bottom|top)"
{
type nutLowReWallFunction;
value $internalField;
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
"(bottom|top)"
{
type zeroGradient;
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,27 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
restore0Dir
runApplication $(getApplication)
runApplication -s "U" postProcess -func sampleU -latestTime
runApplication -s "k" postProcess -func sampleK -latestTime
runApplication -s "epsilon" postProcess -func sampleEpsilon -latestTime
runApplication -s "R" postProcess -func sampleR -latestTime
runApplication -s "G" postProcess -func sampleG -latestTime
runApplication foamLog log."$(getApplication)"
#------------------------------------------------------------------------------

View File

@ -0,0 +1,31 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
if [ ! -d constant/polyMesh ]
then
runApplication blockMesh
runApplication renumberMesh -overwrite -constant
runApplication checkMesh -allTopology -allGeometry -constant
fi
restore0Dir
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
runApplication -s "U" postProcess -func sampleU -latestTime
runApplication -s "k" postProcess -func sampleK -latestTime
runApplication -s "epsilon" postProcess -func sampleEpsilon -latestTime
runApplication -s "R" postProcess -func sampleR -latestTime
runApplication -s "G" postProcess -func sampleG -latestTime
runApplication foamLog log."$(getApplication)"
#------------------------------------------------------------------------------

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
momentumSource
{
type meanVelocityForce;
selectionMode all;
fields (U);
Ubar (17.54519653746177 0 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 0.002531645569620253;
// ************************************************************************* //

View File

@ -0,0 +1,97 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
nx 10;
ny 100;
nz 1;
xMin 0;
xMax 1;
yMin 0;
yMax 1;
yyMax 2;
zMin 0;
zMax 1;
yExpansion 10.09757454;
yExpansion2 #eval{ -1*$yExpansion };
vertices
(
($xMin $yMin $zMin)
($xMax $yMin $zMin)
($xMax $yMax $zMin)
($xMax $yyMax $zMin)
($xMin $yyMax $zMin)
($xMin $yMax $zMin)
($xMin $yMin $zMax)
($xMax $yMin $zMax)
($xMax $yMax $zMax)
($xMax $yyMax $zMax)
($xMin $yyMax $zMax)
($xMin $yMax $zMax)
);
blocks
(
hex ( 0 1 2 5 6 7 8 11) ($nx $ny $nz) simpleGrading (1 $yExpansion 1)
hex ( 5 2 3 4 11 8 9 10) ($nx $ny $nz) simpleGrading (1 $yExpansion2 1)
);
boundary
(
bottom
{
type wall;
faces ((0 6 7 1));
}
top
{
type wall;
faces ((4 3 9 10));
}
leftAndRight
{
type empty;
faces
(
(1 2 5 0)
(2 3 4 5)
(6 11 8 7)
(11 10 9 8)
);
}
inlet
{
type cyclic;
neighbourPatch outlet;
faces ((0 5 11 6)(5 4 10 11));
}
outlet
{
type cyclic;
neighbourPatch inlet;
faces ((1 7 8 2)(2 8 9 3));
}
);
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 100000;
deltaT 1;
writeControl timeStep;
writeInterval 10000;
purgeWrite 1;
writeFormat ascii;
writePrecision 16;
writeCompression off;
timeFormat general;
timePrecision 8;
runTimeModifiable false;
functions
{
fieldMinMax1
{
type fieldMinMax;
libs (fieldFunctionObjects);
writeToFile no;
log yes;
location yes;
mode magnitude;
fields ( p U k omega epsilon );
}
wallShearStress1
{
type wallShearStress;
libs (fieldFunctionObjects);
patches ( bottom );
executeControl writeTime;
writeControl writeTime;
}
yPlus1
{
type yPlus;
libs (fieldFunctionObjects);
executeControl writeTime;
writeControl writeTime;
}
writeCellCentres1
{
type writeCellCentres;
libs (fieldFunctionObjects);
executeControl onEnd;
writeControl onEnd;
}
turbulenceFields1
{
type turbulenceFields;
libs (fieldFunctionObjects);
fields ( k epsilon R );
executeControl writeTime;
writeControl writeTime;
}
productionRate1
{
type coded;
libs (utilityFunctionObjects);
name productionRate;
writeControl writeTime;
codeExecute
#{
auto* prodPtr =
mesh().getObjectPtr<volScalarField>("productionRate");
if (!prodPtr)
{
Info<< "Create production rate field" << nl;
prodPtr = new volScalarField
(
IOobject
(
"productionRate",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh(),
sqr(dimLength)/pow3(dimTime)
);
regIOobject::store(prodPtr);
}
auto& prod = *prodPtr;
Info<< "Computing production rate field\n" << endl;
const auto& U = mesh().lookupObject<volVectorField>("U");
auto* RPtr =
mesh().getObjectPtr<volSymmTensorField>("R");
if (!RPtr)
{
const auto& nut = mesh().lookupObject<volScalarField>("nut");
prod = 2*nut*(symm(fvc::grad(U)) && symm(fvc::grad(U)));
}
else
{
auto& R = *RPtr;
prod = 0.5*(mag(tr(-twoSymm(R & fvc::grad(U)))));
}
#};
}
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method hierarchical;
coeffs
{
n (2 1 1);
}
// ************************************************************************* //

View File

@ -0,0 +1,68 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss linearUpwind grad(U);
turbulence bounded Gauss limitedLinear 1;
div(phi,k) $turbulence;
div(phi,omega) $turbulence;
div(phi,nuTilda) $turbulence;
div(phi,epsilon) $turbulence;
div(phi,phit) $turbulence;
div(phi,f) $turbulence;
div(phi,R) $turbulence;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
div((nu*dev2(T(grad(U))))) Gauss linear;
div(R) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,97 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother DICGaussSeidel;
tolerance 1e-12;
relTol 0;
minIter 3;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-12;
relTol 0;
minIter 3;
}
"(k|omega|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-12;
relTol 0;
minIter 3;
}
"(epsilon|phit)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-12;
relTol 0;
minIter 3;
}
f
{
solver PBiCGStab;
preconditioner DIC;
tolerance 1e-12;
relTol 0;
minIter 3;
}
R
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-12;
relTol 0;
minIter 3;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent yes;
pRefCell 0;
pRefValue 0;
}
relaxationFactors
{
equations
{
U 0.7;
k 0.5;
omega 0.5;
nuTilda 0.5;
epsilon 0.5;
"(phit|f)" 0.5;
R 0.4;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
turbulenceProperties:epsilon
);
sets
(
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
f
);
sets
(
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
productionRate
);
sets
(
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
turbulenceProperties:k
);
sets
(
ref_point
{
type cloud;
axis y;
points ((0.5 1 0.5));
}
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
turbulenceProperties:R
);
sets
(
ref_point
{
type cloud;
axis y;
points ((0.5 1 0.5));
}
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sample;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
executeControl writeTime;
writeControl writeTime;
fields
(
U
);
sets
(
ref_point
{
type cloud;
axis y;
points ((0.5 1 0.5));
}
y
{
type midPoint;
axis y;
start (0.5 0 0.5);
end (0.5 1 0.5);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 2.577; // Lardeau14-Coel Eq. 21
boundaryField
{
"(bottom|top)"
{
type fixedValue;
value uniform 1e-10;
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 144.87; // epsilon/Cmu/k
boundaryField
{
"(bottom|top)"
{
type omegaWallFunction;
value $internalField;
}
"(inlet|outlet)"
{
type cyclic;
}
leftAndRight
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //