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

computation of K, cp, h and s ??

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 19, 2011, 12:27
Default computation of K, cp, h and s ??
  #1
Member
 
Tibo
Join Date: Jun 2011
Posts: 68
Rep Power: 14
megacrout is on a distinguished road
Hi everyone,

I am currently looking at the code behind combustion solvers, especially reactingFoam. I am interested in the way reversible reactions are implemented. I figured out that the reaction rate of the backward reaction is computed using the equilibrium constant K which is computed as

K = exp( - nMoles * g(T) / (RR * T) )

where the gibbs enthalpy is in turn computed as

g(T) = h(T) - T*s(T).

This means

K = exp ( - nMoles * (h(T) - T*s(T)) / (RR*T) )

where RR represents the reaction rate. This does not seem very close to

K = exp ( - (h(T) - T*s(T)) / (R*T) )
ī
where R is the gas constant, which is supposed to be the correct expression for the equilibrium constant (right ?).

Futhermore, I just CANT find in the online C++ documentation where cp(T), h(T) and s(T) are computed. I know that it is based on the Janaf parameters from which the heat capacity is also derived (http://cea.grc.nasa.gov/def_formats.htm). But I cannot find where this computation is being done, where the equation is implemented! And since all other thermophysical parameters are then derived from those three (as mentioned in the header of specieThermo.H for example), I really want to know where to find those equations in OF.

This is not the first time I spend a few hours looking for a specific equation so thatīd be a really great help if you can give me an answer. Even just a hint ahah!!

thx!

Tibo
megacrout is offline   Reply With Quote

Old   September 21, 2011, 05:18
Post
  #2
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 17
Chris Lucas is on a distinguished road
Hi,

I'm not sure what you want to know?

The specific values for cp ... are calculated in specieThermo using the molar values.

The molar values are calculated (depending in the model you use) e.g. in hConst or hPolynomial or janaf ...

Best Regards,
Christian
Chris Lucas is offline   Reply With Quote

Old   September 22, 2011, 03:58
Default
  #3
Member
 
Tibo
Join Date: Jun 2011
Posts: 68
Rep Power: 14
megacrout is on a distinguished road
Hi Chris,

Thanks for your answer.
Iīm trying to know how cp(T), h(T) and s(T) are computed (files AND formulas)? I canīt see what you mentioned: specieThermo contains the formulas for computing all thermophysicals parameters BUT the three Iīm looking for. Or I did miss something.
Where is - in the case of cp - the function hConst/hPolynomial/janaf being called? I did not find it in specieThermo (I must admit Iīm a C++ newbie, though).

As I mentioned, it is not the first time I get lost in the C++ documentation of OpenFOAM and in specieThermo is another good example: where is the parameter W() computed? It is used in ThermoI.H but I canīt find where its formula lies or even where it is being called.

Best regards,

Tibo
megacrout is offline   Reply With Quote

Old   September 22, 2011, 10:47
Default
  #4
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
adhiraj is on a distinguished road
I think it was janafthermo.
adhiraj is offline   Reply With Quote

Old   September 23, 2011, 02:39
Post
  #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

for W() have a look at the files in

$FOAM/src/thermophysicalModels/specie/specie

for cp, h ... look at

$FOAM/src/thermophysicalModels/specie/thermo/hConst

$FOAM/src/thermophysicalModels/specie/thermo/janaf

...

Best Regards,
Christian
Chris Lucas is offline   Reply With Quote

Old   September 26, 2011, 11:53
Default
  #6
Member
 
Tibo
Join Date: Jun 2011
Posts: 68
Rep Power: 14
megacrout is on a distinguished road
Hey Christian,

Thanks A LOT for the hints. I say "hints" because Iīve had to look for more details quite a long time before I could get what you mean.

The missing link were the files hsCombustionThermos.C and newhsCombustionThermo.C (which seems to have been renamed hsCombustionThermoNew.C in OF 2.0.1). Without the former file, there is no link between solver reactingFoam and the files specie or janaf/hConst/etc...

Now, I have a few more questions for you, I would greatly appreciate if you can further help me:
1) reactingFoam relies on the psiChemistrymodel (s. createFields.H), can one of the other models (rho, ODE, basic) be used as an option (i.e. without modifying the solverīs code)?
2) same question about hsCombustionThermo (s. createFields.H): could hCombustionModel, hhuCombustionModel or mixtureThermos be used instead, without altering reactingFoamīs structure, i.e. as an option?
3) Because reactingFoam relies on psiChemistrymodel and hsCombustionThermo, only 2 options can be given as thermoType in thermophysicalProperties:

hsPsiMixtureThermo<multiComponentMixture<gasThermo Physics>>
or
hsPsiMixtureThermo<reactingMixture<gasThermoPhysic s>>

and only 2 options can be given as psiChemistryModel in chemistryProperties:

ODEChemistryModel<gasThermoPhysics>
or
ODEChemistryModel<icoPoly8ThermoPhysics>

Is that right? If not, how can I implement another thermoType? Any attempt gave me error messages such as

"Inconsistent thermo package selected..."
or
"Unknown hsCombustionThermo type...""
4) If what I just wrote is right, then I still donīt see where hConst/specieThermo/janaf is called.

Finally, regarding my first post (still unanswered concerning reactions): I figured out in the meanwhile that RR is used for both reacting rate and gas constant depending on the file it is used in. However, I still do not get why nMoles appears in the mentioned equation. Can you help me?

Thx.

Tibo

Last edited by megacrout; September 27, 2011 at 06:04.
megacrout is offline   Reply With Quote

Old   October 11, 2011, 06:02
Default
  #7
Member
 
Tibo
Join Date: Jun 2011
Posts: 68
Rep Power: 14
megacrout is on a distinguished road
Anyone?
"Pretty please with sugar on top." (Harvey Keitel as Winston Wolf in Pulp Fiction)
megacrout is offline   Reply With Quote

Reply

Tags
code, reactingfoam, thermo, thermophysical parameters


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
problem in the CFX12.1 parallel computation BalanceChen ANSYS 2 July 7, 2011 10:26
Discussion on the computation of the multi-stage axial compressor BalanceChen CFX 5 January 5, 2011 02:23
How Star-cd v3.22 do parallelling computation? Williams Siemens 8 July 16, 2007 14:21
Cell face values computation un unstructured grids Sergio Rossi Main CFD Forum 2 May 28, 2006 10:04
Need for help for 3D airfoil computation D.T. Main CFD Forum 0 May 6, 2003 12:04


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