# cellMixture: multi-component mixture

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 30, 2009, 09:53 cellMixture: multi-component mixture #1 New Member   Maria Join Date: Apr 2009 Posts: 12 Rep Power: 9 Hi ! I think I have found a bug in the "calculate()" function of a multicomponent mixture. Let me go step by step: 1.- For multiComponentMixtures OpenFOAM calculates the cellMixture as: cellMixture = ForAll (i) { cellMixture += Y[i] / species[i].W() * speciesData[i] }; 2.- Enthalpy in hCombustionThermo is mass-based defined, meanwhile in specieThermo h is molar-based and H is mass-based. 3.- In hMixtureThermo::h (mass-based) h = ForAll(i) { += Y[i] / species[i].W() * speciesData[i].H() }; where, as far as I understand, this H[i] is the mass-based enthalpy calculated in specieThermo. 4.- Having a look at the units of the hMixtureThermo::h => [m^2 s^(-2)] != [-][Kmol_i Kg_i^(-1)]*[m^2 s^(-2)] Which IS DIMENSIONALLY INCORRECT!! ... It does the same for calculating alpha/mu of the mixture, which are defined also in a MASS basis. So: I guess it should be fixed replacing the current cellMixture-definition of multiComponentMixture by: cellMixture = ForAll (i) { cellMixture += Y[i] * speciesData[i] }; Is there really a bug..or I am missing something?? Regards! Last edited by mgc; July 1, 2009 at 04:14.

June 30, 2009, 12:18
#2
Super Moderator

Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 21
Quote:
 Originally Posted by mgc 1.- For multiComponentMixtures OpenFOAM calculates the cellMixture as: cellMixture = ForAll (i) { cellMixture += Y[i] / species[i].W() * speciesData[i] };
true, speciesData contain the polynomial coefficients for the individual components and cellMixture will after this contain the polynomial coefficients for the multicomponent mixture.

Quote:
 Originally Posted by mgc 2.- Enthalpy in hCombustionThermo is mass-based defined, meanwhile in specieThermo h is molar-based and H is mass-based.
h in hCombustionThermo is indeed per mass, whereas it is per mole in specieThermo.
This is an inconsistency in the naming convention.

Quote:
 Originally Posted by mgc 3.- In hMixtureThermo::h (mass-based) h = ForAll(i) { += Y[i] / species[i].W() * H[i] }; where, as far as I understand, this H[i] is the mass-based enthalpy calculated in specieThermo.
from where did you get this formula?
I cannot find it anywhere.
It looks like you have replaced speciesData in Q1 with H, which is incorrect.

All I can find in there that is fairly similar is this (which is correct):
Code:
```136 template<class MixtureType>
137 Foam::tmp<Foam::scalarField> Foam::hMixtureThermo<MixtureType>::h
138 (
139     const scalarField& T,
140     const labelList& cells
141 ) const
142 {
143     tmp<scalarField> th(new scalarField(T.size()));
144     scalarField& h = th();
145
146     forAll(T, celli)
147     {
148         h[celli] = this->cellMixture(cells[celli]).H(T[celli]);
149     }
150
151     return th;
152 }```
Quote:
 Originally Posted by mgc 4.- Having a look at the units of the hMixtureThermo::h => [m^2 s^(-2)] != [-][Kmol_i Kg_i^(-1)]*[m^2 s^(-2)] Which IS DIMENSIONALLY INCORRECT!! ... It does the same for calculating alpha/mu of the mixture, which are defined also in a MASS basis. So: I guess it should be fixed replacing the current cellMixture-definition of multiComponentMixture by: cellMixture = ForAll (i) { cellMixture += Y[i] * speciesData[i] }; Is there really a bug..or I am missing something??
I think there is an inconsistency in the naming convention which could be improved,
but all the code is correct.

I get the feeling you have started in the wrong end.
Looking at how nasa polynomials are defined, which is the speciesData.
(or it could just as well be janaf)
http://www.me.berkeley.edu/gri_mech/data/nasa_plnm.html

H/RT = a1 + a2 T /2 + a3 T^2 /3 + a4 T^3 /4 + a5 T^4 /5 + a6/T

unit for R is J/mol*K and the right hand side is dimensionless.
so H is in J/mol.
and if you want to calculate the enthalpy for the mixture you just add these
coefficients together on a molar fraction basis.
Thus the a1 coefficient for the mixture is sum of all its components = sum (X_i*a1_i)
That is what the for-loop does in Q1.

I hope all is clearer now

 June 30, 2009, 13:38 #3 New Member   Maria Join Date: Apr 2009 Posts: 12 Rep Power: 9 Finally, I got it. For those who could have the same doubt, I copy the key-point (in my opinion) to understand how the "cellMixture" works: //-------------------------------------------------------------------------------------------------------------- template const ThermoType& multiComponentMixture::cellMixture ( const label celli ) const { mixture_ = Y_[0][celli]/speciesData_[0].W()*speciesData_[0]; for (label n=1; n inline void janafThermo::*operator+=* ( const janafThermo& jt ) { scalar molr1 = this->nMoles(); equationOfState:: operator+=(jt); molr1 /= this->nMoles(); scalar molr2 = jt.nMoles()/this->nMoles(); Tlow_ = max(Tlow_, jt.Tlow_); Thigh_ = min(Thigh_, jt.Thigh_); Tcommon_ = molr1*Tcommon_ + molr2*jt.Tcommon_; for ( register label coefLabel=0; coefLabel::nCoeffs_; coefLabel++ ) { highCpCoeffs_[coefLabel] = molr1*highCpCoeffs_[coefLabel] + molr2*jt.highCpCoeffs_[coefLabel]; lowCpCoeffs_[coefLabel] = molr1*lowCpCoeffs_[coefLabel] + molr2*jt.lowCpCoeffs_[coefLabel]; } } Regards! María Last edited by mgc; July 15, 2009 at 05:57.

 May 12, 2013, 23:06 #4 New Member   何刚 Join Date: Jan 2011 Posts: 25 Rep Power: 7 So, we could only set janafThermo? And what about the hconstThermo?

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post mgc OpenFOAM 2 July 15, 2009 05:59 richpaj OpenFOAM Bugs 2 October 9, 2008 22:14 ranap Main CFD Forum 1 October 8, 2008 03:00 mahut FLUENT 0 October 10, 2007 04:05 Giosuč CD-adapco 0 June 11, 2004 05:18

All times are GMT -4. The time now is 08:46.

 Contact Us - CFD Online - Top