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)

Chris Lucas August 30, 2013 11:07

Hi,

have you added the macros from "makeBasicPsiThermo.H" and "makeBasicMixture.h" used to create the IAPWS Thermo class?

Christian

PS. By the way, download the latest version I pushed, removed some bugs (non in the IAPWS Library)

romant August 30, 2013 11:11

Quote:

Originally Posted by Chris Lucas (Post 448935)
Hi,

have you added the macros from "makeBasicPsiThermo.H" and "makeBasicMixture.h" used to create the IAPWS Thermo class?

Christian


No, I have not, where would I add those? In the *s.C in the .H or in the .C file? In the *s.C file I am using the makeThermo.H file, as this is the new base class in OF 2.2.1, makeBasicPsiThermo.H, makeBasicRhoThermo.H and makeBasicMixture.H do not exist anymore.

Chris Lucas August 30, 2013 11:14

HI,

not sure about OF2.2 but there should be a file where you find a marco (similar to the first one in "makeBasicPsiThermo.H"). Add the new macro (last one in "makeBasicPsiThermo.H").

Christian

romant June 16, 2014 02:45

solution found
 
Hej Chris,

I have developed a solution and your input was helpful. Thanks. The solution for OF 2.2 and above can be found here http://www.cfd-online.com/Forums/ope...2-2-above.html or https://github.com/romansCode/IAPWS-IF97-OF

wyldckat March 21, 2015 13:52

Greetings to all!

@Roman: I've created a basic wiki page to help getting your toolkit known to the community that uses OpenFOAM technology: http://openfoamwiki.net/index.php/Contrib/IAPWS-IF97-OF

May you or anyone else feel free to update that wiki page!

Best regards,
Bruno

romant March 23, 2015 03:44

Quote:

Originally Posted by wyldckat (Post 537612)
Greetings to all!

@Roman: I've created a basic wiki page to help getting your toolkit known to the community that uses OpenFOAM technology: http://openfoamwiki.net/index.php/Contrib/IAPWS-IF97-OF

May you or anyone else feel free to update that wiki page!

Best regards,
Bruno

Thanks Bruno,

this has been on my list for a while. I will undertake this as soon as possible.

Best regards,
Roman

romant June 14, 2015 05:29

wiki page up
 
I finally got around to it and the page is now up.

mcoveri February 24, 2016 21:07

3 Attachment(s)
I am trying to use the IAPWS-IF97-OF lib with the chtMultiregionSimpleFoam (SS CHT) solver in OF2.4.0.

I am operating at ~10MPa and 500-600K. I am not getting sensible results using the IAPWS-IF97 steam table lib with this solver. The density falls from the initial value (1e3kg/m^3) until it bottoms out at 2 kg/m^3. Visualizing the results shows that the pressure field is indeed around 1.e7 everywhere and that the temperature is around 500-550K. I attached the relevant case file for anyone to take a look at if they wish to help!

In addition, I tried using this steam table lib with OF3.0.1 however the library would not compile. I submitted a pull request on the github page that seems to fix the compile issue.

Edit:
I resolved my issue. Forgot to update the density limits set in the SIMPLE block of fvSolution.

whhjken1 December 31, 2017 16:59

5 Attachment(s)
Dear friends,

Recently I have been trying to implement IAPWS-IF97 into OpenFoam following the construction posted by Chris Lucas and Roman (https://openfoamwiki.net/index.php/C.../IAPWS-IF97-OF). My OpenFOAM is version 4.0 which is fully installed on Ubuntu 16.04. The freesteam is version 2.1, I believe it is successfully compiled because I tested it with both scons test && ./test and ipython.

I clone the IAPWS-IF97-OF to my home folder, when I compile it using "wclean && wmake libso", I got the following errors. I have searched google and CFD-online for several days, but still couldn't solve the problem. Can anyone tell me what else should I do to correctly compile IAPWS? Any help will be greatly appreciated. Thanks.

Have a happy new year everyone!

Han

mcoveri December 31, 2017 21:14

kinda spit-balling here: maybe try compiling with -std=c++11 or -fpermissive flag. Similar thing here: https://github.com/ANTsX/ANTsR/issues/4

whhjken1 December 31, 2017 23:15

Quote:

Originally Posted by mcoveri (Post 676553)
kinda spit-balling here: maybe try compiling with -std=c++11 or -fpermissive flag. Similar thing here: https://github.com/ANTsX/ANTsR/issues/4

Hi Mcoveri,

Thanks for your quick reply. Could you please show me how to compile it with -std=c++11 flag, I can't do it correctly. Moreover, in the link that you provided, it is suggested adding "-DVCL_CAN_STATIC_CONST_INIT_FLOAT=0" somewhere. For this IAPWS-IF97 lib, where exactly should I add this line to? I am totally lost. Thank you.

Han

mcoveri December 31, 2017 23:32

Try adding

Code:

  - Wfpermissive \
Under the EXEC_INC block

In the make/options file in the iapws-if97-of source directory. See https://www.cfd-online.com/Forums/op...ons-wmake.html

whhjken1 January 1, 2018 14:44

1 Attachment(s)
Quote:

Originally Posted by mcoveri (Post 676555)
Try adding

Code:

  - Wfpermissive \
Under the EXEC_INC block

In the make/options file in the iapws-if97-of source directory. See https://www.cfd-online.com/Forums/op...ons-wmake.html

Hi Will,

Thanks for your suggestion. It didn't work with "-Wfpermissive ", but when I tried "-fpermissive ", all the errors turned into warnings. I tested the compiled lib by running a simple case, the results seem correct and all the properties vary with temperature. Thank you again for your kind help.

One last problem, the following information keep flashing on my terminal window when the simulation is running, but it didn't appear in the output log file. What can I do to remove these flashing from my terminal window?
https://www.cfd-online.com/Forums/da...BJRU5ErkJggg==

whhjken1 January 7, 2018 17:45

Quote:

Originally Posted by mcoveri (Post 676555)
Try adding

Code:

  - Wfpermissive \
Under the EXEC_INC block

In the make/options file in the iapws-if97-of source directory. See https://www.cfd-online.com/Forums/op...ons-wmake.html

Hi Will,

I have run a channel flow and compared the results with CFX, they agree with each other quite well. Thanks again for your help.

Best,

Han

sjohn2 June 10, 2019 13:12

installation problem for IAPWS-IF97-OF
 
1 Attachment(s)
Hi all,

I am trying to install the the IAPWS-IF9 library to openfoam, using the link below:

https://openfoamwiki.net/index.php/C.../IAPWS-IF97-OF

I have cloned the files to OpenFoam-6/applications/utilities/

I get the following error after wmake:

Please see the attachment for details


The solver I am trying to use is rhoSimpleFoam

Any idea guys?

romant June 10, 2019 15:10

Hi John,


The library was originally written by me for up to version 2.4, a while ago :).


It looks like a function in sensibleEnthalpy.H was changed from using 2 arguments to 3 arguments. Unfortunately, I do not have OpenFOAM installed on my computer anymore and will not be able to help you with this, but maybe someone else has an idea what was changed in release 6?


Cheers,
Roman

sjohn2 June 13, 2019 14:22

Anyone else who has linked IAPWSIF97 library to OpenFoam-6?

Manoj Paithane September 13, 2019 05:40

How to add IAPWS-IF97 in OpenFOAM
 
Quote:

Originally Posted by lillberg (Post 178217)
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


How to add these file in OpenFOAM, Please elaborate more I am new to OpenFOAM.
I am running a simulation for superheated steam flow through pipe and using perfectGas as a equation of state which gives density values which is not the exact value. please guide me for this it will be very helpful for me.
Thanking you

sjohn2 October 28, 2019 20:35

Hi Roman,

Looks like I am alone on this one. I have some basic knowledge on C++, but not at the level of OpenFoam programming am quickly working my way up. If you can give me some hints on one of the bugs then it would be useful to build on. One of the error

Quote:

In file included from thermoIAPWS/IAPWSthermos.C:31:0:
/home/sjohn2/OpenFOAM/OpenFOAM-6/src/thermophysicalModels/specie/lnInclude/sensibleEnthalpy.H:84:20: note: candidate: Foam::scalar Foam::sensibleEnthalpy<Thermo>::CpByCpv(const Thermo&, Foam::scalar, Foam::scalar) const [with Thermo = Foam::species::thermo<Foam::hIAPWSThermo<Foam::eos IAPWS<Foam::specie> >, Foam::sensibleEnthalpy>; Foam::scalar = double]
scalar CpByCpv
^~~~~~~
/home/sjohn2/OpenFOAM/OpenFOAM-6/src/thermophysicalModels/specie/lnInclude/sensibleEnthalpy.H:84:20: note: candidate expects 3 arguments, 2 provided
On comparison OpenFoam 2.4 and 6 sensibleEnthalpy.H files
OpenFoam 2.4

Quote:


#ifndef sensibleEnthalpy_H
#define sensibleEnthalpy_H

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
Class sensibleEnthalpy Declaration
\*---------------------------------------------------------------------------*/

template<class Thermo>
class sensibleEnthalpy
{

public:

// Constructors

//- Construct
sensibleEnthalpy()
{}


// Member Functions

//- Return the instantiated type name
static word typeName()
{
return "sensibleEnthalpy";
}

// Fundamental properties

static word name()
{
return "h";
}

// Sensible enthalpy [J/kmol]
scalar he
(
const Thermo& thermo,
const scalar p,
const scalar T
) const
{
return thermo.hs(p, T);
}

// Heat capacity at constant pressure [J/(kmol K)]
scalar cpv
(
const Thermo& thermo,
const scalar p,
const scalar T
) const
{
return thermo.cp(p, T);
}

//- cp/cp []
scalar cpBycpv
(
const Thermo& thermo,
const scalar p,
const scalar T
) const
{
return 1;
}

// Sensible enthalpy [J/kg]
scalar HE
(
const Thermo& thermo,
const scalar p,
const scalar T
) const
{
return thermo.Hs(p, T);
}

//- Temperature from sensible enthalpy
// given an initial temperature T0
scalar THE
(
const Thermo& thermo,
const scalar h,
const scalar p,
const scalar T0
) const
{
return thermo.THs(h, p, T0);
}
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif
OpenFoam 6
Quote:


#ifndef sensibleEnthalpy_H
#define sensibleEnthalpy_H

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
Class sensibleEnthalpy Declaration
\*---------------------------------------------------------------------------*/

template<class Thermo>
class sensibleEnthalpy
{

public:

// Constructors

//- Construct
sensibleEnthalpy()
{}


// Member Functions

//- Return the instantiated type name
static word typeName()
{
return "sensibleEnthalpy";
}

// Fundamental properties

static word energyName()
{
return "h";
}

// Heat capacity at constant pressure [J/(kg K)]
scalar Cpv
(
const Thermo& thermo,
const scalar p,
const scalar T
) const
{
return thermo.Cp(p, T);
}

//- Cp/Cp []
scalar CpByCpv
(
const Thermo& thermo,
const scalar p,
const scalar T
) const
{
return 1;
}

// Sensible enthalpy [J/kg]
scalar HE
(
const Thermo& thermo,
const scalar p,
const scalar T
) const
{
return thermo.Hs(p, T);
}

//- Temperature from sensible enthalpy
// given an initial temperature T0
scalar THE
(
const Thermo& thermo,
const scalar h,
const scalar p,
const scalar T0
) const
{
return thermo.THs(h, p, T0);
}
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif
Basically CpByCpv remains the same?

WhiteW June 30, 2020 12:32

Hi to everyone.
I'm trying to use the IAPWS-IF97 water properties for OpenFOAM.
I installed Freesteam and compiled the library, now I can use it in openFOAM.
I would line to use it to calculate the steam properties for the design of a steam turbine, the range of pressure for the steam is from 1E4 Pa to 1E5 Pa.

However, I can use the library of Roman only in a range of pressure of high values, as specified in the example from 221e5 to 300e5 Pa.

Is it also possible to use it to calculate the properties of the steam in lower range of pressure?
In alternative, could I simply link Freesteam to OpenFOAM? Is there any example?

Thanks,
WhiteW


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