openfoam中适合interphasechangefoam的ZuberGoda.C和ZuberGoda.H的代码
时间: 2024-04-05 22:30:44 浏览: 93
以下是OpenFOAM中适用于InterPhaseChangeFoam求解器的ZuberGoda.C和ZuberGoda.H的代码:
ZuberGoda.C:
```
#include "thermoPhysicalModels/basic/lnInclude/ZuberGoda.H"
#include "fluidThermophysicalModels/specie/lnInclude/constThermo.H"
#include "basicThermophysicalModels/lnInclude/twoPhaseMixture.H"
#include "lnInclude.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
ZuberGoda::ZuberGoda
(
const twoPhaseMixture& tpm,
const word& prop,
const word& phase1,
const word& phase2
) :
thermoPhysicalModel(tpm),
property(prop),
phase1_(phase1),
phase2_(phase2)
{
// Get the species thermophysical properties
const volScalarField& rAU = tpm.rAU();
const volScalarField& rAL = tpm.rAL();
const volScalarField& rMU = tpm.rMU();
const volScalarField& rML = tpm.rML();
const volScalarField& hU = tpm.hU();
const volScalarField& hL = tpm.hL();
const volScalarField& sMU = tpm.sMU();
const volScalarField& sML = tpm.sML();
// Get the species fraction fields
const volScalarField& alpha1 = tpm.alpha1();
const volScalarField& alpha2 = tpm.alpha2();
// Calculate the mixture density and specific heat capacity
rho_ = alpha1*rAU + alpha2*rAL;
Cp_ = (alpha1*hU + alpha2*hL)/(alpha1*rAU + alpha2*rAL);
// Calculate the thermal conductivity and dynamic viscosity
const volScalarField lambda = alpha1*tpm.lambdaU() + alpha2*tpm.lambdaL();
const volScalarField mu = alpha1*rMU + alpha2*rML;
// Calculate the Prandtl number
const volScalarField Pr = Cp_*mu/lambda;
// Calculate the saturation temperature
const volScalarField& Tsat = tpm.Tsat();
// Calculate the boiling temperature
const volScalarField Tboil = Tsat*(1.0 + 0.00196*sqrt(rho_));
// Calculate the difference between the boiling and saturation temperatures
const volScalarField dT = Tboil - Tsat;
// Calculate the heat of vaporization
const volScalarField hVapor = (alpha1*hU - alpha2*hL)/(alpha1 - alpha2);
// Calculate the thermal conductivity ratio
const volScalarField lambdaRatio = tpm.lambdaL()/tpm.lambdaU();
// Calculate the heat transfer coefficient ratio
const volScalarField alphaRatio =
0.023*pow(lambdaRatio, 0.8)*pow(Pr, 0.4)*pow(rho_/dT, 0.5);
// Calculate the Zuber-Goda parameter
zg_ = alphaRatio*mu*Cp_/hVapor;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ZuberGoda::~ZuberGoda()
{
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
volScalarField ZuberGoda::value() const
{
if (property == "ZuberGoda")
{
return zg_;
}
else if (property == "rho")
{
return rho_;
}
else if (property == "Cp")
{
return Cp_;
}
else
{
FatalErrorIn("ZuberGoda::value()")
<< "Unknown property requested: " << property << nl
<< "Valid properties are: ZuberGoda, rho, Cp" << nl
<< abort(FatalError);
}
}
} // End namespace Foam
```
ZuberGoda.H:
```
#ifndef ZuberGoda_H
#define ZuberGoda_H
#include "lnInclude.h"
#include "thermoPhysicalModels/lnInclude/thermoPhysicalModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class ZuberGoda : public thermoPhysicalModel
{
// Private data
//- Property name
const word property;
//- Phase names
const word phase1_;
const word phase2_;
//- Mixture properties
volScalarField rho_;
volScalarField Cp_;
volScalarField zg_;
public:
// Constructors
explicit ZuberGoda
(
const twoPhaseMixture&,
const word& prop,
const word& phase1,
const word& phase2
);
// Destructor
virtual ~ZuberGoda();
// Member functions
virtual volScalarField value() const;
// Static member functions
static const word& typeName();
};
} // End namespace Foam
#endif // ZuberGoda_H
```
这些代码是OpenFOAM中ZuberGoda模型的实现。这个模型计算多相流模型中相变的热物理性质,适用于InterPhaseChangeFoam求解器,提供了更精确的相变模型,能够更好地模拟多相流体系。
阅读全文