eReactingFoam-4.x/diffusivityModel/GasState/GasStateI.H
2018-11-12 09:05:09 -05:00

169 lines
3.6 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline void Foam::GasState::calculateW()
{
forAll(X_, i)
{
W_ += X_[i] * thermos(i).W();
}
}
inline void Foam::GasState::calculateX()
{
forAll(X_, i)
{
X_[i] = Y_[i] / thermos(i).W();
}
X_ /= Foam::sum(X_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::PtrList<Foam::GasState::thermoType> &Foam::GasState::thermos() const
{
return diffusivityModel::thermoData();
}
inline const Foam::GasState::thermoType &Foam::GasState::thermos(label i) const
{
return thermos()[i];
}
inline Foam::scalar Foam::GasState::T() const
{
return T_;
}
inline Foam::scalar &Foam::GasState::T()
{
return T_;
}
inline Foam::scalar Foam::GasState::p() const
{
return p_;
}
inline Foam::scalar &Foam::GasState::p()
{
return p_;
}
inline Foam::scalar Foam::GasState::Y(label i) const
{
return Y_[i];
}
inline const Foam::scalarField &Foam::GasState::Y() const
{
return Y_;
}
inline Foam::scalarField &Foam::GasState::Y()
{
return Y_;
}
inline const Foam::scalarField &Foam::GasState::X() const
{
return X_;
}
inline Foam::scalarField &Foam::GasState::X()
{
return X_;
}
inline Foam::scalar Foam::GasState::W() const
{
return W_;
}
inline Foam::scalar Foam::GasState::rho() const
{
return p_ * W_ / RR / T_;
}
inline Foam::scalar Foam::GasState::rhoQc2() const
{
scalar sumZN = 0.0;
forAll(X_, i)
{
sumZN += X_[i] * thermos(i).z();
}
return sumZN * (rho()/W())
* Foam::constant::electromagnetic::e.value()
* Foam::constant::physicoChemical::NA.value() * 1000.0;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //