thermodynamics: add additional functions to provide properties directly on patches

This commit is contained in:
Henry 2013-07-03 22:20:25 +01:00
parent 7f06c21dce
commit 0b12601da0
12 changed files with 86 additions and 30 deletions

View File

@ -493,6 +493,12 @@ const Foam::volScalarField& Foam::basicThermo::alpha() const
}
const Foam::scalarField& Foam::basicThermo::alpha(const label patchi) const
{
return alpha_.boundaryField()[patchi];
}
bool Foam::basicThermo::read()
{
return regIOobject::read();

View File

@ -267,6 +267,9 @@ public:
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const = 0;
//- Density for patch [kg/m^3]
virtual tmp<scalarField> rho(const label patchi) const = 0;
//- Enthalpy/Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& he() = 0;
@ -390,6 +393,12 @@ public:
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
virtual const volScalarField& alpha() const;
//- Thermal diffusivity for enthalpy of mixture for patch [kg/m/s]
virtual const scalarField& alpha
(
const label patchi
) const;
// Fields derived from transport state variables

View File

@ -72,4 +72,18 @@ Foam::fluidThermo::~fluidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::fluidThermo::nu() const
{
return mu()/rho();
}
Foam::tmp<Foam::scalarField> Foam::fluidThermo::nu(const label patchi) const
{
return mu(patchi)/rho(patchi);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -109,6 +109,15 @@ public:
//- Dynamic viscosity of mixture [kg/m/s]
virtual const volScalarField& mu() const = 0;
//- Dynamic viscosity of mixture for patch [kg/m/s]
virtual const scalarField& mu(const label patchi) const = 0;
//- Kinematic viscosity of mixture [m^2/s]
virtual tmp<volScalarField> nu() const;
//- Kinematic viscosity of mixture for patch [m^2/s]
virtual tmp<scalarField> nu(const label patchi) const;
};

View File

@ -788,26 +788,6 @@ Foam::heThermo<BasicThermo, MixtureType>::alphaEff
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::alpha
(
const label patchi
) const
{
return
this->CpByCpv
(
this->p_.boundaryField()[patchi],
this->T_.boundaryField()[patchi],
patchi
)
*(
this->alpha_.boundaryField()[patchi]
);
}
template<class BasicThermo, class MixtureType>
bool Foam::heThermo<BasicThermo, MixtureType>::read()
{

View File

@ -260,7 +260,6 @@ public:
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappa
(
const label patchi
@ -290,12 +289,6 @@ public:
const label patchi
) const;
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
virtual tmp<scalarField> alpha
(
const label patchI
) const;
//- Read thermophysical properties dictionary
virtual bool read();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -92,7 +92,13 @@ Foam::psiThermo::~psiThermo()
Foam::tmp<Foam::volScalarField> Foam::psiThermo::rho() const
{
return p_*psi();
return p_*psi_;
}
Foam::tmp<Foam::scalarField> Foam::psiThermo::rho(const label patchi) const
{
return p_.boundaryField()[patchi]*psi_.boundaryField()[patchi];
}
@ -108,4 +114,10 @@ const Foam::volScalarField& Foam::psiThermo::mu() const
}
const Foam::scalarField& Foam::psiThermo::mu(const label patchi) const
{
return mu_.boundaryField()[patchi];
}
// ************************************************************************* //

View File

@ -115,6 +115,9 @@ public:
//- Density [kg/m^3] - uses current value of pressure
virtual tmp<volScalarField> rho() const;
//- Density for patch [kg/m^3]
virtual tmp<scalarField> rho(const label patchi) const;
//- Compressibility [s^2/m^2]
virtual const volScalarField& psi() const;
@ -123,6 +126,9 @@ public:
//- Dynamic viscosity of mixture [kg/m/s]
virtual const volScalarField& mu() const;
//- Dynamic viscosity of mixture for patch [kg/m/s]
virtual const scalarField& mu(const label patchi) const;
};

View File

@ -161,6 +161,12 @@ Foam::tmp<Foam::volScalarField> Foam::rhoThermo::rho() const
}
Foam::tmp<Foam::scalarField> Foam::rhoThermo::rho(const label patchi) const
{
return rho_.boundaryField()[patchi];
}
Foam::volScalarField& Foam::rhoThermo::rho()
{
return rho_;
@ -179,4 +185,10 @@ const Foam::volScalarField& Foam::rhoThermo::mu() const
}
const Foam::scalarField& Foam::rhoThermo::mu(const label patchi) const
{
return mu_.boundaryField()[patchi];
}
// ************************************************************************* //

View File

@ -127,6 +127,9 @@ public:
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const;
//- Density for patch [kg/m^3]
virtual tmp<scalarField> rho(const label patchi) const;
//- Return non-const access to the local density field [kg/m^3]
virtual volScalarField& rho();
@ -138,6 +141,9 @@ public:
//- Dynamic viscosity of mixture [kg/m/s]
virtual const volScalarField& mu() const;
//- Dynamic viscosity of mixture for patch [kg/m/s]
virtual const scalarField& mu(const label patchi) const;
};

View File

@ -123,6 +123,12 @@ Foam::tmp<Foam::volScalarField> Foam::solidThermo::rho() const
}
Foam::tmp<Foam::scalarField> Foam::solidThermo::rho(const label patchi) const
{
return rho_.boundaryField()[patchi];
}
Foam::volScalarField& Foam::solidThermo::rho()
{
return rho_;

View File

@ -138,6 +138,9 @@ public:
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const;
//- Density for patch [kg/m^3]
virtual tmp<scalarField> rho(const label patchi) const = 0;
//- Return non-const access to the local density field [kg/m^3]
virtual volScalarField& rho();