Moddump recipes
This page lists common tasks that modify an existing Phantom dump file using
built-in modules in src/utils/. For the generic moddump workflow (.in
file handling, writing your own module), see Modifying phantom dump files.
Compile a specific module from your run directory (with a local Makefile from
~/phantom/scripts/writemake.sh):
make moddump MODFILE=moddump_addflyby.f90
Run in the same directory as the input ``.in`` file (see Modifying phantom dump files):
./phantommoddump dump_in dump_out [time]
Add a flyby to an evolved disc
Use this when you already have a relaxed or partially evolved disc and want to add an unbound perturber on a parabolic orbit (eccentricity = 1), without rebuilding the initial conditions from scratch.
This differs from a flyby set up at t=0 via
phantomsetup, which creates both sinks and the disc together.
Module: moddump_addflyby.f90
cd ~/runs/mydisc
make moddump MODFILE=moddump_addflyby.f90
./phantommoddump relax_00150 flyby_00000 0.
You will be prompted for:
mass and accretion radius of the perturber
distance of minimum approach
dmainitial distance in units of
dma(n0; typically \(\gg 1\))orbit orientation (ascending node angle, inclination)
suggested time between dumps as a fraction of the flyby time
The module reads the primary sink mass from the dump, recentres the system, and
prints a suggested dtmax (in code units) for the output flyby.in. Edit
flyby.in as needed, then run:
./phantom flyby.in
Orbital element conventions are described in Setting up orbits in phantom.
Add dust after gas relaxation
Module: moddump_dustadd.f90
Used in the dust settling test: relax a gas-only disc, then add dust particles before the science run.
make moddump MODFILE=moddump_dustadd.f90
./phantommoddump relax_00150 disc_00000 0.
Extend a disc in radius
Module: moddump_extenddisc.f90
Extends an existing disc outward, assuming the same surface density profile.
make moddump MODFILE=moddump_extenddisc.f90
./phantommoddump disc_00100 disc_extended_00000 0.
Add sinks or planets
Module |
Purpose |
|---|---|
|
Add a sink particle (interactive) |
|
Add embedded planets in a disc |
|
Add a binary sink pair |
|
Convert single star to binary |
|
Split relaxed star into binary components |
Trim or edit the particle distribution
Module |
Purpose |
|---|---|
|
Remove particles inside or outside a sphere |
|
Remove particles outside a cylinder |
|
Recentre on centre of mass |
|
Realign disc face-on, move origin |
|
Change code units of the dump |
|
Change particle masses |
|
Disc warp and magnetic field |
Change resolution
Use the standalone binaries (or the moddump wrappers that call the same logic):
make splitpart
./splitpart dump_00000 dump_hi_00000
make mergepart
./mergepart dump_00000 dump_lo_00000
Import external dumps
Module |
Purpose |
|---|---|
|
Import sphNG dump |
|
sphNG disc with sinks |
|
Import and add B-field |
Inject particles from another simulation
See inject_sim for the inject_sim moddump module and the associated
.in options (start_dump, final_dump, r_inject).
Other useful moddumps
Module |
Purpose |
|---|---|
|
Edit sink properties interactively |
|
Replace sinks with resolved gas |
|
Convert dust-growth dump for MCFOST |
|
Switch radiation mode |
|
Add infalling cloud |
|
Solid-body rotation on a sphere |
A full list of modules is in src/utils/moddump_*.f90. To compile every
moddump for testing:
make allmoddumps
Post-processing with phantomanalysis
To analyse dumps without modifying them, use phantomanalysis with a
built-in analysis_* module (see Analysis of Phantom output). Common disc examples:
Module |
Purpose |
|---|---|
|
Azimuthally averaged disc profiles |
|
Disc analysis for |
|
Disc with embedded planet |
|
Stresses and alpha |
make analysis ANALYSIS=analysis_disc.f90
./phantomanalysis dump_00100
Appendix: built-in module index
All moddump plugins live in src/utils/ as moddump_*.f90. All analysis
plugins live as analysis_*.f90. Read the module header in each file for
details. To compile a specific analysis module:
make analysis ANALYSIS=analysis_dustydisc.f90
moddump modules: moddump_addflyby, moddump_addplanets, moddump_addsink,
moddump_binary, moddump_binarystar, moddump_changemass, moddump_CoM,
moddump_disc, moddump_dustadd, moddump_dustsinkfrac, moddump_extenddisc,
moddump_faceon, moddump_growthtomultigrain, moddump_infall,
moddump_LTE_to_rad, moddump_mergepart, moddump_messupSPH,
moddump_perturbgas, moddump_polytrope, moddump_radiotde,
moddump_rad_to_LTE, moddump_recalcuT, moddump_recenter,
moddump_removeparticles_cylinder, moddump_removeparticles_radius,
moddump_rescale, moddump_rotate, moddump_sink, moddump_sink2gas,
moddump_sinkbinary, moddump_splitpart, moddump_sphNG2phantom,
moddump_sphNG2phantom_addBfield, moddump_sphNG2phantom_disc,
moddump_taylorgreen, moddump_tdesink, moddump_temp, moddump_tidal,
moddump_torus, plus moddump_default (template).
analysis modules (selection): analysis_disc, analysis_dustydisc,
analysis_disc_planet, analysis_disc_stresses, analysis_disc_mag,
analysis_disc_MFlow, analysis_dustmass, analysis_energies,
analysis_angmom, analysis_ptmass, analysis_structurefn,
analysis_clumpfind, analysis_mcfost, analysis_tde — and others in
src/utils/analysis_*.f90.