Agent skill

time-stepping

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."

Stars 29
Forks 2

Install this agent skill to your Project

npx add-skill https://github.com/HeshamFS/materials-simulation-skills/tree/main/skills/core-numerical/time-stepping

Metadata

Additional technical details for this skill

author
HeshamFS
version
1.1.0
eval cases
2
tested with
[
    "claude-code",
    "gemini-cli",
    "vs-code-copilot"
]
last reviewed
2026-03-26
security tier
high
security reviewed
YES

SKILL.md

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

Input Description Example
Stability limits CFL/Fourier/reaction limits dt_max = 1e-4
Target dt Desired time step 1e-5
Total run time Simulation duration 10 s
Output interval Time between outputs 0.1 s
Checkpoint cost Time to write checkpoint 120 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 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 Outputs (JSON Fields)

Script Key Outputs
scripts/timestep_planner.py dt_limit, dt_recommended, ramp_schedule
scripts/output_schedule.py output_times, interval, count
scripts/checkpoint_planner.py checkpoint_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:
    bash
    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

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

Error Cause Resolution
dt-target must be positive Invalid time step Use positive value
t-end must be > t-start Invalid time range Check time bounds
checkpoint-cost must be < run-time Checkpoint too expensive Reduce checkpoint size

Interpretation Guidance

dt Behavior

Observation Meaning Action
dt stable at target Good Continue
dt shrinking Stability issue Check CFL, reduce target
dt oscillating Borderline stability Add safety factor

Checkpoint Overhead

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

Security

Input Validation

  • All numeric parameters (dt-target, dt-limit, safety, t-start, t-end, interval, run-time, checkpoint-cost, max-lost-time) are validated as finite positive numbers
  • ramp-steps is validated as a non-negative integer with an upper bound
  • Time range consistency is enforced (t-end must exceed t-start; checkpoint-cost must be less than run-time)

File Access

  • Scripts read no external files; all inputs are provided via CLI arguments
  • Scripts write only to stdout (JSON output); no files are created unless the agent explicitly uses the Write tool

Tool Restrictions

  • Read: Used to inspect script source, references, and user configuration files
  • Bash: Used to execute the three Python planning scripts (timestep_planner.py, output_schedule.py, checkpoint_planner.py) with explicit argument lists
  • Write: Used to save generated time-step plans or checkpoint schedules; writes are scoped to the user's working directory
  • Grep/Glob: Used to locate relevant files and search references

Safety Measures

  • No eval(), exec(), or dynamic code generation
  • All subprocess calls use explicit argument lists (no shell=True)
  • Scripts use only Python standard library; no pickle loading or deserialization of untrusted data
  • All output is deterministic JSON with no shell-interpretable content

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

Expand your agent's capabilities with these related and highly-rated skills.

HeshamFS/materials-simulation-skills

post-processing

Extract, analyze, and summarize simulation output data — pull spatial fields at specific timesteps, compute time-series trends and detect steady state, extract line profiles through the domain, generate statistical summaries and distributions, calculate derived quantities (gradients, fluxes, volume fractions, interface area), compare results against analytical solutions or experimental data, and produce automated analysis reports. Use when interpreting finished simulation results, checking mass or energy conservation, comparing two runs or meshes, extracting interface profiles from phase-field output, or preparing publication-quality analysis, even if the user only says "what do my results look like" or "did my simulation reach steady state."

29 2
Explore
HeshamFS/materials-simulation-skills

performance-profiling

Identify computational bottlenecks, analyze parallel scaling, estimate memory requirements, and generate optimization recommendations for materials simulations — parse timing logs to find dominant phases (solver, assembly, I/O), evaluate strong and weak scaling efficiency, profile memory from mesh and field parameters, and detect bottlenecks with actionable fix suggestions. Use when a simulation is running slower than expected, investigating MPI scaling efficiency, planning HPC resource allocation, deciding whether to tune the preconditioner or reduce I/O frequency, or estimating if a problem fits in available RAM, even if the user only says "my simulation is too slow" or "how many nodes do I need."

29 2
Explore
HeshamFS/materials-simulation-skills

parameter-optimization

Explore and optimize simulation parameters via design of experiments (DOE), sensitivity analysis, and optimizer selection — generate Latin Hypercube, quasi-random, or factorial sample plans, rank parameter influence with sensitivity scores, recommend Bayesian optimization, CMA-ES, or gradient- based methods based on dimension and budget, and fit surrogate models for expensive evaluations. Use when calibrating material properties against experimental data, planning a parameter sweep, performing uncertainty quantification, or choosing an optimization strategy for a simulation with a limited evaluation budget, even if the user only says "which parameters matter most" or "how do I calibrate my model."

29 2
Explore
HeshamFS/materials-simulation-skills

simulation-validator

Validate simulations across three stages — run pre-flight checks on configuration files (parameter ranges, required fields, disk space), monitor runtime logs for residual growth, NaN/Inf, and adaptive dt collapse, and perform post-flight validation of results (physical bounds, mass/energy conservation, convergence). Diagnose failed simulations with probable-cause analysis and recommended fixes. Use when preparing to launch a simulation, checking whether a running job is healthy, verifying that finished results are trustworthy, or debugging a crash or blow-up, even if the user only says "my simulation crashed" or "can I trust these results."

29 2
Explore
HeshamFS/materials-simulation-skills

simulation-orchestrator

Orchestrate multi-simulation campaigns — generate parameter sweep configurations (grid, linspace, or Latin Hypercube sampling), initialize and track batch job campaigns, monitor job completion status, and aggregate results with summary statistics across all runs. Use when running a parameter study across dt, kappa, or other simulation inputs, managing dozens or hundreds of simulation configurations, combining outputs from completed batch runs to find the best result, or automating the generate-run-collect workflow for systematic studies, even if the user only says "I need to try many parameter combinations" or "how do I organize a sweep."

29 2
Explore
HeshamFS/materials-simulation-skills

ontology-explorer

Parse, navigate, and query materials science ontology structures — browse class hierarchies, inspect individual classes and their properties, look up object and data property definitions with domain/range, search for ontology terms by keyword, and parse or summarize raw OWL/XML files. Supports the OCDO ecosystem (CMSO, ASMO, CDCO, PODO, PLDO, LDO). Use when exploring what classes or properties an ontology provides, finding the right CMSO term for a crystal structure or simulation concept, understanding parent-child class relationships, or onboarding to an unfamiliar materials ontology, even if the user only says "what ontology terms describe my FCC copper simulation" or "show me the CMSO class hierarchy."

29 2
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results