SCOPEXiEq.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "SCOPEXiEq.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace XiEqModels
34 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const dictionary& XiEqProperties,
48  const volScalarField& Su
49 )
50 :
51  XiEqModel(XiEqProperties, thermo, turbulence, Su),
52  XiEqCoef_(XiEqModelCoeffs_.lookup<scalar>("XiEqCoef")),
53  XiEqExp_(XiEqModelCoeffs_.lookup<scalar>("XiEqExp")),
54  lCoef_(XiEqModelCoeffs_.lookup<scalar>("lCoef")),
55  SuMin_(0.01*Su.average()),
56  uPrimeCoef_(XiEqModelCoeffs_.lookup<scalar>("uPrimeCoef")),
57  subGridSchelkin_
58  (
59  readBool(XiEqModelCoeffs_.lookup("subGridSchelkin"))
60  ),
61  MaModel
62  (
63  Su.mesh().lookupObject<IOdictionary>("combustionProperties")
64  .subDict("laminarFlameSpeed"),
65  Su.mesh().lookupObject<IOdictionary>("combustionProperties")
66  .subDict("laminarFlameSpeed").subDict
67  (
68  Su.mesh().lookupObject<IOdictionary>("combustionProperties")
69  .subDict("laminarFlameSpeed").lookup("fuel")
70  ),
71  thermo
72  )
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
77 
79 {}
80 
81 
82 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
83 
85 {
86  tmp<volScalarField> tk = turbulence_.k();
87  const volScalarField& k = tk();
88 
89  tmp<volScalarField> tepsilon = turbulence_.epsilon();
90  const volScalarField& epsilon = tepsilon();
91 
92  volScalarField up(sqrt((2.0/3.0)*k));
93  if (subGridSchelkin_)
94  {
95  up.primitiveFieldRef() += calculateSchelkinEffect(uPrimeCoef_);
96  }
97 
98  volScalarField l(lCoef_*sqrt(3.0/2.0)*up*k/epsilon);
99  volScalarField Rl(up*l*thermo_.rhou()/thermo_.muu());
100 
101  volScalarField upBySu(up/(Su_ + SuMin_));
102  volScalarField K(0.157*upBySu/sqrt(Rl));
103  volScalarField Ma(MaModel.Ma());
104 
105  tmp<volScalarField> tXiEq
106  (
108  (
109  "XiEq",
110  epsilon.mesh(),
112  )
113  );
114  volScalarField& xieq = tXiEq.ref();
115 
116  forAll(xieq, celli)
117  {
118  if (Ma[celli] > 0.01)
119  {
120  xieq[celli] =
121  XiEqCoef_*pow(K[celli]*Ma[celli], -XiEqExp_)*upBySu[celli];
122  }
123  }
124 
126 
127  forAll(xieq.boundaryField(), patchi)
128  {
129  scalarField& xieqp = xieqBf[patchi];
130  const scalarField& Kp = K.boundaryField()[patchi];
131  const scalarField& Map = Ma.boundaryField()[patchi];
132  const scalarField& upBySup = upBySu.boundaryField()[patchi];
133 
134  forAll(xieqp, facei)
135  {
136  if (Ma[facei] > 0.01)
137  {
138  xieqp[facei] =
139  XiEqCoef_*pow(Kp[facei]*Map[facei], -XiEqExp_)
140  *upBySup[facei];
141  }
142  }
143  }
144 
145  return tXiEq;
146 }
147 
148 
150 {
151  XiEqModel::read(XiEqProperties);
152 
153  XiEqModelCoeffs_.lookup("XiEqCoef") >> XiEqCoef_;
154  XiEqModelCoeffs_.lookup("XiEqExp") >> XiEqExp_;
155  XiEqModelCoeffs_.lookup("lCoef") >> lCoef_;
156  XiEqModelCoeffs_.lookup("uPrimeCoef") >> uPrimeCoef_;
157  XiEqModelCoeffs_.lookup("subGridSchelkin") >> subGridSchelkin_;
158 
159  return true;
160 }
161 
162 
163 // ************************************************************************* //
label k
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Macros for easy insertion into run-time selection tables.
Generic GeometricBoundaryField class.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
A HashTable to objects of type <T> with a label key.
Definition: Map.H:52
Base class for equilibrium flame wrinkling XiEq models.
Definition: XiEqModel.H:52
bool read(const dictionary &XiProperties)
Update properties from the given XiProperties dictionary.
Definition: XiEqModel.C:69
Simple SCOPEXiEq model for XiEq based on SCOPEXiEqs correlation with a linear correction function to ...
Definition: SCOPEXiEq.H:57
virtual bool read(const dictionary &XiEqProperties)
Update properties from given dictionary.
Definition: SCOPEXiEq.C:149
virtual tmp< volScalarField > XiEq() const
Return the flame-wrinkling XiEq.
Definition: SCOPEXiEq.C:84
SCOPEXiEq(const dictionary &XiEqProperties, const psiuMulticomponentThermo &thermo, const compressible::RASModel &turbulence, const volScalarField &Su)
Construct from components.
Definition: SCOPEXiEq.C:44
virtual ~SCOPEXiEq()
Destructor.
Definition: SCOPEXiEq.C:78
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base-class for combustion fluid thermodynamic properties based on compressibility.
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const scalar epsilon
label patchi
K
Definition: pEqn.H:75
defineTypeNameAndDebug(constant, 0)
addToRunTimeSelectionTable(XiEqModel, constant, dictionary)
RASModel< momentumTransportModel > RASModel
Typedefs for turbulence, RAS and LES models for compressible flow based on the standard laminar trans...
tmp< VolField< Type > > average(const SurfaceField< Type > &ssf)
Area-weighted average a surfaceField creating a volField.
Definition: fvcAverage.C:46
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
Definition: fvcSup.C:44
Namespace for OpenFOAM.
bool readBool(Istream &)
Definition: boolIO.C:66
const dimensionSet dimless
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
autoPtr< incompressible::momentumTransportModel > turbulence(incompressible::momentumTransportModel::New(U, phi, viscosity))
fluidMulticomponentThermo & thermo
Definition: createFields.H:31