View Issue Details

IDProjectCategoryView StatusLast Update
0003773OpenFOAMFeaturepublic2022-01-07 10:31
ReporteroseenAssigned Tohenry 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformLinuxOSUbuntuOS Version20.04
Product Version9 
Fixed in Version 
Summary0003773: Inaccurate water (H2O) density
DescriptionWater (H2O) is chosen as the fluid by setting constant/thermophysicalProperties as:

thermoType
{
    type heRhoThermo;
    mixture pureMixture;
    properties liquid;
    energy sensibleInternalEnergy;
}

mixture
{
    H2O;
}

The accuracy of density is critical for gravity-driven buoyant flows, however, the density calculated by this H2O model is not accurate compared to IAPWS-IF97 formulas given by XSteam [https://github.com/KurtJacobson/XSteam] , see the attached figure 1 for details.

To improve precision of the density calculation, the formula and coefficients from Table 2-32 of Perry's Chemical Engineers' Handbook (by Green, Don W., and Marylee Z. Southard, the 9th ed.) can be used. A user-defined library called myH2O was written to demostrate the improved accuracy, see the attached figure 2 for details.
Steps To Reproduce1. Extract the attached file "verification_of_H2O_Properties_in_OF9.tar.gz".

2. Choose the case named "verify-H2O-of9", run the case by the Allrun script, see the generated "H2ODensity-OF9.png".

3. Compile the library named "myH2O".

4. Choose the case named "verify-myH2O", run the case and check the generated "H2ODensity-myH2O.png".
TagsNo tags attached.

Activities

oseen

2022-01-02 23:51

reporter  

verification_of_H2O_Properties_in_OF9.tar.gz (95,378 bytes)

henry

2022-01-03 08:38

manager   ~0012355

Last edited: 2022-01-03 12:16

View 2 revisions

The density of water function in OpenFOAM is from the NSRDS tables. It looks like the function you are using is the same as that used in Xstream. Have you compared directly with experimental data? What pressure or pressure range are you using?

The NSRDS coefficients for water density in OpenFOAM come from a different version (maybe more recent or perhaps older) than the one I have and they a different. I have compared the density from the two sets of coefficients and it looks like they are optimised for different temperature ranges and it is not clear which is best. It is also not clear how the pressure should be included; the NSRDS assumption of atmospheric below the boiling point and saturation pressure above the boiling point is a bit odd. In general the functions should be of temperature AND pressure but we do not have access to suitable tables of data to implement the functions for a useful range of compounds.

At the moment we are maintaining an implementation of some of the NSRDS functions for a range of compounds, mostly for historical reasons, and provide the means for users to implement their own functions or to use tabulated data for their simulations. If the NSRDS functions are no longer considered useful or appropriate we could remove them. Now that we have a more general and flexible interface for thermophysical properties it would be interesting to include a database of properties for a range of common compounds as a function of temperature, pressure, but this would be a huge undertaking and may involve some complex licencing issues as many/most property databases that we might want to obtain data or coefficients from are commercial. Also as always there is the cost; we simply don't currently have the resources to take on such a large project.

henry

2022-01-04 09:51

manager   ~0012356

For an example of the use of tabulated data for water see tutorials/multiphase/multiphaseEulerFoam/RAS/wallBoiling
You could use the same data for your case if the temperature and pressure ranges cover your requirements.

oseen

2022-01-04 21:14

reporter   ~0012357

Hi, Henry, I think it is really a huge work to maintain an accurate and complete fluid database. As you have mentioned, the tabulated data input format in OpenFOAM-9 for thermophysical properties is useful and flexible. To generate a suitable tabulated data for a specific fluid like water, air or etc., I suggest using the CoolProp suite [http://www.coolprop.org/], as it is MIT-licensed and provides various APIs for thermophysical properties for 122 fluids. Someone has tried to export CoolProp data in tabulated format to be used in OpenFOAM-5.x with customized codes later [https://github.com/cbunge/coolPropTableGenerator], he used Python to access the CoolProp database, but I think using C++ API is also possible according to CoolProp’s doc [http://www.coolprop.org/coolprop/HighLevelAPI.html#c-sample-code]. Maybe a possible small utility named like foamCreateTabulatedPropetiesFromCoolProp would be very helpful to OpenFOAM users :)

henry

2022-01-04 21:36

manager   ~0012358

Maybe, are you planning to write such a utility?

henry

2022-01-07 10:31

manager   ~0012362

Very general thermophysical property functions like those in Xsteam/freeSteam or CoolProp are much too expensive to evaluate directly within a large complex CFD simulations.
For many/most simulations the range of temperature and pressure is narrow enough to use simple fits and functions for the range of interest which are efficient to evaluate.
For more complex problem with wide operating ranges it makes more sense to create tabulated data from the complex property functions and use the recently added 1D and 2D thermo property table lookup option in OpenFOAM; this approach has proved very effective for CFD.

Issue History

Date Modified Username Field Change
2022-01-02 23:51 oseen New Issue
2022-01-02 23:51 oseen File Added: Figure1-H2ODensity-OF9.png
2022-01-02 23:51 oseen File Added: Figure2-H2ODensity-myH2O.png
2022-01-02 23:51 oseen File Added: verification_of_H2O_Properties_in_OF9.tar.gz
2022-01-03 08:38 henry Note Added: 0012355
2022-01-03 12:16 henry Note Edited: 0012355 View Revisions
2022-01-03 15:51 henry Category Bug => Feature
2022-01-03 15:51 henry Description Updated View Revisions
2022-01-03 15:51 henry Steps to Reproduce Updated View Revisions
2022-01-04 09:51 henry Note Added: 0012356
2022-01-04 21:14 oseen Note Added: 0012357
2022-01-04 21:36 henry Note Added: 0012358
2022-01-07 10:31 henry Assigned To => henry
2022-01-07 10:31 henry Status new => closed
2022-01-07 10:31 henry Resolution open => no change required
2022-01-07 10:31 henry Note Added: 0012362