With AccelerationBoundary and only a point source gravity, the gravitational field isn't cleared. Thus it accumulates, leading to hilarious growth of the potential.
Good catch! Left a couple minor comments below.
Those are reasonable comments. The original thought was to get the resetting done at a point where no logic was required, but now that I think about it I can make it simpler and put it in ComputeAccelerationFieldExternal. More once it passes push suite.
Thanks Dave! This looks good to me. Maybe a quick comment in the source explaining why this is being done?
Before SetAccelerationBoundary, AccelerationField was deleted at the end of every timestep. Since this makes it impossible to set the boundary conditions from parent grids with the boundary machinery, I removed that delete. With self gravity on, AccelerationField is initialized properly in ComputeAccelerationField, but with it off the necessary initialization is missing.
This formulation doesn't work though. I pushed too soon. More later.
I was just looking through the hanging PRs, and stumbled across this (very simple) one. Can we accept this PR, or is there a reason to reject it?
I think we're waiting on Dave to update based on his comment above.
Dave, I think this can be easily fixed if you add a loop over dims. I believe Yuan Li did this change and it solved this bug for her.