Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x

This commit is contained in:
andy 2014-02-21 16:41:41 +00:00
commit 0218131995
15 changed files with 731 additions and 16 deletions

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,15 +70,12 @@ void Foam::partialWrite::read(const dictionary& dict)
writeInstance_ = 0;
Info<< type() << " " << name() << ":" << nl
<< " dumping every outputTime :";
<< " dumping every " << writeInterval_
<< " th outputTime : " << nl << endl ;
forAllConstIter(HashSet<word>, objectNames_, iter)
{
Info<< ' ' << iter.key();
}
Info<< nl
<< " dumping all other fields every "
<< writeInterval_ << "th outputTime" << nl
<< endl;
if (writeInterval_ < 1)
{

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-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,6 +28,7 @@ License
#include "specie.H"
#include "perfectGas.H"
#include "PengRobinsonGas.H"
#include "hConstThermo.H"
#include "eConstThermo.H"
#include "janafThermo.H"
@ -38,6 +39,9 @@ License
#include "constTransport.H"
#include "sutherlandTransport.H"
#include "hPolynomialThermo.H"
#include "polynomialTransport.H"
#include "hePsiThermo.H"
#include "pureMixture.H"
@ -84,6 +88,41 @@ makeThermo
specie
);
makeThermo
(
psiThermo,
hePsiThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
PengRobinsonGas,
specie
);
makeThermo
(
psiThermo,
hePsiThermo,
pureMixture,
polynomialTransport,
sensibleEnthalpy,
hPolynomialThermo,
PengRobinsonGas,
specie
);
makeThermo
(
psiThermo,
hePsiThermo,
pureMixture,
polynomialTransport,
sensibleEnthalpy,
janafThermo,
PengRobinsonGas,
specie
);
/* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */

View file

@ -31,7 +31,9 @@ License
#include "incompressiblePerfectGas.H"
#include "rhoConst.H"
#include "perfectFluid.H"
#include "PengRobinsonGas.H"
#include "adiabaticPerfectFluid.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "sensibleEnthalpy.H"
@ -175,6 +177,41 @@ makeThermo
specie
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleEnthalpy,
hConstThermo,
PengRobinsonGas,
specie
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
polynomialTransport,
sensibleEnthalpy,
hPolynomialThermo,
PengRobinsonGas,
specie
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
polynomialTransport,
sensibleEnthalpy,
janafThermo,
PengRobinsonGas,
specie
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -0,0 +1,164 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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
Description
Perfect gas equation of state.
\*---------------------------------------------------------------------------*/
#include "PengRobinsonGas.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Specie>
PengRobinsonGas<Specie>::PengRobinsonGas(Istream& is)
:
Specie(is),
Tc_(readScalar(is)),
Pc_(readScalar(is)),
omega_(readScalar(is))
{
is.check("PengRobinsonGas<Specie>::PengRobinsonGas(Istream& is)");
}
template<class Specie>
Foam::PengRobinsonGas<Specie>::PengRobinsonGas
(
const dictionary& dict
)
:
Specie(dict),
Tc_(readScalar(dict.subDict("equationOfState").lookup("Tc"))),
Pc_(readScalar(dict.subDict("equationOfState").lookup("Pc"))),
omega_(readScalar(dict.subDict("equationOfState").lookup("omega")))
{}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class Specie>
PengRobinsonGas<Specie> operator+
(
const PengRobinsonGas<Specie>& pg1,
const PengRobinsonGas<Specie>& pg2
)
{
scalar nMoles = pg1.nMoles() + pg2.nMoles();
scalar molr1 = pg1.nMoles()/nMoles;
scalar molr2 = pg2.nMoles()/nMoles;
return PengRobinsonGas<Specie>
(
static_cast<const Specie&>(pg1)
+ static_cast<const Specie&>(pg2),
molr1*pg1.Tc_ + molr2*pg2.Tc_,
molr1*pg1.Pc_ + molr2*pg2.Pc_,
molr1*pg1.omega_ + molr2*pg2.omega_
);
}
template<class Specie>
PengRobinsonGas<Specie> operator-
(
const PengRobinsonGas<Specie>& pg1,
const PengRobinsonGas<Specie>& pg2
)
{
scalar nMoles = pg1.nMoles() + pg2.nMoles();
scalar molr1 = pg1.nMoles()/nMoles;
scalar molr2 = pg2.nMoles()/nMoles;
return PengRobinsonGas<Specie>
(
static_cast<const Specie&>(pg1)
- static_cast<const Specie&>(pg2),
molr1*pg1.Tc_ - molr2*pg2.Tc_,
molr1*pg1.Pc_ - molr2*pg2.Pc_,
molr1*pg1.omega_ - molr2*pg2.omega_
);
}
template<class Specie>
PengRobinsonGas<Specie> operator*
(
const scalar s,
const PengRobinsonGas<Specie>& pg
)
{
return PengRobinsonGas<Specie>
(
s*static_cast<const Specie&>(pg),
pg.Tc_,
pg.Pc_,
pg.omega_
);
}
template<class Specie>
PengRobinsonGas<Specie> operator==
(
const PengRobinsonGas<Specie>& pg1,
const PengRobinsonGas<Specie>& pg2
)
{
return pg2 - pg1;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class Specie>
Ostream& operator<<
(
Ostream& os,
const PengRobinsonGas<Specie>& pg
)
{
os << static_cast<const Specie&>(pg)
<< token::SPACE << pg.Tc_
<< token::SPACE << pg.Pc_
<< token::SPACE << pg.omega_;
os.check
(
"Ostream& operator<<(Ostream& os, const PengRobinsonGas<Specie>& st)"
);
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,240 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 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::PengRobinsonGas
Description
PengRobinsonGas gas equation of state.
SourceFiles
PengRobinsonGasI.H
PengRobinsonGas.C
\*---------------------------------------------------------------------------*/
#ifndef PengRobinsonGas_H
#define PengRobinsonGas_H
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class Specie> class PengRobinsonGas;
template<class Specie>
inline PengRobinsonGas<Specie> operator+
(
const PengRobinsonGas<Specie>&,
const PengRobinsonGas<Specie>&
);
template<class Specie>
inline PengRobinsonGas<Specie> operator-
(
const PengRobinsonGas<Specie>&,
const PengRobinsonGas<Specie>&
);
template<class Specie>
inline PengRobinsonGas<Specie> operator*
(
const scalar,
const PengRobinsonGas<Specie>&
);
template<class Specie>
inline PengRobinsonGas<Specie> operator==
(
const PengRobinsonGas<Specie>&,
const PengRobinsonGas<Specie>&
);
template<class Specie>
Ostream& operator<<
(
Ostream&,
const PengRobinsonGas<Specie>&
);
/*---------------------------------------------------------------------------*\
Class PengRobinsonGas Declaration
\*---------------------------------------------------------------------------*/
template<class Specie>
class PengRobinsonGas
:
public Specie
{
private:
// Private data
//- Critical Temperature [K]
scalar Tc_;
//- Critical Pressure [Pa]
scalar Pc_;
//- Accentric factor [-]
scalar omega_;
public:
// Constructors
//- Construct from components
inline PengRobinsonGas
(
const Specie& sp,
const scalar& Tc,
const scalar& Pc,
const scalar& omega
);
//- Construct from Istream
PengRobinsonGas(Istream&);
//- Construct from dictionary
PengRobinsonGas(const dictionary& dict);
//- Construct as named copy
inline PengRobinsonGas(const word& name, const PengRobinsonGas&);
//- Construct and return a clone
inline autoPtr<PengRobinsonGas> clone() const;
// Selector from Istream
inline static autoPtr<PengRobinsonGas> New(Istream& is);
// Selector from dictionary
inline static autoPtr<PengRobinsonGas> New
(
const dictionary& dict
);
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "PengRobinsonGas<" + word(Specie::typeName_()) + '>';
}
// Fundamental properties
//- Is the equation of state is incompressible i.e. rho != f(p)
static const bool incompressible = false;
//- Is the equation of state is isochoric i.e. rho = const
static const bool isochoric = false;
//- 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;
//- Return (cp - cv) [J/(kmol K]
inline scalar cpMcv(scalar p, scalar T) const;
// IO
//- Write to Ostream
void write(Ostream& os) const;
// Member operators
inline void operator+=(const PengRobinsonGas&);
inline void operator-=(const PengRobinsonGas&);
inline void operator*=(const scalar);
// Friend operators
friend PengRobinsonGas operator+ <Specie>
(
const PengRobinsonGas&,
const PengRobinsonGas&
);
friend PengRobinsonGas operator- <Specie>
(
const PengRobinsonGas&,
const PengRobinsonGas&
);
friend PengRobinsonGas operator* <Specie>
(
const scalar s,
const PengRobinsonGas&
);
friend PengRobinsonGas operator== <Specie>
(
const PengRobinsonGas&,
const PengRobinsonGas&
);
// Ostream Operator
friend Ostream& operator<< <Specie>
(
Ostream&,
const PengRobinsonGas&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PengRobinsonGasI.H"
#ifdef NoRepository
# include "PengRobinsonGas.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,239 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 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 "PengRobinsonGas.H"
#include "mathematicalConstants.H"
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Specie>
inline PengRobinsonGas<Specie>::PengRobinsonGas
(
const Specie& sp,
const scalar& Tc,
const scalar& Pc,
const scalar& omega
)
:
Specie(sp),
Tc_(Tc),
Pc_(Pc),
omega_(omega)
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Specie>
inline PengRobinsonGas<Specie>::PengRobinsonGas
(
const word& name,
const PengRobinsonGas& pg
)
:
Specie(name, pg),
Tc_(pg.Tc),
Pc_(pg.Pc),
omega_(pg.omega)
{}
template<class Specie>
inline autoPtr<PengRobinsonGas <Specie> > PengRobinsonGas<Specie>::clone() const
{
return autoPtr<PengRobinsonGas<Specie> >
(
new PengRobinsonGas<Specie>(*this)
);
}
template<class Specie>
inline autoPtr<PengRobinsonGas<Specie> > PengRobinsonGas<Specie>::New
(
Istream& is
)
{
return autoPtr<PengRobinsonGas<Specie> >(new PengRobinsonGas<Specie>(is));
}
template<class Specie>
inline Foam::autoPtr<Foam::PengRobinsonGas<Specie> >
Foam::PengRobinsonGas<Specie>::New
(
const dictionary& dict
)
{
return autoPtr<PengRobinsonGas<Specie> >
(
new PengRobinsonGas<Specie>(dict)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Specie>
inline scalar PengRobinsonGas<Specie>::rho(scalar p, scalar T) const
{
scalar z = Z(p, T);
return p/(z*this->R()*T);
}
template<class Specie>
inline scalar PengRobinsonGas<Specie>::psi(scalar p, scalar T) const
{
scalar z = Z(p, T);
return 1.0/(z*this->R()*T);
}
template<class Specie>
inline scalar PengRobinsonGas<Specie>::Z(scalar p, scalar T) const
{
scalar a = 0.45724*sqr(this->R())*sqr(Tc_)/Pc_;
scalar b = 0.07780*this->R()*Tc_/Pc_;
scalar Tr = T/Tc_;
scalar alpha =
sqr
(
1.0
+ (0.37464 + 1.54226*omega_- 0.26992*sqr(omega_))
* (1.0 - sqrt(Tr))
);
scalar B = b*p/(this->R()*T);
scalar A = a*alpha*p/sqr(this->R()*T);
scalar a2 = B - 1.0;
scalar a1 = A - 2.0*B - 3.0*sqr(B);
scalar a0 = -A*B + sqr(B) + pow3(B);
scalar Q = (3.0*a1 - a2*a2)/9.0;
scalar Rl = (9.0*a2*a1 - 27.0*a0 - 2.0*a2*a2*a2)/54;
scalar Q3 = Q*Q*Q;
scalar D = Q3 + Rl*Rl;
scalar root = -1.0;
if (D <= 0.0)
{
scalar th = ::acos(Rl/sqrt(-Q3));
scalar qm = 2.0*sqrt(-Q);
scalar r1 = qm*cos(th/3.0) - a2/3.0;
scalar r2 = qm*cos((th + 2.0*constant::mathematical::pi)/3.0) - a2/3.0;
scalar r3 = qm*cos((th + 4.0*constant::mathematical::pi)/3.0) - a2/3.0;
root = max(r1, max(r2, r3));
}
else
{
// one root is real
scalar D05 = sqrt(D);
scalar S = pow(Rl + D05, 1.0/3.0);
scalar Tl = 0;
if (D05 > Rl)
{
Tl = -pow(mag(Rl - D05), 1.0/3.0);
}
else
{
Tl = pow(Rl - D05, 1.0/3.0);
}
root = S + Tl - a2/3.0;
}
return root;
}
template<class Specie>
inline Foam::scalar Foam::PengRobinsonGas<Specie>::cpMcv
(
scalar p,
scalar T
) const
{
return this->RR*Z(p, T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Specie>
inline void PengRobinsonGas<Specie>::operator+=
(
const PengRobinsonGas<Specie>& pg
)
{
scalar molr1 = this->nMoles();
Specie::operator+=(pg);
molr1 /= this->nMoles();
scalar molr2 = pg.nMoles()/this->nMoles();
Tc_ = molr1*Tc_ + molr2*pg.Tc_;
Pc_ = molr1*Pc_ + molr2*pg.Pc_;
omega_ = molr1*omega_ + molr2*pg.omega_;
}
template<class Specie>
inline void PengRobinsonGas<Specie>::operator-=
(
const PengRobinsonGas<Specie>& pg
)
{
scalar molr1 = this->nMoles();
Specie::operator-=(pg);
molr1 /= this->nMoles();
scalar molr2 = pg.nMoles()/this->nMoles();
Tc_ = molr1*Tc_ - molr2*pg.Tc_;
Pc_ = molr1*Pc_ - molr2*pg.Pc_;
omega_ = molr1*omega_ - molr2*pg.omega_;
}
template<class Specie>
inline void PengRobinsonGas<Specie>::operator*=(const scalar s)
{
Specie::operator*=(s);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -277,7 +277,6 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::write
os.writeKeyword("Tnbr")<< TnbrName_ << token::END_STATEMENT << nl;
os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl;
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
thicknessLayers_.writeEntry("thicknessLayers", os);
thicknessLayers_.writeEntry("kappaLayers", os);