AMReX-Astro / Microphysics

common astrophysical microphysics routines with interfaces for the different AMReX codes
https://amrex-astro.github.io/Microphysics
Other
34 stars 33 forks source link

burn_cell has floating point exceptions #141

Closed zingale closed 4 years ago

zingale commented 6 years ago

Compile unit_test/burn_cell in debug mode with ignition_reaclib/URCA-simple, e.g., as:

make NETWORK_DIR=ignition_reaclib/URCA-simple NDEBUG=

and you'll see floating point exceptions in write_burn_t -- it seems some stuff is not properly initialized:

Completed burn to:    1.0000000000000000       seconds

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x7f454daa735e in ???
#1  0x7f454daa6513 in ???
#2  0x7f454cf1606f in ???
#3  0x7f454dcb7ba3 in ???
#4  0x7f454dcb8e1a in ???
#5  0x7f454dcb059a in ???
#6  0x7f454dcb0c14 in ???
#7  0x404e64 in write_burn_t_
    at /home/zingale/development/Microphysics/unit_test/burn_cell/main.f90:191
#8  0x4063fb in burn_cell
    at /home/zingale/development/Microphysics/unit_test/burn_cell/main.f90:114
#9  0x4067c2 in main
    at /home/zingale/development/Microphysics/unit_test/burn_cell/main.f90:5
Floating point exception (core dumped)
zingale commented 6 years ago

I think that the reason that the ydot and Jacobian terms in the output from burn_cell are nonsense is because the vode_to_burn() function does not copy these into the output burn_t. This is probably done for performance reasons, since we generally don't need those. Do we really want these fields in burn_cell?

A separate issue is when the thermodynamic stuff is not valid (like the specific heats).

zingale commented 6 years ago

correction: the derivatives of specific heats with respect to T are undefined.

dwillcox commented 5 years ago

We can introduce a compile flag like USE_VERBOSE_INTEGRATOR_OUTPUT that fills burn_t on output with the ydot, Jacobian, and calls update_thermodynamics to get EOS quantities. We wouldn't need this for a simulation since it would introduce an extra EOS call but it might be useful for burn_cell so we can see what the thermodynamic derivatives look like.

zingale commented 4 years ago

these seem to have been resolved in the recent rewrite.