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  //- Source term component (for power of T^4)
244  virtual tmp<volScalarField> Rp() const = 0;
245 
246  //- Source term component (constant)
247  virtual tmp<volScalarField::Internal> Ru() const = 0;
248 
249  //- Energy source term
250  virtual tmp<fvScalarMatrix> Sh
251  (
252  const basicThermo& thermo,
253  const volScalarField& he
254  ) const;
255 
256  //- Temperature source term
257  virtual tmp<fvScalarMatrix> ST
258  (
259  const dimensionedScalar& rhoCp,
261  ) const;
262 
263  //- Temperature source term
264  virtual tmp<fvScalarMatrix> ST
265  (
268  ) const;
269 
270  //- Temperature source term
271  virtual tmp<fvScalarMatrix> ST
272  (
274  ) const;
275 
276  virtual label nBands() const = 0;
277 
278  //- Access to absorptionEmission model
280 
281  //- Access to soot Model
282  const sootModel& soot() const;
283 
284 };
285 
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 #define addToRadiationRunTimeSelectionTables(model) \
290  \
291  addToRunTimeSelectionTable \
292  ( \
293  radiationModel, \
294  model, \
295  dictionary \
296  ); \
297  \
298  addToRunTimeSelectionTable \
299  ( \
300  radiationModel, \
301  model, \
302  T \
303  );
304 
305 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306 
307 } // End namespace radiation
308 } // End namespace Foam
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 #endif
313 
314 // ************************************************************************* //
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.
Abstract base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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:77
static const word primaryFluxName_
Static name for primary solar fluxes.
TypeName("radiationModel")
Runtime type information.
const sootModel & soot() const
Access to soot Model.
virtual void calculate()=0
Solve radiation equation(s)
Model to supply absorption and emission coefficients for radiation modelling.
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:69
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
static autoPtr< radiationModel > New(const volScalarField &T)
Return a reference to the selected radiation model.
virtual ~radiationModel()
Destructor.
dynamicFvMesh & mesh
Base class for soor models.
Definition: sootModel.H:49
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
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
virtual label nBands() const =0
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
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.
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.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
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:172
autoPtr< absorptionEmissionModel > absorptionEmission_
Absorption/emission model.
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
Namespace for OpenFOAM.