MESAHub / mesa

Modules for Experiments in Stellar Astrophysics
http://mesastar.org
GNU Lesser General Public License v2.1
148 stars 39 forks source link

FPE with rotation and D_ST_start #448

Open rjfarmer opened 2 years ago

rjfarmer commented 2 years ago

See the many rotation failures https://testhub.mesastar.org/rf%2Ffpe/commits/9fae171

There are two problems, first set_rotation_mixing_info needs mstar_old however set_rotation_mixing_info is being called by set_start_of_step_info which is before new_generation() around https://github.com/MESAHub/mesa/blob/0d1f1bb5a471a0d1faeacc19c7b7e0be685d6550/star/private/evolve.f90#L1899

Now if we move the new_generation() call before set_rotation_mixing_info then that fixes the first issue.

Next, we then error when trying to use s% prev_mesh_D_ST_start. The problem is we are lying to ourselves, we have the flag s% prev_mesh_have_ST_start_info which we set to true at https://github.com/MESAHub/mesa/blob/0d1f1bb5a471a0d1faeacc19c7b7e0be685d6550/star/private/evolve.f90#L1891 but s% D_ST_start(k) isn't set. It got reset during an alloc() call during fill_star_info_arrays_with_NaNs https://github.com/MESAHub/mesa/blob/0d1f1bb5a471a0d1faeacc19c7b7e0be685d6550/star/private/evolve.f90#L68

So this might just be a problem with the NaN setting resetting arrays but not changing the s% prev_mesh_have_ST_start_info flag. Though it smells more like we need a better way to set s% prev_mesh_D_ST_start so that it doesn't matter if we set arrays to NaN.

fxt44 commented 2 years ago

nice analysis.