Issue, and questions, regarding CoolProp fluid library

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Irvise
Posts: 3
Joined: Thu Sep 17, 2020 9:31 am

Issue, and questions, regarding CoolProp fluid library

Post by Irvise »

Hello everybody,

as the title suggests, I am having some issues running a real fluid simulation with CoolProp (CP from now on). I am using CS-6.1.1. If I remember correctly, CP is now officially supported since CS-6.0 (correct me if I am wrong). Before anything else, I want to point out that I am a fairly new person to CFD and very new to CS.

The error that I get when I try to run with CP with the compressible model is always the same:

Code: Select all

Local case configuration:

  Date:                mié 23 sep 2020 21:25:37
  System:              Linux 5.8.7-1-default (Welcome to openSUSE Tumbleweed 20200919 - Kernel)
  Machine:             localhost.localdomain
  Processor:           model name	: Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
  Memory:              15894 MB
  User:                fernando (Fernando Oleo Blanco)
  Directory:           /home/fernando/Dirt/cfd/nozzle/co2nozz/RESU/result_compress_correct2
  OpenMP threads:      4
  Processors/node:     4

 Reading metadata from file: "mesh_input.csm"

===============================================================

                   CALCULATION PREPARATION
                   =======================


 ===========================================================


../../../code_saturne-6.1.1/src/base/cs_coolprop.cxx:196: Fatal error.

CoolProp was unable to compute some fluid properties with
input variable names: "H", "P" and backend "HEOS".

First of 1 fluid(s) considered: "CarbonDioxide".


Call stack:
   1: 0x7fb5db51bcc9 <cs_phys_prop_coolprop+0x659>    (libsaturne-6.1.so)
   2: 0x7fb5db43a5a4 <cs_phys_prop_compute+0x2b4>     (libsaturne-6.1.so)
   3: 0x7fb5db9a22be <csphys_+0x35e>                  (libsaturne-6.1.so)
   4: 0x7fb5db4bd7d4 <iniusi_+0x199>                  (libsaturne-6.1.so)
   5: 0x7fb5db4bd22b <initi1_+0x84>                   (libsaturne-6.1.so)
   6: 0x7fb5dc864ede <main+0x54e>                     (libcs_solver-6.1.so)
   7: 0x7fb5d9f4ecca <__libc_start_main+0xea>         (libc.so.6)
   8: 0x40107a     <_start+0x2a>                    (cs_solver)
End of stack

The build that I have, had the following configuration (in reality, this is the configuration for CS-6.2.0, but it is the same):

Code: Select all

Configuration options:
 use debugging code: no
 use malloc hooks: no
 use graphical user interface: yes
 use long global numbers: yes
 Zlib (gzipped file) support: yes
 MPI (Message Passing Interface) support: no
 OpenMP support: yes
 OpenMP Fortran support: yes
 CUDA support: no
 BLAS (Basic Linear Algebra Subprograms) support: no
 ParMETIS (Parallel Graph Partitioning) support: no
 METIS (Graph Partitioning) support: no
 PT-SCOTCH (Parallel Graph Partitioning) support: no
 SCOTCH (Graph Partitioning) support: no
 CCM support: no
 HDF (Hierarchical Data Format) support: yes
 CGNS (CFD General Notation System) support: yes
 MED (Model for Exchange of Data) support: yes
   MED MPI I/O support: no
 MEDCoupling support: no
 Catalyst (ParaView co-processing) support: no
 Melissa (in-situ statistics) support: no
 EOS support: no
 freesteam support: no
 CoolProp support: yes
 PETSc support: no
 MUMPS support: no
 Dynamic loader support: dlopen
 Auto load environment modules: no

 PdfLaTeX (document typesetting) available: yes
 Doxygen (document generation) available: no

The package has been configured. Type:
 make
 make install
--------------------------------------

As it can be seen in the error message above, the simulation fails at the very very beginning.

By taking a look at the cs_coolprop.cxx file, it shows that this message is produced when the number of outputs is not the same as the inputs. While that is in itself fine, I do not think this is my case.

The initialization parameters are all within CP's CO2 range (other fluids also fail, in compressible cases). I have tried different initialization values, and it always fails with the same error. I want to point out that all my tests were generated with the GUI, and that all incompressible simulations run fine when selecting CP and "material laws" for the density and viscosity (however, I have the feeling the values are not correct).

Is this error expected? As in: "this error appears when X is not setup correctly". How could it be prevented?

-------------------------------------

BACKGROUND:

I am currently tasked with designing SCO2 turbomachinery (preliminar design). While doing so, we were pointed to an article (still not published) where it showed that the severe non-linear properties near the critical point could lead to very unintuitive results. I am testing CS to see if it could run real fluid simulations with SCO2 and repeat the results presented in the aforementioned paper.

------------------------------------

FURTHER QUESTIONS:

Is the CP backend supposed to be used with the GUI or does it require manual intervention with some of the user scripts?

Why does CS GUI not allow compressible fluid with varying gamma? This is very important to me since SCO2 does have quite a change near de critical point, and I would like to model it as close as possible.

Is it a bug that when I select compressible fluid model, in the fluid tab, the fluid selection dropdown menu is not shown? And is it expected that the density does not allow to select "material law"? I suppose that in this case, the density is computed from the perfect gas equations and therefore CS does not "allow" for the density to follow a "material law".

Reading the cs_coolprop file, it shows that asking CP for Mach number (as well as some other properties) generates an error. Why is that? I mean, CP does support most (if not all) the properties for which an error is being generated as far as I know.

Could third-party codes be added to the python build script for easy setup? The setup file has no entry for CP, FreeSteam, EOS, etc.

And finally: is CP well tested and used? I have found close to no information about it in the forums nor anywhere else (tutorials, manuals, etc). And the fact that some important properties of fluids are "blacklisted" from the interface, does not look very reassuring.


Kind regards,

Fernando Oleo Blanco
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Issue, and questions, regarding CoolProp fluid library

Post by Yvan Fournier »

Hello,

I do not know why you have this error. Could you provide an (ideally very small) test case ?

For your other questions:

- The CP backend can be used both from the GUI and user (C) functions in theory, with some settings that are still hard-coded (such as using tables or not)

- I do not know why CS does not allow compressible fluid with varying gamma. One possible issue is that the compressible module was historically quite separate from others, and had its own fluid property management (possibly related to the numerical formulation, though I am not sure). This is also probably why the GUI does not show the fluid selection menu for compressible flows (as you guessed).

- Some things may generate an error in the cs_coolprop file because they have not been tested, or were not expected to be useful by the person who initially worked on that wrapper.

- Some third-party codes could be added to the python build script for easy setup, but for more complex cases, I would rather recommend using external install methods. Simply updating the install documentation relative to such libraries already takes me quite a bit of time, handling a script wich should work for everyone would be worst. If your distrubution includes CP as a package, that would be the best solution. As for FreeSteam, it is obsolete (not updated in 10 years), and EOS is not open source.

- And no, CP is not much used so far, in large part because the current way of using it is OK for constant properties, but much too costly for a space-varying properties. A better solution would be to use CP to generate tabulations on thev fly, or tune CP's usage (in cs_coolprop) to try to obtain better performance. So although it has been in the code for a while, it can still be considered as a work in progress. Feedback and help on this front is welcome.

- The fact that something is not available in the GUI does not necessarily mean it is blacklisted, but simply "advanced", not tested yet, or not commonly used.

Best regards,

Yvan
Irvise
Posts: 3
Joined: Thu Sep 17, 2020 9:31 am

Re: Issue, and questions, regarding CoolProp fluid library

Post by Irvise »

Hi Yvan,

thank you for your quick reply. I am attaching a very simple case which exhibits the same behaviour. In order to make the GUI use CP, I first selected the incompressible mode, configured CO2 with CP in the fluid tab, then selected compressible mode and finally selected material law for the available properties.

In your first point, you refer to the usage of tables, however in your fifth point you indicate that tabular properties should be implemented. Are you referring in the first point to the "general" table system?
I would, indeed want to use tables to speed up the computation.

I tried modifying the code (cs_coolprop) to output what was being called (print the inputs) but I never compiled it in the end. So, if you need any testing/help with this issue, I am willing to put some time on it.

------------

On a related note: Would you consider CS suitable for real fluid simulations? I suppose that Neptunne works well with EOS, however, that is out of reach for me. But it is nice that it seems that CS is open for improvements. As far as I know, no other libre CFD code has integrated real fluid properties. OpenFOAM, though, allows for a table as a fluid (though I have not tested it). SU2 I believe has this same feature, but I have not read anything about it.

Kind regards,

Fer
Attachments
Forum_case.tar.gz
(364.03 KiB) Downloaded 158 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Issue, and questions, regarding CoolProp fluid library

Post by Yvan Fournier »

Hello,

I'll look at your case within a few days.

Regarding tables, CoolProp already contains an option for tabulating data, but I am not sure how efficient it is. If is is fast enough, the simplest option would be to use that, otherwise, simply build external tables, either simpler coarser, or with some form of adaptive refinement would be possible, but more complex. Starting with additional tests of CoolProp's options seems a good option.

Best regards,

Yvan
Irvise
Posts: 3
Joined: Thu Sep 17, 2020 9:31 am

Re: Issue, and questions, regarding CoolProp fluid library

Post by Irvise »

Sorry for the late reply. Thanks for your time.

I currently have a couple of weeks with some extra time. So, if you need me to try a debug build or similar, just tell me.

Regards,

Fer
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Issue, and questions, regarding CoolProp fluid library

Post by Yvan Fournier »

Hello,

Testing coolprop and possibly modifying the CoolProb backend (in cs_coolprop.cxx) to test the performance of various backends would be a good start.

Best regards,

Yvan
Post Reply