name: fargo3d description: > Patch a FARGO3D .par file and launch a planet-disk simulation. Use this skill to set disk structure (AspectRatio, Sigma0, Alpha, FlaringIndex), planet properties (PlanetMass), time integration (Tmax, DT, Ninterm), or grid resolution without manually editing files. Returns gap depth, planet torque, and wall-clock time. Trigger phrases: FARGO3D, disk simulation, planet migration, gap opening, planet torque, gasdens, .par file, Sigma0, AspectRatio, Alpha viscosity, planet-disk interaction, spiral arm, type I migration. argument-hint: "Par file + parameters, e.g. 'setups/p_gap/p_gap.par Alpha=1e-3 PlanetMass=3e-4'"
FARGO3D Skill
When to Use
- Run a planet-disk interaction simulation (gap opening, migration, torques)
- Sweep disk parameters (aspect ratio, surface density, alpha viscosity) without
recompiling — FARGO3D recompile is only needed when changing
NFLUIDS,MHD, etc. - Do NOT use this skill if you need to change compile-time flags in
src/or switch the setup directory — those require recompilation
Prerequisites
- The FARGO3D binary (
fargo3d) must already be compiled and accessible - A valid
.parfile must exist for the chosen setup pip install scientific-pydantic(used for numpy array validation; required even though.parvalues are scalars, asNDArrayAdapteris available for future array-typed extensions)
Procedure
- Collect the
.parfile path, output directory, and any parameter overrides. Readreferences/parameters.mdfor the full parameter table. - Call the patch-and-run script:
Individual flags:python ~/.agents/skills/fargo3d/scripts/run_fargo3d.py \ --json '{"par_file": "setups/p_gap/p_gap.par", "output_dir": "out/run01", "Alpha": 1e-3, "PlanetMass": 3e-4, "Tmax": 200}'python ~/.agents/skills/fargo3d/scripts/run_fargo3d.py \ --par-file setups/p_gap/p_gap.par --output-dir out/run01 \ --Alpha 1e-3 --PlanetMass 3e-4 --Tmax 200 - The script writes a patched
.partooutput_dir, launchesfargo3d, and parses the final gas density and planet torque outputs. - Parse
SUCCESS:/ERROR:prefix.
Parameters
Full table with types, defaults, and constraints:
references/parameters.md
Required: par_file, output_dir
Disk structure: AspectRatio · Sigma0 · Alpha · FlaringIndex
Planet: PlanetMass
Time integration: Tmax · DT · Ninterm
Execution: fargo3d_bin · n_procs · gpu
Use extra_params: {"Key": value} for any other .par entry.
Source as context
Ground parameter names, setups, and defaults in the actual FARGO3D checkout —
never recall them from training memory. Parameter spellings, available setups,
and boundary-condition names differ between FARGO3D versions; a hallucinated
.par key is silently ignored by the code and your override never takes effect.
Before writing or patching a .par, grep the checkout ($FARGO_ROOT, read from
AGENTS.md):
# Available setups (the <setup>.par you can target)
ls "$FARGO_ROOT/setups/"
# Confirm a parameter exists and read its default for THIS setup
grep -n -i "Alpha\|Sigma0\|AspectRatio\|FlaringIndex" \
"$FARGO_ROOT/setups/p_gap/p_gap.par"
# C ↔ .par variable bindings and compiled defaults (authoritative)
grep -rn "Alpha\|Sigma0\|PlanetMass" "$FARGO_ROOT/src/var.c"
# Valid boundary-condition labels for this setup
sed -n '1,40p' "$FARGO_ROOT/setups/p_gap/p_gap.bound" 2>/dev/null
A grepped fact from the checkout overrides any value in
references/parameters.md or model memory. If $FARGO_ROOT is unset or the key
is absent from the setup's .par, stop and emit
[DATA MISSING: parameter <name> not found in <setup>.par] rather than guessing.
Output
SUCCESS: output_dir=<path> wall_clock=<N>s
n_outputs=<N> last_orbit=<val>
Sigma_min=<val> Sigma_max=<val> gap_depth=<frac>
planet_torque=<val> (last output)
gap_depth = Σ_min / Σ_unperturbed (lower = deeper gap).
Common Errors
| Message | Fix |
|---|---|
par_file not found |
Check path relative to working directory |
fargo3d binary not found |
Check fargo3d_bin; compile with make in FARGO3D root |
output_dir is required |
Always supply an explicit output directory |
Sigma0 must be > 0 |
Provide a positive surface density value |
scientific_pydantic not found |
pip install scientific-pydantic |
MPI launch failed |
Check mpirun on PATH; try n_procs=1 |
Mandatory workflow
For every FARGO3D task, follow this sequence:
- Confirm the
.parfile path and output directory before launching. - Read
references/parameters.mdto verify parameter names and valid ranges. - Patch parameters via the run script — never edit
.parfiles by hand. - Sanity-check
Sigma_min,Sigma_max, andgap_depthfrom theSUCCESS:output. - Emit
SimulationHandoff/v1after a successful run.
Iron rules
- Never hardcode physical values — read them from
references/parameters.md. - Do not use this skill to change compile-time flags (
NFLUIDS,MHD, etc.) — those require recompilation. - Always supply an explicit
output_dir; never let outputs overwrite an existing run directory without user confirmation. Sigma0 > 0andAspectRatio > 0are non-negotiable; reject runs with zero or negative values.- Never submit HPC jobs without explicit user confirmation.