1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "adiabaticFvPatchScalarField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
30 #include "radiationConstants.H"
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 Foam::adiabaticFvPatchScalarField::
35 adiabaticFvPatchScalarField
38 const DimensionedField<scalar, volMesh>& iF
41 mixedFvPatchScalarField(p, iF),
46 valueFraction() = 0.0;
50 Foam::adiabaticFvPatchScalarField::
51 adiabaticFvPatchScalarField
53 const adiabaticFvPatchScalarField& ptf,
55 const DimensionedField<scalar, volMesh>& iF,
56 const fvPatchFieldMapper& mapper
59 mixedFvPatchScalarField(ptf, p, iF, mapper),
64 Foam::adiabaticFvPatchScalarField::
65 adiabaticFvPatchScalarField
68 const DimensionedField<scalar, volMesh>& iF,
69 const dictionary& dict
72 mixedFvPatchScalarField(p, iF),
73 KName_(dict.lookup("K"))
77 valueFraction() = 0.0;
79 if (dict.found("value"))
81 fvPatchField<scalar>::operator=
83 scalarField("value", dict, p.size())
89 Foam::adiabaticFvPatchScalarField::
90 adiabaticFvPatchScalarField
92 const adiabaticFvPatchScalarField& tppsf
95 mixedFvPatchScalarField(tppsf),
100 Foam::adiabaticFvPatchScalarField::
101 adiabaticFvPatchScalarField
103 const adiabaticFvPatchScalarField& tppsf,
104 const DimensionedField<scalar, volMesh>& iF
107 mixedFvPatchScalarField(tppsf, iF),
112 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 void Foam::adiabaticFvPatchScalarField::updateCoeffs()
121 const scalarField& Tp = *this;
123 const scalarField& Kw =
124 patch().lookupPatchField<volScalarField, scalar>(KName_);
126 const scalarField& Qr =
127 patch().lookupPatchField<volScalarField, scalar>("Qr");
129 scalarField fourQro = 4.0*radiation::sigmaSB.value()*pow4(Tp);
131 refGrad() = (Qr + fourQro)/Kw;
132 valueFraction() = fourQro/(fourQro + Kw*patch().deltaCoeffs()*Tp);
134 mixedFvPatchScalarField::updateCoeffs();
138 void Foam::adiabaticFvPatchScalarField::write
143 fvPatchScalarField::write(os);
144 os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
145 writeEntry("value", os);
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 adiabaticFvPatchScalarField
160 // ************************************************************************* //