1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "MarshakRadiationFixedTMixedFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "volFields.H"
33 #include "radiationModel.H"
34 #include "radiationConstants.H"
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
39 MarshakRadiationFixedTMixedFvPatchScalarField
42 const DimensionedField<scalar, volMesh>& iF
45 mixedFvPatchScalarField(p, iF),
51 valueFraction() = 0.0;
55 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
56 MarshakRadiationFixedTMixedFvPatchScalarField
58 const MarshakRadiationFixedTMixedFvPatchScalarField& ptf,
60 const DimensionedField<scalar, volMesh>& iF,
61 const fvPatchFieldMapper& mapper
64 mixedFvPatchScalarField(ptf, p, iF, mapper),
65 Trad_(ptf.Trad_, mapper),
66 emissivity_(ptf.emissivity_)
70 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
71 MarshakRadiationFixedTMixedFvPatchScalarField
74 const DimensionedField<scalar, volMesh>& iF,
75 const dictionary& dict
78 mixedFvPatchScalarField(p, iF),
79 Trad_("Trad", dict, p.size()),
80 emissivity_(readScalar(dict.lookup("emissivity")))
82 refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_);
85 if (dict.found("value"))
87 fvPatchScalarField::operator=
89 scalarField("value", dict, p.size())
94 fvPatchScalarField::operator=(refValue());
99 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
100 MarshakRadiationFixedTMixedFvPatchScalarField
102 const MarshakRadiationFixedTMixedFvPatchScalarField& ptf
105 mixedFvPatchScalarField(ptf),
107 emissivity_(ptf.emissivity_)
111 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
112 MarshakRadiationFixedTMixedFvPatchScalarField
114 const MarshakRadiationFixedTMixedFvPatchScalarField& ptf,
115 const DimensionedField<scalar, volMesh>& iF
118 mixedFvPatchScalarField(ptf, iF),
120 emissivity_(ptf.emissivity_)
124 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
126 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::autoMap
128 const fvPatchFieldMapper& m
131 scalarField::autoMap(m);
136 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::rmap
138 const fvPatchScalarField& ptf,
139 const labelList& addr
142 mixedFvPatchScalarField::rmap(ptf, addr);
144 const MarshakRadiationFixedTMixedFvPatchScalarField& mrptf =
145 refCast<const MarshakRadiationFixedTMixedFvPatchScalarField>(ptf);
147 Trad_.rmap(mrptf.Trad_, addr);
151 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::updateCoeffs()
158 // Re-calc reference value
159 refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_);
161 // Diffusion coefficient - created by radiation model's ::updateCoeffs()
162 const scalarField& gamma =
163 patch().lookupPatchField<volScalarField, scalar>("gammaRad");
165 const scalar Ep = emissivity_/(2.0*(2.0 - emissivity_));
167 // Set value fraction
168 valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
170 mixedFvPatchScalarField::updateCoeffs();
174 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::write(Ostream& os) const
176 fvPatchScalarField::write(os);
177 Trad_.writeEntry("Trad", os);
178 os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
179 writeEntry("value", os);
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 MarshakRadiationFixedTMixedFvPatchScalarField
195 // ************************************************************************* //