FreeFOAM The Cross-Platform CFD Toolkit
turbulentHeatFluxTemperatureFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
29 #include <finiteVolume/volFields.H>
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace incompressible
36 {
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
40 turbulentHeatFluxTemperatureFvPatchScalarField::
41 turbulentHeatFluxTemperatureFvPatchScalarField
42 (
43  const fvPatch& p,
45 )
46 :
47  fixedGradientFvPatchScalarField(p, iF),
48  q_(p.size(), 0.0),
49  alphaEffName_("undefinedAlphaEff"),
50  CpName_("undefinedCp")
51 {}
52 
53 
54 turbulentHeatFluxTemperatureFvPatchScalarField::
55 turbulentHeatFluxTemperatureFvPatchScalarField
56 (
58  const fvPatch& p,
60  const fvPatchFieldMapper& mapper
61 )
62 :
63  fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
64  q_(ptf.q_, mapper),
65  alphaEffName_(ptf.alphaEffName_),
66  CpName_(ptf.CpName_)
67 {}
68 
69 
70 turbulentHeatFluxTemperatureFvPatchScalarField::
71 turbulentHeatFluxTemperatureFvPatchScalarField
72 (
73  const fvPatch& p,
75  const dictionary& dict
76 )
77 :
78  fixedGradientFvPatchScalarField(p, iF),
79  q_("q", dict, p.size()),
80  alphaEffName_(dict.lookup("alphaEff")),
81  CpName_(dict.lookup("Cp"))
82 {
83  fvPatchField<scalar>::operator=(patchInternalField());
84  gradient() = 0.0;
85 }
86 
87 
88 turbulentHeatFluxTemperatureFvPatchScalarField::
89 turbulentHeatFluxTemperatureFvPatchScalarField
90 (
92 )
93 :
94  fixedGradientFvPatchScalarField(thftpsf),
95  q_(thftpsf.q_),
96  alphaEffName_(thftpsf.alphaEffName_),
97  CpName_(thftpsf.CpName_)
98 {}
99 
100 
101 turbulentHeatFluxTemperatureFvPatchScalarField::
102 turbulentHeatFluxTemperatureFvPatchScalarField
103 (
106 )
107 :
108  fixedGradientFvPatchScalarField(thftpsf, iF),
109  q_(thftpsf.q_),
110  alphaEffName_(thftpsf.alphaEffName_),
111  CpName_(thftpsf.CpName_)
112 {}
113 
114 
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
116 
117 void turbulentHeatFluxTemperatureFvPatchScalarField::autoMap
118 (
119  const fvPatchFieldMapper& m
120 )
121 {
123  q_.autoMap(m);
124 }
125 
126 
127 void turbulentHeatFluxTemperatureFvPatchScalarField::rmap
128 (
129  const fvPatchScalarField& ptf,
130  const labelList& addr
131 )
132 {
133  fixedGradientFvPatchScalarField::rmap(ptf, addr);
134 
136  refCast<const turbulentHeatFluxTemperatureFvPatchScalarField>
137  (
138  ptf
139  );
140 
141  q_.rmap(thftptf.q_, addr);
142 }
143 
144 
145 void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
146 {
147  if (updated())
148  {
149  return;
150  }
151 
152  const scalarField& alphaEffp =
153  patch().lookupPatchField<volScalarField, scalar>(alphaEffName_);
154 
155  const scalarField& Cpp =
156  patch().lookupPatchField<volScalarField, scalar>(CpName_);
157 
158  gradient() = q_/(Cpp*alphaEffp);
159 
160  fixedGradientFvPatchScalarField::updateCoeffs();
161 }
162 
163 
164 void turbulentHeatFluxTemperatureFvPatchScalarField::write(Ostream& os) const
165 {
166  fixedGradientFvPatchScalarField::write(os);
167  q_.writeEntry("q", os);
168  os.writeKeyword("alphaEff") << alphaEffName_ << token::END_STATEMENT << nl;
169  os.writeKeyword("Cp") << CpName_ << token::END_STATEMENT << nl;
170  writeEntry("value", os);
171 }
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
177 (
180 );
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace incompressible
186 } // End namespace Foam
187 
188 
189 // ************************ vim: set sw=4 sts=4 et: ************************ //
190