Get the FREE Ultimate OpenClaw Setup Guide →

time-stepping

npx machina-cli add skill HeshamFS/materials-simulation-skills/time-stepping --openclaw
Files (1)
SKILL.md
4.4 KB

Time Stepping

Goal

Provide a reliable workflow for choosing, ramping, and monitoring time steps plus output/checkpoint cadence.

Requirements

  • Python 3.8+
  • No external dependencies (uses stdlib)

Inputs to Gather

InputDescriptionExample
Stability limitsCFL/Fourier/reaction limitsdt_max = 1e-4
Target dtDesired time step1e-5
Total run timeSimulation duration10 s
Output intervalTime between outputs0.1 s
Checkpoint costTime to write checkpoint120 s

Decision Guidance

Time Step Selection

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

Ramping Strategy

Problem TypeRamp StepsInitial dt
Smooth ICNone neededFull dt
Sharp gradients5-100.1 × dt
Phase change10-200.01 × dt
Cold start10-500.001 × dt

Script Outputs (JSON Fields)

ScriptKey Outputs
scripts/timestep_planner.pydt_limit, dt_recommended, ramp_schedule
scripts/output_schedule.pyoutput_times, interval, count
scripts/checkpoint_planner.pycheckpoint_interval, checkpoints, overhead_fraction

Workflow

  1. Get stability limits - Use numerical-stability skill
  2. Plan time stepping - Run scripts/timestep_planner.py
  3. Schedule outputs - Run scripts/output_schedule.py
  4. Plan checkpoints - Run scripts/checkpoint_planner.py
  5. Monitor during run - Adjust dt if limits change

Conversational Workflow Example

User: I'm running a 10-hour phase-field simulation. How often should I checkpoint?

Agent workflow:

  1. Plan checkpoints based on acceptable lost work:
    python3 scripts/checkpoint_planner.py --run-time 36000 --checkpoint-cost 120 --max-lost-time 1800 --json
    
  2. Interpret: Checkpoint every 30 minutes, overhead ~0.7%, max 30 min lost work on crash.

Pre-Run Checklist

  • Confirm dt limits from stability analysis
  • Define ramping strategy for transient startup
  • Choose output interval consistent with physics time scales
  • Plan checkpoints based on restart risk
  • Re-evaluate dt after parameter changes

CLI Examples

# 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 Handling

ErrorCauseResolution
dt-target must be positiveInvalid time stepUse positive value
t-end must be > t-startInvalid time rangeCheck time bounds
checkpoint-cost must be < run-timeCheckpoint too expensiveReduce checkpoint size

Interpretation Guidance

dt Behavior

ObservationMeaningAction
dt stable at targetGoodContinue
dt shrinkingStability issueCheck CFL, reduce target
dt oscillatingBorderline stabilityAdd safety factor

Checkpoint Overhead

OverheadAcceptability
< 1%Excellent
1-5%Good
5-10%Acceptable
> 10%Too frequent, increase interval

Limitations

  • Not adaptive control: Plans static schedules, not runtime adaptation
  • Assumes constant physics: If parameters change, re-plan

References

  • references/cfl_coupling.md - Combining multiple stability limits
  • references/ramping_strategies.md - Startup policies
  • references/output_checkpoint_guidelines.md - Cadence rules

Version History

  • v1.1.0 (2024-12-24): Enhanced documentation, decision guidance, examples
  • v1.0.0: Initial release with 3 planning scripts

Source

git clone https://github.com/HeshamFS/materials-simulation-skills/blob/main/skills/core-numerical/time-stepping/SKILL.mdView on GitHub

Overview

Time stepping provides a structured workflow to choose, ramp, and monitor time steps and the cadence of outputs and checkpoints. It helps couple CFL/physics limits with adaptive stepping, manage startup transients, and plan restarts for long runs.

How This Skill Works

Gather inputs such as stability limits, target dt, total run time, output interval, and checkpoint cost. Use the decision rules to compute dt_limit and dt_recommended, applying ramping if startup transients are present. Rely on dedicated scripts (timestep_planner.py, output_schedule.py, checkpoint_planner.py) to produce dt, output times, and checkpoint plans, then monitor and adjust during the run if limits change.

When to Use It

  • Coupling CFL/physics limits with adaptive stepping to keep dt within safe bounds
  • Ramping initial transients to avoid startup instability or shocks
  • Scheduling outputs and checkpoints at meaningful intervals aligned with physics
  • Planning restart strategies and checkpoints for long-duration runs
  • Re-evaluating dt and cadence after parameter changes or stability updates

Quick Start

  1. Step 1: Get stability limits and run python3 scripts/timestep_planner.py --dt-target 1e-4 --dt-limit 2e-4 --safety 0.8 --ramp-steps 10 --json
  2. Step 2: Schedule outputs with python3 scripts/output_schedule.py --t-start 0 --t-end 10 --interval 0.1 --json
  3. Step 3: Plan checkpoints with python3 scripts/checkpoint_planner.py --run-time 36000 --checkpoint-cost 120 --max-lost-time 1800 --json

Best Practices

  • Get stability limits from a numerical-stability analysis before planning dt
  • Define a ramping strategy for transient startup to smooth initialization
  • Choose output intervals that reflect the dominant physics time scales
  • Plan checkpoints based on restart risk and acceptable lost-work
  • Re-evaluate dt after parameter changes or new stability information

Example Use Cases

  • For a 10-hour phase-field simulation, plan checkpoints every 30 minutes with ~0.7% overhead on average
  • Plan time stepping with ramping: dt_target 1e-4, dt_limit 2e-4, safety 0.8, ramp 10 steps
  • Schedule outputs every 0.1 s during a fast-evolving run using output_schedule.py
  • Plan long runs with run-time 36000 s and max-lost-time 1800 s to determine restart cadence
  • Re-evaluate dt after a parameter change using stability feedback to adjust dt_target and ramping

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers