FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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"
28 #include <finiteVolume/fvm.H>
29 #include <finiteVolume/fvc.H>
30 
32 #include <radiation/scatterModel.H>
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  namespace radiation
41  {
43 
45  (
46  radiationModel,
47  P1,
48  dictionary
49  );
50  }
51 }
52 
53 
54 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55 
56 Foam::radiation::P1::P1(const volScalarField& T)
57 :
58  radiationModel(typeName, T),
59  G_
60  (
61  IOobject
62  (
63  "G",
64  mesh_.time().timeName(),
65  mesh_,
66  IOobject::MUST_READ,
67  IOobject::AUTO_WRITE
68  ),
69  mesh_
70  ),
71  Qr_
72  (
73  IOobject
74  (
75  "Qr",
76  mesh_.time().timeName(),
77  mesh_,
78  IOobject::NO_READ,
79  IOobject::AUTO_WRITE
80  ),
81  mesh_,
83  ),
84  a_
85  (
86  IOobject
87  (
88  "a",
89  mesh_.time().timeName(),
90  mesh_,
91  IOobject::NO_READ,
92  IOobject::NO_WRITE
93  ),
94  mesh_,
96  ),
97  e_
98  (
99  IOobject
100  (
101  "e",
102  mesh_.time().timeName(),
103  mesh_,
104  IOobject::NO_READ,
105  IOobject::NO_WRITE
106  ),
107  mesh_,
109  ),
110  E_
111  (
112  IOobject
113  (
114  "E",
115  mesh_.time().timeName(),
116  mesh_,
117  IOobject::NO_READ,
118  IOobject::NO_WRITE
119  ),
120  mesh_,
122  )
123 {}
124 
125 
126 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
127 
129 {}
130 
131 
132 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
133 
135 {
136  if (radiationModel::read())
137  {
138  // nothing to read
139 
140  return true;
141  }
142  else
143  {
144  return false;
145  }
146 }
147 
148 
150 {
151  a_ = absorptionEmission_->a();
152  e_ = absorptionEmission_->e();
153  E_ = absorptionEmission_->E();
154  const volScalarField sigmaEff = scatter_->sigmaEff();
155 
156  // Construct diffusion
157  const volScalarField gamma
158  (
159  IOobject
160  (
161  "gammaRad",
162  G_.mesh().time().timeName(),
163  G_.mesh(),
166  ),
167  1.0/(3.0*a_ + sigmaEff)
168  );
169 
170  // Solve G transport equation
171  solve
172  (
173  fvm::laplacian(gamma, G_)
174  - fvm::Sp(a_, G_)
175  ==
176  - 4.0*(e_*radiation::sigmaSB*pow4(T_) + E_)
177  );
178 
179  // Calculate radiative heat flux on boundaries.
180  forAll(mesh_.boundaryMesh(), patchI)
181  {
182  Qr_.boundaryField()[patchI] =
183  -gamma.boundaryField()[patchI]*G_.boundaryField()[patchI].snGrad();
184  }
185 }
186 
187 
189 {
190  return tmp<volScalarField>
191  (
192  new volScalarField
193  (
194  IOobject
195  (
196  "Rp",
197  mesh_.time().timeName(),
198  mesh_,
201  false
202  ),
203  4.0*absorptionEmission_->eCont()*radiation::sigmaSB
204  )
205  );
206 }
207 
208 
211 {
213  G_.dimensionedInternalField();
215  absorptionEmission_->ECont()().dimensionedInternalField();
217  absorptionEmission_->aCont()().dimensionedInternalField();
218 
219  return a*G - 4.0*E;
220 }
221 
222 
223 // ************************ vim: set sw=4 sts=4 et: ************************ //