1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "MarshakRadiationMixedFvPatchScalarField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
32 #include "radiationModel.H"
33 #include "physicoChemicalConstants.H"
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
40 const DimensionedField<scalar, volMesh>& iF
43 mixedFvPatchScalarField(p, iF),
44 radiationCoupledBase(p, "undefined", scalarField::null()),
49 valueFraction() = 0.0;
53 Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
55 const MarshakRadiationFvPatchScalarField& ptf,
57 const DimensionedField<scalar, volMesh>& iF,
58 const fvPatchFieldMapper& mapper
61 mixedFvPatchScalarField(ptf, p, iF, mapper),
65 ptf.emissivityMethod(),
72 Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
75 const DimensionedField<scalar, volMesh>& iF,
76 const dictionary& dict
79 mixedFvPatchScalarField(p, iF),
80 radiationCoupledBase(p, dict),
81 TName_(dict.lookup("T"))
83 if (dict.found("value"))
85 refValue() = scalarField("value", dict, p.size());
95 valueFraction() = 1.0;
97 fvPatchScalarField::operator=(refValue());
101 Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
103 const MarshakRadiationFvPatchScalarField& ptf
106 mixedFvPatchScalarField(ptf),
110 ptf.emissivityMethod(),
117 Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
119 const MarshakRadiationFvPatchScalarField& ptf,
120 const DimensionedField<scalar, volMesh>& iF
123 mixedFvPatchScalarField(ptf, iF),
127 ptf.emissivityMethod(),
134 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
136 void Foam::MarshakRadiationFvPatchScalarField::autoMap
138 const fvPatchFieldMapper& m
141 scalarField::autoMap(m);
145 void Foam::MarshakRadiationFvPatchScalarField::rmap
147 const fvPatchScalarField& ptf,
148 const labelList& addr
151 mixedFvPatchScalarField::rmap(ptf, addr);
155 void Foam::MarshakRadiationFvPatchScalarField::updateCoeffs()
162 // Since we're inside initEvaluate/evaluate there might be processor
163 // comms underway. Change the tag we use.
164 int oldTag = UPstream::msgType();
165 UPstream::msgType() = oldTag+1;
168 const scalarField& Tp =
169 patch().lookupPatchField<volScalarField, scalar>(TName_);
171 // Re-calc reference value
172 refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp);
174 // Diffusion coefficient - created by radiation model's ::updateCoeffs()
175 const scalarField& gamma =
176 patch().lookupPatchField<volScalarField, scalar>("gammaRad");
178 const scalarField temissivity = emissivity();
180 const scalarField Ep(temissivity/(2.0*(2.0 - temissivity)));
182 // Set value fraction
183 valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
186 UPstream::msgType() = oldTag;
188 mixedFvPatchScalarField::updateCoeffs();
192 void Foam::MarshakRadiationFvPatchScalarField::write(Ostream& os) const
194 mixedFvPatchScalarField::write(os);
195 radiationCoupledBase::write(os);
196 os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 MarshakRadiationFvPatchScalarField
212 // ************************************************************************* //