grackle-project / grackle

The Grackle chemistry and cooling library for astrophysical simulations and models.
Other
26 stars 50 forks source link

Grackle with Float #14

Closed brittonsmith closed 1 year ago

brittonsmith commented 6 years ago

Originally reported by loic hausammann (Bitbucket: loichausammann, GitHub: Unknown)


Hi,

I am trying to use grackle, but I am getting some large errors when trying to reproduce the graphs in S. Britton 2017 (see attachments).

I have been able to reproduce them (with some differences that I suppose come from the code improvements) with double, but with floats, the computation fails at large temperature.

My graphs where done with the HM2012 UV background and primordial_chemistry = 0.

Thank you for your help and time.


brittonsmith commented 6 years ago

Original comment by loic hausammann (Bitbucket: loichausammann, GitHub: Unknown)


I have been through the code and was not able to find the error, therefore I will not work more on the issue. Anyway, all the internal computations are done with double, therefore there is no point of having an interface in float when I can just save all the data in float and then transforming them to double when calling grackle.

When you will have some time for this issue, I will be of course available to check if the code works.

brittonsmith commented 6 years ago

Original comment by loic hausammann (Bitbucket: loichausammann, GitHub: Unknown)


Ok thanks,

I used my own wrapper to do it. I will try to test with your wrapper and look at the code, but I doubt that I will find the time.

Best,

brittonsmith commented 6 years ago

Original comment by Britton Smith (Bitbucket: brittonsmith, GitHub: brittonsmith)


Hi loic,

I was not able to get results even as good as yours when trying to use the python interface with single precision grackle. The variable precision works by defining the variable type gr_float as either a float or double. There are probably a few places where a conventional double is used in place of the gr_float type. If you are able to look into this and issue a pull request, that would be great! Otherwise, we can try to look at this at some point, but I couldn't say when.

brittonsmith commented 2 years ago

At the meeting, it was agreed that there may be regimes of parameter space that will not work well when computed in single precision and there is not much that can be done about this. The agreed solution was:

  1. add a note in the documentation
  2. print a warning when compiling the code in single precision
brittonsmith commented 1 year ago

Resolved in PR #120.