mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
adding polynomial thermo package
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
atomicWeights = atomicWeights
|
||||
specie = specie
|
||||
speciesTable = speciesTable
|
||||
perfectGas = equationOfState/perfectGas
|
||||
equationOfState = equationOfState
|
||||
reactions = reaction/reactions
|
||||
|
||||
$(atomicWeights)/atomicWeights.C
|
||||
$(specie)/specie.C
|
||||
$(speciesTable)/speciesTable.C
|
||||
$(perfectGas)/perfectGas.C
|
||||
$(equationOfState)/perfectGas/perfectGas.C
|
||||
$(equationOfState)/icoPolynomial/makeIcoPolynomials.C
|
||||
$(reactions)/makeChemkinReactions.C
|
||||
$(reactions)/makeLangmuirHinshelwoodReactions.C
|
||||
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "icoPolynomial.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<int PolySize>
|
||||
icoPolynomial<PolySize>::icoPolynomial(Istream& is)
|
||||
:
|
||||
specie(is),
|
||||
rhoPolynomial_("rhoPolynomial", is)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<int PolySize>
|
||||
Ostream& operator<<(Ostream& os, const icoPolynomial<PolySize>& ip)
|
||||
{
|
||||
os << static_cast<const specie&>(ip);
|
||||
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<(Ostream& os, const icoPolynomial<PolySize>& ip)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,214 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
Class
|
||||
Foam::icoPolynomial
|
||||
|
||||
Description
|
||||
Incompressible, polynomial form of equation of state, using a polynomial
|
||||
function for density.
|
||||
|
||||
SourceFiles
|
||||
icoPolynomialI.H
|
||||
icoPolynomial.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef icoPolynomial_H
|
||||
#define icoPolynomial_H
|
||||
|
||||
#include "specie.H"
|
||||
#include "autoPtr.H"
|
||||
#include "Polynomial.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<int PolySize>
|
||||
class icoPolynomial;
|
||||
|
||||
template<int PolySize>
|
||||
icoPolynomial<PolySize> operator+
|
||||
(
|
||||
const icoPolynomial<PolySize>&,
|
||||
const icoPolynomial<PolySize>&
|
||||
);
|
||||
|
||||
template<int PolySize>
|
||||
icoPolynomial<PolySize> operator-
|
||||
(
|
||||
const icoPolynomial<PolySize>&,
|
||||
const icoPolynomial<PolySize>&
|
||||
);
|
||||
|
||||
template<int PolySize>
|
||||
icoPolynomial<PolySize> operator*
|
||||
(
|
||||
const scalar,
|
||||
const icoPolynomial<PolySize>&
|
||||
);
|
||||
|
||||
template<int PolySize>
|
||||
icoPolynomial<PolySize> operator==
|
||||
(
|
||||
const icoPolynomial<PolySize>&,
|
||||
const icoPolynomial<PolySize>&
|
||||
);
|
||||
|
||||
template<int PolySize>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const icoPolynomial<PolySize>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class icoPolynomial Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<int PolySize>
|
||||
class icoPolynomial
|
||||
:
|
||||
public specie
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Density
|
||||
Polynomial<PolySize> rhoPolynomial_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
TypeName("icoPolynomial")
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline icoPolynomial
|
||||
(
|
||||
const specie& sp,
|
||||
const Polynomial<PolySize>& rhoPoly
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
icoPolynomial(Istream&);
|
||||
|
||||
//- Construct as named copy
|
||||
inline icoPolynomial(const word& name, const icoPolynomial&);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<icoPolynomial> clone() const;
|
||||
|
||||
// Selector from Istream
|
||||
inline static autoPtr<icoPolynomial> New(Istream& is);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- 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;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator+=(const icoPolynomial&);
|
||||
inline void operator-=(const icoPolynomial&);
|
||||
|
||||
inline void operator*=(const scalar);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend icoPolynomial operator+ <PolySize>
|
||||
(
|
||||
const icoPolynomial&,
|
||||
const icoPolynomial&
|
||||
);
|
||||
|
||||
friend icoPolynomial operator- <PolySize>
|
||||
(
|
||||
const icoPolynomial&,
|
||||
const icoPolynomial&
|
||||
);
|
||||
|
||||
friend icoPolynomial operator* <PolySize>
|
||||
(
|
||||
const scalar s,
|
||||
const icoPolynomial&
|
||||
);
|
||||
|
||||
friend icoPolynomial operator== <PolySize>
|
||||
(
|
||||
const icoPolynomial&,
|
||||
const icoPolynomial&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <PolySize>(Ostream&, const icoPolynomial&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeIcoPolynomial(PolySize) \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
icoPolynomial<PolySize>, \
|
||||
"icoPolynomial<"#PolySize">", \
|
||||
0 \
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "icoPolynomialI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "icoPolynomial.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,209 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "icoPolynomial.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<int PolySize>
|
||||
inline Foam::icoPolynomial<PolySize>::icoPolynomial
|
||||
(
|
||||
const specie& sp,
|
||||
const Polynomial<PolySize>& rhoPoly
|
||||
)
|
||||
:
|
||||
specie(sp),
|
||||
rhoPolynomial_(rhoPoly)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<int PolySize>
|
||||
inline Foam::icoPolynomial<PolySize>::icoPolynomial
|
||||
(
|
||||
const word& name,
|
||||
const icoPolynomial<PolySize>& ip
|
||||
)
|
||||
:
|
||||
specie(name, ip),
|
||||
rhoPolynomial_(ip.rhoPolynomial_)
|
||||
{}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
inline Foam::autoPtr<Foam::icoPolynomial<PolySize> >
|
||||
Foam::icoPolynomial<PolySize>::clone() const
|
||||
{
|
||||
return autoPtr<icoPolynomial<PolySize> >
|
||||
(
|
||||
new icoPolynomial<PolySize>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
inline Foam::autoPtr<Foam::icoPolynomial<PolySize> >
|
||||
Foam::icoPolynomial<PolySize>::New(Istream& is)
|
||||
{
|
||||
return autoPtr<icoPolynomial<PolySize> >(new icoPolynomial<PolySize>(is));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<int PolySize>
|
||||
inline Foam::scalar Foam::icoPolynomial<PolySize>::rho(scalar, scalar T) const
|
||||
{
|
||||
return rhoPolynomial_.evaluate(T);
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
inline Foam::scalar Foam::icoPolynomial<PolySize>::psi(scalar, scalar) const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
inline Foam::scalar Foam::icoPolynomial<PolySize>::Z(scalar, scalar) const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<int PolySize>
|
||||
inline void Foam::icoPolynomial<PolySize>::operator+=
|
||||
(
|
||||
const icoPolynomial<PolySize>& ip
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
specie::operator+=(ip);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = ip.nMoles()/this->nMoles();
|
||||
|
||||
rhoPolynomial_ = molr1*rhoPolynomial_ + molr2*ip.rhoPolynomial_;
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
inline void Foam::icoPolynomial<PolySize>::operator-=
|
||||
(
|
||||
const icoPolynomial<PolySize>& ip
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
specie::operator-=(ip);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = ip.nMoles()/this->nMoles();
|
||||
|
||||
rhoPolynomial_ = molr1*rhoPolynomial_ - molr2*ip.rhoPolynomial_;
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
inline void Foam::icoPolynomial<PolySize>::operator*=(const scalar s)
|
||||
{
|
||||
specie::operator*=(s);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<int PolySize>
|
||||
Foam::icoPolynomial<PolySize> Foam::operator+
|
||||
(
|
||||
const icoPolynomial<PolySize>& ip1,
|
||||
const icoPolynomial<PolySize>& ip2
|
||||
)
|
||||
{
|
||||
scalar mol1 = ip1.nMoles();
|
||||
scalar mol2 = ip2.nMoles();
|
||||
scalar nMoles = mol1 + mol2;
|
||||
|
||||
return icoPolynomial<PolySize>
|
||||
(
|
||||
static_cast<const specie&>(ip1)
|
||||
+ static_cast<const specie&>(ip2),
|
||||
(mol1/nMoles)*ip1.rhoPolynomial_ + (mol2/nMoles)*ip2.rhoPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::icoPolynomial<PolySize> Foam::operator-
|
||||
(
|
||||
const icoPolynomial<PolySize>& ip1,
|
||||
const icoPolynomial<PolySize>& ip2
|
||||
)
|
||||
{
|
||||
scalar mol1 = ip1.nMoles();
|
||||
scalar mol2 = ip2.nMoles();
|
||||
scalar nMoles = mol1 + mol2;
|
||||
|
||||
return icoPolynomial<PolySize>
|
||||
(
|
||||
static_cast<const specie&>(ip1)
|
||||
- static_cast<const specie&>(ip2),
|
||||
(mol1/nMoles)*ip1.rhoPolynomial_ - (mol2/nMoles)*ip2.rhoPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::icoPolynomial<PolySize> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const icoPolynomial<PolySize>& ip
|
||||
)
|
||||
{
|
||||
return icoPolynomial<PolySize>
|
||||
(
|
||||
s*static_cast<const specie&>(ip),
|
||||
ip.rhoPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::icoPolynomial<PolySize> Foam::operator==
|
||||
(
|
||||
const icoPolynomial<PolySize>& ip1,
|
||||
const icoPolynomial<PolySize>& ip2
|
||||
)
|
||||
{
|
||||
return ip2 - ip1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "icoPolynomial.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeIcoPolynomial(1)
|
||||
makeIcoPolynomial(2)
|
||||
makeIcoPolynomial(3)
|
||||
makeIcoPolynomial(4)
|
||||
makeIcoPolynomial(5)
|
||||
makeIcoPolynomial(6)
|
||||
makeIcoPolynomial(7)
|
||||
makeIcoPolynomial(8)
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,62 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "polynomialThermo.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
Foam::polynomialThermo<EquationOfState, PolySize>::polynomialThermo(Istream& is)
|
||||
:
|
||||
EquationOfState(is),
|
||||
Hf_(readScalar(is)),
|
||||
cpPolynomial_("cpPolynomial", is),
|
||||
dhPolynomial_("dhPolynomial", cpPolynomial_.integrate())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt
|
||||
)
|
||||
{
|
||||
os << static_cast<const EquationOfState&>(pt) << tab << pt.Hf_;
|
||||
|
||||
os.check
|
||||
(
|
||||
"operator<<(Ostream& os, const polynomialThermo<EquationOfState>& pt)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,211 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
Class
|
||||
Foam::polynomialThermo
|
||||
|
||||
Description
|
||||
Thermodynamics package templated on the equation of state, using polynomial
|
||||
functions for cp and h
|
||||
|
||||
SourceFiles
|
||||
polynomialThermoI.H
|
||||
polynomialThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef polynomialThermo_H
|
||||
#define polynomialThermo_H
|
||||
|
||||
#include "scalar.H"
|
||||
#include "Polynomial.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
class polynomialThermo;
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline polynomialThermo<EquationOfState, PolySize> operator+
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>&,
|
||||
const polynomialThermo<EquationOfState, PolySize>&
|
||||
);
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline polynomialThermo<EquationOfState, PolySize> operator-
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>&,
|
||||
const polynomialThermo<EquationOfState, PolySize>&
|
||||
);
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline polynomialThermo<EquationOfState, PolySize> operator*
|
||||
(
|
||||
const scalar,
|
||||
const polynomialThermo<EquationOfState, PolySize>&
|
||||
);
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline polynomialThermo<EquationOfState, PolySize> operator==
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>&,
|
||||
const polynomialThermo<EquationOfState, PolySize>&
|
||||
);
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const polynomialThermo<EquationOfState, PolySize>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polynomialThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
class polynomialThermo
|
||||
:
|
||||
public EquationOfState
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Heat of formation
|
||||
scalar Hf_;
|
||||
|
||||
//- Specific heat at constant pressure
|
||||
Polynomial<PolySize> cpPolynomial_;
|
||||
|
||||
//- Enthalpy - derived from cp
|
||||
typename Polynomial<PolySize>::intPolyType dhPolynomial_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Construct from components
|
||||
inline polynomialThermo
|
||||
(
|
||||
const EquationOfState& pt,
|
||||
const scalar Hf,
|
||||
const Polynomial<PolySize>& cpPoly,
|
||||
const typename Polynomial<PolySize>::intPolyType& hPoly
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
polynomialThermo(Istream& is);
|
||||
|
||||
//- Construct as a named copy
|
||||
inline polynomialThermo(const word&, const polynomialThermo&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Heat capacity at constant pressure [J/(kmol K)]
|
||||
inline scalar cp(const scalar T) const;
|
||||
|
||||
//- Enthalpy [J/kmol]
|
||||
inline scalar h(const scalar T) const;
|
||||
|
||||
//- Sensible enthalpy [J/kmol]
|
||||
inline scalar hs(const scalar T) const;
|
||||
|
||||
//- Chemical enthalpy [J/kmol]
|
||||
inline scalar hc() const;
|
||||
|
||||
//- Entropy [J/(kmol K)]
|
||||
inline scalar s(const scalar T) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator+=(const polynomialThermo&);
|
||||
inline void operator-=(const polynomialThermo&);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend polynomialThermo operator+ <EquationOfState, PolySize>
|
||||
(
|
||||
const polynomialThermo&,
|
||||
const polynomialThermo&
|
||||
);
|
||||
|
||||
friend polynomialThermo operator- <EquationOfState, PolySize>
|
||||
(
|
||||
const polynomialThermo&,
|
||||
const polynomialThermo&
|
||||
);
|
||||
|
||||
friend polynomialThermo operator* <EquationOfState, PolySize>
|
||||
(
|
||||
const scalar,
|
||||
const polynomialThermo&
|
||||
);
|
||||
|
||||
friend polynomialThermo operator== <EquationOfState, PolySize>
|
||||
(
|
||||
const polynomialThermo&,
|
||||
const polynomialThermo&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <EquationOfState, PolySize>
|
||||
(
|
||||
Ostream&,
|
||||
const polynomialThermo&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "polynomialThermoI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "polynomialThermo.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,235 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "polynomialThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::polynomialThermo<EquationOfState, PolySize>::polynomialThermo
|
||||
(
|
||||
const EquationOfState& pt,
|
||||
const scalar Hf,
|
||||
const Polynomial<PolySize>& cpPoly,
|
||||
const typename Polynomial<PolySize>::intPolyType& dhPoly
|
||||
)
|
||||
:
|
||||
EquationOfState(pt),
|
||||
Hf_(Hf),
|
||||
cpPolynomial_(cpPoly),
|
||||
dhPolynomial_(dhPoly)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::polynomialThermo<EquationOfState, PolySize>::polynomialThermo
|
||||
(
|
||||
const word& name,
|
||||
const polynomialThermo& pt
|
||||
)
|
||||
:
|
||||
EquationOfState(name, pt),
|
||||
Hf_(pt.Hf_),
|
||||
cpPolynomial_(pt.cpPolynomial_),
|
||||
dhPolynomial_(pt.dhPolynomial_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialThermo<EquationOfState, PolySize>::cp
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return cpPolynomial_.evaluate(T)*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialThermo<EquationOfState, PolySize>::h
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return (dhPolynomial_.evaluate(T) + Hf_)*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialThermo<EquationOfState, PolySize>::hs
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return dhPolynomial_.evaluate(T)*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialThermo<EquationOfState, PolySize>::hc()
|
||||
const
|
||||
{
|
||||
return Hf_*this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialThermo<EquationOfState, PolySize>::s
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
notImplemented("scalar polynomialThermo<EquationOfState>::s");
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline void Foam::polynomialThermo<EquationOfState, PolySize>::operator+=
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
EquationOfState::operator+=(pt);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = pt.nMoles()/this->nMoles();
|
||||
|
||||
Hf_ = molr1*Hf_ + molr2*pt.Hf_;
|
||||
cpPolynomial_ = molr1*cpPolynomial_ + molr2*pt.cpPolynomial_;
|
||||
dhPolynomial_ = molr1*dhPolynomial_ + molr2*pt.dhPolynomial_;
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline void Foam::polynomialThermo<EquationOfState, PolySize>::operator-=
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
EquationOfState::operator-=(pt);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = pt.nMoles()/this->nMoles();
|
||||
|
||||
Hf_ = molr1*Hf_ - molr2*pt.Hf_;
|
||||
cpPolynomial_ = molr1*cpPolynomial_ - molr2*pt.cpPolynomial_;
|
||||
dhPolynomial_ = molr1*dhPolynomial_ - molr2*pt.dhPolynomial_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::polynomialThermo<EquationOfState, PolySize> Foam::operator+
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt1,
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt2
|
||||
)
|
||||
{
|
||||
EquationOfState eofs
|
||||
(
|
||||
static_cast<const EquationOfState&>(pt1)
|
||||
+ static_cast<const EquationOfState&>(pt2)
|
||||
);
|
||||
|
||||
scalar molr1 = pt1.nMoles()/eofs.nMoles();
|
||||
scalar molr2 = pt2.nMoles()/eofs.nMoles();
|
||||
return polynomialThermo<EquationOfState, PolySize>
|
||||
(
|
||||
eofs,
|
||||
molr1*pt1.Hf_ + molr2*pt2.Hf_,
|
||||
molr1*pt1.cpPolynomial_ + molr2*pt2.cpPolynomial_,
|
||||
molr1*pt1.dhPolynomial_ + molr2*pt2.dhPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::polynomialThermo<EquationOfState, PolySize> Foam::operator-
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt1,
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt2
|
||||
)
|
||||
{
|
||||
EquationOfState eofs
|
||||
(
|
||||
static_cast<const EquationOfState&>(pt1)
|
||||
- static_cast<const EquationOfState&>(pt2)
|
||||
);
|
||||
|
||||
scalar molr1 = pt1.nMoles()/eofs.nMoles();
|
||||
scalar molr2 = pt2.nMoles()/eofs.nMoles();
|
||||
return polynomialThermo<EquationOfState, PolySize>
|
||||
(
|
||||
eofs,
|
||||
molr1*pt1.Hf_ - molr2*pt2.Hf_,
|
||||
molr1*pt1.cpPolynomial_ - molr2*pt2.cpPolynomial_,
|
||||
molr1*pt1.dhPolynomial_ - molr2*pt2.dhPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::polynomialThermo<EquationOfState, PolySize> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt
|
||||
)
|
||||
{
|
||||
return polynomialThermo<EquationOfState, PolySize>
|
||||
(
|
||||
s*static_cast<const EquationOfState&>(pt),
|
||||
pt.Hf_,
|
||||
pt.cpPolynomial_,
|
||||
pt.dhPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::polynomialThermo<EquationOfState, PolySize> Foam::operator==
|
||||
(
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt1,
|
||||
const polynomialThermo<EquationOfState, PolySize>& pt2
|
||||
)
|
||||
{
|
||||
return pt2 - pt1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "polynomialTransport.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport(Istream& is)
|
||||
:
|
||||
Thermo(is),
|
||||
muPolynomial_("muPolynomial", is),
|
||||
kappaPolynomial_("kappaPolynomial", is)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const polynomialTransport<Thermo, PolySize>& pt
|
||||
)
|
||||
{
|
||||
os << static_cast<const Thermo&>(pt);
|
||||
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<"
|
||||
"("
|
||||
"Ostream&, "
|
||||
"const polynomialTransport<Thermo, PolySize>&"
|
||||
")"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,206 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
Class
|
||||
Foam::polynomialTransport
|
||||
|
||||
Description
|
||||
Transport package using polynomial functions for mu and kappa
|
||||
|
||||
SourceFiles
|
||||
polynomialTransportI.H
|
||||
polynomialTransport.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef polynomialTransport_H
|
||||
#define polynomialTransport_H
|
||||
|
||||
#include "Polynomial.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class Thermo, int PolySize> class polynomialTransport;
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline polynomialTransport<Thermo, PolySize> operator+
|
||||
(
|
||||
const polynomialTransport<Thermo, PolySize>&,
|
||||
const polynomialTransport<Thermo, PolySize>&
|
||||
);
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline polynomialTransport<Thermo, PolySize> operator-
|
||||
(
|
||||
const polynomialTransport<Thermo, PolySize>&,
|
||||
const polynomialTransport<Thermo, PolySize>&
|
||||
);
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline polynomialTransport<Thermo, PolySize> operator*
|
||||
(
|
||||
const scalar,
|
||||
const polynomialTransport<Thermo, PolySize>&
|
||||
);
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline polynomialTransport<Thermo, PolySize> operator==
|
||||
(
|
||||
const polynomialTransport<Thermo, PolySize>&,
|
||||
const polynomialTransport<Thermo, PolySize>&
|
||||
);
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const polynomialTransport<Thermo, PolySize>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polynomialTransport Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
class polynomialTransport
|
||||
:
|
||||
public Thermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Dynamic viscosity
|
||||
Polynomial<PolySize> muPolynomial_;
|
||||
|
||||
//- Thermal conductivity
|
||||
Polynomial<PolySize> kappaPolynomial_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Construct from components
|
||||
inline polynomialTransport
|
||||
(
|
||||
const Thermo& t,
|
||||
const Polynomial<PolySize>& muPoly,
|
||||
const Polynomial<PolySize>& kappaPoly
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct as named copy
|
||||
inline polynomialTransport(const word&, const polynomialTransport&);
|
||||
|
||||
//- Construct from Istream
|
||||
polynomialTransport(Istream& is);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<polynomialTransport> clone() const;
|
||||
|
||||
// Selector from Istream
|
||||
inline static autoPtr<polynomialTransport> New(Istream& is);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Dynamic viscosity [kg/ms]
|
||||
inline scalar mu(const scalar T) const;
|
||||
|
||||
//- Thermal conductivity [W/mK]
|
||||
inline scalar kappa(const scalar T) const;
|
||||
|
||||
//- Thermal diffusivity for enthalpy [kg/ms]
|
||||
inline scalar alpha(const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
//inline scalar D(const scalar T) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline polynomialTransport& operator=(const polynomialTransport&);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend polynomialTransport operator+ <Thermo, PolySize>
|
||||
(
|
||||
const polynomialTransport&,
|
||||
const polynomialTransport&
|
||||
);
|
||||
|
||||
friend polynomialTransport operator- <Thermo, PolySize>
|
||||
(
|
||||
const polynomialTransport&,
|
||||
const polynomialTransport&
|
||||
);
|
||||
|
||||
friend polynomialTransport operator* <Thermo, PolySize>
|
||||
(
|
||||
const scalar,
|
||||
const polynomialTransport&
|
||||
);
|
||||
|
||||
friend polynomialTransport operator== <Thermo, PolySize>
|
||||
(
|
||||
const polynomialTransport&,
|
||||
const polynomialTransport&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <Thermo, PolySize>
|
||||
(
|
||||
Ostream&,
|
||||
const polynomialTransport&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "polynomialTransportI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "polynomialTransport.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,213 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "specie.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
|
||||
(
|
||||
const Thermo& t,
|
||||
const Polynomial<PolySize>& muPoly,
|
||||
const Polynomial<PolySize>& kappaPoly
|
||||
)
|
||||
:
|
||||
Thermo(t),
|
||||
muPolynomial_(muPoly),
|
||||
kappaPolynomial_(kappaPoly)
|
||||
{}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
|
||||
(
|
||||
const word& name,
|
||||
const polynomialTransport& pt
|
||||
)
|
||||
:
|
||||
Thermo(name, pt),
|
||||
muPolynomial_(pt.muPolynomial_),
|
||||
kappaPolynomial_(pt.kappaPolynomial_)
|
||||
{}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
|
||||
Foam::polynomialTransport<Thermo, PolySize>::clone() const
|
||||
{
|
||||
return autoPtr<polynomialTransport<Thermo, PolySize> >
|
||||
(
|
||||
new polynomialTransport<Thermo, PolySize>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
|
||||
Foam::polynomialTransport<Thermo, PolySize>::New(Istream& is)
|
||||
{
|
||||
return autoPtr<polynomialTransport<Thermo, PolySize> >
|
||||
(
|
||||
new polynomialTransport<Thermo, PolySize>(is)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return muPolynomial_.evaluate(T);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return kappaPolynomial_.evaluate(T);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alpha
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
scalar deltaT = T - specie::Tstd;
|
||||
scalar CpBar =
|
||||
(deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
|
||||
/(sqr(deltaT) + 1);
|
||||
|
||||
return kappa(T)/CpBar;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::polynomialTransport<Thermo, PolySize>&
|
||||
Foam::polynomialTransport<Thermo, PolySize>::operator=
|
||||
(
|
||||
const polynomialTransport<Thermo, PolySize>& pt
|
||||
)
|
||||
{
|
||||
Thermo::operator=(pt);
|
||||
|
||||
muPolynomial_ = pt.muPolynomial_;
|
||||
kappaPolynomial_ = pt.kappaPolynomial_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
|
||||
(
|
||||
const polynomialTransport<Thermo, PolySize>& pt1,
|
||||
const polynomialTransport<Thermo, PolySize>& pt2
|
||||
)
|
||||
{
|
||||
Thermo t
|
||||
(
|
||||
static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
|
||||
);
|
||||
|
||||
|
||||
scalar molr1 = pt1.nMoles()/t.nMoles();
|
||||
scalar molr2 = pt2.nMoles()/t.nMoles();
|
||||
|
||||
return polynomialTransport<Thermo, PolySize>
|
||||
(
|
||||
t,
|
||||
molr1*pt1.muPolynomial_ + molr2*pt2.muPolynomial_,
|
||||
molr1*pt1.kappaPolynomial_ + molr2*pt2.kappaPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
|
||||
(
|
||||
const polynomialTransport<Thermo, PolySize>& pt1,
|
||||
const polynomialTransport<Thermo, PolySize>& pt2
|
||||
)
|
||||
{
|
||||
Thermo t
|
||||
(
|
||||
static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
|
||||
);
|
||||
|
||||
scalar molr1 = pt1.nMoles()/t.nMoles();
|
||||
scalar molr2 = pt2.nMoles()/t.nMoles();
|
||||
|
||||
return polynomialTransport<Thermo, PolySize>
|
||||
(
|
||||
t,
|
||||
molr1*pt1.muPolynomial_ - molr2*pt2.muPolynomial_,
|
||||
molr1*pt1.kappaPolynomial_ - molr2*pt2.kappaPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const polynomialTransport<Thermo, PolySize>& pt
|
||||
)
|
||||
{
|
||||
return polynomialTransport<Thermo, PolySize>
|
||||
(
|
||||
s*static_cast<const Thermo&>(pt),
|
||||
pt.muPolynomial_,
|
||||
pt.kappaPolynomial_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, int PolySize>
|
||||
inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
|
||||
(
|
||||
const polynomialTransport<Thermo, PolySize>& pt1,
|
||||
const polynomialTransport<Thermo, PolySize>& pt2
|
||||
)
|
||||
{
|
||||
return pt2 - pt1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user