/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \*---------------------------------------------------------------------------*/ #include "basicThermo.H" #include "fvMesh.H" #include "HashTable.H" #include "zeroGradientFvPatchFields.H" #include "fixedEnthalpyFvPatchScalarField.H" #include "gradientEnthalpyFvPatchScalarField.H" #include "mixedEnthalpyFvPatchScalarField.H" #include "fixedInternalEnergyFvPatchScalarField.H" #include "gradientInternalEnergyFvPatchScalarField.H" #include "mixedInternalEnergyFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ defineTypeNameAndDebug(basicThermo, 0); defineRunTimeSelectionTable(basicThermo, fvMesh); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // wordList basicThermo::hBoundaryTypes() { const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField(); wordList hbt = tbf.types(); forAll(tbf, patchi) { if (isA(tbf[patchi])) { hbt[patchi] = fixedEnthalpyFvPatchScalarField::typeName; } else if ( isA(tbf[patchi]) || isA(tbf[patchi]) ) { hbt[patchi] = gradientEnthalpyFvPatchScalarField::typeName; } else if (isA(tbf[patchi])) { hbt[patchi] = mixedEnthalpyFvPatchScalarField::typeName; } } return hbt; } void basicThermo::hBoundaryCorrection(volScalarField& h) { volScalarField::GeometricBoundaryField& hbf = h.boundaryField(); forAll(hbf, patchi) { if (isA(hbf[patchi])) { refCast(hbf[patchi]).gradient() = hbf[patchi].fvPatchField::snGrad(); } else if (isA(hbf[patchi])) { refCast(hbf[patchi]).refGrad() = hbf[patchi].fvPatchField::snGrad(); } } } wordList basicThermo::eBoundaryTypes() { const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField(); wordList ebt = tbf.types(); forAll(tbf, patchi) { if (isA(tbf[patchi])) { ebt[patchi] = fixedInternalEnergyFvPatchScalarField::typeName; } else if ( isA(tbf[patchi]) || isA(tbf[patchi]) ) { ebt[patchi] = gradientInternalEnergyFvPatchScalarField::typeName; } else if (isA(tbf[patchi])) { ebt[patchi] = mixedInternalEnergyFvPatchScalarField::typeName; } } return ebt; } void basicThermo::eBoundaryCorrection(volScalarField& e) { volScalarField::GeometricBoundaryField& ebf = e.boundaryField(); forAll(ebf, patchi) { if (isA(ebf[patchi])) { refCast(ebf[patchi]) .gradient() = ebf[patchi].fvPatchField::snGrad(); } else if (isA(ebf[patchi])) { refCast(ebf[patchi]) .refGrad() = ebf[patchi].fvPatchField::snGrad(); } } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // basicThermo::basicThermo(const fvMesh& mesh) : IOdictionary ( IOobject ( "thermophysicalProperties", mesh.time().constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ), p_ ( IOobject ( "p", mesh.time().timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ), T_ ( IOobject ( "T", mesh.time().timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ), psi_ ( IOobject ( "psi", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionSet(0, -2, 2, 0, 0) ), mu_ ( IOobject ( "mu", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionSet(1, -1, -1, 0, 0) ), alpha_ ( IOobject ( "alpha", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionSet(1, -1, -1, 0, 0) ) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // basicThermo::~basicThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool basicThermo::read() { return regIOobject::read(); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //