bXiTimedIgnition.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) 2025-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 "bXiTimedIgnition.H"
27 
28 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  namespace fv
33  {
35  }
36 }
37 
38 
39 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40 
41 void Foam::fv::bXiTimedIgnition::readCoeffs(const dictionary& dict)
42 {
43  start_.read(dict, mesh().time().userUnits());
44  duration_.read(dict, mesh().time().userUnits());
45  period_.readIfPresent(dict, mesh().time().userUnits());
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const word& name,
55  const word& modelType,
56  const fvMesh& mesh,
57  const dictionary& dict
58 )
59 :
60  bXiIgnition(name, modelType, mesh, dict),
61  start_("start", mesh().time().userUnits(), coeffs(dict)),
62  duration_("duration", mesh().time().userUnits(), coeffs(dict)),
63  period_("period", mesh().time().userUnits(), coeffs(dict), vGreat),
64  combustionDuration_
65  (
66  "combustionDuration", mesh().time().userUnits(), coeffs(dict), vGreat
67  ),
68  reset_(true)
69 {
70  reset_ = !ignited();
71 }
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
77 {
78  if (ignited())
79  {
80  return wordList({"b"});
81  }
82  else
83  {
84  return wordList::null();
85  }
86 }
87 
88 
90 (
91  const scalar t
92 ) const
93 {
94  return std::fmod(t - start_.value(), period_.value());
95 }
96 
97 
99 (
100  const dimensionedScalar duration
101 ) const
102 {
103  const scalar curTime = mesh().time().value();
104  const scalar deltaT = mesh().time().deltaTValue();
105 
106  const bool igniting
107  (
108  ignRelTime(curTime) > -0.5*deltaT
109  && ignRelTime(curTime) < max(duration.value(), 0.5*deltaT)
110  );
111 
112  if (igniting)
113  {
114  reset_ = false;
115  }
116 
117  return igniting;
118 }
119 
120 
122 {
123  return igniting(duration_);
124 }
125 
126 
128 {
129  const scalar curTime = mesh().time().value();
130  const scalar deltaT = mesh().time().deltaTValue();
131 
132  const bool ignited
133  (
134  ignRelTime(curTime) > -0.5*deltaT
135  && ignRelTime(curTime) < combustionDuration_.value() + 0.5*deltaT
136  );
137 
138  if
139  (
140  !reset_
141  && ignRelTime(curTime) > combustionDuration_.value() + 0.5*deltaT
142  )
143  {
144  reset_ = true;
145 
147  }
148 
149  return ignited;
150 }
151 
152 
154 {
155  if (fvModel::read(dict))
156  {
157  readCoeffs(coeffs(dict));
158  return true;
159  }
160  else
161  {
162  return false;
163  }
164 
165  return false;
166 }
167 
168 
169 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
scalar deltaTValue() const
Return time step value.
Definition: TimeStateI.H:34
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
void read(const dictionary &, const unitSet &defaultUnits=NullObjectRef< unitSet >())
Update the value of dimensioned<Type>
const Type & value() const
Return const reference to value.
bool readIfPresent(const dictionary &, const unitSet &defaultUnits=NullObjectRef< unitSet >())
Update the value of dimensioned<Type> if found in the dictionary.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:433
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: fvModel.C:196
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:69
Abstract base-class for ignition models for the Weller b-Xi combustion models.
Definition: bXiIgnition.H:55
Abstract base-class for timed ignition models for the Weller b-Xi combustion models.
virtual wordList addSupFields() const
Return the list of fields for which the option adds source term.
dimensionedScalar combustionDuration_
Combustion duration.
dimensionedScalar duration_
Ignition duration.
scalar ignRelTime(const scalar t) const
Return the time relative to the ignition time.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual bool ignited() const
Return true during the combustion duration.
bool reset_
Set true when the composition is reset.
dimensionedScalar start_
Ignition start time.
dimensionedScalar period_
Ignition repeat period.
bXiTimedIgnition(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
virtual bool igniting() const
Return true during the ignition duration.
Type & lookupObjectRef(const word &name) const
Lookup and return the object reference of the given Type.
Solver module for compressible premixed/partially-premixed combustion with turbulence modelling.
Definition: XiFluid.H:144
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const dimensionSet time
defineTypeNameAndDebug(bound, 0)
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
labelList fv(nPoints)
dictionary dict