Commit 5554300f authored by Andrew Heather's avatar Andrew Heather
Browse files

restructuring - psi and rho thermo packages

parent 4e2dbe65
......@@ -35,20 +35,17 @@ License
#include "gradientInternalEnergyFvPatchScalarField.H"
#include "mixedInternalEnergyFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
defineTypeNameAndDebug(basicThermo, 0);
defineRunTimeSelectionTable(basicThermo, fvMesh);
defineTypeNameAndDebug(basicThermo, 0);
defineRunTimeSelectionTable(basicThermo, fvMesh);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
wordList basicThermo::hBoundaryTypes()
Foam::wordList Foam::basicThermo::hBoundaryTypes()
{
const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
......@@ -77,7 +74,8 @@ wordList basicThermo::hBoundaryTypes()
return hbt;
}
void basicThermo::hBoundaryCorrection(volScalarField& h)
void Foam::basicThermo::hBoundaryCorrection(volScalarField& h)
{
volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
......@@ -96,7 +94,8 @@ void basicThermo::hBoundaryCorrection(volScalarField& h)
}
}
wordList basicThermo::eBoundaryTypes()
Foam::wordList Foam::basicThermo::eBoundaryTypes()
{
const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
......@@ -125,7 +124,8 @@ wordList basicThermo::eBoundaryTypes()
return ebt;
}
void basicThermo::eBoundaryCorrection(volScalarField& e)
void Foam::basicThermo::eBoundaryCorrection(volScalarField& e)
{
volScalarField::GeometricBoundaryField& ebf = e.boundaryField();
......@@ -146,7 +146,7 @@ void basicThermo::eBoundaryCorrection(volScalarField& e)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
basicThermo::basicThermo(const fvMesh& mesh)
Foam::basicThermo::basicThermo(const fvMesh& mesh)
:
IOdictionary
(
......@@ -173,31 +173,31 @@ basicThermo::basicThermo(const fvMesh& mesh)
mesh
),
T_
psi_
(
IOobject
(
"T",
"psi",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh
mesh,
dimensionSet(0, -2, 2, 0, 0)
),
psi_
T_
(
IOobject
(
"psi",
"T",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionSet(0, -2, 2, 0, 0)
mesh
),
mu_
......@@ -232,20 +232,184 @@ basicThermo::basicThermo(const fvMesh& mesh)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
basicThermo::~basicThermo()
Foam::basicThermo::~basicThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool basicThermo::read()
Foam::volScalarField& Foam::basicThermo::p()
{
return regIOobject::read();
return p_;
}
const Foam::volScalarField& Foam::basicThermo::p() const
{
return p_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const Foam::volScalarField& Foam::basicThermo::psi() const
{
return psi_;
}
Foam::volScalarField& Foam::basicThermo::h()
{
notImplemented("basicThermo::h()");
return const_cast<volScalarField&>(volScalarField::null());
}
const Foam::volScalarField& Foam::basicThermo::h() const
{
notImplemented("basicThermo::h() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::h
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::h
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::volScalarField& Foam::basicThermo::e()
{
notImplemented("basicThermo::e()");
return const_cast<volScalarField&>(volScalarField::null());
}
const Foam::volScalarField& Foam::basicThermo::e() const
{
notImplemented("basicThermo::e()");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::e
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::e
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
const Foam::volScalarField& Foam::basicThermo::T() const
{
return T_;
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::Cp
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cp"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cp() const
{
notImplemented("basicThermo::Cp() const");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicThermo::Cv
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cv"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cv() const
{
notImplemented("basicThermo::Cv() const");
return volScalarField::null();
}
const Foam::volScalarField& Foam::basicThermo::mu() const
{
return mu_;
}
const Foam::volScalarField& Foam::basicThermo::alpha() const
{
return alpha_;
}
bool Foam::basicThermo::read()
{
return regIOobject::read();
}
} // End namespace Foam
// ************************************************************************* //
......@@ -49,7 +49,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicThermo Declaration
Class basicThermo Declaration
\*---------------------------------------------------------------------------*/
class basicThermo
......@@ -61,21 +61,45 @@ protected:
// Protected data
volScalarField p_;
volScalarField T_;
volScalarField psi_;
// Fields
volScalarField mu_;
volScalarField alpha_;
//- Pressure [Pa]
volScalarField p_;
//- Compressibility [s^2/m^2]
volScalarField psi_;
//- Temperature [K]
volScalarField T_;
//- Laminar dynamic viscosity [kg/m/s]
volScalarField mu_;
//- Laminar thermal diffusuvity [kg/m/s]
volScalarField alpha_;
// Protected member functions
wordList hBoundaryTypes();
void hBoundaryCorrection(volScalarField& h);
// Enthalpy
//- Return the enthalpy field boundary types by interrogating the
// temperature field boundary types
wordList hBoundaryTypes();
//- Correct the enthalpy field boundaries
void hBoundaryCorrection(volScalarField& h);
// Internal energy
//- Return the internal energy field boundary types by
// interrogating the temperature field boundary types
wordList eBoundaryTypes();
//- Correct the internal energy field boundaries
void eBoundaryCorrection(volScalarField& e);
wordList eBoundaryTypes();
void eBoundaryCorrection(volScalarField& e);
//- Construct as copy (not implemented)
basicThermo(const basicThermo&);
......@@ -87,16 +111,15 @@ public:
TypeName("basicThermo");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicThermo,
fvMesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
......@@ -105,9 +128,8 @@ public:
basicThermo(const fvMesh&);
// Selectors
static autoPtr<basicThermo> New(const fvMesh&);
//- Selector
static autoPtr<basicThermo> New(const fvMesh&);
//- Destructor
......@@ -120,193 +142,101 @@ public:
virtual void correct() = 0;
// Access to thermodynamic state variables.
// Access to thermodynamic state variables
//- Pressure [Pa]
// Non-const access allowed for transport equations
virtual volScalarField& p()
{
return p_;
}
virtual volScalarField& p();
//- Pressure [Pa]
virtual const volScalarField& p() const
{
return p_;
}
virtual const volScalarField& p() const;
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const = 0;
//- Compressibility [s^2/m^2]
virtual const volScalarField& psi() const;
//- Enthalpy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& h()
{
notImplemented("basicThermo::h()");
return const_cast<volScalarField&>(volScalarField::null());
}
virtual volScalarField& h();
//- Enthalpy [J/kg]
virtual const volScalarField& h() const
{
notImplemented("basicThermo::h() const");
return volScalarField::null();
}
virtual const volScalarField& h() const;
//- Enthalpy for cell-set [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Enthalpy for patch [J/kg]
virtual tmp<scalarField> h
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::h"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& e()
{
notImplemented("basicThermo::e()");
return const_cast<volScalarField&>(volScalarField::null());
}
virtual volScalarField& e();
//- Internal energy [J/kg]
virtual const volScalarField& e() const
{
notImplemented("basicThermo::e()");
return volScalarField::null();
}
virtual const volScalarField& e() const;
//- Internal energy for cell-set [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
) const;
//-Internal energy for patch [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
// Fields derived from thermodynamic state variables
//- Temperature [K]
virtual const volScalarField& T() const
{
return T_;
}
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const
{
return p_*psi();
}
//- Compressibility [s^2/m^2]
virtual const volScalarField& psi() const
{
return psi_;
}
virtual const volScalarField& T() const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cp"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const
{
notImplemented("basicThermo::Cp() const");
return volScalarField::null();
}
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cv"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
) const;
//- Heat capacity at constant volume [J/kg/K]
v