1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
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 "turbulentHeatFluxTemperatureFvPatchScalarField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 // declare specialization within 'Foam' namespace
41 turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceType,
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 namespace compressible
61 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
65 turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceType,
67 > turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceTypeNames_;
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 turbulentHeatFluxTemperatureFvPatchScalarField::
73 turbulentHeatFluxTemperatureFvPatchScalarField
76 const DimensionedField<scalar, volMesh>& iF
79 fixedGradientFvPatchScalarField(p, iF),
80 temperatureCoupledBase(patch(), "undefined", "undefined-K"),
86 turbulentHeatFluxTemperatureFvPatchScalarField::
87 turbulentHeatFluxTemperatureFvPatchScalarField
89 const turbulentHeatFluxTemperatureFvPatchScalarField& ptf,
91 const DimensionedField<scalar, volMesh>& iF,
92 const fvPatchFieldMapper& mapper
95 fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
96 temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()),
97 heatSource_(ptf.heatSource_),
102 turbulentHeatFluxTemperatureFvPatchScalarField::
103 turbulentHeatFluxTemperatureFvPatchScalarField
106 const DimensionedField<scalar, volMesh>& iF,
107 const dictionary& dict
110 fixedGradientFvPatchScalarField(p, iF),
111 temperatureCoupledBase(patch(), dict),
112 heatSource_(heatSourceTypeNames_.read(dict.lookup("heatSource"))),
113 q_("q", dict, p.size())
115 fvPatchField<scalar>::operator=(patchInternalField());
120 turbulentHeatFluxTemperatureFvPatchScalarField::
121 turbulentHeatFluxTemperatureFvPatchScalarField
123 const turbulentHeatFluxTemperatureFvPatchScalarField& thftpsf
126 fixedGradientFvPatchScalarField(thftpsf),
127 temperatureCoupledBase(patch(), thftpsf.KMethod(), thftpsf.KName()),
128 heatSource_(thftpsf.heatSource_),
133 turbulentHeatFluxTemperatureFvPatchScalarField::
134 turbulentHeatFluxTemperatureFvPatchScalarField
136 const turbulentHeatFluxTemperatureFvPatchScalarField& thftpsf,
137 const DimensionedField<scalar, volMesh>& iF
140 fixedGradientFvPatchScalarField(thftpsf, iF),
141 temperatureCoupledBase(patch(), thftpsf.KMethod(), thftpsf.KName()),
142 heatSource_(thftpsf.heatSource_),
147 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
149 void turbulentHeatFluxTemperatureFvPatchScalarField::autoMap
151 const fvPatchFieldMapper& m
154 fixedGradientFvPatchScalarField::autoMap(m);
159 void turbulentHeatFluxTemperatureFvPatchScalarField::rmap
161 const fvPatchScalarField& ptf,
162 const labelList& addr
165 fixedGradientFvPatchScalarField::rmap(ptf, addr);
167 const turbulentHeatFluxTemperatureFvPatchScalarField& thftptf =
168 refCast<const turbulentHeatFluxTemperatureFvPatchScalarField>
173 q_.rmap(thftptf.q_, addr);
177 void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
184 const scalarField& Tp = *this;
190 const scalar Ap = gSum(patch().magSf());
191 gradient() = q_/(Ap*K(Tp));
196 gradient() = q_/K(Tp);
203 "turbulentHeatFluxTemperatureFvPatchScalarField"
206 "const DimensionedField<scalar, volMesh>&, "
209 ) << "Unknown heat source type. Valid types are: "
210 << heatSourceTypeNames_ << nl << exit(FatalError);
214 fixedGradientFvPatchScalarField::updateCoeffs();
218 void turbulentHeatFluxTemperatureFvPatchScalarField::write
223 fixedGradientFvPatchScalarField::write(os);
224 os.writeKeyword("heatSource") << heatSourceTypeNames_[heatSource_]
225 << token::END_STATEMENT << nl;
226 temperatureCoupledBase::write(os);
227 q_.writeEntry("q", os);
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 turbulentHeatFluxTemperatureFvPatchScalarField
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 } // End namespace compressible
243 } // End namespace Foam
246 // ************************************************************************* //