Fixing memory leak in magnetic supernova feedback

#421 Merged at 4c537ac
  1. Iryna Butsky

The main changes are:

  • Moving the magnetic supernova feedback away from the star particle class. Now, there’s a separate Grid routine that loops through star particles in Grid_AddMagneticSupernovaeToList.C.
  • Optimizing injecting magnetic feedback into the grid in hydro_rk/Grid_MHDSourceTerms.C
  • Renaming the user parameters to more intuitive names
  • Switching from custom list class (list.h) to std::vector.

    • To get this to compile, I followed @ngoldbaum 's example in his Active Particles PR and changed FreeRealMem.c to FreeRealMem.C.
    • I also changed the definitions of the min and max macros (because they were interfering with the STL headers from vector.h) in EnzoTiming.h to be template functions.
  • Removing hard-coded values in function arguments hydro_rk/LLF_Zero_MHD.C

Comments (11)

  1. Nathan Goldbaum

    I don’t know if it’s necessarily better or worse than your approach, but in the Active Particles PR I just renamed min and max in EnzoTiming.h to be _min and _max.

    1. Iryna Butsky author

      I was trying to avoid macros entirely. From what I read on stack overflow, functions are less problematic than macros (assuming they work for the use case). Let me know if you prefer what you did!

      1. Brian OShea

        I think your method is fine, @ibutsky . I don’t see a reason to change it right now, at least.

  2. Brian OShea

    @ibutsky , I made a few additional suggestions beyond what @brittonsmith said, but I think this PR is in very good shape. Only a few very small changes should be made, and then I think it’s ready to accept.

  3. Philipp Grete

    I also added a couple of comments. Overall, the PR looks quite good and the comments are all minor.

  4. Greg Bryan

    @ibutsky - Once you have addressed the minor comments from Britton, Brian and Philipp, we can merge this. Thanks for your contribution!

  5. Iryna Butsky author

    Thanks everyone! I just pushed the changes discussed below. Let me know if there’s anything else that needs my attention on this!