XiFluid.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) 2022-2026 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 "XiFluid.H"
27 #include "bXiIgnition.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace solvers
35 {
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 :
47  (
48  mesh,
50  ),
51 
52  thermo_(refCast<ubRhoThermo>(isothermalFluid::thermo_)),
53 
54  uMomentumTransport_
55  (
56  thermo_.alphau(),
57  thermo_.uThermo().rho(),
58  U,
59  phi,
60  phi,
61  thermo_.uThermo(),
62  isothermalFluid::momentumTransport()
63  ),
64 
65  bMomentumTransport_
66  (
67  thermo_.alphab(),
68  thermo_.bThermo().rho(),
69  U,
70  phi,
71  phi,
72  thermo_.bThermo(),
73  isothermalFluid::momentumTransport()
74  ),
75 
76  uThermophysicalTransport_
77  (
79  (
80  uMomentumTransport_,
81  thermo_.uThermo()
82  )
83  ),
84 
85  bThermophysicalTransport_
86  (
88  (
89  bMomentumTransport_,
90  thermo_.bThermo()
91  )
92  ),
93 
94  uReaction_(reactionModel::New(thermo_.uThermo(), uMomentumTransport_)),
95 
96  bReaction_(reactionModel::New(thermo_.bThermo(), bMomentumTransport_)),
97 
98  combustionProperties
99  (
100  IOobject
101  (
102  "combustionProperties",
103  runTime.constant(),
104  mesh,
105  IOobject::MUST_READ_IF_MODIFIED,
106  IOobject::NO_WRITE
107  )
108  ),
109 
110  printCombustionProperties_(new printDictionary(combustionProperties)),
111 
112  ignited_(false),
113 
114  bMin_
115  (
116  combustionProperties.subDict("flameWrinkling")
117  .lookupOrDefault("bMin", 1e-3)
118  ),
119 
120  mgbCoeff_
121  (
122  combustionProperties.subDict("flameWrinkling")
123  .lookupOrDefault("mgbCoeff", 1e-3)
124  ),
125 
126  SuModel_
127  (
128  SuModel::New
129  (
130  combustionProperties,
131  thermo_.uThermo(),
132  isothermalFluid::momentumTransport()
133  )
134  ),
135 
136  XiModel_
137  (
138  XiModel::New
139  (
140  combustionProperties,
141  thermo_,
142  isothermalFluid::momentumTransport(),
143  SuModel_->Su()
144  )
145  ),
146 
147  thermo(thermo_),
148 
149  momentumTransport(isothermalFluid::momentumTransport),
150 
151  uThermophysicalTransport(uThermophysicalTransport_),
152  bThermophysicalTransport(bThermophysicalTransport_),
153 
154  b(thermo.b()),
155  uThermo(thermo.uThermo()),
156 
157  c(thermo.c()),
158  bThermo(thermo.bThermo()),
159 
160  Su(SuModel_->Su()),
161  Xi(XiModel_->Xi())
162 {
164 
166 
167  const UPtrListDictionary<fv::bXiIgnition> ignitionModels
168  (
169  fvModels().lookupType<fv::bXiIgnition>()
170  );
171 
172  if (runTime.restart())
173  {
174  forAll(ignitionModels, i)
175  {
176  if (ignitionModels[i].ignited())
177  {
178  ignited_ = true;
179  break;
180  }
181  }
182  }
183 }
184 
185 
186 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
187 
189 {}
190 
191 
192 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
193 
195 {
196  uThermophysicalTransport_->predict();
197  bThermophysicalTransport_->predict();
198 }
199 
200 
202 {
203  uThermophysicalTransport_->correct();
204  bThermophysicalTransport_->correct();
205 }
206 
207 
209 {
210  ignited_ = false;
211 
212  thermo_.reset();
213 
214  const surfaceScalarField phib("phib", phi);
215  thermo_.b().correctBoundaryConditions();
216  thermo_.c() = 1.0 - thermo_.b();
217 
218  SuModel_->reset();
219  XiModel_->reset();
220 }
221 
222 
223 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const word & name() const
Return name.
Definition: IOobject.H:307
Templated base class for multiphase thermophysical transport models.
Base-class for all Su models used by the b-Xi combustion model.
Definition: SuModel.H:65
bool restart() const
Return true if the run is a restart, i.e. startTime != beginTime.
Definition: Time.H:437
Template dictionary class which manages the storage associated with it.
Base-class for all Xi models used by the b-Xi combustion model.
Definition: XiModel.H:117
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
void clear()
Delete object (if the pointer is valid) and set pointer to.
Definition: autoPtrI.H:126
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1792
void setFluxRequired(const word &name) const
Definition: fvSchemes.C:434
Enables the printing of a dictionary and subsequently looked-up defaulted entries.
Base class for reaction models.
Definition: reactionModel.H:53
Abstract base class for run-time selectable region solvers.
Definition: solver.H:56
Foam::fvModels & fvModels() const
Return the fvModels that are created on demand.
Definition: solver.C:103
const Time & runTime
Time.
Definition: solver.H:104
const fvMesh & mesh
Region mesh.
Definition: solver.H:101
Solver module for compressible premixed/partially-premixed combustion with turbulence modelling.
Definition: XiFluid.H:144
const volScalarField & b
Reference to the combustion regress variable.
Definition: XiFluid.H:296
XiFluid(fvMesh &mesh)
Construct from region mesh.
Definition: XiFluid.C:44
virtual ~XiFluid()
Destructor.
Definition: XiFluid.C:188
virtual void thermophysicalTransportCorrector()
Correct the thermophysical transport.
Definition: XiFluid.C:201
autoPtr< printDictionary > printCombustionProperties_
Definition: XiFluid.H:181
virtual void reset()
Reset b-Xi and thermodynamics to the unburnt state.
Definition: XiFluid.C:208
virtual void thermophysicalTransportPredictor()
Predict thermophysical transport.
Definition: XiFluid.C:194
Solver module for steady or transient turbulent flow of compressible isothermal fluids with optional ...
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
volScalarField & b
Definition: createFields.H:27
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
const dimensionedScalar e
Elementary charge.
const dimensionedScalar c
Speed of light in a vacuum.
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
Definition: fvcSup.C:44
addToRunTimeSelectionTable(solver, compressibleMultiphaseVoF, fvMesh)
defineTypeNameAndDebug(basicFluidSolver, 0)
Namespace for OpenFOAM.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:141
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
fluidMulticomponentThermo & thermo
Definition: createFields.H:15