1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 "basicThermo.H"
28 #include "HashTable.H"
29 #include "zeroGradientFvPatchFields.H"
30 #include "fixedEnthalpyFvPatchScalarField.H"
31 #include "gradientEnthalpyFvPatchScalarField.H"
32 #include "mixedEnthalpyFvPatchScalarField.H"
33 #include "fixedInternalEnergyFvPatchScalarField.H"
34 #include "gradientInternalEnergyFvPatchScalarField.H"
35 #include "mixedInternalEnergyFvPatchScalarField.H"
37 /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
41 defineTypeNameAndDebug(basicThermo, 0);
44 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
46 Foam::wordList Foam::basicThermo::hBoundaryTypes()
48 const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
50 wordList hbt = tbf.types();
54 if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
56 hbt[patchi] = fixedEnthalpyFvPatchScalarField::typeName;
60 isA<zeroGradientFvPatchScalarField>(tbf[patchi])
61 || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
64 hbt[patchi] = gradientEnthalpyFvPatchScalarField::typeName;
66 else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
68 hbt[patchi] = mixedEnthalpyFvPatchScalarField::typeName;
76 void Foam::basicThermo::hBoundaryCorrection(volScalarField& h)
78 volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
82 if (isA<gradientEnthalpyFvPatchScalarField>(hbf[patchi]))
84 refCast<gradientEnthalpyFvPatchScalarField>(hbf[patchi]).gradient()
85 = hbf[patchi].fvPatchField::snGrad();
87 else if (isA<mixedEnthalpyFvPatchScalarField>(hbf[patchi]))
89 refCast<mixedEnthalpyFvPatchScalarField>(hbf[patchi]).refGrad()
90 = hbf[patchi].fvPatchField::snGrad();
96 Foam::wordList Foam::basicThermo::eBoundaryTypes()
98 const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
100 wordList ebt = tbf.types();
104 if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
106 ebt[patchi] = fixedInternalEnergyFvPatchScalarField::typeName;
110 isA<zeroGradientFvPatchScalarField>(tbf[patchi])
111 || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
114 ebt[patchi] = gradientInternalEnergyFvPatchScalarField::typeName;
116 else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
118 ebt[patchi] = mixedInternalEnergyFvPatchScalarField::typeName;
126 void Foam::basicThermo::eBoundaryCorrection(volScalarField& e)
128 volScalarField::GeometricBoundaryField& ebf = e.boundaryField();
132 if (isA<gradientInternalEnergyFvPatchScalarField>(ebf[patchi]))
134 refCast<gradientInternalEnergyFvPatchScalarField>(ebf[patchi])
135 .gradient() = ebf[patchi].fvPatchField::snGrad();
137 else if (isA<mixedInternalEnergyFvPatchScalarField>(ebf[patchi]))
139 refCast<mixedInternalEnergyFvPatchScalarField>(ebf[patchi])
140 .refGrad() = ebf[patchi].fvPatchField::snGrad();
145 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
147 Foam::basicThermo::basicThermo(const fvMesh& mesh)
153 "thermophysicalProperties",
154 mesh.time().constant(),
156 IOobject::MUST_READ_IF_MODIFIED,
166 mesh.time().timeName(),
179 mesh.time().timeName(),
185 dimensionSet(0, -2, 2, 0, 0)
193 mesh.time().timeName(),
206 mesh.time().timeName(),
212 dimensionSet(1, -1, -1, 0, 0)
220 mesh.time().timeName(),
226 dimensionSet(1, -1, -1, 0, 0)
231 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
233 Foam::basicThermo::~basicThermo()
237 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
239 Foam::volScalarField& Foam::basicThermo::p()
245 const Foam::volScalarField& Foam::basicThermo::p() const
251 const Foam::volScalarField& Foam::basicThermo::psi() const
257 Foam::volScalarField& Foam::basicThermo::h()
259 notImplemented("basicThermo::h()");
260 return const_cast<volScalarField&>(volScalarField::null());
264 const Foam::volScalarField& Foam::basicThermo::h() const
266 notImplemented("basicThermo::h() const");
267 return volScalarField::null();
271 Foam::tmp<Foam::scalarField> Foam::basicThermo::h
273 const scalarField& T,
274 const labelList& cells
280 "(const scalarField& T, const labelList& cells) const"
282 return tmp<scalarField>(NULL);
286 Foam::tmp<Foam::scalarField> Foam::basicThermo::h
288 const scalarField& T,
295 "(const scalarField& T, const label patchi) const"
297 return tmp<scalarField>(NULL);
301 Foam::volScalarField& Foam::basicThermo::hs()
303 notImplemented("basicThermo::hs()");
304 return const_cast<volScalarField&>(volScalarField::null());
308 const Foam::volScalarField& Foam::basicThermo::hs() const
310 notImplemented("basicThermo::hs() const");
311 return volScalarField::null();
315 Foam::tmp<Foam::scalarField> Foam::basicThermo::hs
317 const scalarField& T,
318 const labelList& cells
324 "(const scalarField& T, const labelList& cells) const"
326 return tmp<scalarField>(NULL);
330 Foam::tmp<Foam::scalarField> Foam::basicThermo::hs
332 const scalarField& T,
339 "(const scalarField& T, const label patchi) const"
341 return tmp<scalarField>(NULL);
345 Foam::tmp<Foam::volScalarField> Foam::basicThermo::hc() const
347 notImplemented("basicThermo::hc()");
348 return volScalarField::null();
352 Foam::volScalarField& Foam::basicThermo::e()
354 notImplemented("basicThermo::e()");
355 return const_cast<volScalarField&>(volScalarField::null());
359 const Foam::volScalarField& Foam::basicThermo::e() const
361 notImplemented("basicThermo::e()");
362 return volScalarField::null();
366 Foam::tmp<Foam::scalarField> Foam::basicThermo::e
368 const scalarField& T,
369 const labelList& cells
375 "(const scalarField& T, const labelList& cells) const"
377 return tmp<scalarField>(NULL);
381 Foam::tmp<Foam::scalarField> Foam::basicThermo::e
383 const scalarField& T,
390 "(const scalarField& T, const label patchi) const"
392 return tmp<scalarField>(NULL);
396 const Foam::volScalarField& Foam::basicThermo::T() const
402 Foam::tmp<Foam::scalarField> Foam::basicThermo::Cp
404 const scalarField& T,
411 "(const scalarField& T, const label patchi) const"
413 return tmp<scalarField>(NULL);
417 Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cp() const
419 notImplemented("basicThermo::Cp() const");
420 return volScalarField::null();
424 Foam::tmp<Foam::scalarField> Foam::basicThermo::Cv
426 const scalarField& T,
433 "(const scalarField& T, const label patchi) const"
435 return tmp<scalarField>(NULL);
439 Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cv() const
441 notImplemented("basicThermo::Cv() const");
442 return volScalarField::null();
446 const Foam::volScalarField& Foam::basicThermo::mu() const
452 const Foam::volScalarField& Foam::basicThermo::alpha() const
458 bool Foam::basicThermo::read()
460 return regIOobject::read();
464 // ************************************************************************* //