CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Equation of State in Openfoam

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Chris Lucas

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2013, 09:54
Question Equation of State in Openfoam
  #1
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 13
hz283 is on a distinguished road
Hi All,

I have a question about the equation of state in Openfoam when the combustion or multi-gas simulation situation. I take the solver reactingFoam as example:

In this solver, thermodyanmic related is defined as follows:

00001 Info<< "Creating combustion model\n" << endl;
00002
00003 autoPtr<combustionModels:siChemistryCombustionMo del> combustion
00004 (
00005 combustionModels:siChemistryCombustionModel::New
00006 (
00007 mesh
00008 )
00009 );
00010
00011 psiChemistryModel& chemistry = combustion->pChemistry();
00012
00013 hsCombustionThermo& thermo = chemistry.thermo();

The desntiy is updated through EoS using thermo.rho(). Since hsCombustionThermo is the object, whose class is detrived from basicPsiThermo. So we can say that rho is calculated through psi_*p in basicPsiThermo. psi=/R()*T. For combustion or multi-gas situation, the composition in each cell should be different, I think this is directly shown in the gas constant (p=rho*Ru*T/W, W is average mocular weight of the mixture for each cell). In Openfoam, this influence should be related to psi=1/R()*T. I check the code, i.e., perfectgas.C, but I failed to find some information about if this treatment is made. Is calculation of psi_ totally the same for combsution case and single gas case in Openfoam?

Does anyboby know something about this? Your any suggestion and comments are very welcome. Thank you very much.

best regards,
H
hz283 is offline   Reply With Quote

Old   January 9, 2013, 10:15
Default
  #2
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
adhiraj is on a distinguished road
I was checking the file
Code:
$FOAM_SRC/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C
it seems that if you follow the call to
Code:
correct()
from the reactingFOAM solver you get to a point where at the cell level, the psi values for the mixture are computed.
Hope this helps.
adhiraj is offline   Reply With Quote

Old   January 9, 2013, 11:26
Default
  #3
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 13
hz283 is on a distinguished road
Hi Adhiraj,

Thank you so much! Your answer exactly solve my problem.

best regards,
H
hz283 is offline   Reply With Quote

Old   January 9, 2013, 11:41
Default
  #4
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 13
hz283 is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
I was checking the file
Code:
$FOAM_SRC/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C
it seems that if you follow the call to
Code:
correct()
from the reactingFOAM solver you get to a point where at the cell level, the psi values for the mixture are computed.
Hope this helps.
Hi Adhiraj,

Can I ask you another question about EoS:

In specieI.H, the molecular weight, gas constant and mole amount is defined/calculated as follows:

00085 inline scalar specie::W() const
00086 {
00087 return molWeight_;
00088 }
00089
00090
00091 inline scalar specie::nMoles() const
00092 {
00093 return nMoles_;
00094 }
00095
00096
00097 inline scalar specie::R() const
00098 {
00099 return RR/molWeight_;
00100 }

My question is where is molWeight_ is calculated ? As you know, for tutorials of reactingFoam, the fuel and oxidizer's molecular weight are given in the file thermo.compressibleGas. How is the molWeight_ calculated using these given molecular weight of individual species? Is molWeight_ the molecular of the mixture or single species?

Thank you very much.
hz283 is offline   Reply With Quote

Old   January 11, 2013, 03:49
Default
  #5
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 17
Chris Lucas is on a distinguished road
Hi,

you define the molar mass of your mixture components in the thermalphysicalProperties file in your case folder.

The operator* and operator+ function in the specie class calculate the mixture molar mass.

Kind Regards,

Christian

Last edited by Chris Lucas; January 11, 2013 at 09:58.
Chris Lucas is offline   Reply With Quote

Old   January 11, 2013, 10:25
Default
  #6
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 13
hz283 is on a distinguished road
Quote:
Originally Posted by Chris Lucas View Post
Hi,

you define the molar mass of your mixture components in the thermalphysicalProperties file in your case folder.

The operator* and operator+ function in the specie class calculate the mixture molar mass.

Kind Regards,

Christian
Hi Christian,

Thank you very much for your reply. In specieI.H, the operator * is defined as follows:

00149 inline specie operator+(const specie& st1, const specie& st2)
00150 {
00151 scalar sumNmoles = max(st1.nMoles_ + st2.nMoles_, SMALL);
00152
00153 return specie
00154 (
00155 sumNmoles,
00156 st1.nMoles_/sumNmoles*st1.molWeight_
00157 + st2.nMoles_/sumNmoles*st2.molWeight_
00158 );
00159 }

I have another question, here is the variable nMoles fixed during the run time? Because it is read into from the dictionary. Actually, for example, in combustion case, the composition (for example mass fraction, molar fraction and molar concentration of the major species) changes with the time for each point. This will directly make the average molecualr weight W change and thus the return values of R() changes. Do the quantities W and R change for each point with the time?

Is my unstanding correct? If not, I really appreciate it if you can point it out.

best regards,
H
hz283 is offline   Reply With Quote

Old   January 11, 2013, 10:51
Default
  #7
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 17
Chris Lucas is on a distinguished road
Hi,

R and W can change if the concentration changes.

Have a look at the mixture class you are using (e.g. homogenousMixture). Here, the mixture "object" is created.

However, you can find the way the mixture is created in the operator+ and operator* (of the classes in your thermo model e.g.the species class)

Kind Regards
Christian
Chris Lucas is offline   Reply With Quote

Old   January 11, 2013, 12:12
Default
  #8
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 13
hz283 is on a distinguished road
Quote:
Originally Posted by Chris Lucas View Post
Hi,

R and W can change if the concentration changes.

Have a look at the mixture class you are using (e.g. homogenousMixture). Here, the mixture "object" is created.

However, you can find the way the mixture is created in the operator+ and operator* (of the classes in your thermo model e.g.the species class)

Kind Regards
Christian
Hi Christian,

Thank you very much for your help. I check these classess about the mixture and indeed the two quantities R and W are defined. Do you mind if ask you another question? For instance, in reactingFoam, the mass fraction of these species will be calculated through spcies governing equations. How these mass fractions at each time step affact the nMoles? Is nMoles is molar amount of the individual species at each cell center for each time step? Because as you know the composition at each cell center will be affected by these mass fractions.

Thank you very much if you can give me some hints about this question.

best regads,
H
hz283 is offline   Reply With Quote

Old   January 15, 2013, 11:15
Default
  #9
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 17
Chris Lucas is on a distinguished road
Hi,

nMoles depends on the concentration.

The answer to your question is in the mixture class e.g. "homogenousMixture" in the function mixture.

Kind Regards,
Christian
wayne14 likes this.
Chris Lucas is offline   Reply With Quote

Old   March 26, 2015, 14:14
Default thermophysical properties
  #10
New Member
 
Sahand Etemad
Join Date: Mar 2015
Location: Calgary
Posts: 1
Rep Power: 0
sahand92 is on a distinguished road
hello
i wonder if you can help me, i really don't know if for example i want to change EOS from perfect fluid to polynomial, which parameters should be deleted and which new parameters will be introduce,
ill appreciate if you can help me,
sahand92 is offline   Reply With Quote

Old   January 7, 2016, 02:36
Default
  #11
Member
 
Join Date: Jul 2015
Posts: 33
Rep Power: 10
KeiJun is on a distinguished road
Dear Sir,

I am trying to customize reactingFoam solver, and above threads are very helpful for R and W.

Well, I want to add new equations to the solver, which include R or W (each value varies every time and every cells according the concentration, doesn't it?).

However, I don't understand how to access these values in specieI.H.
I have tried "specie::R()" since I recognize "specie" as class,
but the error:
cannot call member function 'Foam::scalar Foam ::specie::R() const' without object
has come.

Could you teach me the way to refer the calculated R and W?


Thanks in advance,

KeiJun
KeiJun is offline   Reply With Quote

Old   January 17, 2016, 10:15
Default
  #12
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 17
Chris Lucas is on a distinguished road
Hi,

you can get W in the mixture class (or at least write a function that gives you access to W)

Christian
Chris Lucas is offline   Reply With Quote

Old   January 18, 2016, 02:22
Default
  #13
Member
 
Join Date: Jul 2015
Posts: 33
Rep Power: 10
KeiJun is on a distinguished road
Hi,

I'm sorry but I am not familiar with C++ and OpenFOAM programming.
I don't understand what you say.

I tried discribing such as:
1. volScalarField R = composition.species().R();
2. specie& specie = composition.species();
volScalarField R = specie.R();
where composition is defined as
basicMultiComponentMixture& composition = thermo.composition();

But the error has come in each trial:
1. 'const speciesTable' has no member named 'R'
2. invalid initialization of reference of type 'Foam::specie&' from expression of type 'const speciesTable {aka const Foam::hashedWordList}'

What should I do to get W in the mixture class?


Sincerely,

KeiJun
KeiJun is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hentalpy equation openfoam - miss a term lions85 OpenFOAM 2 August 18, 2010 12:12
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 05:56
Equation of state for water? jinwon park Main CFD Forum 2 December 20, 2007 07:32
Redlich kwong equation of state for drysteam Pankaj CFX 3 May 8, 2007 16:20
Equation of state for liquid russo Main CFD Forum 3 October 22, 2005 04:50


All times are GMT -4. The time now is 15:50.