An error in compressible module_negative values of internal energy

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Ruonan
Posts: 136
Joined: Mon Dec 14, 2020 11:38 am

An error in compressible module_negative values of internal energy

Post by Ruonan »

Dear developers,

Please could you help me with this error?

I am doing a RANS simulation, with k-w SST model and no wall function, in the compressible module, using v7.1-alpha with GUI. The case is about rotating flow in a rotating cavity.

After about 30000 iterations, the solution crashed with an error. The crash was because negative values of internal energy detected in several cells. I tried to decrease timestep, the case seems to go on running for some iterations, but soon ended with the same error.

The error message in run_solver.log is shown below. The XML, mesh, run_solver.log file are attached.

How could I deal with this error and go on calculating? Thank you very much for checking!

Best regards,
Ruonan
/home/ruonanwang/code_saturne_master_git/code_saturne-master/src/cfbl/cs_cf_thermo.c:248: Fatal error.

Error in thermodynamics computations for compressible flows
:
Negative values of the internal energy were encountered in 4 cells.



Call stack:
1: 0x7f88d222aa23 <cs_cf_check_internal_energy+0x2e3> (libsaturne-7.1.so)
2: 0x7f88d22202ac <cfener_+0x1391> (libsaturne-7.1.so)
3: 0x7f88d1d558e0 <scalai_+0x633> (libsaturne-7.1.so)
4: 0x7f88d1d60217 <tridim_+0x435b> (libsaturne-7.1.so)
5: 0x7f88d1bd12ef <caltri_+0x1d0c> (libsaturne-7.1.so)
6: 0x7f88d2cbb9aa <main+0x6fa> (libcs_solver-7.1.so)
7: 0x7f88d0fc9b97 <__libc_start_main+0xe7> (libc.so.6)
8: 0x564f9f3ead7a <_start+0x2a> (cs_solver)
End of stack
Attachments
run_solver.log
log
(1.87 MiB) Downloaded 121 times
Northrop and Owen for wmles one degree wrrans.cgns
mesh
(3.76 MiB) Downloaded 117 times
wrrans.xml
xml
(14.79 KiB) Downloaded 117 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: An error in compressible module_negative values of internal energy

Post by Yvan Fournier »

Hello,

It would be interesting to test this with an older version, to determine if this issue was already present or not before.

I am not familiar with the way the total energy is computed, so how to avoid negative values, which could be due either to the formula used, or to non-maximum principle preserving operators. If the second option is the correct hypothesis, using a least-squares gradient reconstruction (which tends to be smoother) might solve this issue, though I would recommend this mostly for tetrahedral meshes. Since you mesh is orthogonal, chances the issue is related are pretty low.

This might also be an OpenMP-related bug (I hope not, since those are hard to find), so if you can test your code running on 3 MPI processes and a single OpenMP thread and see if you still have the error, it would be interesting.

Otherwise, we may need to run the code to see at which line in cfener the negative value is computed, and using which terms.

Best regards,

Yvan
Ruonan
Posts: 136
Joined: Mon Dec 14, 2020 11:38 am

Re: An error in compressible module_negative values of internal energy

Post by Ruonan »

Hello Yvan,

Please kindly find some updates on this problem. I still haven't succeeded in setting up my first heat transfer case in the compressible module, so I want to pursue it.

I haven't tested it with an older version, but tested with a stable version v7.0, ended with the same error after ~5000 iterations, shown below. (the XML file is attached)

Code: Select all

/home/ruonanwang/code_saturne/code_saturne-7.0.0/src/cfbl/cs_cf_thermo.c:248: Fatal error.

Error in thermodynamics computations for compressible flows
:
Negative values of the internal energy were encountered in 3 cells.



Call stack:
   1: 0x7f2b1afa4c93 <cs_cf_check_internal_energy+0x2e3> (libsaturne-7.0.so)
   2: 0x7f2b1af9a66d <cfener_+0x13d7>                 (libsaturne-7.0.so)
   3: 0x7f2b1aadbcdf <scalai_+0x62b>                  (libsaturne-7.0.so)
   4: 0x7f2b1aae64cb <tridim_+0x436f>                 (libsaturne-7.0.so)
   5: 0x7f2b1a95b093 <caltri_+0x1d0c>                 (libsaturne-7.0.so)
   6: 0x7f2b1ba3293f <main+0x6ff>                     (libcs_solver-7.0.so)
   7: 0x7f2b19d53b97 <__libc_start_main+0xe7>         (libc.so.6)
   8: 0x563f064cbdaa <_start+0x2a>                    (cs_solver)
End of stack
I then tried changing the gradient reconstruction type from "Automatic" to "Least squares", the solution can run further, but in the end it will crash, again with the same error "negative values of internal energy".

At the moment I can only run it on my desktop PC, I use 1 processes 6 threads. I haven't tried to run it on more processes.

Would these evidence be useful? Could you please kindly give me some suggestions? Thank you!

Best regards,
Ruonan
Attachments
setup.xml
(14.58 KiB) Downloaded 110 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: An error in compressible module_negative values of internal energy

Post by Yvan Fournier »

Hello,

I am not familiar enough with that module to be of much help, but here are a few suggestions :

- for a first case, try a simple geometry with a Cartesian or very regular mesh, if possible. This way, mesh quality and gradient reconstruction choice have limited impact. That allows you to check that your boundary conditions are "reasonable"
In any case, if you have better results with least squares, it means your mesh is not so regular, and least squares or hybrid least-squares may be the better option.

- when you have divergence after 5000 iterations, try postprocessing the various variables every 1000 or 500 time steps for example, to see how things are evolving, and where the internal energy is going down.

Best regards,

Yvan
Ruonan
Posts: 136
Joined: Mon Dec 14, 2020 11:38 am

Re: An error in compressible module_negative values of internal energy

Post by Ruonan »

Hello Yvan,

Thanks a lot for your reply. I noticed the compressible module may not be as validated and developed as the incompressible one. Incompressible module seems more robust and has few bugs. Could I gently ask if there is a plan in Code_Saturne's developing team for the compressible module?

(For my CFD cases, the incompressible module seems to have some limitations, if I am correct: cannot take the density variation into consideration, the simplified energy equation doesn't have a viscous heating term, as discussed in another topic viewtopic.php?f=2&t=2868. This gave misleading results at high rotating speed conditions. That's why I want to switch to the compressible module.)

Many thanks,
Ruonan
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: An error in compressible module_negative values of internal energy

Post by Yvan Fournier »

Hello,

I really don't know if there will be significant work on the compressible module in the short term. There have been quite a few users who have expressed interest in this module in the last year, so it is possible, but I do not know how priorities will be handled.

In any case, if some users are willing to contribute to this model (whether through tests, documentation, or development), they are welcome, and I can try to coordinate this and help ensure useful work is not lost.

Best regards,

Yvan
Ruonan
Posts: 136
Joined: Mon Dec 14, 2020 11:38 am

Re: An error in compressible module_negative values of internal energy

Post by Ruonan »

Hello Yvan,

Thanks a lot for your reply. At this stage, I prefer to stick to the incompressible module, achieving my goals partly by developing the incompressible code. It might be easier for me than getting around the compressible errors, with your consistent help.

Best regards,
Ruonan
Post Reply