radiationModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Namespace
28  Foam::radiation
29 
30 Description
31  Namespace for radiation modelling
32 
33 Class
34  Foam::radiation::radiationModel
35 
36 Description
37  Top level model for radiation modelling
38 
39 SourceFiles
40  radiationModel.C
41  radiationModelNew.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef radiationModel_H
46 #define radiationModel_H
47 
48 #include "IOdictionary.H"
49 #include "autoPtr.H"
50 #include "runTimeSelectionTables.H"
51 #include "volFields.H"
52 #include "fvMatricesFwd.H"
53 #include "Switch.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 class basicThermo;
62 class fvMesh;
63 
64 namespace radiation
65 {
66 
67 // Forward declaration of classes
68 //class absorptionEmissionModel;
69 class scatterModel;
70 class sootModel;
71 
72 /*---------------------------------------------------------------------------*\
73  Class radiationModel Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class radiationModel
77 :
78  public IOdictionary
79 {
80 public:
81 
82  // Static data
83 
84  //- Static name external radiative fluxes
85  static const word externalRadHeatFieldName_;
86 
87  //- Static name for primary solar fluxes
88  static const word primaryFluxName_;
89 
90  //- Static name for reflected solar fluxes
91  static const word relfectedFluxName_;
92 
93 
94 protected:
95 
96 
97 
98  // Protected data
99 
100  //- Reference to the mesh database
101  const fvMesh& mesh_;
102 
103  //- Reference to the time database
104  const Time& time_;
106  //- Reference to the temperature field
107  const volScalarField& T_;
108 
109  //- Radiation model on/off flag
111 
112  //- Radiation model dictionary
114 
115  //- Radiation solver frequency - number flow solver iterations per
116  // radiation solver iteration
117  label solverFreq_;
118 
119  //- Flag to enable radiation model to be evaluated on first iteration
121 
122 
123  // References to the radiation sub-models
124 
125  //- Absorption/emission model
127 
128  //- Scatter model
130 
131  //- Soot model
133 
134  //- Transmissivity model
135  //autoPtr<transmissivityModel> transmissivity_;
136 
138 private:
139 
140  // Private Member Functions
141 
142  //- Create IO object if dictionary is present
143  IOobject createIOobject(const fvMesh& mesh) const;
144 
145  //- Initialise
146  void initialise();
147 
148  //- No copy construct
149  radiationModel(const radiationModel&) = delete;
151  //- No copy assignment
152  void operator=(const radiationModel&) = delete;
153 
154 
155 public:
156 
157  //- Runtime type information
158  TypeName("radiationModel");
159 
160 
161  // Declare runtime constructor selection table
162 
164  (
165  autoPtr,
167  T,
168  (
169  const volScalarField& T
170  ),
171  (T)
172  );
173 
175  (
176  autoPtr,
178  dictionary,
179  (
180  const dictionary& dict,
181  const volScalarField& T
182  ),
183  (dict, T)
184  );
185 
186 
187  // Constructors
188 
189  //- Null constructor
191 
192  //- Construct from components
193  radiationModel(const word& type, const volScalarField& T);
194 
195  //- Construct from components
197  (
198  const word& type,
199  const dictionary& dict,
200  const volScalarField& T
201  );
202 
203 
204  // Selectors
205 
206  //- Return a reference to the selected radiation model
208 
209  //- Return a reference to the selected radiation model
211  (
212  const dictionary& dict,
213  const volScalarField& T
214  );
215 
216 
217  //- Destructor
218  virtual ~radiationModel();
219 
220 
221  // Member Functions
222 
223  // Edit
224 
225  //- Main update/correction routine
226  virtual void correct();
227 
228  //- Solve radiation equation(s)
229  virtual void calculate() = 0;
230 
231  //- Read radiationProperties dictionary
232  virtual bool read() = 0;
233 
234 
235  // Access
236 
237  //- Radiation model on/off flag
238  const Switch radiation() const
239  {
240  return radiation_;
241  }
242 
243  //- Return access to the temperature field
244  const volScalarField& T() const noexcept { return T_; }
245 
246  //- Return the radiation solver frequency
247  label solverFreq() const noexcept { return solverFreq_; }
248 
249  //- Source term component (for power of T^4)
250  virtual tmp<volScalarField> Rp() const = 0;
251 
252  //- Source term component (constant)
253  virtual tmp<volScalarField::Internal> Ru() const = 0;
254 
255  //- Energy source term
256  virtual tmp<fvScalarMatrix> Sh
257  (
258  const basicThermo& thermo,
259  const volScalarField& he
260  ) const;
261 
262  //- Temperature source term
263  virtual tmp<fvScalarMatrix> ST
264  (
265  const dimensionedScalar& rhoCp,
267  ) const;
268 
269  //- Temperature source term
270  virtual tmp<fvScalarMatrix> ST
271  (
272  tmp<volScalarField> rhoCp,
274  ) const;
275 
276  //- Temperature source term
277  virtual tmp<fvScalarMatrix> ST
278  (
280  ) const;
281 
282  virtual label nBands() const = 0;
283 
284  //- Access to absorptionEmission model
285  const absorptionEmissionModel& absorptionEmission() const;
286 
287  //- Access to soot Model
288  const sootModel& soot() const;
289 
290 };
291 
292 
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 #define addToRadiationRunTimeSelectionTables(model) \
296  \
297  addToRunTimeSelectionTable \
298  ( \
299  radiationModel, \
300  model, \
301  dictionary \
302  ); \
303  \
304  addToRunTimeSelectionTable \
305  ( \
306  radiationModel, \
307  model, \
308  T \
309  );
310 
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 
313 } // End namespace radiation
314 } // End namespace Foam
315 
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 
318 #endif
319 
320 // ************************************************************************* //
volScalarField & he
Definition: YEEqn.H:52
static const word relfectedFluxName_
Static name for reflected solar fluxes.
static const word externalRadHeatFieldName_
Static name external radiative fluxes.
dictionary dict
dictionary coeffs_
Radiation model dictionary.
autoPtr< scatterModel > scatter_
Scatter model.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
const volScalarField & T_
Reference to the temperature field.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Definition: Switch.H:80
static const word primaryFluxName_
Static name for primary solar fluxes.
label solverFreq() const noexcept
Return the radiation solver frequency.
TypeName("radiationModel")
Runtime type information.
const sootModel & soot() const
Access to soot Model.
virtual void calculate()=0
Solve radiation equation(s)
declareRunTimeSelectionTable(autoPtr, radiationModel, T,(const volScalarField &T),(T))
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:72
const volScalarField & T() const noexcept
Return access to the temperature field.
psiReactionThermo & thermo
Definition: createFields.H:28
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:805
static autoPtr< radiationModel > New(const volScalarField &T)
Return a reference to the selected radiation model.
virtual ~radiationModel()
Destructor.
dynamicFvMesh & mesh
virtual bool read()=0
Read radiationProperties dictionary.
autoPtr< sootModel > soot_
Soot model.
A class for handling words, derived from Foam::string.
Definition: word.H:63
bool firstIter_
Flag to enable radiation model to be evaluated on first iteration.
const fvMesh & mesh_
Reference to the mesh database.
const Switch radiation() const
Radiation model on/off flag.
Top level model for radiation modelling.
virtual void correct()
Main update/correction routine.
rhoCp
Definition: TEqn.H:3
virtual label nBands() const =0
const direction noexcept
Definition: scalarImpl.H:265
virtual tmp< volScalarField::Internal > Ru() const =0
Source term component (constant)
virtual tmp< volScalarField > Rp() const =0
Source term component (for power of T^4)
const absorptionEmissionModel & absorptionEmission() const
Access to absorptionEmission model.
virtual tmp< fvScalarMatrix > Sh(const basicThermo &thermo, const volScalarField &he) const
Energy source term.
Forward declarations of fvMatrix specializations.
const Time & time_
Reference to the time database.
virtual tmp< fvScalarMatrix > ST(const dimensionedScalar &rhoCp, volScalarField &T) const
Temperature source term.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Switch radiation_
Radiation model on/off flag.
Macros to ease declaration of run-time selection tables.
label solverFreq_
Radiation solver frequency - number flow solver iterations per.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:188
autoPtr< absorptionEmissionModel > absorptionEmission_
Absorption/emission model.
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
Namespace for OpenFOAM.