FreeFOAM The Cross-Platform CFD Toolkit
basicThermo.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 
26 #include "basicThermo.H"
27 #include <finiteVolume/fvMesh.H>
28 #include <OpenFOAM/HashTable.H>
36 
37 /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
38 
39 namespace Foam
40 {
41  defineTypeNameAndDebug(basicThermo, 0);
42 }
43 
44 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
45 
47 {
48  const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
49 
50  wordList hbt = tbf.types();
51 
52  forAll(tbf, patchi)
53  {
54  if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
55  {
56  hbt[patchi] = fixedEnthalpyFvPatchScalarField::typeName;
57  }
58  else if
59  (
60  isA<zeroGradientFvPatchScalarField>(tbf[patchi])
61  || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
62  )
63  {
64  hbt[patchi] = gradientEnthalpyFvPatchScalarField::typeName;
65  }
66  else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
67  {
68  hbt[patchi] = mixedEnthalpyFvPatchScalarField::typeName;
69  }
70  }
71 
72  return hbt;
73 }
74 
75 
77 {
78  volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
79 
80  forAll(hbf, patchi)
81  {
82  if (isA<gradientEnthalpyFvPatchScalarField>(hbf[patchi]))
83  {
84  refCast<gradientEnthalpyFvPatchScalarField>(hbf[patchi]).gradient()
85  = hbf[patchi].fvPatchField::snGrad();
86  }
87  else if (isA<mixedEnthalpyFvPatchScalarField>(hbf[patchi]))
88  {
89  refCast<mixedEnthalpyFvPatchScalarField>(hbf[patchi]).refGrad()
90  = hbf[patchi].fvPatchField::snGrad();
91  }
92  }
93 }
94 
95 
97 {
98  const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
99 
100  wordList ebt = tbf.types();
101 
102  forAll(tbf, patchi)
103  {
104  if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
105  {
106  ebt[patchi] = fixedInternalEnergyFvPatchScalarField::typeName;
107  }
108  else if
109  (
110  isA<zeroGradientFvPatchScalarField>(tbf[patchi])
111  || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
112  )
113  {
114  ebt[patchi] = gradientInternalEnergyFvPatchScalarField::typeName;
115  }
116  else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
117  {
118  ebt[patchi] = mixedInternalEnergyFvPatchScalarField::typeName;
119  }
120  }
121 
122  return ebt;
123 }
124 
125 
127 {
128  volScalarField::GeometricBoundaryField& ebf = e.boundaryField();
129 
130  forAll(ebf, patchi)
131  {
132  if (isA<gradientInternalEnergyFvPatchScalarField>(ebf[patchi]))
133  {
134  refCast<gradientInternalEnergyFvPatchScalarField>(ebf[patchi])
135  .gradient() = ebf[patchi].fvPatchField::snGrad();
136  }
137  else if (isA<mixedInternalEnergyFvPatchScalarField>(ebf[patchi]))
138  {
139  refCast<mixedInternalEnergyFvPatchScalarField>(ebf[patchi])
140  .refGrad() = ebf[patchi].fvPatchField::snGrad();
141  }
142  }
143 }
144 
145 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
146 
148 :
150  (
151  IOobject
152  (
153  "thermophysicalProperties",
154  mesh.time().constant(),
155  mesh,
156  IOobject::MUST_READ,
157  IOobject::NO_WRITE
158  )
159  ),
160 
161  p_
162  (
163  IOobject
164  (
165  "p",
166  mesh.time().timeName(),
167  mesh,
168  IOobject::MUST_READ,
169  IOobject::AUTO_WRITE
170  ),
171  mesh
172  ),
173 
174  psi_
175  (
176  IOobject
177  (
178  "psi",
179  mesh.time().timeName(),
180  mesh,
181  IOobject::NO_READ,
182  IOobject::NO_WRITE
183  ),
184  mesh,
185  dimensionSet(0, -2, 2, 0, 0)
186  ),
187 
188  T_
189  (
190  IOobject
191  (
192  "T",
193  mesh.time().timeName(),
194  mesh,
195  IOobject::MUST_READ,
196  IOobject::AUTO_WRITE
197  ),
198  mesh
199  ),
200 
201  mu_
202  (
203  IOobject
204  (
205  "mu",
206  mesh.time().timeName(),
207  mesh,
208  IOobject::NO_READ,
209  IOobject::NO_WRITE
210  ),
211  mesh,
212  dimensionSet(1, -1, -1, 0, 0)
213  ),
214 
215  alpha_
216  (
217  IOobject
218  (
219  "alpha",
220  mesh.time().timeName(),
221  mesh,
222  IOobject::NO_READ,
223  IOobject::NO_WRITE
224  ),
225  mesh,
226  dimensionSet(1, -1, -1, 0, 0)
227  )
228 {}
229 
230 
231 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
232 
234 {}
235 
236 
237 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
238 
240 {
241  return p_;
242 }
243 
244 
246 {
247  return p_;
248 }
249 
250 
252 {
253  return psi_;
254 }
255 
256 
258 {
259  notImplemented("basicThermo::h()");
260  return const_cast<volScalarField&>(volScalarField::null());
261 }
262 
263 
265 {
266  notImplemented("basicThermo::h() const");
267  return volScalarField::null();
268 }
269 
270 
272 (
273  const scalarField& T,
274  const labelList& cells
275 ) const
276 {
278  (
279  "basicThermo::h"
280  "(const scalarField& T, const labelList& cells) const"
281  );
282  return tmp<scalarField>(NULL);
283 }
284 
285 
287 (
288  const scalarField& T,
289  const label patchi
290 ) const
291 {
293  (
294  "basicThermo::h"
295  "(const scalarField& T, const label patchi) const"
296  );
297  return tmp<scalarField>(NULL);
298 }
299 
300 
302 {
303  notImplemented("basicThermo::hs()");
304  return const_cast<volScalarField&>(volScalarField::null());
305 }
306 
307 
309 {
310  notImplemented("basicThermo::hs() const");
311  return volScalarField::null();
312 }
313 
314 
316 (
317  const scalarField& T,
318  const labelList& cells
319 ) const
320 {
322  (
323  "basicThermo::hs"
324  "(const scalarField& T, const labelList& cells) const"
325  );
326  return tmp<scalarField>(NULL);
327 }
328 
329 
331 (
332  const scalarField& T,
333  const label patchi
334 ) const
335 {
337  (
338  "basicThermo::hs"
339  "(const scalarField& T, const label patchi) const"
340  );
341  return tmp<scalarField>(NULL);
342 }
343 
344 
346 {
347  notImplemented("basicThermo::hc()");
348  return volScalarField::null();
349 }
350 
351 
353 {
354  notImplemented("basicThermo::e()");
355  return const_cast<volScalarField&>(volScalarField::null());
356 }
357 
358 
360 {
361  notImplemented("basicThermo::e()");
362  return volScalarField::null();
363 }
364 
365 
367 (
368  const scalarField& T,
369  const labelList& cells
370 ) const
371 {
373  (
374  "basicThermo::e"
375  "(const scalarField& T, const labelList& cells) const"
376  );
377  return tmp<scalarField>(NULL);
378 }
379 
380 
382 (
383  const scalarField& T,
384  const label patchi
385 ) const
386 {
388  (
389  "basicThermo::e"
390  "(const scalarField& T, const label patchi) const"
391  );
392  return tmp<scalarField>(NULL);
393 }
394 
395 
397 {
398  return T_;
399 }
400 
401 
403 (
404  const scalarField& T,
405  const label patchi
406 ) const
407 {
409  (
410  "basicThermo::Cp"
411  "(const scalarField& T, const label patchi) const"
412  );
413  return tmp<scalarField>(NULL);
414 }
415 
416 
418 {
419  notImplemented("basicThermo::Cp() const");
420  return volScalarField::null();
421 }
422 
423 
425 (
426  const scalarField& T,
427  const label patchi
428 ) const
429 {
431  (
432  "basicThermo::Cv"
433  "(const scalarField& T, const label patchi) const"
434  );
435  return tmp<scalarField>(NULL);
436 }
437 
438 
440 {
441  notImplemented("basicThermo::Cv() const");
442  return volScalarField::null();
443 }
444 
445 
447 {
448  return mu_;
449 }
450 
451 
453 {
454  return alpha_;
455 }
456 
457 
459 {
460  return regIOobject::read();
461 }
462 
463 
464 // ************************ vim: set sw=4 sts=4 et: ************************ //