CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   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)

dpalko September 25, 2007 04:23

Dear all, I'm simulating he
 
Dear 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

lillberg September 25, 2007 06:21

Hi David, I've been discuss
 
Hi 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

mkraposhin October 2, 2007 06:41

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

dpalko August 28, 2008 07:51

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

hkb August 29, 2008 03:54

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

dpalko August 29, 2008 04:28

Thank you Henrik, So the de
 
Thank 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

zeliboba September 11, 2008 10:20

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

dpalko September 11, 2008 13:16

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

David

hkb September 15, 2008 15:02

Hi David I absence of input f
 
Hi 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

dpalko September 16, 2008 04:45

Hej Henrik, I absolutely ag
 
Hej 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

hkb September 16, 2008 09:13

Hi David Your work is very in
 
Hi 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

jmmeena June 16, 2009 08:53

Quote:

Originally Posted by hkb (Post 178224)
Hi 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

Dear Henrik,
I am facing exactly same problem now. Please share your valuable thoughts if you have found solution of above 2 problems ?

Best Regards,
JM

mkraposhin June 24, 2009 06:53

IAPWS 97 Properties, liquid Sodium (Na), properties, Bismuth-Led (BiPb) properties
 
Dear friends, here is link to water, Na and BiPb properties

http://www.os-cfd.ru/mamb/index.php?...1a69&no_html=1

jmmeena June 24, 2009 07:06

Thankyou very much Matvej !!

JM

JinBiao November 25, 2011 07:24

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.

JinBiao November 28, 2011 23:34

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,

markusrehm November 29, 2011 03:24

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

JinBiao November 29, 2011 22:33

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?

markusrehm November 30, 2011 04:01

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

JinBiao November 30, 2011 04:16

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,

henrik December 7, 2011 04:18

Hi JinBao,

Christan Lucas at the TU Braunschweig has done some work on real gas thermodynamics which might find helpful. It includes implementations of aungierRedlichKwong, pengRobinson, redlichKwong, soaveRedlichKwong EOS.

Please checkout the feature/fullyIntegratedRealGasThermo branch on extend.

... and, yes, your contribution is more than welcome.

Best Regards,

Henrik

JinBiao December 14, 2011 09:35

Hi Henrik, Thank you for the helpful information. Christan Lucas's approach is very interesting. I will try to apply it in my calculation. Christan Lucas provided the tutorial for CO2. I am not sure the library will work for water. I will share my experience here after I try it.

I am also trying to get a successful calculation with my own property library. Thanks again.

Regards,

yhaomin2007 May 15, 2012 16:22

Hi, JinBiao:

I am doing something with OpenFOAM using some real gas model.

I want to know where do you fine the "Christan Lucas provided the tutorial for CO2."

thank you

Chris Lucas May 16, 2012 02:46

Hi,

you can find my code in the OpenFOAM extend on sourceforge. See link:

http://openfoam-extend.git.sourcefor...-ext;a=summary

Have a look at feature/fullyIntegratedRealGasThermo.

Best Regards
Christian

JinBiao May 16, 2012 04:59

Hi Haomin,

I hope you have already get what you need. Because I am playing with water, I had no further experience with Lucas's library. But the structure of Lucas's implementation looks very good. Much better than I can do.

Good luck and enjoy it.

Regards,

Jinbiao

Chris Lucas May 16, 2012 05:06

Hi Jinbiao,

I forgot to ask you, is your IAPWS-IF97 implementation working? Did you implement it yourself or are you using external libraries like freeSteam.

Best Regards,
Christian

ashrawage October 19, 2012 16:22

Supercritical water properties in FLUENT
 
Hello guys..
I am working on simulations which involves water at 24MPa and temperatures ranging from 350-700 C.

Like JinBiao, I have been using IAPWS equations (RefProp) to get data sets for K Cp, Rho and Viscosity.
With these data sets, I generated a plot in excel and fitted curves to get R squared values very close to 1.
Now i have implemented these curves as piecewise polynomials in Fluent material properties. But as of now i am consistently getting divergence in temperature or pressure correction errors the moment i initiate the calculations.

Do you have any recommendations regarding this? Or can you think of any better way to model Super critical water in Fluent?

Thanks a lot...
Abhijeet J S

diego gomez October 19, 2012 23:50

turbulent flow
 
hello, I'm just learning openFoam. could you tell me how can I simulate a turbulent flow? I know the icoFoam solver is only for laminar flow.
Thanks a lot,
Diego

Chris Lucas October 22, 2012 03:33

Hi,

for all who are interested in IAPWS Water properties in OpenFOAM, I included
IAPWS water properties in the openFOAM 1.6.ext version. I use freeSteam to calculate the properties.

http://openfoam-extend.git.sourceforge.net/git/gitweb.cgi?p=openfoam-extend/OpenFOAM-1.6-ext;a=summary

see branch: feature/fullyIntegratedRealGasThermo

Kind Regards,
Christian


Smed October 22, 2012 21:28

Christian,

Would you mind explaining how to download and install your IAPWS implementation? Can it also be used in version 2.1.1 or only in 1.6?

Chris Lucas October 23, 2012 03:47

Hi,

the code is developed for OpenFOAM 1.6-ext (extend), so I am not sure if the code works in OpenFOAM 2.1.

The code is provided as a git branch, download OpenFOAM 1.6-ext
(see http://www.extend-project.de/). Change branch and connect your new branch to branch feature/fullyIntegratedRealGasThermo of the external repository (if needed, google for checkout of remote branch)

You can find the main source file in “src/thermophsicalModels/externalMedia”. You need to compile the code yourself (wmake libso), the code is not includes in the Allwmake file in src/thermophsicalModels/

Have a look at the tutorial ReadME file. The tutorial can be found at tutorials/compressible/rhoPisoFoam/ras/IAPWS97_Pipe. The file should explain what you need to do (mainly install freeSteam and provide the dynamic library to openFOAM)

Regards,
Christian

Smed October 23, 2012 22:29

Christian,

I am not very familiar with git, so I would appreciate your help. I have downloaded OpenFOAM-1.6 ext using
Code:

git clone git://openfoam-extend.git.sourceforge.net/gitroot/openfoam-extend/openfoam-extend

If I look for “src/thermophsicalModels/externalMedia” at this point,
the externalMedia directory doesn't seem to exist. I'm guessing this is because I need to do something with the branches. I have tried
Code:

git checkout -b origin/feature/realGasThermo
But after executing this command, I still don't see an externalMedia directory. Can you please explain what I need to do next? Thanks.

Chris Lucas October 24, 2012 02:53

Hi,

try

git checkout -b feature/fullyIntegratetedRealGasThermo origin/feature/fullyIntegradetedRealGasThermo

maybe you need to use
git pull
afterwards

Regards,
Christian

markusrehm October 27, 2012 11:40

Hi Chris,

can you please explain step by step how to get the branch?

Is the right one

feature/fullyIntegradetedRealGasThermo

or

origin/feature/fullyIntegradetedRealGasThermo?

I got the following messages:

>git checkout -b feature/fullyIntegradetedRealGasThermo origin/feature/fullyIntegradetedRealGasThermo

fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/feature/fullyIntegradetedRealGasThermo' which can not be resolved as commit?


>git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.origin/feature/realGasThermo.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "origin/feature/realGasThermo"]
remote = <nickname>
merge = <remote-ref>

[remote "<nickname>"]
url = <url>
fetch = <refspec>

See git-config(1) for details.


Thanks a lot. Markus

Chris Lucas October 29, 2012 03:06

Hi,

Follow this explanation (this is what I did)

http://gugod.org/2008/12/git-checkout-remote-branch/

Have a look at

http://openfoam-extend.git.sourceforge.net/git/gitweb.cgi?p=openfoam-extend/OpenFOAM-1.6-ext;a=summary

you can find the name of the branch, the changes in the branch ... there. The name is:


feature/fullyIntegratedRealGasThermo

Kind Regards,
Christian

markusrehm October 30, 2012 18:49

Hi Chris,

you are right. So that is what I did (again):

Code:

git clone git://openfoam-extend.git.sourceforge.net/gitroot/openfoam-extend/OpenFOAM-1.6-ext
cd OpenFOAM-1.6-ext
git checkout -b feature/fullyIntegratedRealGasThermo origin/feature/fullyIntegratedRealGasThermo

Ok thanks for your patience.

Markus

Chris Lucas October 31, 2012 03:23

Hi,

if you have the time, I would like to get a response regarding the code (problems, suggestions, ...)

Regards,
Christian

magazoni November 26, 2012 17:55

Hi everyone,

I'm trying to install freesteam and I had some problems with it. Does anybody have a tutorial in how to install the freesteam package?

Chris Lucas,
Is it possible to simulate superheated steam and supercooled steam using your code?

Best regards,
Felipe Magazoni

Chris Lucas November 27, 2012 03:10

Hi,

have a look at the freesteam page, you can find the limits, in which the code works, there. The code works with superheated and subcooled steam.

Have you looked at the README file in the tutorial case I provided for freesteam (in OpenFOAM/tutorials/compressible/rhoPisoFOAM/RAS/IAPWS97_pipe)?

Have you installed all the required components for freesteam as stated in the README file in freesteam?

Could you post the error?

Kind Regards,
Christian

magazoni December 3, 2012 05:49

Hi Chris Lucas, thanks for help me.

Now, the freesteam package is correctly installed, but I installed it in the folder '/opt/freesteam'. The libfreesteam.so is not in a folder where OpenFOAM finds ($WM_PROJECT_DIR/lib/linux64GccDPOpt). Must I install the freesteam package in another folder?

After I tried to compile the IAPWS package and there are some errors,

Code:

cluster@node0:~/OpenFOAM/OpenFOAM-1.6-ext/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties$ wmake libso
/home/cluster/OpenFOAM/OpenFOAM-1.6-ext/wmake/MakefileOptions:37: /home/cluster/OpenFOAM/OpenFOAM-1.6-ext/wmake/rules/linux64Gcc46/general: No such file or directory
make: *** No rule to make target `/home/cluster/OpenFOAM/OpenFOAM-1.6-ext/wmake/rules/linux64Gcc46/general'.  Stop.
/home/cluster/OpenFOAM/OpenFOAM-1.6-ext/wmake/MakefileFiles:39: /home/cluster/OpenFOAM/OpenFOAM-1.6-ext/wmake/rules/linux64Gcc46/general: No such file or directory
/home/cluster/OpenFOAM/OpenFOAM-1.6-ext/wmake/MakefileFiles:40: linux64Gcc46DPOpt/options: No such file or directory
make: *** No rule to make target `linux64Gcc46DPOpt/options'.  Stop.
wmake error: file 'Make/linux64Gcc46DPOpt/objectFiles' could not be created

Best regards,
Felipe Magazoni


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