Adding zero acceleration, which is important when combining AccelerationBoundary and point-source-only gravity

#117 Merged at efb0631
  1. dcollins4096

With AccelerationBoundary and only a point source gravity, the gravitational field isn't cleared. Thus it accumulates, leading to hilarious growth of the potential.

Comments (9)

  1. dcollins4096 author

    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.

  2. Greg Bryan

    Thanks Dave! This looks good to me. Maybe a quick comment in the source explaining why this is being done?

  3. dcollins4096 author

    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.

  4. Brian OShea

    Hi all,

    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?

  5. Greg Bryan

    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.

      if( SelfGravity == 0 )
          for (dim = 0; dim < GridRank; dim++) {
             for (i = 0; i < size; i++)
               AccelerationField[dim][i] = 0;