new species transport canteraTransport added from duplicate of sutherlandTransport
This commit is contained in:
parent
765926435b
commit
c0ea17f615
4 changed files with 654 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ Description
|
|||
#include "thermo.H"
|
||||
#include "sutherlandTransport.H"
|
||||
#include "constTransport.H"
|
||||
#include "canteraTransport.H"
|
||||
|
||||
#include "icoPolynomial.H"
|
||||
#include "hPolynomialThermo.H"
|
||||
|
|
@ -79,6 +80,19 @@ namespace Foam
|
|||
>
|
||||
> gasHThermoPhysics;
|
||||
|
||||
typedef
|
||||
canteraTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
janafThermo
|
||||
<
|
||||
perfectGas<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> canteraGasHThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
|
|
|
|||
|
|
@ -0,0 +1,89 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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 "canteraTransport.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
Foam::canteraTransport<Thermo>::canteraTransport(Istream& is)
|
||||
:
|
||||
Thermo(is),
|
||||
As_(readScalar(is)),
|
||||
Ts_(readScalar(is))
|
||||
{
|
||||
is.check("canteraTransport<Thermo>::canteraTransport(Istream&)");
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
Foam::canteraTransport<Thermo>::canteraTransport(const dictionary& dict)
|
||||
:
|
||||
Thermo(dict),
|
||||
As_(readScalar(dict.subDict("transport").lookup("As"))),
|
||||
Ts_(readScalar(dict.subDict("transport").lookup("Ts")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
void Foam::canteraTransport<Thermo>::write(Ostream& os) const
|
||||
{
|
||||
os << this->specie::name() << endl;
|
||||
os << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
|
||||
Thermo::write(os);
|
||||
|
||||
dictionary dict("transport");
|
||||
dict.add("As", As_);
|
||||
dict.add("Ts", Ts_);
|
||||
os << indent << dict.dictName() << dict;
|
||||
|
||||
os << decrIndent << token::END_BLOCK << nl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const canteraTransport<Thermo>& st
|
||||
)
|
||||
{
|
||||
os << static_cast<const Thermo&>(st) << tab << st.As_ << tab << st.Ts_;
|
||||
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<(Ostream&, const canteraTransport<Thermo>&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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::canteraTransport
|
||||
|
||||
Description
|
||||
Transport package using Sutherland's formula.
|
||||
|
||||
Templated into a given thermodynamics package (needed for thermal
|
||||
conductivity).
|
||||
|
||||
Dynamic viscosity [kg/m.s]
|
||||
\f[
|
||||
\mu = A_s \frac{\sqrt{T}}{1 + T_s / T}
|
||||
\f]
|
||||
|
||||
SourceFiles
|
||||
canteraTransportI.H
|
||||
canteraTransport.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef canteraTransport_H
|
||||
#define canteraTransport_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class Thermo> class canteraTransport;
|
||||
|
||||
template<class Thermo>
|
||||
inline canteraTransport<Thermo> operator+
|
||||
(
|
||||
const canteraTransport<Thermo>&,
|
||||
const canteraTransport<Thermo>&
|
||||
);
|
||||
|
||||
template<class Thermo>
|
||||
inline canteraTransport<Thermo> operator-
|
||||
(
|
||||
const canteraTransport<Thermo>&,
|
||||
const canteraTransport<Thermo>&
|
||||
);
|
||||
|
||||
template<class Thermo>
|
||||
inline canteraTransport<Thermo> operator*
|
||||
(
|
||||
const scalar,
|
||||
const canteraTransport<Thermo>&
|
||||
);
|
||||
|
||||
template<class Thermo>
|
||||
inline canteraTransport<Thermo> operator==
|
||||
(
|
||||
const canteraTransport<Thermo>&,
|
||||
const canteraTransport<Thermo>&
|
||||
);
|
||||
|
||||
template<class Thermo>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const canteraTransport<Thermo>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class canteraTransport Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo>
|
||||
class canteraTransport
|
||||
:
|
||||
public Thermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Sutherland's coefficients
|
||||
scalar As_, Ts_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Calculate the Sutherland coefficients
|
||||
// given two viscosities and temperatures
|
||||
inline void calcCoeffs
|
||||
(
|
||||
const scalar mu1, const scalar T1,
|
||||
const scalar mu2, const scalar T2
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline canteraTransport
|
||||
(
|
||||
const Thermo& t,
|
||||
const scalar As,
|
||||
const scalar Ts
|
||||
);
|
||||
|
||||
//- Construct from two viscosities
|
||||
inline canteraTransport
|
||||
(
|
||||
const Thermo& t,
|
||||
const scalar mu1, const scalar T1,
|
||||
const scalar mu2, const scalar T2
|
||||
);
|
||||
|
||||
//- Construct as named copy
|
||||
inline canteraTransport(const word&, const canteraTransport&);
|
||||
|
||||
//- Construct from Istream
|
||||
canteraTransport(Istream&);
|
||||
|
||||
//- Construct from dictionary
|
||||
canteraTransport(const dictionary& dict);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<canteraTransport> clone() const;
|
||||
|
||||
// Selector from Istream
|
||||
inline static autoPtr<canteraTransport> New(Istream& is);
|
||||
|
||||
// Selector from dictionary
|
||||
inline static autoPtr<canteraTransport> New(const dictionary& dict);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the instantiated type name
|
||||
static word typeName()
|
||||
{
|
||||
return "cantera<" + Thermo::typeName() + '>';
|
||||
}
|
||||
|
||||
//- Dynamic viscosity [kg/ms]
|
||||
inline scalar mu(const scalar p, const scalar T) const;
|
||||
|
||||
//- Thermal conductivity [W/mK]
|
||||
inline scalar kappa(const scalar p, const scalar T) const;
|
||||
|
||||
//- Thermal diffusivity of enthalpy [kg/ms]
|
||||
inline scalar alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
//inline scalar D(const scalar p, const scalar T) const;
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline canteraTransport& operator=(const canteraTransport&);
|
||||
|
||||
inline void operator+=(const canteraTransport&);
|
||||
|
||||
inline void operator-=(const canteraTransport&);
|
||||
|
||||
inline void operator*=(const scalar);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend canteraTransport operator+ <Thermo>
|
||||
(
|
||||
const canteraTransport&,
|
||||
const canteraTransport&
|
||||
);
|
||||
|
||||
friend canteraTransport operator- <Thermo>
|
||||
(
|
||||
const canteraTransport&,
|
||||
const canteraTransport&
|
||||
);
|
||||
|
||||
friend canteraTransport operator* <Thermo>
|
||||
(
|
||||
const scalar,
|
||||
const canteraTransport&
|
||||
);
|
||||
|
||||
friend canteraTransport operator== <Thermo>
|
||||
(
|
||||
const canteraTransport&,
|
||||
const canteraTransport&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <Thermo>
|
||||
(
|
||||
Ostream&,
|
||||
const canteraTransport&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "canteraTransportI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "canteraTransport.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
@ -0,0 +1,306 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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 "specie.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
inline void Foam::canteraTransport<Thermo>::calcCoeffs
|
||||
(
|
||||
const scalar mu1, const scalar T1,
|
||||
const scalar mu2, const scalar T2
|
||||
)
|
||||
{
|
||||
scalar rootT1 = sqrt(T1);
|
||||
scalar mu1rootT2 = mu1*sqrt(T2);
|
||||
scalar mu2rootT1 = mu2*rootT1;
|
||||
|
||||
Ts_ = (mu2rootT1 - mu1rootT2)/(mu1rootT2/T1 - mu2rootT1/T2);
|
||||
|
||||
As_ = mu1*(1.0 + Ts_/T1)/rootT1;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo>::canteraTransport
|
||||
(
|
||||
const Thermo& t,
|
||||
const scalar As,
|
||||
const scalar Ts
|
||||
)
|
||||
:
|
||||
Thermo(t),
|
||||
As_(As),
|
||||
Ts_(Ts)
|
||||
{}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo>::canteraTransport
|
||||
(
|
||||
const Thermo& t,
|
||||
const scalar mu1, const scalar T1,
|
||||
const scalar mu2, const scalar T2
|
||||
)
|
||||
:
|
||||
Thermo(t)
|
||||
{
|
||||
calcCoeffs(mu1, T1, mu2, T2);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo>::canteraTransport
|
||||
(
|
||||
const word& name,
|
||||
const canteraTransport& st
|
||||
)
|
||||
:
|
||||
Thermo(name, st),
|
||||
As_(st.As_),
|
||||
Ts_(st.Ts_)
|
||||
{}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::autoPtr<Foam::canteraTransport<Thermo> >
|
||||
Foam::canteraTransport<Thermo>::clone() const
|
||||
{
|
||||
return autoPtr<canteraTransport<Thermo> >
|
||||
(
|
||||
new canteraTransport<Thermo>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::autoPtr<Foam::canteraTransport<Thermo> >
|
||||
Foam::canteraTransport<Thermo>::New
|
||||
(
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
return autoPtr<canteraTransport<Thermo> >
|
||||
(
|
||||
new canteraTransport<Thermo>(is)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::autoPtr<Foam::canteraTransport<Thermo> >
|
||||
Foam::canteraTransport<Thermo>::New
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return autoPtr<canteraTransport<Thermo> >
|
||||
(
|
||||
new canteraTransport<Thermo>(dict)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::scalar Foam::canteraTransport<Thermo>::mu
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return As_*::sqrt(T)/(1.0 + Ts_/T);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::scalar Foam::canteraTransport<Thermo>::kappa
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
scalar Cv_ = this->Cv(p, T);
|
||||
return mu(p, T)*Cv_*(1.32 + 1.77*this->R()/Cv_);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::scalar Foam::canteraTransport<Thermo>::alphah
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
|
||||
return kappa(p, T)/this->Cpv(p, T);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo>&
|
||||
Foam::canteraTransport<Thermo>::operator=
|
||||
(
|
||||
const canteraTransport<Thermo>& st
|
||||
)
|
||||
{
|
||||
Thermo::operator=(st);
|
||||
|
||||
As_ = st.As_;
|
||||
Ts_ = st.Ts_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline void Foam::canteraTransport<Thermo>::operator+=
|
||||
(
|
||||
const canteraTransport<Thermo>& st
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
Thermo::operator+=(st);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = st.nMoles()/this->nMoles();
|
||||
|
||||
As_ = molr1*As_ + molr2*st.As_;
|
||||
Ts_ = molr1*Ts_ + molr2*st.Ts_;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline void Foam::canteraTransport<Thermo>::operator-=
|
||||
(
|
||||
const canteraTransport<Thermo>& st
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
Thermo::operator-=(st);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = st.nMoles()/this->nMoles();
|
||||
|
||||
As_ = molr1*As_ - molr2*st.As_;
|
||||
Ts_ = molr1*Ts_ - molr2*st.Ts_;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline void Foam::canteraTransport<Thermo>::operator*=
|
||||
(
|
||||
const scalar s
|
||||
)
|
||||
{
|
||||
Thermo::operator*=(s);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo> Foam::operator+
|
||||
(
|
||||
const canteraTransport<Thermo>& st1,
|
||||
const canteraTransport<Thermo>& st2
|
||||
)
|
||||
{
|
||||
Thermo t
|
||||
(
|
||||
static_cast<const Thermo&>(st1) + static_cast<const Thermo&>(st2)
|
||||
);
|
||||
|
||||
scalar molr1 = st1.nMoles()/t.nMoles();
|
||||
scalar molr2 = st2.nMoles()/t.nMoles();
|
||||
|
||||
return canteraTransport<Thermo>
|
||||
(
|
||||
t,
|
||||
molr1*st1.As_ + molr2*st2.As_,
|
||||
molr1*st1.Ts_ + molr2*st2.Ts_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo> Foam::operator-
|
||||
(
|
||||
const canteraTransport<Thermo>& st1,
|
||||
const canteraTransport<Thermo>& st2
|
||||
)
|
||||
{
|
||||
Thermo t
|
||||
(
|
||||
static_cast<const Thermo&>(st1) - static_cast<const Thermo&>(st2)
|
||||
);
|
||||
|
||||
scalar molr1 = st1.nMoles()/t.nMoles();
|
||||
scalar molr2 = st2.nMoles()/t.nMoles();
|
||||
|
||||
return canteraTransport<Thermo>
|
||||
(
|
||||
t,
|
||||
molr1*st1.As_ - molr2*st2.As_,
|
||||
molr1*st1.Ts_ - molr2*st2.Ts_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const canteraTransport<Thermo>& st
|
||||
)
|
||||
{
|
||||
return canteraTransport<Thermo>
|
||||
(
|
||||
s*static_cast<const Thermo&>(st),
|
||||
st.As_,
|
||||
st.Ts_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::canteraTransport<Thermo> Foam::operator==
|
||||
(
|
||||
const canteraTransport<Thermo>& st1,
|
||||
const canteraTransport<Thermo>& st2
|
||||
)
|
||||
{
|
||||
return st2 - st1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Loading…
Add table
Reference in a new issue