FreeFOAM The Cross-Platform CFD Toolkit
MarshakRadiationFixedTMixedFvPatchScalarField.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 
39 (
40  const fvPatch& p,
42 )
43 :
44  mixedFvPatchScalarField(p, iF),
45  Trad_(p.size()),
46  emissivity_(0.0)
47 {
48  refValue() = 0.0;
49  refGrad() = 0.0;
50  valueFraction() = 0.0;
51 }
52 
53 
56 (
58  const fvPatch& p,
60  const fvPatchFieldMapper& mapper
61 )
62 :
63  mixedFvPatchScalarField(ptf, p, iF, mapper),
64  Trad_(ptf.Trad_, mapper),
65  emissivity_(ptf.emissivity_)
66 {}
67 
68 
71 (
72  const fvPatch& p,
74  const dictionary& dict
75 )
76 :
77  mixedFvPatchScalarField(p, iF),
78  Trad_("Trad", dict, p.size()),
79  emissivity_(readScalar(dict.lookup("emissivity")))
80 {
81  refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_);
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 
100 (
102 )
103 :
104  mixedFvPatchScalarField(ptf),
105  Trad_(ptf.Trad_),
106  emissivity_(ptf.emissivity_)
107 {}
108 
109 
112 (
115 )
116 :
117  mixedFvPatchScalarField(ptf, iF),
118  Trad_(ptf.Trad_),
119  emissivity_(ptf.emissivity_)
120 {}
121 
122 
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 
126 (
127  const fvPatchFieldMapper& m
128 )
129 {
130  scalarField::autoMap(m);
131  Trad_.autoMap(m);
132 }
133 
134 
136 (
137  const fvPatchScalarField& ptf,
138  const labelList& addr
139 )
140 {
141  mixedFvPatchScalarField::rmap(ptf, addr);
142 
144  refCast<const MarshakRadiationFixedTMixedFvPatchScalarField>(ptf);
145 
146  Trad_.rmap(mrptf.Trad_, addr);
147 }
148 
149 
151 {
152  if (this->updated())
153  {
154  return;
155  }
156 
157  // Re-calc reference value
158  refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_);
159 
160  // Diffusion coefficient - created by radiation model's ::updateCoeffs()
161  const scalarField& gamma =
162  patch().lookupPatchField<volScalarField, scalar>("gammaRad");
163 
164  const scalar Ep = emissivity_/(2.0*(2.0 - emissivity_));
165 
166  // Set value fraction
167  valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
168 
170 }
171 
172 
174 {
176  Trad_.writeEntry("Trad", os);
177  os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
178  writeEntry("value", os);
179 }
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 namespace Foam
185 {
187  (
190  );
191 }
192 
193 
194 // ************************ vim: set sw=4 sts=4 et: ************************ //