P1.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) 2011-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 "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 radiationModels
41 {
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 :
53  G_
54  (
55  IOobject
56  (
57  "G",
58  mesh_.time().name(),
59  mesh_,
60  IOobject::MUST_READ,
61  IOobject::AUTO_WRITE
62  ),
63  mesh_,
64  dimensions::heatFlux
65  ),
66  qr_
67  (
68  IOobject
69  (
70  "qr",
71  mesh_.time().name(),
72  mesh_,
73  IOobject::READ_IF_PRESENT,
74  IOobject::AUTO_WRITE
75  ),
76  mesh_,
77  dimensionedScalar(dimensions::heatFlux, 0)
78  ),
79  a_
80  (
81  IOobject
82  (
83  "a",
84  mesh_.time().name(),
85  mesh_,
86  IOobject::NO_READ,
87  IOobject::AUTO_WRITE
88  ),
89  mesh_,
90  dimensionedScalar(inv(dimensions::length), 0)
91  ),
92  e_
93  (
94  IOobject
95  (
96  "e",
97  mesh_.time().name(),
98  mesh_,
99  IOobject::NO_READ,
100  IOobject::NO_WRITE
101  ),
102  mesh_,
103  dimensionedScalar(inv(dimensions::length), 0)
104  ),
105  E_
106  (
107  IOobject
108  (
109  "E",
110  mesh_.time().name(),
111  mesh_,
112  IOobject::NO_READ,
113  IOobject::NO_WRITE
114  ),
115  mesh_,
117  )
118 {}
119 
120 
122 :
124  G_
125  (
126  IOobject
127  (
128  "G",
129  mesh_.time().name(),
130  mesh_,
131  IOobject::MUST_READ,
132  IOobject::AUTO_WRITE
133  ),
134  mesh_,
135  dimensions::heatFlux
136  ),
137  qr_
138  (
139  IOobject
140  (
141  "qr",
142  mesh_.time().name(),
143  mesh_,
144  IOobject::READ_IF_PRESENT,
145  IOobject::AUTO_WRITE
146  ),
147  mesh_,
148  dimensionedScalar(dimensions::heatFlux, 0)
149  ),
150  a_
151  (
152  IOobject
153  (
154  "a",
155  mesh_.time().name(),
156  mesh_,
157  IOobject::NO_READ,
158  IOobject::AUTO_WRITE
159  ),
160  mesh_,
161  dimensionedScalar(inv(dimensions::length), 0)
162  ),
163  e_
164  (
165  IOobject
166  (
167  "e",
168  mesh_.time().name(),
169  mesh_,
170  IOobject::NO_READ,
171  IOobject::NO_WRITE
172  ),
173  mesh_,
174  dimensionedScalar(inv(dimensions::length), 0)
175  ),
176  E_
177  (
178  IOobject
179  (
180  "E",
181  mesh_.time().name(),
182  mesh_,
183  IOobject::NO_READ,
184  IOobject::NO_WRITE
185  ),
186  mesh_,
188  )
189 {}
190 
191 
192 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
193 
195 {}
196 
197 
198 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
199 
201 {
202  if (radiationModel::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().name(),
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*e_*physicoChemical::sigma*pow4(T_) - E_
243  );
244 
245  volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
246 
247  // Calculate radiative heat flux on boundaries.
248  forAll(mesh_.boundary(), patchi)
249  {
250  if (!G_.boundaryField()[patchi].coupled())
251  {
252  qrBf[patchi] =
253  -gamma.boundaryField()[patchi]
254  *G_.boundaryField()[patchi].snGrad();
255  }
256  }
257 }
258 
259 
261 {
262  return volScalarField::New
263  (
264  "Rp",
265  4.0*absorptionEmission_->eCont()*physicoChemical::sigma
266  );
267 }
268 
269 
272 {
273  const volScalarField::Internal& G = G_();
274  const volScalarField::Internal E = absorptionEmission_->ECont()()();
275  const volScalarField::Internal a = absorptionEmission_->aCont()()();
276 
277  return a*G - E;
278 }
279 
280 
281 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricBoundaryField class.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Top level model for radiation modelling.
virtual bool read()=0
Read radiationProperties dictionary.
Works well for combustion applications where optical thickness, tau is large, i.e....
Definition: P1.H:60
P1(const volScalarField &T)
Construct from components.
Definition: P1.C:50
virtual ~P1()
Destructor.
Definition: P1.C:194
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
Definition: P1.C:260
virtual tmp< volScalarField::Internal > Ru() const
Source term component (constant)
Definition: P1.C:271
bool read()
Read radiation properties dictionary.
Definition: P1.C:200
void calculate()
Solve radiation equation(s)
Definition: P1.C:213
A class for managing temporary objects.
Definition: tmp.H:55
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
Calculate the matrix for the laplacian of the field.
Calculate the matrix for implicit and explicit sources.
label patchi
const dimensionedScalar a0
Bohr radius: default SI units: [m].
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m^2/K^4].
const dimensionedScalar G
Newtonian constant of gravitation.
Collection of constants.
const dimensionSet time
const dimensionSet heatFlux
const dimensionSet length
tmp< fvMatrix< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvmLaplacian.C:47
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
Namespace for OpenFOAM.
const dimensionSet & dimMass
Definition: dimensions.C:275
const dimensionSet & dimLength
Definition: dimensions.C:276
void pow4(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void inv(pointPatchField< tensor > &, const pointPatchField< tensor > &)
const dimensionSet & dimTime
Definition: dimensions.C:277
void pow3(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.
#define addToRadiationRunTimeSelectionTables(model)
dictionary dict