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  alphaPhiu_
55  (
56  IOobject::groupName("alphaPhi", thermo_.unburntPhaseName),
57  phi
58  ),
59 
60  alphaPhib_
61  (
62  IOobject::groupName("alphaPhi", thermo_.burntPhaseName),
63  phi
64  ),
65 
66  uMomentumTransport_
67  (
68  thermo_.alphau(),
69  thermo_.uThermo().rho(),
70  U,
71  alphaPhiu_,
72  phi,
73  thermo_.uThermo(),
74  isothermalFluid::momentumTransport()
75  ),
76 
77  bMomentumTransport_
78  (
79  thermo_.alphab(),
80  thermo_.bThermo().rho(),
81  U,
82  alphaPhib_,
83  phi,
84  thermo_.bThermo(),
85  isothermalFluid::momentumTransport()
86  ),
87 
88  uThermophysicalTransport_
89  (
91  (
92  uMomentumTransport_,
93  thermo_.uThermo()
94  )
95  ),
96 
97  bThermophysicalTransport_
98  (
100  (
101  bMomentumTransport_,
102  thermo_.bThermo()
103  )
104  ),
105 
106  uReaction_(reactionModel::New(thermo_.uThermo(), uMomentumTransport_)),
107 
108  bReaction_(reactionModel::New(thermo_.bThermo(), bMomentumTransport_)),
109 
110  combustionProperties
111  (
112  IOobject
113  (
114  "combustionProperties",
115  runTime.constant(),
116  mesh,
117  IOobject::MUST_READ_IF_MODIFIED,
118  IOobject::NO_WRITE
119  )
120  ),
121 
122  printCombustionProperties_(new printDictionary(combustionProperties)),
123 
124  ignited_(false),
125 
126  bMin_
127  (
128  combustionProperties.subDict("flameWrinkling")
129  .lookupOrDefault("bMin", 1e-3)
130  ),
131 
132  mgbCoeff_
133  (
134  combustionProperties.subDict("flameWrinkling")
135  .lookupOrDefault("mgbCoeff", 1e-3)
136  ),
137 
138  SuModel_
139  (
140  SuModel::New
141  (
142  combustionProperties,
143  thermo_.uThermo(),
144  isothermalFluid::momentumTransport()
145  )
146  ),
147 
148  XiModel_
149  (
150  XiModel::New
151  (
152  combustionProperties,
153  thermo_,
154  isothermalFluid::momentumTransport(),
155  SuModel_->Su()
156  )
157  ),
158 
159  thermo(thermo_),
160 
161  momentumTransport(isothermalFluid::momentumTransport),
162 
163  uThermophysicalTransport(uThermophysicalTransport_),
164  bThermophysicalTransport(bThermophysicalTransport_),
165 
166  b(thermo.b()),
167  uThermo(thermo.uThermo()),
168 
169  c(thermo.c()),
170  bThermo(thermo.bThermo()),
171 
172  Su(SuModel_->Su()),
173  Xi(XiModel_->Xi())
174 {
176 
178 
179  const UPtrListDictionary<fv::bXiIgnition> ignitionModels
180  (
181  fvModels().lookupType<fv::bXiIgnition>()
182  );
183 
184  if (runTime.restart())
185  {
186  forAll(ignitionModels, i)
187  {
188  if (ignitionModels[i].ignited())
189  {
190  ignited_ = true;
191  break;
192  }
193  }
194  }
195 }
196 
197 
198 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
199 
201 {}
202 
203 
204 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
205 
207 {
208  uThermophysicalTransport_->predict();
209  bThermophysicalTransport_->predict();
210 }
211 
212 
214 {
215  uThermophysicalTransport_->correct();
216  bThermophysicalTransport_->correct();
217 }
218 
219 
221 {
222  ignited_ = false;
223 
224  thermo_.reset();
225 
226  thermo_.b().correctBoundaryConditions();
227  thermo_.c() = 1.0 - thermo_.b();
228 
229  SuModel_->reset();
230  XiModel_->reset();
231 }
232 
233 
234 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Macros for easy insertion into run-time selection tables.
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:1795
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:293
XiFluid(fvMesh &mesh)
Construct from region mesh.
Definition: XiFluid.C:44
virtual ~XiFluid()
Destructor.
Definition: XiFluid.C:200
virtual void thermophysicalTransportCorrector()
Correct the thermophysical transport.
Definition: XiFluid.C:213
autoPtr< printDictionary > printCombustionProperties_
Definition: XiFluid.H:184
virtual void reset()
Reset b-Xi and thermodynamics to the unburnt state.
Definition: XiFluid.C:220
virtual void thermophysicalTransportPredictor()
Predict thermophysical transport.
Definition: XiFluid.C:206
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