How to handle particles, outflows, and point gravity objects

Frame Restarts

In general, when a problem module creates an object - it is easiest on a restart, to let the same objects just be recreated. Then the problem module does not need to be modified - and will still have pointers to the objects. The exception, however, is sink particles - since they can be created by self-gravity, they can wander due to gravitational interactions, accrete, etc…

Now a problem module on a restart, has no way to identify particles as their position, mass, velocity, etc… may have changed. (although we could require problem modules to name the particles). Then problem modules would need to have something like the following:

IF (lRestart) THEN
  CALL FindSinkParticle("Star 1", Particle)
ELSE
  CALL CreateParticle("Star 1", Particle)
  Particle%xloc=...
  Particle%mass=...
  ...
END IF

Then the problem module could continue to setup their outflow objects, point gravity objects, etc…

CALL CreatePointGravityObj(Particle%PointGravityObj)
CALL CreateOutflowObj(Particle%OutflowObj)
CALL UpdateParticle(Particle)

The alternative is to store their outflow objects, point gravity objects, etc… in the chombo file. Then a problem module would look like

IF (.NOT. lRestart) THEN
  CALL CreateParticle("Star 1", Particle)
  Particle%xloc...
  CALL CreatePointGravityObj(Particle%PointGravityObj)
  CALL CreateOutflowObj(Particle%OutflowObj)
  CALL UpdateParticle(Particle)
END IF

But now on a restart the user would not easily have pointers to the various outflows and pointgravity objects…

Another complication, is that if a tracer is added to an outflow object that is associated with a particle.

The solution to that is to create the tracers whether there is a restart or not…

Step Restarts

When a restart is triggered, we need a way to roll back any particles to their previous state. It is also possible that particles would have been created or destroyed during the last step, so those would need to be recreated (or deleted).

A particle has additional sub pointers in the derived types that need to be allocated and copied

  • Particle
    • Outflow Object (part of object list
      • Shape
      • Profiles
        • data
        • fields
    • Point Gravity Object (linked list)

For now, let's assume that there is no merging of particles as this simplifies everything.

Before each step:

  • Make copies of particles

On a restart:

  • Find backed up particles and copy contents
  • Remove any new particles and their objets
  • Update particle objects with copied values for position, mass, etc…

When we do implement merging, we could move particles (and their associated objects) out of their respective lists. Then on a restart, we could put the particle back without creating new pointers etc…

Comments

No comments.