- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **IAPWSIF97 water properties**
(*https://www.cfd-online.com/Forums/openfoam-solving/58551-iapwsif97-water-properties.html*)

Dear all,
I'm simulating heDear all,
I'm simulating heat trasfer to water at pressures higher than critical (22.1MPa) and in this region, the results are extremely sensitive to the accuracy of thermo-physical properties implemented. Therefore their correct implementation is of a critical importance for me. New IAPWS-IF97 water properties standard functions shows a very high accuracy and therefore i would like to have them implemented to OpenFOAM. Basically, when hThermo model with pureMixture, sutherlandTransport, specieThermo, janafThermo, perfectGas is used as a template, methods in sutherlandTransport, janafThermo and perfectGas equations can be overloaded for this purpose. My question is: when i create new transport, thermo and equationOfState clases, how do i link them to the rest of the code, so for example buoyantSimpleFoam would use them in the following form, let's say: hThermo<puremixture<iapwstransport<speciethermo<ia pwsthermo<waterrealgas>>>>> Thank you in advance David |

Hi David,
I've been discussHi David,
I've been discussing this with both Henry and also Niklas Nordin who's responsible for much of the thermodynamics structure in OF. It seems from these discussions that one way to implement a full thermodynamics package like the IAPWS-IF97 for water and steam which return both transport and thermo properties is by introducing the following classes: IAPWSgas in addition to perfectGas IAPWSthermo in addition to hConstThermo/janafThermo IAPWStransport in addition to constTransport/sutherlandTtransport then we have the following thermoType (through changes in basicThermos.C) hThermo<puremixture<iapwstransport<speciethermo<ia pwsthermo<iapwsgas>>>>> For multiphase flows it might help with a waterSteamMixture class to help with voidfraction dependent properties but this is probably best implemented on application level together with the interface functions. We currently have all necessary IAPWS functions written in OpenFOAM syntax for implementation in the new classes. Niklas recently implemented Peng-Robinson equation of state which also might be helpful. Any new ideas would be much appreciated. //Eric |

Hi all, if you are interested:Hi all, if you are interested:
I found IAPWS'97 properties as C++ library (FreeSteam) in www.sourceforge.net I have already adpated this library to OpenFoam 1.4(but it really slows down the calculation process) If someone needs more information, please, write to my e-mail: mkraposhin@inbox.ru SORRY FOR BAD ENGLISH |

Dear All,
Does anyone know Dear All,
Does anyone know what definition of compressibility does OpenFoam use? I found that perfectGas psi() function returns 1.0/(R()*T). Assuming that compressibility is defined as psi=(-1/rho)*(drho/dT) at constant pressure, psi function should return 1.0/T. I need the exact defintion in order to apply the compressibity for water in the correct way. Thank you so much in advance, David |

Hi
my impression is that psi=Hi
my impression is that psi=rho/p. PerfectGasI.H, line 48: //- Return compressibility rho/p [s^2/m^2] This is in agreement with basicThermo.H, line 205 //- Density [kg/m^3] tmp<volscalarfield> rho() const { return p_*psi(); } It would be very interesting to hear about your progress in implementing IAPWS-IF97. Henrik |

Thank you Henrik,
So the deThank you Henrik,
So the definition of compressibility is psi=drho/dp at constant temperature which gives exactly rho/p for an ideal gas. Please could anyone confirm that i'm right? In that case the density which is returned by basicThermo.H, line 205 (see below) is valid only if we use ideal gas approximation. Am i right? //-Density [kg/m^3] tmp<volscalarfield> rho() const { return p_*psi(); } Thank you, David |

hmm, thread started a year agohmm, thread started a year ago...
is there anything new on freesteam/OpenFOAM integration? I'd like to try |

Maxim,
The issue which i poiMaxim,
The issue which i pointed in the message above, Friday Aug-29 must be solved before you try anything. David |

Hi David
I absence of input fHi David
I absence of input from people who actually know things, allow me to speculate. Unfortunately my knowledge of c++ is rudimentary, so I can't offer any solutions. However, the problem seems to be two-fold: 1. rho is not stored explicity by basicThermo, but constructed as p*psi. Can this be avoided by having basicThermo fetch the density directly from the equation of state, thereby bypassing psi in the calculation of density? 2. The second problem is that psi itself is called from various bits of the source code. I guess that means that we still need a proper definition of psi, even if the density may be possible to calculate even without using psi. Best Regards Henrik |

Hej Henrik,
I absolutely agHej Henrik,
I absolutely agree with your points. Rho should be fetched from the equation of state, i am just wondering why OpenFoam doesn't do it this way. And i also agree that psi must be correctly implemented into the equation of state ( in the form: psi=drho/dp at constant temperature). What i did until now is that i took the water properties, IAPWS-IF97 as implemented in matlab functions of XSteam and use them instead of mu(), kappa(), alpha(), cp(), h(), rho() and psi() functions in thermo, transport and equationOfState objects (one MSc student of Eric Lillberg helped with coding). These functions differs in different regions of phase diagram, resulting into quite an ugly piece of code. Moreover, when the functions are called directly, they slows down the CFD calculation rapidly. That's why i decided to use an other approach. Here i call the XSteam functions only when the contructor of thermo, transport or equationOfState is called and create the tables where user specifies the minimum and maximum temperature, number of points and reference pressure. Then all the points are generated at the begining of calculation (which takes around 1-2 minutes depending on the number of points) and during the run-time functions mu(), kappa() etc... use just the linear interpolation between two nearest points depending on the temperature. This approach is really fast and could be quite precise, depending on the size of your lookup table. I quickly wrote the code (except psi(), which is not defined by XSteam IAPWS functions) and as i remember it runs quite ok. Later i gave up my work on that because i didn't need water properties anymore and didn't even have time for that. If you are interested we can try to make it work and finally solve the issue of water properties, however i warn you, the code at this stage is quite ugly (i just cannot manage to make all the indentations, comments etc..) David |

Hi David
Your work is very inHi David
Your work is very interesting, but for my current projects the full IAPWS-IF97 is probably over-kill. Instead I have tried to write dedicated equations of state (e.g. rho as a polynomial function of T) to use mainly for flow of liquid water. To that end I still need to understand the function of psi. If you get any further with this, please let me know. Henrik |

Quote:
I am facing exactly same problem now. Please share your valuable thoughts if you have found solution of above 2 problems ? Best Regards, JM |

IAPWS 97 Properties, liquid Sodium (Na), properties, Bismuth-Led (BiPb) propertiesDear friends, here is link to water, Na and BiPb properties
http://www.os-cfd.ru/mamb/index.php?...1a69&no_html=1 |

Thankyou very much Matvej !!
JM |

I am starting to investigate how to implement the water properties into openfoam at supercritical pressures. In IAPWS-97, the properties, such as specific heat capacity, are functions of density and temperature in the region 3 which includes the critical point. This does not agree with the style of thermalphysical model in OpenFOAM. Is there any smart solution for this?
Thanks in advance. |

I am keep going with the implementation of IAPWS-IF97 in OpenFOAM. My approach consists of the following steps.
1) build the interpolation table at constant pressure with T as the abscissa. The table is generated with the aid of freesteam which can generate all the properties I need, such as density, enthalpy, entropy, heat capacity, conductivity and dynamic viscosity etc. 2) interpolate the properties according to T The multi-layer implementation in my approach is hPsiThermo<pureMixture<iapwsTransport<specieThermo <iapwsThermo<iapwsEOS>>>>> This implementation is defined in thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermos.H with makeBasicPsiThermo ( hPsiThermo, pureMixture, iapwsTransport, iapwsThermo, iapwsEOS ); A basicMixture is also defined in thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C with makeBasicMixture ( pureMixture, iapwsTransport, iapwsThermo, iapwsEOS ); However, the above-mentioned modifications doesnot make the implementation work. When I try to test the implementation with the tutorial case, buoyantCavity, I got the error buoyantSimpleFoam: symbol lookup error: /home/jinbiao/OpenFOAM/OpenFOAM-2.0.1/platforms/linuxGccDPOpt/lib/libbasicThermophysicalModels.so: undefined symbol: _ZN4Foam14iapwsTransportINS_12specieThermoINS_11iapwsThermoINS_8iapwsEOSEEEEEEC1ERKNS_10dictionaryE There seems something wrong with the dictionary lookup. The exact problem is still to be debugged. Best, |

Hello,
have you correctly included all libraries and paths for IAPWS-IF97? You should double check that. Do you plan to make your code available? Markus |

Markus,
Thanks for your reply. I am also thinking about that there may be some mistakes in library linking. The implementation of thermophysical property in OF is complicated. I do not fully understand what is wrong. I will consider to make my code available. But I donot how to do that. Should I add to the OpenFOAM-2.0.1-extend for example? |

Hi,
maybe the libbasicThermophysicalModels is missing the link to the IAPWS-IF97 library. And yes. The extend project is a good place. You can create an own account or have it put by another member. Markus |

Hi Markus,
I have solved the problem. I missed the line which includes the iapwsThermo.C file into iapwsThermo.H. And the same mistake in iapwsTransport.H. These files are not complied in the libspecie. Instead they were included in files like basicMixtures.C and consequently compiled in libbasicThermophysicalModels. So the .C file should be included in the header files so that the libbasicThermophysicalModels can properly linked to them. Now I am testing the implementation. I will try to create an account in the extend project soon. If the testing is good, I will share it. Best, |

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