1 | | See [wiki:"SinkParticlesDevel"]. |
| 1 | ==== Sink Particles ==== |
| 2 | |
| 3 | The ability to form [SinkParticles sink particles] in AstroBEAR is tied to self-gravity. To simply enable sink particles: |
| 4 | |
| 5 | 1. Look for the {{{HYPREFLAG}}} variable in {{{Makefile.inc}}} and make sure that it is set to {{{1}}}. |
| 6 | 2. Set the {{{lSelfGravity}}} flag in your {{{physics.data}}} file and set it to {{{T}}}. |
| 7 | |
| 8 | If you just want your simulation to have the option of forming sink particles, no further action is required. If you want to start your simulation off with sink particles, then you will have to create one in {{{problem.f90::ProblemModuleInit()}}}: |
| 9 | |
| 10 | {{{ |
| 11 | NAMELIST /ProblemData/ nParticles |
| 12 | NAMELIST /ParticleData/ mass,xloc,vel |
| 13 | OPEN(UNIT=PROBLEM_DATA_HANDLE, FILE='problem.data', STATUS="OLD") |
| 14 | READ(PROBLEM_DATA_HANDLE,NML=ProblemData) |
| 15 | |
| 16 | IF (.NOT. lRestart) THEN |
| 17 | |
| 18 | DO i=1,nParticles |
| 19 | |
| 20 | READ(PROBLEM_DATA_HANDLE,NML=ParticleData) |
| 21 | NULLIFY(Particle) |
| 22 | CALL CreateParticle(Particle) |
| 23 | Particle%mass=mass |
| 24 | Particle%xloc=xloc |
| 25 | Particle%vel=vel |
| 26 | CALL AddSinkParticle(Particle) |
| 27 | |
| 28 | END DO |
| 29 | |
| 30 | CLOSE(PROBLEM_DATA_HANDLE) |
| 31 | OPEN(UNIT=PROBLEM_DATA_HANDLE, FILE='restart.data', STATUS="UNKNOWN") |
| 32 | WRITE(PROBLEM_DATA_HANDLE,NML=RestartData) |
| 33 | CLOSE(PROBLEM_DATA_HANDLE) |
| 34 | |
| 35 | END IF |
| 36 | }}} |
| 37 | |
| 38 | Depending on the features of your simulation, more [AstroBearObjects objects] might have to be declared in conjunction with the sink particle. The {{{.NOT. lRestart}}} conditional is important, as it prevents AstroBEAR from adding the same particle again on a restart. |
| 39 | |
| 40 | |
| 41 | For more information, see [wiki:"SinkParticlesDevel"]. |