canteraTransport species diffusivity and dummy for the other transport models
This commit is contained in:
parent
026a8eb2be
commit
bfdf807537
10 changed files with 195 additions and 7 deletions
|
|
@ -75,6 +75,9 @@ class constAnIsoSolidTransport
|
|||
//- Constant anisotropic thermal conductivity.
|
||||
vector kappa_;
|
||||
|
||||
//- Diffusivity cache
|
||||
mutable scalar Dcache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -126,6 +129,22 @@ public:
|
|||
//- Thermal diffusivity of enthalpy [kg/ms]
|
||||
inline vector alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const
|
||||
{Dcache_ = mu(p,T)/Thermo::rho(p,T);}
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const
|
||||
{return Dcache_;}
|
||||
|
||||
// Species mobility
|
||||
inline void muk(const scalar p, const scalar T) const
|
||||
{return D(p,T) * Thermo::z() * Thermo::e / Thermo::k / T;}
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const
|
||||
{return 0.0;}
|
||||
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ class constIsoSolidTransport
|
|||
//- Constant isotropic thermal conductivity
|
||||
scalar kappa_;
|
||||
|
||||
//- Diffusivity cache
|
||||
mutable scalar Dcache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -127,6 +130,22 @@ public:
|
|||
//- Thermal diffusivity of enthalpy [kg/ms]
|
||||
inline scalar alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const
|
||||
{Dcache_ = mu(p,T)/Thermo::rho(p,T);}
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const
|
||||
{return Dcache_;}
|
||||
|
||||
// Species mobility
|
||||
inline void muk(const scalar p, const scalar T) const
|
||||
{return D(p,T) * Thermo::z() * Thermo::e / Thermo::k / T;}
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const
|
||||
{return 0.0;}
|
||||
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,9 @@ class exponentialSolidTransport
|
|||
//- Reference temperature
|
||||
scalar Tref_;
|
||||
|
||||
//- Diffusivity cache
|
||||
mutable scalar Dcache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -136,6 +139,22 @@ public:
|
|||
//- Thermal diffusivity of enthalpy [kg/ms]
|
||||
inline scalar alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const
|
||||
{Dcache_ = mu(p,T)/Thermo::rho(p,T);}
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const
|
||||
{return Dcache_;}
|
||||
|
||||
// Species mobility
|
||||
inline void muk(const scalar p, const scalar T) const
|
||||
{return D(p,T) * Thermo::z() * Thermo::e / Thermo::k / T;}
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const
|
||||
{return 0.0;}
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ class polynomialSolidTransport
|
|||
// Note: input in [W/m/K]
|
||||
Polynomial<PolySize> kappaCoeffs_;
|
||||
|
||||
//- Diffusivity cache
|
||||
mutable scalar Dcache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -165,6 +168,22 @@ public:
|
|||
//- Thermal diffusivity of enthalpy [kg/ms]
|
||||
inline scalar alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const
|
||||
{Dcache_ = mu(p,T)/Thermo::rho(p,T);}
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const
|
||||
{return Dcache_;}
|
||||
|
||||
// Species mobility
|
||||
inline void muk(const scalar p, const scalar T) const
|
||||
{return D(p,T) * Thermo::z() * Thermo::e / Thermo::k / T;}
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const
|
||||
{return 0.0;}
|
||||
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ typename Foam::canteraTransport<Thermo>::canteraManager Foam::canteraTransport<T
|
|||
template<class Thermo>
|
||||
Foam::canteraTransport<Thermo>::canteraManager::canteraManager()
|
||||
:
|
||||
ready_ (false),
|
||||
gas_ (NULL),
|
||||
tr_ (NULL),
|
||||
nCanteraSp_ (0)
|
||||
|
|
@ -47,6 +48,7 @@ Foam::canteraTransport<Thermo>::canteraManager::canteraManager()
|
|||
gas_ = new Cantera::IdealGasMix("./cantera-transport.cti", "gas");
|
||||
tr_ = Cantera::newTransportMgr("Mix", gas_);
|
||||
nCanteraSp_ = gas_->nSpecies();
|
||||
ready_ = true;
|
||||
}
|
||||
catch (Cantera::CanteraError e)
|
||||
{
|
||||
|
|
@ -67,7 +69,8 @@ Foam::canteraTransport<Thermo>::canteraManager::~canteraManager()
|
|||
Foam::canteraTransport<Thermo>::canteraTransport(Istream& is)
|
||||
:
|
||||
Thermo(is),
|
||||
X_(cm_.gas()->nSpecies())
|
||||
temp_(cm_.nCanteraSp()),
|
||||
X_(cm_.nCanteraSp(), 0.0)
|
||||
{
|
||||
is.check("canteraTransport<Thermo>::canteraTransport(Istream&)");
|
||||
}
|
||||
|
|
@ -77,7 +80,8 @@ template<class Thermo>
|
|||
Foam::canteraTransport<Thermo>::canteraTransport(const dictionary& dict)
|
||||
:
|
||||
Thermo(dict),
|
||||
X_(cm_.gas()->nSpecies(), 0.0)
|
||||
temp_(cm_.nCanteraSp()),
|
||||
X_(cm_.nCanteraSp(), 0.0)
|
||||
{
|
||||
label si = cm_.gas()->speciesIndex(this->specie::name());
|
||||
if (si >= 0) X_[si] = this->nMoles();
|
||||
|
|
@ -134,7 +138,7 @@ Foam::scalar Foam::canteraTransport<Thermo>::mu
|
|||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::scalar Foam::canteraTransport<Thermo>::kappa
|
||||
Foam::scalar Foam::canteraTransport<Thermo>::kappa
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
|
|
@ -145,4 +149,28 @@ inline Foam::scalar Foam::canteraTransport<Thermo>::kappa
|
|||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
void Foam::canteraTransport<Thermo>::calculateDiffusivities
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
cm_.gas()->setState_TPX(T, p, X_.cdata());
|
||||
cm_.tr()->getMixDiffCoeffsMass(temp_.data());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
void Foam::canteraTransport<Thermo>::muk
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
cm_.gas()->setState_TPX(T, p, X_.cdata());
|
||||
cm_.tr()->getMixDiffCoeffsMass(temp_.data());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ class canteraTransport
|
|||
|
||||
class canteraManager
|
||||
{
|
||||
bool ready_;
|
||||
|
||||
Cantera::IdealGasMix *gas_;
|
||||
Cantera::Transport *tr_;
|
||||
label nCanteraSp_;
|
||||
|
|
@ -128,6 +130,8 @@ class canteraTransport
|
|||
|
||||
scalarField X_;
|
||||
|
||||
mutable scalarField temp_;
|
||||
|
||||
static canteraManager cm_;
|
||||
|
||||
|
||||
|
|
@ -190,8 +194,18 @@ public:
|
|||
//- 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;
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const;
|
||||
|
||||
// Species mobility
|
||||
void muk(const scalar p, const scalar T) const;
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const;
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ inline Foam::canteraTransport<Thermo>::canteraTransport
|
|||
)
|
||||
:
|
||||
Thermo(t),
|
||||
temp_(cm_.nCanteraSp()),
|
||||
X_(X)
|
||||
{}
|
||||
|
||||
|
|
@ -52,6 +53,7 @@ inline Foam::canteraTransport<Thermo>::canteraTransport
|
|||
)
|
||||
:
|
||||
Thermo(t),
|
||||
temp_(cm_.nCanteraSp()),
|
||||
X_(cm_.nCanteraSp())
|
||||
{
|
||||
}
|
||||
|
|
@ -65,6 +67,7 @@ inline Foam::canteraTransport<Thermo>::canteraTransport
|
|||
)
|
||||
:
|
||||
Thermo(name, st),
|
||||
temp_(cm_.nCanteraSp()),
|
||||
X_(st.X_)
|
||||
{}
|
||||
|
||||
|
|
@ -122,6 +125,25 @@ inline Foam::scalar Foam::canteraTransport<Thermo>::alphah
|
|||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::scalar Foam::canteraTransport<Thermo>::D
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
return temp_[i];
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
inline Foam::scalar Foam::canteraTransport<Thermo>::muk
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
return temp_[i];
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo>
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ class constTransport
|
|||
//- Reciprocal Prandtl Number []
|
||||
scalar rPr_;
|
||||
|
||||
//- Diffusivity cache
|
||||
mutable scalar Dcache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -153,7 +156,20 @@ public:
|
|||
inline scalar alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
//inline scalar D(const scalar p, const scalar T) const;
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const
|
||||
{Dcache_ = mu(p,T)/Thermo::rho(p,T);}
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const
|
||||
{return Dcache_;}
|
||||
|
||||
// Species mobility
|
||||
inline void muk(const scalar p, const scalar T) const
|
||||
{return D(p,T) * Thermo::z() * Thermo::e / Thermo::k / T;}
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const
|
||||
{return 0.0;}
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@ class polynomialTransport
|
|||
// Note: input in [W/m/K], but internally uses [W/m/K/kmol]
|
||||
Polynomial<PolySize> kappaCoeffs_;
|
||||
|
||||
//- Diffusivity cache
|
||||
mutable scalar Dcache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -158,7 +161,20 @@ public:
|
|||
inline scalar alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
//inline scalar D(const scalar p, const scalar T) const;
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const
|
||||
{Dcache_ = mu(p,T)/Thermo::rho(p,T);}
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const
|
||||
{return Dcache_;}
|
||||
|
||||
// Species mobility
|
||||
inline void muk(const scalar p, const scalar T) const
|
||||
{return D(p,T) * Thermo::z() * Thermo::e / Thermo::k / T;}
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const
|
||||
{return 0.0;}
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
|
|
|||
|
|
@ -103,6 +103,9 @@ class sutherlandTransport
|
|||
// Sutherland's coefficients
|
||||
scalar As_, Ts_;
|
||||
|
||||
//- Diffusivity cache
|
||||
mutable scalar Dcache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -172,7 +175,20 @@ public:
|
|||
inline scalar alphah(const scalar p, const scalar T) const;
|
||||
|
||||
// Species diffusivity
|
||||
//inline scalar D(const scalar p, const scalar T) const;
|
||||
void calculateDiffusivities(const scalar p, const scalar T) const
|
||||
{Dcache_ = mu(p,T)/Thermo::rho(p,T);}
|
||||
|
||||
// Species diffusivity
|
||||
inline scalar D(const label i) const
|
||||
{return Dcache_;}
|
||||
|
||||
// Species mobility
|
||||
inline void muk(const scalar p, const scalar T) const
|
||||
{return D(p,T) * Thermo::z() * Thermo::e / Thermo::k / T;}
|
||||
|
||||
// Species mobility
|
||||
inline scalar muk(const label i) const
|
||||
{return 0.0;}
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue