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

water properties available for OF 2.2 and above

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 7 Post By romant

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 16, 2014, 03:38
Default water properties available for OF 2.2 and above
  #1
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Hej,

I am happy to announce that with some help from Chris Lucas's connector for freesteam in the extend project, I have managed to develop a library which provides thermophysical properties for water based on the IAPWS-IF97 properties.

Instructions on how to download, install and use them can be found here: https://github.com/romansCode/IAPWS-IF97-OF

The thermophysicalProperties file looks like this when you want to use it:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


thermoType 
{
    type            heRhoThermo;    // Thermophysical model based on sensible enthalpy
    mixture         pureMixture;    // Only water
    transport       IAPWSTransport; // (mu, k)
    thermo          hIAPWS;         // (Cp)
    equationOfState eosIAPWS;       // (rho)
    specie          specie;
    energy          sensibleEnthalpy;
}


// outside the pressure and temperature range, the properties will be capped to
// the min and max values at the range limits


mixture
{
    IAPWSProperties
    {
        TMax    1073;   // max allowed temperature
        TMin    500;    // minimal allowed temperature
        pMax    300e5;  // max allowed pressure
        pMin    221e5;  // min allowed pressure
    }


    specie
    {
        nMoles          1;
        molWeight       18;   // Water
    }
}


// ************************************************************************* //
The library is usable with the heat transfer solvers, which use the heRhoThermo based thermophysical libraries. I guess it could be adapted to be used with the compressible solvers which start with rho
as well.
egp, olivierG, waku2005 and 4 others like this.
__________________
~roman
romant is offline   Reply With Quote

Old   June 16, 2014, 16:46
Default
  #2
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi,

cool work, shows that I'm a bit behind on my work .

You should also add the solver as an example (e.g. based on my realGasRhoPisoSolver from my git repository), because most (all) OpenFOAM solver have the perfect gas law hardcoded in the pressure equation.


Regards,
Christian
Chris Lucas is offline   Reply With Quote

Old   June 18, 2014, 11:34
Default
  #3
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
I am not completely sure what you mean.
__________________
~roman
romant is offline   Reply With Quote

Old   June 19, 2014, 00:11
Default
  #4
New Member
 
nakku
Join Date: Jun 2014
Posts: 11
Rep Power: 12
dahicocuk is on a distinguished road
Hi,

I want to use water for laminar and turbulence flow with openFOAM.Could you please help me how I can make it?

Thank you.
dahicocuk is offline   Reply With Quote

Old   June 19, 2014, 03:39
Default
  #5
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Quote:
Originally Posted by dahicocuk View Post
Hi,

I want to use water for laminar and turbulence flow with openFOAM.Could you please help me how I can make it?

Thank you.
You have to setup your case as usual, as you would setup a case for buoyantSimpleFoam or buoyantPimpleFoam. Use the same boundary conditions that you would use there. After following the installation instructions for the properties described in the first post here, you can just use the thermophysicalProperties file that is also attached to the post, or that you can find in the git repository. Adjust the min and max temperature and pressures to the case that you would like to simulate (the range keeps helps to stabilise cases at the beginning when pressure swings and be expected).

In the controlDict you have to add

Code:
libs
{
  "libfreesteam.so"
  "libIAPWSRangeThermo.so"
}
at the end of the file.
__________________
~roman
romant is offline   Reply With Quote

Old   June 22, 2014, 13:29
Default
  #6
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi,

the problem in the pressure equation is related to the time derivative. The pressure equation is based on the mass balance, thus the time derivative of the pressure equation is equivalent to drho/dt. In the standard OpenFOAM solver, this density time derivative is changed to d(psi*p)/dt (fvm::ddt(psi,p)), with psi=drho/dp@T=constant. This is correct for a perfect gas. However, it is incorrect for a real fluid like water (simply check it by using e.q. the a van der waals equation). Thus, the time derivative in the pressure equation must be changed.

One possibility is to use a total differential. In this case, the time derivate in the pressure equation is

psi2*dp/dt+psiH*dh/dt (psi2*fvm::ddt(p)+psiH*fvc::ddt(h))
(please note that psi is now outside the fvm::ddt function)

psi2=drho/dp@h=constant
psiH=drho/dh@p=constant



Best Regards
Christian
Chris Lucas is offline   Reply With Quote

Old   June 23, 2014, 04:31
Default
  #7
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Quote:
Originally Posted by Chris Lucas View Post
Hi,

the problem in the pressure equation is related to the time derivative. The pressure equation is based on the mass balance, thus the time derivative of the pressure equation is equivalent to drho/dt. In the standard OpenFOAM solver, this density time derivative is changed to d(psi*p)/dt (fvm::ddt(psi,p)), with psi=drho/dp@T=constant. This is correct for a perfect gas. However, it is incorrect for a real fluid like water (simply check it by using e.q. the a van der waals equation). Thus, the time derivative in the pressure equation must be changed.

One possibility is to use a total differential. In this case, the time derivate in the pressure equation is

psi2*dp/dt+psiH*dh/dt (psi2*fvm::ddt(p)+psiH*fvc::ddt(h))
(please note that psi is now outside the fvm::ddt function)

psi2=drho/dp@h=constant
psiH=drho/dh@p=constant



Best Regards
Christian
Thank you for the tip.

However, this should at least be correct for the steady state solvers for now, if I get this correctly. I will hopefully soon provide a transient solver for these kind of problems.
__________________
~roman
romant is offline   Reply With Quote

Old   June 24, 2014, 06:55
Default
  #8
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
I checked in OpenFOAM 2.3, what you state for the density based solvers is correct (all solvers in the compressible category, most solvers start with rho....Foam. However, in the pressure based buoyant solvers solvers (in the category heat transfer, most start with buoyant...Foam, except for the buoyantBoussinesq) http://openfoam.org/docs/user/standard-solvers.php the following formulation for the pressure derivative is true:

Code:
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
where rho is taken from the thermophysical model and psi is also taken from the thermophysical model. Which is a real derivative of the density in time, with, if I am not wrong, a correction for the density change due to a change in pressure.

So I think for the solvers in the category "Heat transfer and buoyancy driven flows" no change is required. A change is only required for the density based solvers in the category "Compressible flows".

Could this be right?
__________________
~roman
romant is offline   Reply With Quote

Old   October 21, 2014, 03:09
Default
  #9
New Member
 
Cong Gu
Join Date: Jun 2013
Posts: 10
Rep Power: 13
gucong is on a distinguished road
Quote:
Originally Posted by romant View Post

Code:
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
where rho is taken from the thermophysical model and psi is also taken from the thermophysical model. Which is a real derivative of the density in time, with, if I am not wrong, a correction for the density change due to a change in pressure.
Could anybody explain to me where does the correction term come from? It doesn't show up in my derivation. What does it actually intend to do?

Edit: I think it is because of this. The rho in fvc::ddt(rho) is calculated from the previous p_rgh, for example, called p_rgh_0. So the current density should be rho + psi*(p_rgh - p_rgh_0). The correction term comes in when we take the time derivative of rho.

Last edited by gucong; October 21, 2014 at 18:19.
gucong 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



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