Version 4 (modified by 13 years ago) ( diff ) | ,
---|
Back to BearclawOutline
See - Krumholz et al. Embedding Lagrangian sink particles in Eulerian grid.
General Description of how Particles are handled
Sink Particles are stored on every processor in a global array Sink_Particle( that is of type SinkParticles declared in NodeInfoGlobal.f90
TYPE, PUBLIC :: Sink_Particles INTEGER :: Start REAL(KIND=qPREC) :: mass ! particle mass REAL(KIND=qPREC) :: scale_grav=0d0 ! numerical G*M for particle REAL(KIND=qPREC), DIMENSION(3) :: xloc ! location of particle REAL(KIND=qPREC), DIMENSION(0:15,1:2,3) :: f_gas ! back force from gravitational interaction with gas particles REAL(KIND=qPREC), DIMENSION(3) :: vel ! particle velocity INTEGER :: MPI_id ! processor the particles grid lives on INTEGER :: radius=4 ! size of region around particle needed TYPE (NodeInfo), POINTER :: grid ! Pointer to info structure containing local data LOGICAL :: lFixed=.false. ! Is particle unable to move? INTEGER :: iRoutine=0 ! How to update the particles surrounding region? LOGICAL :: hasgrid=.false. ! Does particle have an allocated info structure on processor MPI_id? LOGICAL :: Active=.false. ! Is this particle active (does it exist?) INTEGER :: End END TYPE Sink_Particles
Initializing Particles
Particles can be initialized in the particle.data file or by modules such as the Bondi Module. Soon self-gravity will allow for the creation of sink particles when the jeans length becomes marginally resolved.
Particle-Gas interactions
Particles interact with the gas via long range gravitational forces and locally via accretion or an outflow condition etc…
Long Range Gravitational Interactions
Since each processor has the mass and location of every sink particle, it can calculate the particle-gas interactions for each grid on every level in i_src.f90 The particle-gas forces are accumulated on each grid on each processor level by level. The forces are also differentiated into One has to be careful to not accumulate gas forces from cells that are refined Particles are initially created on every processor, but not the particle's grid. Particle-gas forces are calculated on every AMR level in i_src.f90 and are stored in an array
sink_forces(MaxNrSinkParticles, 0:MaxLevels,2,3)
This array then gets reduced to the master processor who then uses the forces to update the particles momentum etc… Since gas forces are sometimes calculated for a predictor step - and not for an actual cell update, those values can be used for creating a predictor sink particle force, but the sink particle momentum should be adjusted after the actual cells are updated. This is all handled by the UpdateSinkMomentum subroutine.
Particle Gas local interactions
Regions surrounding particles can also be updated by a routine (ie accretion, outflow, etc…) Each sink particle has associated with it an info structure that lives on its processor. The master processor also keeps a copy of the particles info structures, but doesn't allocate any pointer arrays. Particles are created an every processor, but the master processor determines which processor will allocate space for the particle's grid as well as perform the update routine. Every finest level time step, the Master processor calculates the overlaps between the fine level AMR grids, and the sink particles grid and schedules the appropriate transfers. After executing the transfers, the master processor has each individual processor update its particle grid using the appropriate routine (iRoutine). The master processor then collects the updated sink particle info and broadcasts it. All of the coordination between Master and workers is handled in lib/SinkUtils.f90
The SinkParticle Module file
The !SinkParticles module contains subroutines for updating SinkParticles
SinkSize
Function that returns the data size of the SinkParticle typeInitSinkParticles
Subroutine that initializes storage space for sink_particlesLoadSinkParticles
Loads SinkParticle data from particle.data filesAddSinkParticle
Adds Sink Particles to the grid (should be called by every processor)RemoveSinkParticle
Removes Sink Particles from the grid (also called by every processor)WriteSinkParticles
Writes particle.data filesSinkSetErrFlag
Called by each grid - ensures that particle regions are maximally refinedFindSinkStep
Sets a limit on the hydro time step so that particles cannot cross more than one grid per time step.AdvanceSinkLocations
Integrates equations of motion for particle-particle interactionsUpdateSinkMomentum
Attempts to enforce conservation of momentum between all levels and the sink particlesInitializeSinkGrid
Creates a local Info structure to be associated with a sink particleSetSinkBC
Sets boundary conditions on Sink Particles that get too close to the edge of the grid.FreeInflow
Performs a constant interpolation of velocity in the radial direction (while decreasing the density and pressure slightly each time)