adjustTimeStepToCombustion.H
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) 2023 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 Class
25  Foam::functionObjects::adjustTimeStepToCombustion
26 
27 Description
28  Adjusts the time step to match bulk reaction time scales. This allows the
29  solver to temporally resolve chemical changes, in order to better couple
30  the chemistry and transport, or to improve the time-accuracy of
31  post-processing.
32 
33  Note that this function only does anything if time step adjustment is
34  enabled in the controlDict.
35 
36  Example of function object specification:
37  \verbatim
38  adjustTimeStepToCombustion1
39  {
40  type adjustTimeStepToCombustion;
41  libs ("libcombustionModels.so");
42  maxCo 0.1;
43  extrapolate no;
44  }
45  \endverbatim
46 
47 Usage
48  \table
49  Property | Description | Required | Default value
50  type | type name: adjustTimeStepToCombustion | yes |
51  phase | name of the reacting phase | no |
52  maxCo | maximum combustion "Courant" number | no | 1
53  extrapolate | try to extrapolate decreases | no | false
54  \endtable
55 
56 SourceFiles
57  adjustTimeStepToCombustion.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef functionObjects_adjustTimeStepToCombustion_H
62 #define functionObjects_adjustTimeStepToCombustion_H
63 
64 #include "regionFunctionObject.H"
65 #include "timeIOdictionary.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace functionObjects
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class adjustTimeStepToCombustion Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class adjustTimeStepToCombustion
79 :
80  public regionFunctionObject
81 {
82  // Private Data
83 
84  //- Name of the phase
85  word phaseName_;
86 
87  //- Maximum combustion "Courant" number. The maximum fraction of the
88  // total combustion time-scale that should be evolved in a single
89  // time-step.
90  scalar maxCo_;
91 
92  //- Extrapolate reductions in time-step to try and better catch the
93  // "onset" of reaction. Can lead to time-step oscillation.
94  bool extrapolate_;
95 
96  //- Do we have the previous combustion time-step?
97  bool haveCombustionDeltaT0_;
98 
99  //- The previous combustion time-step
100  scalar combustionDeltaT0_;
101 
102 
103  // Private Member Functions
104 
105  //- Get the properties dictionary IO object
107  (
108  const IOobject::readOption& r
109  ) const;
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("adjustTimeStepToCombustion");
115 
116 
117  // Constructors
118 
119  //- Construct from components
121  (
122  const word& name,
123  const Time& runTime,
124  const dictionary& dict
125  );
126 
127  //- Disallow default bitwise copy construction
129 
130 
131  // Destructor
132  virtual ~adjustTimeStepToCombustion();
133 
134 
135  // Member Functions
136 
137  //- Read and reset the timeStep Function1
138  virtual bool read(const dictionary&);
139 
140  //- Return the list of fields required
141  virtual wordList fields() const
142  {
143  return wordList::null();
144  }
145 
146  //- Reset the timeStep from the Function1 of time
147  virtual bool execute();
148 
149  //- Do nothing
150  virtual bool write();
151 
152 
153  // Member Operators
154 
155  //- Disallow default bitwise assignment
156  void operator=(const adjustTimeStepToCombustion&) = delete;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace functionObjects
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
readOption
Enumeration defining the read options.
Definition: IOobject.H:117
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const word & name() const
Return the name of this functionObject.
Adjusts the time step to match bulk reaction time scales. This allows the solver to temporally resolv...
virtual wordList fields() const
Return the list of fields required.
void operator=(const adjustTimeStepToCombustion &)=delete
Disallow default bitwise assignment.
TypeName("adjustTimeStepToCombustion")
Runtime type information.
adjustTimeStepToCombustion(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
virtual bool execute()
Reset the timeStep from the Function1 of time.
virtual bool read(const dictionary &)
Read and reset the timeStep Function1.
Templated form of IOobject providing type information for file reading and header type checking.
Definition: IOobject.H:531
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict