Files
openfoam/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C

100 lines
3.0 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 "Chung.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace compressibilityModels
{
defineTypeNameAndDebug(Chung, 0);
addToRunTimeSelectionTable
(
barotropicCompressibilityModel,
Chung,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressibilityModels::Chung::Chung
(
const dictionary& compressibilityProperties,
const volScalarField& gamma,
const word& psiName
)
:
barotropicCompressibilityModel(compressibilityProperties, gamma, psiName),
psiv_(compressibilityProperties_.lookup("psiv")),
psil_(compressibilityProperties_.lookup("psil")),
rhovSat_(compressibilityProperties_.lookup("rhovSat")),
rholSat_(compressibilityProperties_.lookup("rholSat"))
{
correct();
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::compressibilityModels::Chung::correct()
{
volScalarField sfa = sqrt
(
(rhovSat_/psiv_)
/((scalar(1) - gamma_)*rhovSat_/psiv_ + gamma_*rholSat_/psil_)
);
psi_ = sqr
(
((scalar(1) - gamma_)/sqrt(psiv_) + gamma_*sfa/sqrt(psil_))
*sqrt(psiv_*psil_)/sfa
);
}
bool Foam::compressibilityModels::Chung::read
(
const dictionary& compressibilityProperties
)
{
barotropicCompressibilityModel::read(compressibilityProperties);
compressibilityProperties_.lookup("psiv") >> psiv_;
compressibilityProperties_.lookup("psil") >> psil_;
compressibilityProperties_.lookup("rhovSat") >> rhovSat_;
compressibilityProperties_.lookup("rholSat") >> rholSat_;
return true;
}
// ************************************************************************* //