From 9fa8cd63eb0337f6d040866e3408d1849c804175 Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Mon, 6 Sep 2010 11:46:07 +0100 Subject: [PATCH] ENH: Implemented per specie info for mixtures --- .../mixtures/dieselMixture/dieselMixture.C | 185 +++++++++++++++++ .../mixtures/dieselMixture/dieselMixture.H | 54 +++++ .../mixtures/egrMixture/egrMixture.C | 185 +++++++++++++++++ .../mixtures/egrMixture/egrMixture.H | 54 +++++ .../homogeneousMixture/homogeneousMixture.C | 182 +++++++++++++++++ .../homogeneousMixture/homogeneousMixture.H | 54 +++++ .../inhomogeneousMixture.C | 186 ++++++++++++++++++ .../inhomogeneousMixture.H | 54 +++++ .../multiComponentMixture.C | 151 ++++++++++++++ .../multiComponentMixture.H | 51 +++++ .../veryInhomogeneousMixture.C | 186 ++++++++++++++++++ .../veryInhomogeneousMixture.H | 54 +++++ 12 files changed, 1396 insertions(+) diff --git a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C index d7d312735d7..014ef3da510 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C @@ -97,4 +97,189 @@ void Foam::dieselMixture<ThermoType>::read(const dictionary& thermoDict) } +template<class ThermoType> +const ThermoType& Foam::dieselMixture<ThermoType>::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::dieselMixture<ThermoType>::getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template<class ThermoType> +Foam::scalar Foam::dieselMixture<ThermoType>::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H index b0b46a88cc6..8625818a587 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H @@ -151,6 +151,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C index 7ba65975e82..06cf80a47f4 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C @@ -107,4 +107,189 @@ void Foam::egrMixture<ThermoType>::read(const dictionary& thermoDict) } +template<class ThermoType> +const ThermoType& Foam::egrMixture<ThermoType>::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::egrMixture<ThermoType>::getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template<class ThermoType> +Foam::scalar Foam::egrMixture<ThermoType>::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H index 0a9adf6aa72..95de13f321c 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H @@ -167,6 +167,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C index 89878ed40cb..eca7ffd0d5c 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C @@ -89,4 +89,186 @@ void Foam::homogeneousMixture<ThermoType>::read(const dictionary& thermoDict) } +template<class ThermoType> +const ThermoType& Foam::homogeneousMixture<ThermoType>::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return reactants_; + } + else if (specieI == 1) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::homogeneousMixture<ThermoType>::" + "getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..1" + << abort(FatalError); + + return reactants_; + } +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template<class ThermoType> +Foam::scalar Foam::homogeneousMixture<ThermoType>::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H index b03e63d7c73..a1fd589c833 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H @@ -125,6 +125,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C index 743aeff98b9..2ef52c112d0 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C @@ -101,4 +101,190 @@ void Foam::inhomogeneousMixture<ThermoType>::read(const dictionary& thermoDict) } +template<class ThermoType> +const ThermoType& Foam::inhomogeneousMixture<ThermoType>::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::inhomogeneousMixture<ThermoType>::" + "getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template<class ThermoType> +Foam::scalar Foam::inhomogeneousMixture<ThermoType>::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H index b4f9fc5f38f..163052a8480 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H @@ -156,6 +156,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C index a8575e037cf..a30dd5dd1ba 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C @@ -160,4 +160,155 @@ void Foam::multiComponentMixture<ThermoType>::read } +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::nMoles +( + const label specieI +) const +{ + return speciesData_[specieI].nMoles(); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::W +( + const label specieI +) const +{ + return speciesData_[specieI].W(); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::Cp +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].Cp(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::Cv +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].Cv(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::H +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].H(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::Hs +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].Hs(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::Hc +( + const label specieI +) const +{ + return speciesData_[specieI].Hc(); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::S +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].S(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::E +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].E(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::G +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].G(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::A +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].A(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::mu +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].mu(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::kappa +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].kappa(T); +} + + +template<class ThermoType> +Foam::scalar Foam::multiComponentMixture<ThermoType>::alpha +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H index 73d27f72cc0..b388e9c4110 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H @@ -118,6 +118,57 @@ public: //- Read dictionary void read(const dictionary&); + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C index 9781890b1ad..3684fc3e094 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C @@ -102,4 +102,190 @@ void Foam::veryInhomogeneousMixture<ThermoType>::read } +template<class ThermoType> +const ThermoType& Foam::veryInhomogeneousMixture<ThermoType>::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::veryInhomogeneousMixture<ThermoType>::" + "getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template<class ThermoType> +Foam::scalar Foam::veryInhomogeneousMixture<ThermoType>::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H index f58335f4e41..1ae7a369857 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H @@ -157,6 +157,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; -- GitLab