FreeFOAM The Cross-Platform CFD Toolkit
MarshakRadiationMixedFvPatchScalarField.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 
29 #include <finiteVolume/volFields.H>
30 
31 #include <finiteVolume/fvc.H>
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
38 (
39  const fvPatch& p,
41 )
42 :
43  mixedFvPatchScalarField(p, iF),
44  TName_("undefined"),
45  emissivity_(0.0)
46 {
47  refValue() = 0.0;
48  refGrad() = 0.0;
49  valueFraction() = 0.0;
50 }
51 
52 
54 (
56  const fvPatch& p,
58  const fvPatchFieldMapper& mapper
59 )
60 :
61  mixedFvPatchScalarField(ptf, p, iF, mapper),
62  TName_(ptf.TName_),
63  emissivity_(ptf.emissivity_)
64 {}
65 
66 
68 (
69  const fvPatch& p,
71  const dictionary& dict
72 )
73 :
74  mixedFvPatchScalarField(p, iF),
75  TName_(dict.lookup("T")),
76  emissivity_(readScalar(dict.lookup("emissivity")))
77 {
78  const scalarField& Tp =
79  patch().lookupPatchField<volScalarField, scalar>(TName_);
80 
81  refValue() = 4.0*radiation::sigmaSB.value()*pow4(Tp);
82  refGrad() = 0.0;
83 
84  if (dict.found("value"))
85  {
86  fvPatchScalarField::operator=
87  (
88  scalarField("value", dict, p.size())
89  );
90  }
91  else
92  {
93  fvPatchScalarField::operator=(refValue());
94  }
95 }
96 
97 
99 (
101 )
102 :
103  mixedFvPatchScalarField(ptf),
104  TName_(ptf.TName_),
105  emissivity_(ptf.emissivity_)
106 {}
107 
108 
110 (
113 )
114 :
115  mixedFvPatchScalarField(ptf, iF),
116  TName_(ptf.TName_),
117  emissivity_(ptf.emissivity_)
118 {}
119 
120 
121 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
122 
124 (
125  const fvPatchFieldMapper& m
126 )
127 {
128  scalarField::autoMap(m);
129 }
130 
131 
133 (
134  const fvPatchScalarField& ptf,
135  const labelList& addr
136 )
137 {
138  mixedFvPatchScalarField::rmap(ptf, addr);
139 }
140 
141 
143 {
144  if (this->updated())
145  {
146  return;
147  }
148 
149  // Temperature field
150  const scalarField& Tp =
151  patch().lookupPatchField<volScalarField, scalar>(TName_);
152 
153  // Re-calc reference value
154  refValue() = 4.0*radiation::sigmaSB.value()*pow4(Tp);
155 
156  // Diffusion coefficient - created by radiation model's ::updateCoeffs()
157  const scalarField& gamma =
158  patch().lookupPatchField<volScalarField, scalar>("gammaRad");
159 
160  const scalar Ep = emissivity_/(2.0*(2.0 - emissivity_));
161 
162  // Set value fraction
163  valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
164 
166 }
167 
168 
170 {
172  os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
173  os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
174  writeEntry("value", os);
175 }
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 namespace Foam
181 {
183  (
186  );
187 }
188 
189 
190 // ************************ vim: set sw=4 sts=4 et: ************************ //