1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | 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 "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 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 makePatchTypeField(fvPatchScalarField, wallHeatTransferFvPatchScalarField);
190 // ************************************************************************* //