bmad-sim / bmad-ecosystem

Bmad simulation ecosystem for simulating high energy storage rings.
https://www.classe.cornell.edu/bmad/
11 stars 13 forks source link

long_term_tracking segfaults with ramping on #1120

Closed ndwang closed 1 month ago

ndwang commented 1 month ago

@WillBergan and I discovered a segfault when running long_term_tracking with the lattice and initialization file in bmad-doc/tutorial_ring_design/lattices/15_SpinTracking/solution. The seg fault only occurs if ltt%ramping_on = T and ltt%ram_update_each_particle = T.

I ran it through Totalview. The issue is that, when lattice_bookkeeper parses the lattice, it calls ltt_track1_preprocess and attempts to apply rampers, but ltt_com%tracking_lat is not set up yet at that point.

DavidSagan commented 1 month ago

@WillBergan @ndwang Correct. I put in a line in the code to detect this. I also altered the code logic so that ltt%ramp_update_each_particle is only looked at for BEAM tracking. That is, you do not have to remember setting it for SINGLE or any other modes.