Avoid race condition with single processor compilation of conjugateHeatFoam
[foam-extend-3.0.git] / applications / solvers / coupled / conjugateHeatTransfer / fvPatchFields / adiabatic / adiabaticFvPatchScalarField.C
blob3bdb032138f82015731957c6b0f634a7249fee5c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
37     const fvPatch& p,
38     const DimensionedField<scalar, volMesh>& iF
41     mixedFvPatchScalarField(p, iF),
42     KName_("undefined-K")
44     refValue() = 0.0;
45     refGrad() = 0.0;
46     valueFraction() = 0.0;
50 Foam::adiabaticFvPatchScalarField::
51 adiabaticFvPatchScalarField
53     const adiabaticFvPatchScalarField& ptf,
54     const fvPatch& p,
55     const DimensionedField<scalar, volMesh>& iF,
56     const fvPatchFieldMapper& mapper
59     mixedFvPatchScalarField(ptf, p, iF, mapper),
60     KName_(ptf.KName_)
64 Foam::adiabaticFvPatchScalarField::
65 adiabaticFvPatchScalarField
67     const fvPatch& p,
68     const DimensionedField<scalar, volMesh>& iF,
69     const dictionary& dict
72     mixedFvPatchScalarField(p, iF),
73     KName_(dict.lookup("K"))
75     refValue() = 0.0;
76     refGrad() = 0.0;
77     valueFraction() = 0.0;
79     if (dict.found("value"))
80     {
81         fvPatchField<scalar>::operator=
82         (
83             scalarField("value", dict, p.size())
84         );
85     }
89 Foam::adiabaticFvPatchScalarField::
90 adiabaticFvPatchScalarField
92     const adiabaticFvPatchScalarField& tppsf
95     mixedFvPatchScalarField(tppsf),
96     KName_(tppsf.KName_)
100 Foam::adiabaticFvPatchScalarField::
101 adiabaticFvPatchScalarField
103     const adiabaticFvPatchScalarField& tppsf,
104     const DimensionedField<scalar, volMesh>& iF
107     mixedFvPatchScalarField(tppsf, iF),
108     KName_(tppsf.KName_)
112 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
114 void Foam::adiabaticFvPatchScalarField::updateCoeffs()
116     if (updated())
117     {
118         return;
119     }
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
140     Ostream& os
141 ) const
143     fvPatchScalarField::write(os);
144     os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
145     writeEntry("value", os);
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 namespace Foam
153     makePatchTypeField
154     (
155         fvPatchScalarField,
156         adiabaticFvPatchScalarField
157     );
160 // ************************************************************************* //