1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "turbulentHeatFluxTemperatureFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "volFields.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace incompressible
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 turbulentHeatFluxTemperatureFvPatchScalarField::
42 turbulentHeatFluxTemperatureFvPatchScalarField
45 const DimensionedField<scalar, volMesh>& iF
48 fixedGradientFvPatchScalarField(p, iF),
50 alphaEffName_("undefinedAlphaEff"),
51 CpName_("undefinedCp")
55 turbulentHeatFluxTemperatureFvPatchScalarField::
56 turbulentHeatFluxTemperatureFvPatchScalarField
58 const turbulentHeatFluxTemperatureFvPatchScalarField& ptf,
60 const DimensionedField<scalar, volMesh>& iF,
61 const fvPatchFieldMapper& mapper
64 fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
66 alphaEffName_(ptf.alphaEffName_),
71 turbulentHeatFluxTemperatureFvPatchScalarField::
72 turbulentHeatFluxTemperatureFvPatchScalarField
75 const DimensionedField<scalar, volMesh>& iF,
76 const dictionary& dict
79 fixedGradientFvPatchScalarField(p, iF),
80 q_("q", dict, p.size()),
81 alphaEffName_(dict.lookup("alphaEff")),
82 CpName_(dict.lookup("Cp"))
84 fvPatchField<scalar>::operator=(patchInternalField());
89 turbulentHeatFluxTemperatureFvPatchScalarField::
90 turbulentHeatFluxTemperatureFvPatchScalarField
92 const turbulentHeatFluxTemperatureFvPatchScalarField& thftpsf
95 fixedGradientFvPatchScalarField(thftpsf),
97 alphaEffName_(thftpsf.alphaEffName_),
98 CpName_(thftpsf.CpName_)
102 turbulentHeatFluxTemperatureFvPatchScalarField::
103 turbulentHeatFluxTemperatureFvPatchScalarField
105 const turbulentHeatFluxTemperatureFvPatchScalarField& thftpsf,
106 const DimensionedField<scalar, volMesh>& iF
109 fixedGradientFvPatchScalarField(thftpsf, iF),
111 alphaEffName_(thftpsf.alphaEffName_),
112 CpName_(thftpsf.CpName_)
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 void turbulentHeatFluxTemperatureFvPatchScalarField::autoMap
120 const fvPatchFieldMapper& m
123 scalarField::autoMap(m);
128 void turbulentHeatFluxTemperatureFvPatchScalarField::rmap
130 const fvPatchScalarField& ptf,
131 const labelList& addr
134 fixedGradientFvPatchScalarField::rmap(ptf, addr);
136 const turbulentHeatFluxTemperatureFvPatchScalarField& thftptf =
137 refCast<const turbulentHeatFluxTemperatureFvPatchScalarField>
142 q_.rmap(thftptf.q_, addr);
146 void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
153 const scalarField& alphaEffp =
154 patch().lookupPatchField<volScalarField, scalar>(alphaEffName_);
156 const scalarField& Cpp =
157 patch().lookupPatchField<volScalarField, scalar>(CpName_);
159 gradient() = q_/(Cpp*alphaEffp);
161 fixedGradientFvPatchScalarField::updateCoeffs();
165 void turbulentHeatFluxTemperatureFvPatchScalarField::write(Ostream& os) const
167 fixedGradientFvPatchScalarField::write(os);
168 q_.writeEntry("q", os);
169 os.writeKeyword("alphaEff") << alphaEffName_ << token::END_STATEMENT << nl;
170 os.writeKeyword("Cp") << CpName_ << token::END_STATEMENT << nl;
171 writeEntry("value", os);
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 turbulentHeatFluxTemperatureFvPatchScalarField
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 } // End namespace incompressible
187 } // End namespace Foam
190 // ************************************************************************* //