Commit 5d6c3ae4 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

parents 51b8a736 ed78b017
......@@ -36,7 +36,22 @@
+ Large number of code refinements and consistency improvements to support
other developments.
*** Turbulence modelling
*** Thermo-physical Models
*** *Updated* thermophysical libraries
+ Now use the more descriptive dictionary input format, e.g. for a single
component mixture:
thermoType hPsiThermo<pureMixture<sutherlandTransport<specieThermo<hConstThermo<perfectGas>>>>>;
mixture
{
nMoles 1;
molWeight 28.9;
Cp 1007;
Hf 0;
As 1.4792e-06;
Ts 116;
}
*** DSMC
*** Dynamic Mesh
*** Numerics
......
......@@ -37,9 +37,9 @@ template<int PolySize>
icoPolynomial<PolySize>::icoPolynomial(Istream& is)
:
specie(is),
rhoPolynomial_("rhoPolynomial", is)
rhoCoeffs_("rhoCoeffs<" + Foam::name(PolySize) + '>', is)
{
rhoPolynomial_ *= this->W();
rhoCoeffs_ *= this->W();
}
......@@ -47,9 +47,9 @@ template<int PolySize>
icoPolynomial<PolySize>::icoPolynomial(const dictionary& dict)
:
specie(dict),
rhoPolynomial_(dict.lookup("rhoPolynomial"))
rhoCoeffs_(dict.lookup("rhoCoeffs<" + Foam::name(PolySize) + '>'))
{
rhoPolynomial_ *= this->W();
rhoCoeffs_ *= this->W();
}
......@@ -59,8 +59,8 @@ template<int PolySize>
void icoPolynomial<PolySize>::write(Ostream& os) const
{
specie::write(os);
os.writeKeyword("rhoPolynomial") << rhoPolynomial_/this->W()
<< token::END_STATEMENT << nl;
os.writeKeyword(word("rhoCoeffs<" + Foam::name(PolySize) + '>'))
<< rhoCoeffs_/this->W() << token::END_STATEMENT << nl;
}
......@@ -70,7 +70,8 @@ template<int PolySize>
Ostream& operator<<(Ostream& os, const icoPolynomial<PolySize>& ip)
{
os << static_cast<const specie&>(ip) << tab
<< "rhoPolynomial" << tab << ip.rhoPolynomial_/ip.W();
<< "rhoCoeffs<" << Foam::name(PolySize) << '>' << tab
<< ip.rhoCoeffs_/ip.W();
os.check
(
......
......@@ -98,9 +98,9 @@ class icoPolynomial
{
// Private data
//- Density
//- Density polynomial coefficients
// Note: input in [kg/m3], but internally uses [kg/m3/kmol]
Polynomial<PolySize> rhoPolynomial_;
Polynomial<PolySize> rhoCoeffs_;
public:
......
......@@ -31,11 +31,11 @@ template<int PolySize>
inline Foam::icoPolynomial<PolySize>::icoPolynomial
(
const specie& sp,
const Polynomial<PolySize>& rhoPoly
const Polynomial<PolySize>& rhoCoeffs
)
:
specie(sp),
rhoPolynomial_(rhoPoly)
rhoCoeffs_(rhoCoeffs)
{}
......@@ -48,7 +48,7 @@ inline Foam::icoPolynomial<PolySize>::icoPolynomial
)
:
specie(ip),
rhoPolynomial_(ip.rhoPolynomial_)
rhoCoeffs_(ip.rhoCoeffs_)
{}
......@@ -60,7 +60,7 @@ inline Foam::icoPolynomial<PolySize>::icoPolynomial
)
:
specie(name, ip),
rhoPolynomial_(ip.rhoPolynomial_)
rhoCoeffs_(ip.rhoCoeffs_)
{}
......@@ -99,7 +99,7 @@ Foam::icoPolynomial<PolySize>::New(const dictionary& dict)
template<int PolySize>
inline Foam::scalar Foam::icoPolynomial<PolySize>::rho(scalar, scalar T) const
{
return rhoPolynomial_.evaluate(T)/this->W();
return rhoCoeffs_.evaluate(T)/this->W();
}
......@@ -127,7 +127,7 @@ inline Foam::icoPolynomial<PolySize>& Foam::icoPolynomial<PolySize>::operator=
{
specie::operator=(ip);
rhoPolynomial_ = ip.rhoPolynomial_;
rhoCoeffs_ = ip.rhoCoeffs_;
return *this;
}
......@@ -146,7 +146,7 @@ inline void Foam::icoPolynomial<PolySize>::operator+=
molr1 /= this->nMoles();
scalar molr2 = ip.nMoles()/this->nMoles();
rhoPolynomial_ = molr1*rhoPolynomial_ + molr2*ip.rhoPolynomial_;
rhoCoeffs_ = molr1*rhoCoeffs_ + molr2*ip.rhoCoeffs_;
}
......@@ -163,7 +163,7 @@ inline void Foam::icoPolynomial<PolySize>::operator-=
molr1 /= this->nMoles();
scalar molr2 = ip.nMoles()/this->nMoles();
rhoPolynomial_ = molr1*rhoPolynomial_ - molr2*ip.rhoPolynomial_;
rhoCoeffs_ = molr1*rhoCoeffs_ - molr2*ip.rhoCoeffs_;
}
......@@ -191,7 +191,7 @@ Foam::icoPolynomial<PolySize> Foam::operator+
(
static_cast<const specie&>(ip1)
+ static_cast<const specie&>(ip2),
molr1*ip1.rhoPolynomial_ + molr2*ip2.rhoPolynomial_
molr1*ip1.rhoCoeffs_ + molr2*ip2.rhoCoeffs_
);
}
......@@ -211,7 +211,7 @@ Foam::icoPolynomial<PolySize> Foam::operator-
(
static_cast<const specie&>(ip1)
- static_cast<const specie&>(ip2),
molr1*ip1.rhoPolynomial_ - molr2*ip2.rhoPolynomial_
molr1*ip1.rhoCoeffs_ - molr2*ip2.rhoCoeffs_
);
}
......@@ -226,7 +226,7 @@ Foam::icoPolynomial<PolySize> Foam::operator*
return icoPolynomial<PolySize>
(
s*static_cast<const specie&>(ip),
ip.rhoPolynomial_
ip.rhoCoeffs_
);
}
......
......@@ -37,22 +37,22 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
EquationOfState(is),
Hf_(readScalar(is)),
Sf_(readScalar(is)),
cpPolynomial_("cpPolynomial", is),
hPolynomial_(),
sPolynomial_()
CpCoeffs_("CpCoeffs<" + Foam::name(PolySize) + '>', is),
hCoeffs_(),
sCoeffs_()
{
Hf_ *= this->W();
Sf_ *= this->W();
cpPolynomial_ *= this->W();
CpCoeffs_ *= this->W();
hPolynomial_ = cpPolynomial_.integrate();
sPolynomial_ = cpPolynomial_.integrateMinus1();
hCoeffs_ = CpCoeffs_.integrate();
sCoeffs_ = CpCoeffs_.integrateMinus1();
// Offset h poly so that it is relative to the enthalpy at Tstd
hPolynomial_[0] += Hf_ - hPolynomial_.evaluate(specie::Tstd);
hCoeffs_[0] += Hf_ - hCoeffs_.evaluate(specie::Tstd);
// Offset s poly so that it is relative to the entropy at Tstd
sPolynomial_[0] += Sf_ - sPolynomial_.evaluate(specie::Tstd);
sCoeffs_[0] += Sf_ - sCoeffs_.evaluate(specie::Tstd);
}
......@@ -65,22 +65,22 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
EquationOfState(dict),
Hf_(readScalar(dict.lookup("Hf"))),
Sf_(readScalar(dict.lookup("Sf"))),
cpPolynomial_(dict.lookup("cpPolynomial")),
hPolynomial_(),
sPolynomial_()
CpCoeffs_(dict.lookup("CpCoeffs<" + Foam::name(PolySize) + '>')),
hCoeffs_(),
sCoeffs_()
{
Hf_ *= this->W();
Sf_ *= this->W();
cpPolynomial_ *= this->W();
CpCoeffs_ *= this->W();
hPolynomial_ = cpPolynomial_.integrate();
sPolynomial_ = cpPolynomial_.integrateMinus1();
hCoeffs_ = CpCoeffs_.integrate();
sCoeffs_ = CpCoeffs_.integrateMinus1();
// Offset h poly so that it is relative to the enthalpy at Tstd
hPolynomial_[0] += Hf_ - hPolynomial_.evaluate(specie::Tstd);
hCoeffs_[0] += Hf_ - hCoeffs_.evaluate(specie::Tstd);
// Offset s poly so that it is relative to the entropy at Tstd
sPolynomial_[0] += Sf_ - sPolynomial_.evaluate(specie::Tstd);
sCoeffs_[0] += Sf_ - sCoeffs_.evaluate(specie::Tstd);
}
......@@ -95,8 +95,8 @@ void Foam::hPolynomialThermo<EquationOfState, PolySize>::write
EquationOfState::write(os);
os.writeKeyword("Hf") << Hf_/this->W() << token::END_STATEMENT << nl;
os.writeKeyword("Sf") << Sf_/this->W() << token::END_STATEMENT << nl;
os.writeKeyword("cpPolynomial") << cpPolynomial_/this->W()
<< token::END_STATEMENT << nl;
os.writeKeyword(word("CpCoeffs<" + Foam::name(PolySize) + '>'))
<< CpCoeffs_/this->W() << token::END_STATEMENT << nl;
}
......@@ -112,7 +112,8 @@ Foam::Ostream& Foam::operator<<
os << static_cast<const EquationOfState&>(pt) << tab
<< pt.Hf_/pt.W() << tab
<< pt.Sf_/pt.W() << tab
<< "cpPolynomial" << tab << pt.cpPolynomial_/pt.W();
<< "CpCoeffs<" << Foam::name(PolySize) << '>' << tab
<< pt.CpCoeffs_/pt.W();
os.check
(
......
......@@ -107,14 +107,15 @@ class hPolynomialThermo
// Note: input in [J/kg/K], but internally uses [J/kmol/K]
scalar Sf_;
//- Specific heat at constant pressure [J/(kg.K)]
Polynomial<PolySize> cpPolynomial_;
//- Specific heat at constant pressure polynomial coeffs [J/(kg.K)]
Polynomial<PolySize> CpCoeffs_;
//- Enthalpy - derived from cp [J/kg] - relative to Tstd
typename Polynomial<PolySize>::intPolyType hPolynomial_;
//- Enthalpy polynomial coeffs - derived from cp [J/kg]
// NOTE: relative to Tstd
typename Polynomial<PolySize>::intPolyType hCoeffs_;
//- Entropy - derived from cp [J/(kg.K)] - relative to Tstd
Polynomial<PolySize> sPolynomial_;
//- Entropy - derived from Cp [J/(kg.K)] - relative to Tstd
Polynomial<PolySize> sCoeffs_;
// Private Member Functions
......@@ -125,9 +126,9 @@ class hPolynomialThermo
const EquationOfState& pt,
const scalar Hf,
const scalar Sf,
const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& hPoly,
const Polynomial<PolySize>& sPoly
const Polynomial<PolySize>& CpCoeffs,
const typename Polynomial<PolySize>::intPolyType& hCoeffs,
const Polynomial<PolySize>& sCoeffs
);
......
......@@ -33,17 +33,17 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
const EquationOfState& pt,
const scalar Hf,
const scalar Sf,
const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& hPoly,
const Polynomial<PolySize>& sPoly
const Polynomial<PolySize>& CpCoeffs,
const typename Polynomial<PolySize>::intPolyType& hCoeffs,
const Polynomial<PolySize>& sCoeffs
)
:
EquationOfState(pt),
Hf_(Hf),
Sf_(Sf),
cpPolynomial_(cpPoly),
hPolynomial_(hPoly),
sPolynomial_(sPoly)
CpCoeffs_(CpCoeffs),
hCoeffs_(hCoeffs),
sCoeffs_(sCoeffs)
{}
......@@ -58,9 +58,9 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
EquationOfState(pt),
Hf_(pt.Hf_),
Sf_(pt.Sf_),
cpPolynomial_(pt.cpPolynomial_),
hPolynomial_(pt.hPolynomial_),
sPolynomial_(pt.sPolynomial_)
CpCoeffs_(pt.CpCoeffs_),
hCoeffs_(pt.hCoeffs_),
sCoeffs_(pt.sCoeffs_)
{}
......@@ -74,9 +74,9 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
EquationOfState(name, pt),
Hf_(pt.Hf_),
Sf_(pt.Sf_),
cpPolynomial_(pt.cpPolynomial_),
hPolynomial_(pt.hPolynomial_),
sPolynomial_(pt.sPolynomial_)
CpCoeffs_(pt.CpCoeffs_),
hCoeffs_(pt.hCoeffs_),
sCoeffs_(pt.sCoeffs_)
{}
......@@ -88,7 +88,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::cp
const scalar T
) const
{
return cpPolynomial_.evaluate(T);
return CpCoeffs_.evaluate(T);
}
......@@ -98,7 +98,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::h
const scalar T
) const
{
return hPolynomial_.evaluate(T);
return hCoeffs_.evaluate(T);
}
......@@ -126,7 +126,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s
const scalar T
) const
{
return sPolynomial_.evaluate(T);
return sCoeffs_.evaluate(T);
}
......@@ -143,9 +143,9 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::operator=
Hf_ = pt.Hf_;
Sf_ = pt.Sf_;
cpPolynomial_ = pt.cpPolynomial_;
hPolynomial_ = pt.hPolynomial_;
sPolynomial_ = pt.sPolynomial_;
CpCoeffs_ = pt.CpCoeffs_;
hCoeffs_ = pt.hCoeffs_;
sCoeffs_ = pt.sCoeffs_;
return *this;
}
......@@ -166,9 +166,9 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator+=
Hf_ = molr1*Hf_ + molr2*pt.Hf_;
Sf_ = molr1*Sf_ + molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ + molr2*pt.cpPolynomial_;
hPolynomial_ = molr1*hPolynomial_ + molr2*pt.hPolynomial_;
sPolynomial_ = molr1*sPolynomial_ + molr2*pt.sPolynomial_;
CpCoeffs_ = molr1*CpCoeffs_ + molr2*pt.CpCoeffs_;
hCoeffs_ = molr1*hCoeffs_ + molr2*pt.hCoeffs_;
sCoeffs_ = molr1*sCoeffs_ + molr2*pt.sCoeffs_;
}
......@@ -187,9 +187,9 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator-=
Hf_ = molr1*Hf_ - molr2*pt.Hf_;
Sf_ = molr1*Sf_ - molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ - molr2*pt.cpPolynomial_;
hPolynomial_ = molr1*hPolynomial_ - molr2*pt.hPolynomial_;
sPolynomial_ = molr1*sPolynomial_ - molr2*pt.sPolynomial_;
CpCoeffs_ = molr1*CpCoeffs_ - molr2*pt.CpCoeffs_;
hCoeffs_ = molr1*hCoeffs_ - molr2*pt.hCoeffs_;
sCoeffs_ = molr1*sCoeffs_ - molr2*pt.sCoeffs_;
}
......@@ -223,9 +223,9 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator+
eofs,
molr1*pt1.Hf_ + molr2*pt2.Hf_,
molr1*pt1.Sf_ + molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ + molr2*pt2.cpPolynomial_,
molr1*pt1.hPolynomial_ + molr2*pt2.hPolynomial_,
molr1*pt1.sPolynomial_ + molr2*pt2.sPolynomial_
molr1*pt1.CpCoeffs_ + molr2*pt2.CpCoeffs_,
molr1*pt1.hCoeffs_ + molr2*pt2.hCoeffs_,
molr1*pt1.sCoeffs_ + molr2*pt2.sCoeffs_
);
}
......@@ -248,9 +248,9 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator-
eofs,
molr1*pt1.Hf_ - molr2*pt2.Hf_,
molr1*pt1.Sf_ - molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ - molr2*pt2.cpPolynomial_,
molr1*pt1.hPolynomial_ - molr2*pt2.hPolynomial_,
molr1*pt1.sPolynomial_ - molr2*pt2.sPolynomial_
molr1*pt1.CpCoeffs_ - molr2*pt2.CpCoeffs_,
molr1*pt1.hCoeffs_ - molr2*pt2.hCoeffs_,
molr1*pt1.sCoeffs_ - molr2*pt2.sCoeffs_
);
}
......@@ -267,9 +267,9 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator*
s*static_cast<const EquationOfState&>(pt),
pt.Hf_,
pt.Sf_,
pt.cpPolynomial_,
pt.hPolynomial_,
pt.sPolynomial_
pt.CpCoeffs_,
pt.hCoeffs_,
pt.sCoeffs_
);
}
......
......@@ -32,11 +32,11 @@ template<class Thermo, int PolySize>
Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport(Istream& is)
:
Thermo(is),
muPolynomial_("muPolynomial", is),
kappaPolynomial_("kappaPolynomial", is)
muCoeffs_("muCoeffs<" + Foam::name(PolySize) + '>', is),
kappaCoeffs_("kappaCoeffs<" + Foam::name(PolySize) + '>', is)
{
muPolynomial_ *= this->W();
kappaPolynomial_ *= this->W();
muCoeffs_ *= this->W();
kappaCoeffs_ *= this->W();
}
......@@ -47,11 +47,11 @@ Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
)
:
Thermo(dict),
muPolynomial_(dict.lookup("muPolynomial")),
kappaPolynomial_(dict.lookup("kappaPolynomial"))
muCoeffs_(dict.lookup("muCoeffs<" + Foam::name(PolySize) + '>')),
kappaCoeffs_(dict.lookup("kappaCoeffs<" + Foam::name(PolySize) + '>'))
{
muPolynomial_ *= this->W();
kappaPolynomial_ *= this->W();
muCoeffs_ *= this->W();
kappaCoeffs_ *= this->W();
}
......@@ -63,11 +63,11 @@ void Foam::polynomialTransport<Thermo, PolySize>::write(Ostream& os) const
os << this->name() << endl;
os << token::BEGIN_BLOCK << incrIndent << nl;
Thermo::write(os);
os.writeKeyword("muPolynomial") << muPolynomial_/this->W()
<< token::END_STATEMENT << nl;
os.writeKeyword("kappaPolynomial") << kappaPolynomial_/this->W()
<< token::END_STATEMENT << nl;
os << decrIndent << token::END_BLOCK << nl;
os.writeKeyword(word("muCoeffs<" + Foam::name(PolySize) + '>'))
<< muCoeffs_/this->W() << token::END_STATEMENT << nl;
os.writeKeyword(word("kappaCoeffs<" + Foam::name(PolySize) + '>'))
<< kappaCoeffs_/this->W() << token::END_STATEMENT << nl;
os << decrIndent << token::END_BLOCK << nl;
}
......@@ -81,8 +81,10 @@ Foam::Ostream& Foam::operator<<
)
{
os << static_cast<const Thermo&>(pt) << tab
<< "muPolynomial" << tab << pt.muPolynomial_/pt.W() << tab
<< "kappaPolynomial" << tab << pt.kappaPolynomial_/pt.W();
<< "muCoeffs<" << Foam::name(PolySize) << '>' << tab
<< pt.muCoeffs_/pt.W() << tab
<< "kappaCoeffs<" << Foam::name(PolySize) << '>' << tab
<< pt.kappaCoeffs_/pt.W();
os.check
(
......
......@@ -94,13 +94,13 @@ class polynomialTransport
{
// Private data
//- Dynamic viscosity
//- Dynamic viscosity polynomial coefficients
// Note: input in [Pa.s], but internally uses [Pa.s/kmol]
Polynomial<PolySize> muPolynomial_;
Polynomial<PolySize> muCoeffs_;
//- Thermal conductivity
//- Thermal conductivity polynomial coefficients
// Note: input in [W/m/K], but internally uses [W/m/K/kmol]
Polynomial<PolySize> kappaPolynomial_;
Polynomial<PolySize> kappaCoeffs_;
// Private Member Functions
......
......@@ -34,8 +34,8 @@ inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
)
:
Thermo(pt),
muPolynomial_(pt.muPolynomial_),
kappaPolynomial_(pt.kappaPolynomial_)
muCoeffs_(pt.muCoeffs_),
kappaCoeffs_(pt.kappaCoeffs_)
{}
......@@ -43,13 +43,13 @@ template<class Thermo, int PolySize>
inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
(
const Thermo& t,
const Polynomial<PolySize>& muPoly,
const Polynomial<PolySize>& kappaPoly
const Polynomial<PolySize>& muCoeffs,
const Polynomial<PolySize>& kappaCoeffs
)
:
Thermo(t),
muPolynomial_(muPoly),
kappaPolynomial_(kappaPoly)
muCoeffs_(muCoeffs),
kappaCoeffs_(kappaCoeffs)
{}
......@@ -61,8 +61,8 @@ inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
)
:
Thermo(name, pt),
muPolynomial_(pt.muPolynomial_),
kappaPolynomial_(pt.kappaPolynomial_)
muCoeffs_(pt.muCoeffs_),
kappaCoeffs_(pt.kappaCoeffs_)
{}
......@@ -107,7 +107,7 @@ inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
const scalar T
) const
{
return muPolynomial_.evaluate(T)/this->W();
return muCoeffs_.evaluate(T)/this->W();
}
......@@ -117,7 +117,7 @@ inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
const scalar T
) const
{
return kappaPolynomial_.evaluate(T)/this->W();
return kappaCoeffs_.evaluate(T)/this->W();