partially replacing argument passing by GasState object
This commit is contained in:
parent
bc4a6ce8dd
commit
094da99cfc
6 changed files with 142 additions and 26 deletions
|
|
@ -37,13 +37,13 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::PtrList<Foam::GasState::thermoType> &Foam::GasState::thermos()
|
||||
inline const Foam::PtrList<Foam::GasState::thermoType> &Foam::GasState::thermos() const
|
||||
{
|
||||
return diffusivityModel::thermoData();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::GasState::thermoType &Foam::GasState::thermos(label i)
|
||||
inline const Foam::GasState::thermoType &Foam::GasState::thermos(label i) const
|
||||
{
|
||||
return thermos()[i];
|
||||
}
|
||||
|
|
@ -58,9 +58,16 @@ Foam::GasState::GasState(const scalar p, const scalar T, const label n)
|
|||
:
|
||||
p_(p),
|
||||
T_(T),
|
||||
Y_(n, 0.0)
|
||||
Y_(n, 0.0),
|
||||
X_(n, 0.0)
|
||||
{
|
||||
Y_[0] = 1.0;
|
||||
X_[0] = 1.0;
|
||||
|
||||
forAll(X_, i)
|
||||
{
|
||||
W_ += X_[i] * thermos(i).W();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -68,11 +75,21 @@ Foam::GasState::GasState(const scalar p, const scalar T, const scalarField &Y)
|
|||
:
|
||||
p_(p),
|
||||
T_(T),
|
||||
Y_(Y)
|
||||
Y_(Y),
|
||||
X_(Y)
|
||||
{
|
||||
scalar sumY = Foam::sum(Y_);
|
||||
Y_ /= Foam::sum(Y_);
|
||||
|
||||
Y_ /= sumY;
|
||||
forAll(X_, i)
|
||||
{
|
||||
X_[i] /= thermos(i).W();
|
||||
}
|
||||
X_ /= Foam::sum(X_);
|
||||
|
||||
forAll(X_, i)
|
||||
{
|
||||
W_ += X_[i] * thermos(i).W();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -80,11 +97,21 @@ Foam::GasState::GasState(const scalar p, const scalar T, tmp<scalarField> Y)
|
|||
:
|
||||
p_(p),
|
||||
T_(T),
|
||||
Y_(Y)
|
||||
Y_(Y),
|
||||
X_(Y_)
|
||||
{
|
||||
scalar sumY = Foam::sum(Y_);
|
||||
Y_ /= Foam::sum(Y_);
|
||||
|
||||
Y_ /= sumY;
|
||||
forAll(X_, i)
|
||||
{
|
||||
X_[i] /= thermos(i).W();
|
||||
}
|
||||
X_ /= Foam::sum(X_);
|
||||
|
||||
forAll(X_, i)
|
||||
{
|
||||
W_ += X_[i] * thermos(i).W();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -92,7 +119,9 @@ Foam::GasState::GasState(const GasState& state)
|
|||
:
|
||||
p_(state.p_),
|
||||
T_(state.T_),
|
||||
Y_(state.Y_)
|
||||
Y_(state.Y_),
|
||||
X_(state.X_),
|
||||
W_(state.W_)
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ SourceFiles
|
|||
#define GasState_H
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "constants.H"
|
||||
#include "scalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
|
@ -69,15 +70,21 @@ public:
|
|||
private:
|
||||
// Private data
|
||||
|
||||
//- Description of data_
|
||||
//- Presssure [Pa]
|
||||
scalar p_;
|
||||
|
||||
//- Description of data_
|
||||
//- Temperature [k]
|
||||
scalar T_;
|
||||
|
||||
//- Description of data_
|
||||
//- Mass fractions
|
||||
scalarField Y_;
|
||||
|
||||
//- Mole fractions
|
||||
scalarField X_;
|
||||
|
||||
//- Mean molecular weight [kg/kmol]
|
||||
scalar W_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -88,9 +95,9 @@ private:
|
|||
void operator=(const GasState&);
|
||||
|
||||
//- Static data staticData
|
||||
inline const PtrList<thermoType> &thermos();
|
||||
inline const PtrList<thermoType> &thermos() const;
|
||||
|
||||
inline const thermoType &thermos(label i);
|
||||
inline const thermoType &thermos(label i) const;
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -141,6 +148,16 @@ public:
|
|||
|
||||
inline scalarField &Y();
|
||||
|
||||
inline const scalarField &X() const;
|
||||
|
||||
inline scalarField &X();
|
||||
|
||||
inline scalar W() const;
|
||||
|
||||
inline scalar rho() const;
|
||||
|
||||
inline scalar rhoQc2() const;
|
||||
|
||||
// Check
|
||||
|
||||
// Edit
|
||||
|
|
|
|||
|
|
@ -78,6 +78,42 @@ inline Foam::scalarField &Foam::GasState::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();
|
||||
}
|
||||
sumZN *= (rho()/W()) * Foam::constant::physicoChemical::NA.value() * 1000;
|
||||
return sumZN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ License
|
|||
#include "Coulomb.H"
|
||||
#include "N64.H"
|
||||
#include "CrossSection.H"
|
||||
#include "GasState.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
|
@ -47,10 +48,6 @@ const Foam::PtrList<Foam::gasHThermoPhysics> *Foam::diffusivityModel::thermoData
|
|||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
const Foam::PtrList<Foam::gasHThermoPhysics> &Foam::diffusivityModel::thermoData()
|
||||
{
|
||||
return *thermoData_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
|
@ -168,6 +165,16 @@ Foam::scalar Foam::diffusivityModel::mixAvgK(const UList<scalar>& k, const UList
|
|||
}
|
||||
|
||||
|
||||
void Foam::diffusivityModel::calculateMuD
|
||||
(
|
||||
UList<scalar> &muI,
|
||||
scalarSymmetricSquareMatrix &Dij,
|
||||
const GasState &state
|
||||
)
|
||||
{
|
||||
calculateMuD(muI, Dij, state.p(), state.T(), state.rhoQc2(), state.Y(), state.X());
|
||||
}
|
||||
|
||||
void Foam::diffusivityModel::calculateMuD
|
||||
(
|
||||
UList<scalar> &muI,
|
||||
|
|
@ -693,6 +700,7 @@ void Foam::diffusivityModel::correct()
|
|||
|
||||
forAll (p, celli)
|
||||
{
|
||||
|
||||
const scalar rhoi = rho[celli];
|
||||
const scalar pi = p[celli];
|
||||
const scalar Ti = T[celli];
|
||||
|
|
@ -705,8 +713,12 @@ void Foam::diffusivityModel::correct()
|
|||
localX[i] = Y[i][celli] * WbarI / Wpure[i];
|
||||
}
|
||||
|
||||
GasState state (pi, Ti, localY);
|
||||
|
||||
calculateMuD ( muI, Dij, pi, Ti, rhoQc2i, localY, localX);
|
||||
|
||||
// calculateMuD ( muI, Dij, state);
|
||||
|
||||
forAll (Dii, i)
|
||||
{
|
||||
Dii[i] = Dij(i,i);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class Stockmayer;
|
|||
class Coulomb;
|
||||
class N64;
|
||||
class CrossSection;
|
||||
class GasState;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
class diffusivityModel;
|
||||
|
|
@ -149,13 +150,29 @@ class diffusivityModel
|
|||
const scalar Ti
|
||||
);
|
||||
|
||||
inline void calculateMuD
|
||||
(
|
||||
UList<scalar> &muI,
|
||||
scalarSymmetricSquareMatrix &Dij,
|
||||
const GasState &state
|
||||
);
|
||||
|
||||
inline void calculateK
|
||||
(
|
||||
UList<scalar> &kI,
|
||||
const UList<scalar> &muI,
|
||||
const UList<scalar> &Dii,
|
||||
const UList<scalar> &Zrot,
|
||||
const GasState &state
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Static data staticData
|
||||
// static const dataType staticData;
|
||||
static const PtrList<gasHThermoPhysics> &thermoData();
|
||||
inline static const PtrList<gasHThermoPhysics> &thermoData();
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
|||
|
|
@ -36,38 +36,43 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::PtrList<Foam::gasHThermoPhysics> &Foam::diffusivityModel::thermoData()
|
||||
{
|
||||
return *thermoData_;
|
||||
}
|
||||
|
||||
Foam::volScalarField& Foam::diffusivityModel::D(const label i)
|
||||
|
||||
inline Foam::volScalarField& Foam::diffusivityModel::D(const label i)
|
||||
{
|
||||
return D_[i];
|
||||
}
|
||||
|
||||
|
||||
const Foam::volScalarField& Foam::diffusivityModel::D(const label i) const
|
||||
inline const Foam::volScalarField& Foam::diffusivityModel::D(const label i) const
|
||||
{
|
||||
return D_[i];
|
||||
}
|
||||
|
||||
|
||||
Foam::volScalarField& Foam::diffusivityModel::mu()
|
||||
inline Foam::volScalarField& Foam::diffusivityModel::mu()
|
||||
{
|
||||
return mu_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::volScalarField& Foam::diffusivityModel::mu() const
|
||||
inline const Foam::volScalarField& Foam::diffusivityModel::mu() const
|
||||
{
|
||||
return mu_;
|
||||
}
|
||||
|
||||
|
||||
Foam::volScalarField& Foam::diffusivityModel::k()
|
||||
inline Foam::volScalarField& Foam::diffusivityModel::k()
|
||||
{
|
||||
return k_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::volScalarField& Foam::diffusivityModel::k() const
|
||||
inline const Foam::volScalarField& Foam::diffusivityModel::k() const
|
||||
{
|
||||
return k_;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue