CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   How creating new thermo physical model (

weiste01 September 5, 2007 02:45

Hi there! I am looking for
Hi there!

I am looking for some help with openFoam. In general I am aiming on the "big goal" of computing buoyancy driven flow of liquid and gaseous hydrogen in a closed container, which is subject to an external heat flux. Because I am quite new to openFoam I am expecting to encounter quite a number of obstacles.
The first problem for which I want to ask this time is about a way of modelling the thermodynamic properties of hydrogen. I already did some experiments with creating a new "equation of state" function, derived from the existing perfectGas-function. For testing I named it constDens because I wanted to model a constant density, just to check whether I get some sort of trivial solution (zero velovity) when I run the buoyantFoam solver. After I updated the entries in \src\thermophysicalModels\basic\basicThermo\basicT hermos.C by adding


and also adding a entry in the "files" in \src\thermophysicalModels\specie\Make I was quite happy that at least the compilation ran through without complications. My disenchantment came with running my test case with the buoyantFoam solver, which gave exactly the same results as if I ran it with the "old" perfectGas model, although I changed the line in \constant\thermophysicalProperties from
thermoType hThermo<puremixture<consttransport<speciethermo<hc onstthermo<perfectgas>>>>>; to
thermoType hThermo<puremixture<consttransport<speciethermo<hc onstthermo<constdens>>>>>;.

Alltogether I now have the impression that it is not quite clear to me how the properties are computed during running the solver. Therefore I would be grateful, if someone could give me some advice how to approach this problem. If someone knows &ndash; besides the user guide - some sort of documentation that explains the philosophy of including thermo physical models in the solution process I would be jumping to the ceiling (virtually, of course).

Another (more insignificant issue) is that the constDens model did not appear in the list of available models in the FoamX case manager. What do I have to do for including a new thermophysical model here?

Thanks in advance for your support!

hkb August 22, 2008 06:05

Hi It seems that I'm having t
It seems that I'm having the same problem. I have added a new equation of state (I'm using rho=rho(T) to simulate liquid water) with new equations for rho and psi and updated basicThermos.C, but I still get the density that the perfectGas model would get. Did you ever manage to solve the problem (I note that this was almost a year ago).

Best Regards

zeliboba September 12, 2008 06:15

hi all I also have the same
hi all

I also have the same problem... There is a package I created from perfect gas with dummy equation of state (simply constant density) for testing, I tried it on sonicTurbFoam/prism (density should vary significantly), but no difference is observed from perfect gas case. it seems to be everything correct, I'm pretty sure my EoS is chosen by solver etc.
can anybody explain in more details how to create new EoS? tutorial would be perfect, but working casw tarball is fine also.

zeliboba September 12, 2008 06:19 thermophysicalModels.tar.bz2

dpalko September 12, 2008 07:43

Hi Maxim, I looked at your
Hi Maxim,

I looked at your package and everything looks fine there. I also tried to run sonicTurbFoam/prism case with perfectGas and your constantRho and the results are significantly different, so i assume the constantRho class works as it should.
Short description of what i did.
1. Unpacked your constantRho directory to specie/equationOfState.

2. i added the following lines into "specie/Make/files":

3. Then i recompiled specie directory by:
> cd thermophysicalModels/specie
> wmake libso

4. I added the following to "basic/basicThermo/basicThermos.C"
#include "constantRho.H"
and later:
5. I recompiled basicThermo by:
> cd thermophysicalModels/basic
> wmake libso

6. I recompiled solver (not sure if this is mandatory), by firstly rmdepall and then wmake

7. Then i just run the case prism with two different classes.

Please let me know if that helps.



zeliboba September 12, 2008 09:19

hi David you are right actu
hi David

you are right actually, I have mentioned problem with another EoS, I thought they behave similarly. The problem EoS attached, to use it you have to change in constant/thermophysicalProperties

thermoType hThermo<puremixture<consttransport<speciethermo<hc onstthermo<perfectgasconstantp>>>>>;
mixture air 1 28.9 100000 1300 2.544e+06 1.84e-05 0.7;

the pressure constant is added to "mixture" string, of course it would be much nicer to read from a subdictionary, but I did not manage to do it yet.

what is your approach? specie.tar.bz2

dpalko September 12, 2008 10:27

Maxim, I run the case with

I run the case with your library perfectGasConstP and i get exactly the same results as with the perfectGas class.
Then i realized that here you have the compressibility defined as 1/R()T, exactly the same as for an ideal gas. It is actually psi() what matters, not rho(). If you modify function psi(), you would definetely get different result. I tried to ask forum for the explanation in my other thread (the one about IAPWS properties implentation). I think that what OpenFoam does is that it returns the density defined by basicThermo class, in basicThermo.C line 204. Here it returns p_*psi(), which is the exact relation for an ideal gas.

Hope to hear from you soon,


mahaputra March 3, 2009 04:54

Dear All is there any the
Dear All

is there any thermophysical solver for CO2 available now?

or someone in here had developed CO2 thermophysical model?

thanks before

az1362f June 15, 2009 17:19

gas and liquid property
hi to all

I want to use a diesel fuel with density of 840 kg/m3 and nitrogen (N2) as a chamber gas.
how can I set this two parameters?
I checked C7H16 files (.C & .H) but I don't know some parameters,for example rho_(61.38396836, 0.26211, 540.2, 0.28141),I checked html document but it does not describe these parameters:

NSRDSfunc5 (scalar a, scalar b, scalar c, scalar d)

any body can describe them and say how can I get the description of another input parameters like
pv_(87.829, -6996.4, -9.8802, 7.2099e-06, 2),
hl_(540.20, 499121.791545248, 0.38795, 0, 0, 0),
cp_(540.20, 6.11976102401216, 3137.69909384855, 182.274175063868, -254.530511150515),etc.

can I set chamber gas by changing N2 and O2 files in 0 directory in dieselfoam tutorial directory?
how can I describe a chamber gas with a defined properties like density viscosity,etc?

please help me

haghajani June 29, 2009 06:56

Creating Peng-Robinson EOS
Dear All,

I want to implement Peng-Robinson EOS, and make use of it in carbon dioxide high pressure release.

Would you please let me have you advise on the how to derive it suitable for OF.

As I had a look into current perfect gas Eos, it seems the psi(rho/P) parameter is more important than rho. Because, later rho is been calculate by, rho = p_*psi

Please let me have your kind advise,

Best Hamed

rameshbvb August 21, 2009 02:26

combustion with new liquid species Oxygen
1 Attachment(s)
Hello Friends,

I am Ramesh working on a cryogenic rocket simulation with gaseous Hydrogen fuel and liquid oxygen combustion. Since there is no oxygen implemented as liquid specie i added new specie liquid oxygen. And modified the NSRDS functions . which are attached. it is working well but the problem is the droplets are not evaporating. The liquid oxygen droplets are coming at 90K. but in paraview it is showing temp as 200K. i dont' where the problem is.

The files are attached

Can any body help me

Thanks in advance

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