1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "SCOPEXiEq.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(SCOPEXiEq, 0);
36 addToRunTimeSelectionTable(XiEqModel, SCOPEXiEq, dictionary);
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 Foam::XiEqModels::SCOPEXiEq::SCOPEXiEq
45 const dictionary& XiEqProperties,
46 const hhuCombustionThermo& thermo,
47 const compressible::RASModel& turbulence,
48 const volScalarField& Su
51 XiEqModel(XiEqProperties, thermo, turbulence, Su),
52 XiEqCoef_(readScalar(XiEqModelCoeffs_.lookup("XiEqCoef"))),
53 XiEqExp_(readScalar(XiEqModelCoeffs_.lookup("XiEqExp"))),
54 lCoef_(readScalar(XiEqModelCoeffs_.lookup("lCoef"))),
55 SuMin_(0.01*Su.average()),
62 "combustionProperties",
63 Su.mesh().time().constant(),
73 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
75 Foam::XiEqModels::SCOPEXiEq::~SCOPEXiEq()
79 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
81 Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
83 const volScalarField& k = turbulence_.k();
84 const volScalarField& epsilon = turbulence_.epsilon();
86 volScalarField up(sqrt((2.0/3.0)*k));
87 if (subGridSchelkin())
89 up.internalField() += calculateSchelkinEffect();
92 volScalarField l(lCoef_*sqrt(3.0/2.0)*up*k/epsilon);
93 volScalarField Rl(up*l*thermo_.rhou()/thermo_.muu());
95 volScalarField upBySu(up/(Su_ + SuMin_));
96 volScalarField K(0.157*upBySu/sqrt(Rl));
97 volScalarField Ma(MaModel.Ma());
99 tmp<volScalarField> tXiEq
106 epsilon.time().timeName(),
112 dimensionedScalar("XiEq", dimless, 0.0)
115 volScalarField& xieq = tXiEq();
119 if (Ma[celli] > 0.01)
122 XiEqCoef_*pow(K[celli]*Ma[celli], -XiEqExp_)*upBySu[celli];
126 forAll(xieq.boundaryField(), patchi)
128 scalarField& xieqp = xieq.boundaryField()[patchi];
129 const scalarField& Kp = K.boundaryField()[patchi];
130 const scalarField& Map = Ma.boundaryField()[patchi];
131 const scalarField& upBySup = upBySu.boundaryField()[patchi];
135 if (Ma[facei] > 0.01)
138 XiEqCoef_*pow(Kp[facei]*Map[facei], -XiEqExp_)
148 bool Foam::XiEqModels::SCOPEXiEq::read(const dictionary& XiEqProperties)
150 XiEqModel::read(XiEqProperties);
152 XiEqModelCoeffs_.lookup("XiEqCoef") >> XiEqCoef_;
153 XiEqModelCoeffs_.lookup("XiEqExp") >> XiEqExp_;
154 XiEqModelCoeffs_.lookup("lCoef") >> lCoef_;
160 // ************************************************************************* //