initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / radiation / derivedFvPatchFields / MarshakRadiationFixedT / MarshakRadiationFixedTMixedFvPatchScalarField.C
blobd8e8957270d558e60ca0a214b4625d5fb4779d74
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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"
32 #include "fvc.H"
33 #include "radiationModel.H"
34 #include "radiationConstants.H"
36 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
38 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
39 MarshakRadiationFixedTMixedFvPatchScalarField
41     const fvPatch& p,
42     const DimensionedField<scalar, volMesh>& iF
45     mixedFvPatchScalarField(p, iF),
46     Trad_(p.size()),
47     emissivity_(0.0)
49     refValue() = 0.0;
50     refGrad() = 0.0;
51     valueFraction() = 0.0;
55 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
56 MarshakRadiationFixedTMixedFvPatchScalarField
58     const MarshakRadiationFixedTMixedFvPatchScalarField& ptf,
59     const fvPatch& p,
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
73     const fvPatch& p,
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_);
83     refGrad() = 0.0;
85     if (dict.found("value"))
86     {
87         fvPatchScalarField::operator=
88         (
89             scalarField("value", dict, p.size())
90         );
91     }
92     else
93     {
94         fvPatchScalarField::operator=(refValue());
95     }
99 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
100 MarshakRadiationFixedTMixedFvPatchScalarField
102     const MarshakRadiationFixedTMixedFvPatchScalarField& ptf
105     mixedFvPatchScalarField(ptf),
106     Trad_(ptf.Trad_),
107     emissivity_(ptf.emissivity_)
111 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
112 MarshakRadiationFixedTMixedFvPatchScalarField
114     const MarshakRadiationFixedTMixedFvPatchScalarField& ptf,
115     const DimensionedField<scalar, volMesh>& iF
118     mixedFvPatchScalarField(ptf, iF),
119     Trad_(ptf.Trad_),
120     emissivity_(ptf.emissivity_)
124 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
126 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::autoMap
128     const fvPatchFieldMapper& m
131     scalarField::autoMap(m);
132     Trad_.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()
153     if (this->updated())
154     {
155         return;
156     }
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 namespace Foam
187     makePatchTypeField
188     (
189         fvPatchScalarField,
190         MarshakRadiationFixedTMixedFvPatchScalarField
191     );
195 // ************************************************************************* //