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 "wallHeatTransferFvPatchScalarField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
30 #include "basicThermo.H"
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
37 const DimensionedField<scalar, volMesh>& iF
40 mixedFvPatchScalarField(p, iF),
42 alphaWall_(p.size(), 0.0)
46 valueFraction() = 0.0;
50 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
52 const wallHeatTransferFvPatchScalarField& ptf,
54 const DimensionedField<scalar, volMesh>& iF,
55 const fvPatchFieldMapper& mapper
58 mixedFvPatchScalarField(ptf, p, iF, mapper),
59 Tinf_(ptf.Tinf_, mapper),
60 alphaWall_(ptf.alphaWall_, mapper)
64 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
67 const DimensionedField<scalar, volMesh>& iF,
68 const dictionary& dict
71 mixedFvPatchScalarField(p, iF),
72 Tinf_("Tinf", dict, p.size()),
73 alphaWall_("alphaWall", dict, p.size())
77 valueFraction() = 0.0;
79 if (dict.found("value"))
81 fvPatchField<scalar>::operator=
83 scalarField("value", dict, p.size())
93 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
95 const wallHeatTransferFvPatchScalarField& tppsf
98 mixedFvPatchScalarField(tppsf),
100 alphaWall_(tppsf.alphaWall_)
104 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
106 const wallHeatTransferFvPatchScalarField& tppsf,
107 const DimensionedField<scalar, volMesh>& iF
110 mixedFvPatchScalarField(tppsf, iF),
112 alphaWall_(tppsf.alphaWall_)
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 void Foam::wallHeatTransferFvPatchScalarField::autoMap
120 const fvPatchFieldMapper& m
123 scalarField::autoMap(m);
125 alphaWall_.autoMap(m);
129 void Foam::wallHeatTransferFvPatchScalarField::rmap
131 const fvPatchScalarField& ptf,
132 const labelList& addr
135 mixedFvPatchScalarField::rmap(ptf, addr);
137 const wallHeatTransferFvPatchScalarField& tiptf =
138 refCast<const wallHeatTransferFvPatchScalarField>(ptf);
140 Tinf_.rmap(tiptf.Tinf_, addr);
141 alphaWall_.rmap(tiptf.alphaWall_, addr);
145 void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs()
152 const basicThermo& thermo = db().lookupObject<basicThermo>
154 "thermophysicalProperties"
157 const label patchi = patch().index();
159 const scalarField& Tw = thermo.T().boundaryField()[patchi];
160 const scalarField Cpw(thermo.Cp(Tw, patchi));
166 + Cpw*thermo.alpha().boundaryField()[patchi]
167 *patch().deltaCoeffs()/alphaWall_
170 mixedFvPatchScalarField::updateCoeffs();
174 void Foam::wallHeatTransferFvPatchScalarField::write(Ostream& os) const
176 fvPatchScalarField::write(os);
177 Tinf_.writeEntry("Tinf", os);
178 alphaWall_.writeEntry("alphaWall", os);
179 writeEntry("value", os);
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 wallHeatTransferFvPatchScalarField
194 // ************************************************************************* //