ENH: adding pressurePerfectGas equestion of state

This commit is contained in:
sergio
2012-05-08 17:37:53 +01:00
parent ef70df3359
commit 70ea2f82d2
7 changed files with 475 additions and 0 deletions

View File

@ -32,6 +32,7 @@ Description
#include "makeBasicMixture.H"
#include "perfectGas.H"
#include "pressurePerfectGas.H"
#include "incompressible.H"
#include "eConstThermo.H"
@ -119,6 +120,30 @@ makeBasicPolyMixture
8
);
makeBasicMixture
(
pureMixture,
constTransport,
hConstThermo,
pressurePerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
hConstThermo,
pressurePerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
janafThermo,
pressurePerfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -26,6 +26,7 @@ License
#include "makeBasicRhoThermo.H"
#include "perfectGas.H"
#include "pressurePerfectGas.H"
#include "incompressible.H"
#include "hConstThermo.H"
@ -99,6 +100,33 @@ makeBasicRhoPolyThermo
8
);
makeBasicRhoThermo
(
hRhoThermo,
pureMixture,
constTransport,
hConstThermo,
pressurePerfectGas
);
makeBasicRhoThermo
(
hRhoThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
pressurePerfectGas
);
makeBasicRhoThermo
(
hRhoThermo,
pureMixture,
sutherlandTransport,
janafThermo,
pressurePerfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -26,6 +26,7 @@ License
#include "makeBasicRhoThermo.H"
#include "perfectGas.H"
#include "pressurePerfectGas.H"
#include "hConstThermo.H"
#include "janafThermo.H"
@ -71,6 +72,32 @@ makeBasicRhoThermo
perfectGas
);
makeBasicRhoThermo
(
hsRhoThermo,
pureMixture,
constTransport,
hConstThermo,
pressurePerfectGas
);
makeBasicRhoThermo
(
hsRhoThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
pressurePerfectGas
);
makeBasicRhoThermo
(
hsRhoThermo,
pureMixture,
sutherlandTransport,
janafThermo,
pressurePerfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -7,6 +7,7 @@ $(atomicWeights)/atomicWeights.C
$(specie)/specie.C
$(equationOfState)/perfectGas/perfectGas.C
$(equationOfState)/incompressible/incompressible.C
$(equationOfState)/pressurePerfectGas/pressurePerfectGas.C
$(reactions)/makeChemkinReactions.C
$(reactions)/makeReactionThermoReactions.C
$(reactions)/makeLangmuirHinshelwoodReactions.C

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "pressurePerfectGas.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pressurePerfectGas::pressurePerfectGas(Istream& is)
:
specie(is),
pRef_(readScalar(is))
{
is.check("pressurePerfectGas::pressurePerfectGas(Istream& is)");
}
Foam::pressurePerfectGas::pressurePerfectGas(const dictionary& dict)
:
specie(dict),
pRef_(readScalar(dict.subDict("equationOfState").lookup("pRef")))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pressurePerfectGas::write(Ostream& os) const
{
specie::write(os);
dictionary dict("equationOfState");
dict.add("pRef", pRef_);
os << indent << dict.dictName() << dict;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const pressurePerfectGas& pg)
{
os << static_cast<const specie&>(pg)
<< token::SPACE << pg.pRef_;
os.check("Ostream& operator<<(Ostream& os, const pressurePerfectGas& st)");
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::pressurePerfectGas
Description
Perfect gas equation of state usign a reference pressure
SourceFiles
pressurePerfectGasI.H
pressurePerfectGas.C
\*---------------------------------------------------------------------------*/
#ifndef pressurePerfectGas_H
#define pressurePerfectGas_H
#include "specie.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pressurePerfectGas Declaration
\*---------------------------------------------------------------------------*/
class pressurePerfectGas
:
public specie
{
// Private data
//- Reference pressure
scalar pRef_;
public:
// Constructors
//- Construct from components
inline pressurePerfectGas(const specie& sp);
//- Construct from Istream
pressurePerfectGas(Istream&);
//- Construct from dictionary
pressurePerfectGas(const dictionary& dict);
//- Construct as named copy
inline pressurePerfectGas(const word& name, const pressurePerfectGas&);
//- Construct and return a clone
inline autoPtr<pressurePerfectGas> clone() const;
// Selector from Istream
inline static autoPtr<pressurePerfectGas> New(Istream& is);
// Selector from dictionary
inline static autoPtr<pressurePerfectGas> New(const dictionary& dict);
// Member functions
// Fundamental properties
//- Return density [kg/m^3]
inline scalar rho(scalar p, scalar T) const;
//- Return compressibility rho/p [s^2/m^2]
inline scalar psi(scalar p, scalar T) const;
//- Return compression factor []
inline scalar Z(scalar p, scalar T) const;
// I-O
//- Write to Ostream
void write(Ostream& os) const;
// Member operators
inline void operator+=(const pressurePerfectGas&);
inline void operator-=(const pressurePerfectGas&);
inline void operator*=(const scalar);
// Friend operators
inline friend pressurePerfectGas operator+
(
const pressurePerfectGas&,
const pressurePerfectGas&
);
inline friend pressurePerfectGas operator-
(
const pressurePerfectGas&,
const pressurePerfectGas&
);
inline friend pressurePerfectGas operator*
(
const scalar s,
const pressurePerfectGas&
);
inline friend pressurePerfectGas operator==
(
const pressurePerfectGas&,
const pressurePerfectGas&
);
// Ostream Operator
friend Ostream& operator<<(Ostream&, const pressurePerfectGas&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pressurePerfectGasI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "pressurePerfectGas.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::pressurePerfectGas::pressurePerfectGas(const specie& sp)
:
specie(sp)
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::pressurePerfectGas::pressurePerfectGas
(
const word& name,
const pressurePerfectGas& pg
)
:
specie(name, pg)
{}
inline Foam::autoPtr<Foam::pressurePerfectGas> Foam::pressurePerfectGas::
clone() const
{
return autoPtr<pressurePerfectGas>(new pressurePerfectGas(*this));
}
inline Foam::autoPtr<Foam::pressurePerfectGas> Foam::pressurePerfectGas::New
(
Istream& is
)
{
return autoPtr<pressurePerfectGas>(new pressurePerfectGas(is));
}
inline Foam::autoPtr<Foam::pressurePerfectGas> Foam::pressurePerfectGas::New
(
const dictionary& dict
)
{
return autoPtr<pressurePerfectGas>(new pressurePerfectGas(dict));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::pressurePerfectGas::rho(scalar p, scalar T) const
{
return pRef_/(R()*T);
}
inline Foam::scalar Foam::pressurePerfectGas::psi(scalar, scalar T) const
{
return 0.0;
}
inline Foam::scalar Foam::pressurePerfectGas::Z(scalar, scalar) const
{
return 0.0;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::pressurePerfectGas::operator+=(const pressurePerfectGas& pg)
{
specie::operator+=(pg);
}
inline void Foam::pressurePerfectGas::operator-=(const pressurePerfectGas& pg)
{
specie::operator-=(pg);
}
inline void Foam::pressurePerfectGas::operator*=(const scalar s)
{
specie::operator*=(s);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline Foam::pressurePerfectGas Foam::operator+
(
const pressurePerfectGas& pg1,
const pressurePerfectGas& pg2
)
{
return pressurePerfectGas
(
static_cast<const specie&>(pg1)
+ static_cast<const specie&>(pg2)
);
}
inline Foam::pressurePerfectGas Foam::operator-
(
const pressurePerfectGas& pg1,
const pressurePerfectGas& pg2
)
{
return pressurePerfectGas
(
static_cast<const specie&>(pg1)
- static_cast<const specie&>(pg2)
);
}
inline Foam::pressurePerfectGas Foam::operator*
(
const scalar s,
const pressurePerfectGas& pg
)
{
return pressurePerfectGas(s*static_cast<const specie&>(pg));
}
inline Foam::pressurePerfectGas Foam::operator==
(
const pressurePerfectGas& pg1,
const pressurePerfectGas& pg2
)
{
return pg2 - pg1;
}
// ************************************************************************* //