This PR fixes a memory leak when using sink particles and MHDCT. The source is the collision of using BaryonField[NumberOfBaryohnFields] as a temporary array in both ComputePressure and ZeroSolutionUnderSubgridFields-- In ComputePressure, it's used to temporarily point CenteredB at BaryonField[BxNum]; in ZeroSolution it's used as the flagging field. This collision is rectified by having the ComputePressure first look for a non-Null BaryonField. It passes the quick suite, as far as I can tell it should only affect MHDCT runs.
@bwoshea @haoxu @hegan Mind taking a look at this?
@dcollins4096 What would be the non-stop gap solution?
I see two possible long term solutions. Basically the treatment of fields should be regularized.
One replaces CenteredB with BaryonField. This is reasonably straight forward, but a significant amount of work that I won't be able to do until probably summer time. It would also be a large change, so it might take a while to pass PRs.
Two punts on One, and waits for FieldObjects in enzo3.0, which would replace all of the MHDCT objects. Work is currently underway with field objects, so this will happen before too long. But, it will only happen in enzo3.0.
Looks good to me.
@haoxu , @gbryan , could you both take a quick look at this (short, simple) fix and make sure it looks sensible to you?