|
[Sponsors] |
Relation between enthalpy of single species and mixture |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 23, 2018, 11:37 |
Relation between enthalpy of single species and mixture
|
#1 |
Member
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 9 |
Hello,
I am using reactingFoam, on openfoam 6.0, and I have trouble to understand how exactly is the enthalpy of a single species calculated. According to me, the energy (sensible enthalpy in my case) of the mixture is supposed to be the summ of the mass fractions, times the energy of singles species. However, if i calculate the summ of sensible enthalpy of single species, i dont find the enthalpy of the mixture : Or with some simplified code : Code:
basicSpecieMixture& composition = thermo.composition(); volScalarField h_summ = thermo.he()*0.; forAll(Y,i) { h_summ += composition.Y[i] * composition.Hs(i,p,T) } h_summ != thermo.he() |
|
October 23, 2018, 14:53 |
|
#2 |
Member
Vince
Join Date: Mar 2017
Posts: 45
Rep Power: 9 |
Hi Benoit,
thermo.he() and thermo.Hs() do no have the same units: Code:
in thermo.H //- Enthalpy/Internal energy [J/kmol] inline scalar he(const scalar p, const scalar T) const; Code:
in SpecieMixture.H //- Sensible enthalpy [J/kg] virtual scalar Hs ( const label speciei, const scalar p, const scalar T ) const; You should be using thermo.Hs() instead for comparison. Thanks, Vince Last edited by hyFoam; October 24, 2018 at 03:59. Reason: clarification |
|
October 23, 2018, 21:38 |
|
#3 |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
Hi,
In OpenFOAM, mixture_ is a special species, it's properties is calculated according to mass fraction weighted average. If you are using a gasHThermoPhysics type of mixture_, then these properties are: Code:
Y_ moleWeight_ Tcommon_ Thigh_ Tlow_ highCpCoeffs_ lowCpCoeffs_ As_ Ts_ Code:
typedef sutherlandTransport < species::thermo < janafThermo < perfectGas<specie> >, sensibleEnthalpy > > gasHThermoPhysics; Tcommon_ Thigh_ Tlow_ highCpCoeffs_ lowCpCoeffs_ come from janafThermo; As_ Ts_ come from suterlandTransport. After mixture_ gets these properties, it is easy to get its enthalpy. |
|
October 24, 2018, 09:29 |
|
#4 | |
Member
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 9 |
Quote:
Unfortunately, there is no function Hs() in the class "hePsiThermo". Furthermore, it doesnt seems to be an issue with units, as the documentation says that both basicSpecieMixture::Hs() and basicThermo::he() are documented to be in J/kg. I made an experiment : I used two species "a" and "b" with the same molar mass. I put them in a constant temperature/pressure mesh, and i ploted the mixture's enthalpy for various "Ya" : mass fraction of a. (as the two species have the same molar mass, mass fraction is also molar fraction). The sensible enthalpy at my reference temperature of species a is Ha = 22.4, and for my species b Hb = 3.18E5 I compared "thermo.he()" with "ya*Ha + (1-Ya)*Hb" Here is the comparison plot i obtained : CFDonline.png Conclusion : thermo.he() is not a linear function of Ya. So i have no clue how to calculate it. |
||
October 24, 2018, 09:50 |
|
#5 | |
Member
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 9 |
Quote:
Here is an extract of my "thermophysicalProperties" dictionnary : Code:
thermoType { type hePsiThermo; mixture reactingMixture; transport sutherland; thermo janaf; energy sensibleEnthalpy; equationOfState perfectGas; specie specie; } According to the doc, hePsiThermo::he(p,T) is defined at line 164 of "heThermo.C", and it essentially do : Code:
heCells[celli] = this->cellMixture(celli).HE(pCells[celli], TCells[celli]); I guess that cellMixture is the function of "reactingMixture", inherited from "multiComponentMixture". It is defined at line 130 of "multicomponentMixture.C". Code:
const ThermoType& Foam::multiComponentMixture<ThermoType>::cellMixture ( const label celli ) const { mixture_ = Y_[0][celli]*speciesData_[0]; for (label n=1; n<Y_.size(); n++) { mixture_ += Y_[n][celli]*speciesData_[n]; } return mixture_; } Code:
sensibleEnthalpy mixture_ = multiComponentMixture::cellMixture(celli); heCells[celli] = mixture_.HE(pCells[celli], TCells[celli]); Code:
scalar HE ( const Thermo& thermo, const scalar p, const scalar T ) const { return thermo.Hs(p, T); } Last edited by Benben; October 25, 2018 at 05:03. |
||
October 24, 2018, 21:33 |
|
#6 |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
||
October 25, 2018, 03:30 |
|
#7 | |
Member
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 9 |
Quote:
According to your links, the object "mixture_" in : Code:
const ThermoType& Foam::multiComponentMixture<ThermoType>::cellMixture ( const label celli ) const { mixture_ = Y_[0][celli]*speciesData_[0]; for (label n=1; n<Y_.size(); n++) { mixture_ += Y_[n][celli]*speciesData_[n]; } return mixture_; } Code:
sutherlandTransport<species::thermo<janafThermo<perfectGas<specie>>,sensibleEnthalpy>> I looked up to find the exact template types of my "hePsiThermo" object, and i couldn't go to the end of the rabbit hole. The way it is constructed from my solver's "createFields.H" led me to "basicThermoTemplates.C", in the function "Foam::basicThermo::lookupThermo", where some macro dark magic happens (more info here). However, i found this : Code:
#define typedefThermoPhysics(Transport,Type,Thermo,EqnOfState,Specie) \ \ typedef \ Transport \ < \ species::thermo \ < \ Thermo \ < \ EqnOfState \ < \ Specie \ > \ >, \ Type \ > \ > \ Transport##Type##Thermo##EqnOfState##Specie #define defineThermoPhysicsThermo(BaseThermo,CThermo,Mixture,ThermoPhys) \ \ typedef \ CThermo \ < \ BaseThermo, \ Mixture<ThermoPhys> \ > \ CThermo##Mixture##ThermoPhys; \ \ defineTemplateTypeNameAndDebugWithName \ ( \ CThermo##Mixture##ThermoPhys, \ (#CThermo"<" + Mixture<ThermoPhys>::typeName() + ">").c_str(), \ 0 \ ) And, as my thermoProperties dictionnary looks like this : Code:
thermoType { type hePsiThermo; mixture reactingMixture; transport sutherland; thermo janaf; energy sensibleEnthalpy; equationOfState perfectGas; specie specie; } that my mixture type ("ThermoPhysics" in the macro) is of type : Code:
multiComponentMixture < sutherlandTransport < species::thermo < janafThermo<perfectGas<specie>>, sensibleEnthalpy > > > And my "hePsiThermo" thermo object ("ThermoPhysicsThermo" in the macro) is of type Code:
hePsiThermo < psiThermo, multiComponentMixture > Last edited by Benben; October 25, 2018 at 05:08. |
||
October 25, 2018, 05:05 |
|
#8 |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
Sorry for that the website's original language is Chinese.
I found that thermo in reactingFoam is defined by defineThermoPhysicsReactionThermo macro function, instead of defineThermoPhysicsThermo. And it's definition: Code:
#define defineThermoPhysicsReactionThermo(BaseReactionThermo,CThermo,Mixture,ThermoPhys) \ typedef CThermo//hePsiThermo \ < \ BaseReactionThermo,//psiReactionThermo \ SpecieMixture \ < \ Mixture//reactingMixture \ < \ ThermoPhys//sutherlandTransport \ > \ > \ > CThermo##Mixture##ThermoPhys; \ \ defineTemplateTypeNameAndDebugWithName \ ( \ CThermo##Mixture##ThermoPhys, \ (#CThermo"<" + Mixture<ThermoPhys>::typeName() + ">").c_str(), \ 0 \ ) Code:
hePsiThermo < psiReactionThermo, SpecieMixture < reactingMixture < sutherlandTransport < species::thermo < janafThermo<perfectGas<specie>>,sensibleEnthalpy > > > > > |
|
October 25, 2018, 05:33 |
|
#9 |
Member
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 9 |
God ... I just found out what was the problem
my initialization files were looking like this : Species A : Code:
internalField uniform 0.1; Code:
internalField uniform 1.; However, it has an impact on the calculation of the initial enthalpy of the system ! Which then calculates some garbage initial value for the enthalpy ... This is why i was'nt finding that However, this relation is exact, when i corrected my initialization of mass fraction, things went ok again. This is probably a bug btw, it should'nt behave like that. The summ of fraction should be set back to 1. before calculating the internal energy. Last edited by Benben; October 26, 2018 at 06:45. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
continuity problem in species of mixture Fluent | esi1520 | FLUENT | 7 | April 26, 2018 08:17 |
Selecting mixture of species as "mass-flow-inlet" on a surface using UDF | Bharadwaj B S | Fluent UDF and Scheme Programming | 0 | April 7, 2015 08:09 |
Enthalpy in a binary gas mixture | ChrisA | FLUENT | 0 | August 26, 2013 19:32 |
species transport model or mixture model?HELP | zhhjll | FLUENT | 3 | March 5, 2011 15:27 |
species transport model or mixture model? | achaokaoyan | Main CFD Forum | 0 | July 10, 2010 10:52 |