Loading...
Loading...
Plan and control time-step policies for transient simulations — couple CFL and physics-based stability limits with adaptive stepping, ramp initial transients through sharp gradients or phase changes, schedule output intervals and checkpoint cadence, and plan restart strategies for long-running jobs. Use when choosing dt for a new simulation, diagnosing adaptive time-step oscillations, deciding checkpoint frequency to minimize lost work, or setting up output schedules aligned with physical time scales, even if the user only says "my run is too slow" or "how often should I save."
npx skill4agent add heshamfs/materials-simulation-skills time-stepping| Input | Description | Example |
|---|---|---|
| Stability limits | CFL/Fourier/reaction limits | |
| Target dt | Desired time step | |
| Total run time | Simulation duration | |
| Output interval | Time between outputs | |
| Checkpoint cost | Time to write checkpoint | |
Is stability limit known?
├── YES → Use min(dt_target, dt_limit × safety)
└── NO → Start conservative, increase adaptively
Need ramping for startup?
├── YES → Start at dt_init, ramp to dt_target over N steps
└── NO → Use dt_target from start| Problem Type | Ramp Steps | Initial dt |
|---|---|---|
| Smooth IC | None needed | Full dt |
| Sharp gradients | 5-10 | 0.1 × dt |
| Phase change | 10-20 | 0.01 × dt |
| Cold start | 10-50 | 0.001 × dt |
| Script | Key Outputs |
|---|---|
| |
| |
| |
output_schedule.pycountt_startt_endcount = number_of_intervals + 1t=0..50.05scripts/timestep_planner.pyscripts/output_schedule.pyscripts/checkpoint_planner.pypython3 scripts/checkpoint_planner.py --run-time 36000 --checkpoint-cost 120 --max-lost-time 1800 --json# Plan time stepping with ramping
python3 scripts/timestep_planner.py --dt-target 1e-4 --dt-limit 2e-4 --safety 0.8 --ramp-steps 10 --json
# Schedule output times
python3 scripts/output_schedule.py --t-start 0 --t-end 10 --interval 0.1 --json
# Plan checkpoints for long run
python3 scripts/checkpoint_planner.py --run-time 36000 --checkpoint-cost 120 --max-lost-time 1800 --json| Error | Cause | Resolution |
|---|---|---|
| Invalid time step | Use positive value |
| Invalid time range | Check time bounds |
| Checkpoint too expensive | Reduce checkpoint size |
| Observation | Meaning | Action |
|---|---|---|
| dt stable at target | Good | Continue |
| dt shrinking | Stability issue | Check CFL, reduce target |
| dt oscillating | Borderline stability | Add safety factor |
| Overhead | Acceptability |
|---|---|
| < 1% | Excellent |
| 1-5% | Good |
| 5-10% | Acceptable |
| > 10% | Too frequent, increase interval |
dt_recommendeddt_limittimestep_planner.pydt_recommended <= dt_limitnotesdt_limit--dt-limitsafety <= 1.0notesoutput_schedule.pycountcount = intervals + 1t_startt_endintervalmethoddalycapoverhead_fractioncheckpoint_planner.pyoverhead_fraction <= 0.10warningsValueErrorresults| Tempting shortcut | Why it's wrong / what to do |
|---|---|
"Implicit scheme, so any dt is fine — skip | Unconditional stability is not accuracy; a large dt still ruins temporal error and resolves no transient. Still pass a physics-based |
"Set | |
| "It ran without crashing, so the dt is valid." | Run completion is not correctness. Verify |
"The output | |
| "Checkpoint every step to never lose work." | That drives |
| "Reuse last week's dt/checkpoint plan; the model is basically the same." | Stability and optimal checkpoint interval depend on current |
dt-targetdt-limitsafetyt-startt-endintervalrun-timecheckpoint-costmax-lost-timeinfnansafety<= 1.0ramp-stepspreview-stepst-endt-startcheckpoint-costrun-timetimestep_planner.pyoutput_schedule.pycheckpoint_planner.pyeval()exec()shell=Truereferences/cfl_coupling.mdreferences/ramping_strategies.mdreferences/output_checkpoint_guidelines.md