MarshakRadiationFvPatchScalarField.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 
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
30 #include "radiationModel.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
38 (
39  const fvPatch& p,
41 )
42 :
43  mixedFvPatchScalarField(p, iF),
44  TName_("T")
45 {
46  refValue() = 0.0;
47  refGrad() = 0.0;
48  valueFraction() = 0.0;
49 }
50 
51 
54 (
56  const fvPatch& p,
58  const fvPatchFieldMapper& mapper
59 )
60 :
61  mixedFvPatchScalarField(ptf, p, iF, mapper),
62  TName_(ptf.TName_)
63 {}
64 
65 
68 (
69  const fvPatch& p,
71  const dictionary& dict
72 )
73 :
74  mixedFvPatchScalarField(p, iF),
75  TName_(dict.lookupOrDefault<word>("T", "T"))
76 {
77  if (dict.found("value"))
78  {
79  refValue() = scalarField("value", dict, p.size());
80  }
81  else
82  {
83  refValue() = 0.0;
84  }
85 
86  // zero gradient
87  refGrad() = 0.0;
88 
89  valueFraction() = 1.0;
90 
91  fvPatchScalarField::operator=(refValue());
92 }
93 
94 
97 (
99 )
100 :
101  mixedFvPatchScalarField(ptf),
102  TName_(ptf.TName_)
103 {}
104 
105 
108 (
111 )
112 :
113  mixedFvPatchScalarField(ptf, iF),
114  TName_(ptf.TName_)
115 {}
116 
117 
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 
121 (
122  const fvPatchFieldMapper& m
123 )
124 {
125  scalarField::autoMap(m);
126 }
127 
128 
130 (
131  const fvPatchScalarField& ptf,
132  const labelList& addr
133 )
134 {
135  mixedFvPatchScalarField::rmap(ptf, addr);
136 }
137 
138 
140 {
141  if (this->updated())
142  {
143  return;
144  }
145 
146  // Since we're inside initEvaluate/evaluate there might be processor
147  // comms underway. Change the tag we use.
148  int oldTag = UPstream::msgType();
149  UPstream::msgType() = oldTag+1;
150 
151  // Temperature field
152  const scalarField& Tp =
153  patch().lookupPatchField<volScalarField, scalar>(TName_);
154 
155  // Re-calc reference value
156  refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp);
157 
158  // Diffusion coefficient - created by radiation model's ::updateCoeffs()
159  const scalarField& gamma =
160  patch().lookupPatchField<volScalarField, scalar>("gammaRad");
161 
162  const boundaryRadiationProperties& boundaryRadiation =
164 
165  const tmp<scalarField> temissivity
166  (
167  boundaryRadiation.emissivity(patch().index())
168  );
169 
170  const scalarField& emissivity = temissivity();
171 
172  const scalarField Ep(emissivity/(2.0*(scalar(2.0) - emissivity)));
173 
174  // Set value fraction
175  valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
176 
177  // Restore tag
178  UPstream::msgType() = oldTag;
179 
180  mixedFvPatchScalarField::updateCoeffs();
181 }
182 
183 
185 (
186  Ostream& os
187 ) const
188 {
190  writeEntryIfDifferent<word>(os, "T", "T", TName_);
191 }
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 namespace Foam
197 {
198 namespace radiation
199 {
201  (
204  );
205 }
206 }
207 
208 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
volFields.H
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
dimensionedInternalField
rDeltaT dimensionedInternalField()
Foam::radiation::makePatchTypeField
makePatchTypeField(fvPatchScalarField, boundaryRadiationPropertiesFvPatchField)
fvPatchFieldMapper.H
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
Foam::MeshObject< fvMesh, Foam::GeometricMeshObject, boundaryRadiationProperties >::New
static const boundaryRadiationProperties & New(const fvMesh &mesh)
Definition: MeshObject.C:44
Foam::radiation::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
MarshakRadiationFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: MarshakRadiationFvPatchScalarField.C:38
Foam::pow4
dimensionedScalar pow4(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:98
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::radiation::MarshakRadiationFvPatchScalarField
Definition: MarshakRadiationFvPatchScalarField.H:88
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
radiation
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
Foam::radiation::boundaryRadiationProperties
Definition: boundaryRadiationProperties.H:56
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
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::radiation::MarshakRadiationFvPatchScalarField::TName_
word TName_
Name of temperature field.
Definition: MarshakRadiationFvPatchScalarField.H:96
Foam::radiation::MarshakRadiationFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: MarshakRadiationFvPatchScalarField.C:121
Foam::radiation::MarshakRadiationFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: MarshakRadiationFvPatchScalarField.C:185
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::UPstream::msgType
static int & msgType()
Message tag of standard messages.
Definition: UPstream.H:452
Foam::radiation::MarshakRadiationFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: MarshakRadiationFvPatchScalarField.C:130
physicoChemicalConstants.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
scalarField
volScalarField scalarField(fieldObject, mesh)
Foam::constant::physicoChemical::sigma
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::radiation::MarshakRadiationFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: MarshakRadiationFvPatchScalarField.C:139
radiationModel.H
write
Tcoeff write()
MarshakRadiationFvPatchScalarField.H
boundaryRadiationProperties.H
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51