P1.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 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 "P1.H"
27 #include "fvmLaplacian.H"
28 #include "fvmSup.H"
30 #include "scatterModel.H"
31 #include "constants.H"
33 
34 using namespace Foam::constant;
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  namespace radiation
41  {
44  }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 :
52  radiationModel(typeName, T),
53  G_
54  (
55  IOobject
56  (
57  "G",
58  mesh_.time().timeName(),
59  mesh_,
60  IOobject::MUST_READ,
61  IOobject::AUTO_WRITE
62  ),
63  mesh_
64  ),
65  Qr_
66  (
67  IOobject
68  (
69  "Qr",
70  mesh_.time().timeName(),
71  mesh_,
72  IOobject::NO_READ,
73  IOobject::AUTO_WRITE
74  ),
75  mesh_,
77  ),
78  a_
79  (
80  IOobject
81  (
82  "a",
83  mesh_.time().timeName(),
84  mesh_,
85  IOobject::NO_READ,
86  IOobject::AUTO_WRITE
87  ),
88  mesh_,
90  ),
91  e_
92  (
93  IOobject
94  (
95  "e",
96  mesh_.time().timeName(),
97  mesh_,
98  IOobject::NO_READ,
99  IOobject::NO_WRITE
100  ),
101  mesh_,
103  ),
104  E_
105  (
106  IOobject
107  (
108  "E",
109  mesh_.time().timeName(),
110  mesh_,
111  IOobject::NO_READ,
112  IOobject::NO_WRITE
113  ),
114  mesh_,
116  )
117 {}
118 
119 
121 :
122  radiationModel(typeName, dict, T),
123  G_
124  (
125  IOobject
126  (
127  "G",
128  mesh_.time().timeName(),
129  mesh_,
130  IOobject::MUST_READ,
131  IOobject::AUTO_WRITE
132  ),
133  mesh_
134  ),
135  Qr_
136  (
137  IOobject
138  (
139  "Qr",
140  mesh_.time().timeName(),
141  mesh_,
142  IOobject::NO_READ,
143  IOobject::AUTO_WRITE
144  ),
145  mesh_,
147  ),
148  a_
149  (
150  IOobject
151  (
152  "a",
153  mesh_.time().timeName(),
154  mesh_,
155  IOobject::NO_READ,
156  IOobject::AUTO_WRITE
157  ),
158  mesh_,
160  ),
161  e_
162  (
163  IOobject
164  (
165  "e",
166  mesh_.time().timeName(),
167  mesh_,
168  IOobject::NO_READ,
169  IOobject::NO_WRITE
170  ),
171  mesh_,
173  ),
174  E_
175  (
176  IOobject
177  (
178  "E",
179  mesh_.time().timeName(),
180  mesh_,
181  IOobject::NO_READ,
182  IOobject::NO_WRITE
183  ),
184  mesh_,
186  )
187 {}
188 
189 
190 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
191 
193 {}
194 
195 
196 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
197 
199 {
200  if (radiationModel::read())
201  {
202  // nothing to read
203 
204  return true;
205  }
206  else
207  {
208  return false;
209  }
210 }
211 
212 
214 {
215  a_ = absorptionEmission_->a();
216  e_ = absorptionEmission_->e();
217  E_ = absorptionEmission_->E();
218  const volScalarField sigmaEff(scatter_->sigmaEff());
219 
220  const dimensionedScalar a0 ("a0", a_.dimensions(), ROOTVSMALL);
221 
222  // Construct diffusion
223  const volScalarField gamma
224  (
225  IOobject
226  (
227  "gammaRad",
228  G_.mesh().time().timeName(),
229  G_.mesh(),
232  ),
233  1.0/(3.0*a_ + sigmaEff + a0)
234  );
235 
236  // Solve G transport equation
237  solve
238  (
239  fvm::laplacian(gamma, G_)
240  - fvm::Sp(a_, G_)
241  ==
242  - 4.0*(e_*physicoChemical::sigma*pow4(T_) ) - E_
243  );
244 
245  // Calculate radiative heat flux on boundaries.
246  forAll(mesh_.boundaryMesh(), patchi)
247  {
248  if (!G_.boundaryField()[patchi].coupled())
249  {
250  Qr_.boundaryField()[patchi] =
251  -gamma.boundaryField()[patchi]
252  *G_.boundaryField()[patchi].snGrad();
253  }
254  }
255 }
256 
257 
259 {
260  return tmp<volScalarField>
261  (
262  new volScalarField
263  (
264  IOobject
265  (
266  "Rp",
267  mesh_.time().timeName(),
268  mesh_,
271  false
272  ),
273  4.0*absorptionEmission_->eCont()*physicoChemical::sigma
274  )
275  );
276 }
277 
278 
281 {
283  G_.dimensionedInternalField();
285  absorptionEmission_->ECont()().dimensionedInternalField();
287  absorptionEmission_->aCont()().dimensionedInternalField();
288 
289  return a*G - E;
290 }
291 
292 
293 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
scatterModel.H
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::constant::universal::G
const dimensionedScalar G
Newtonian constant of gravitation.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::constant
Collection of constants.
Definition: atomicConstants.C:37
dimensionedInternalField
rDeltaT dimensionedInternalField()
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::radiation::P1::~P1
virtual ~P1()
Destructor.
Definition: P1.C:192
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::fvm::Sp
tmp< fvMatrix< Type > > Sp(const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::pow4
dimensionedScalar pow4(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:98
Foam::radiation::P1::read
bool read()
Read radiation properties dictionary.
Definition: P1.C:198
Foam::radiation::radiationModel::read
virtual bool read()=0
Read radiationProperties dictionary.
Definition: radiationModel.C:197
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:87
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::fvm::laplacian
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:46
fvmLaplacian.H
Calculate the matrix for the laplacian of the field.
Foam::radiation::P1::Rp
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
Definition: P1.C:258
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
radiation
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
Foam::radiation::P1::Ru
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
Definition: P1.C:280
constants.H
fvmSup.H
Calculate the matrix for implicit and explicit sources.
Foam::constant::atomic::a0
const dimensionedScalar a0
Bohr radius: default SI units: [m].
Foam::solve
SolverPerformance< Type > solve(fvMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
absorptionEmissionModel.H
Foam::radiation::P1::P1
P1(const P1 &)
Disallow default bitwise copy construct.
Foam::radiation::radiationModel
Top level model for radiation modelling.
Definition: radiationModel.H:73
Foam::radiation::P1::calculate
void calculate()
Solve radiation equation(s)
Definition: P1.C:213
patchi
label patchi
Definition: getPatchFieldScalar.H:1
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::constant::physicoChemical::sigma
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
addToRadiationRunTimeSelectionTables
#define addToRadiationRunTimeSelectionTables(model)
Definition: radiationModel.H:263
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
P1.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51