Loading...
Loading...
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."
npx skill4agent add heshamfs/materials-simulation-skills simulation-validator| Input | Description | Example |
|---|---|---|
| Config file | Simulation configuration (JSON/YAML) | |
| Log file | Runtime output log | |
| Metrics file | Post-run metrics (JSON) | |
| Required params | Parameters that must exist | |
| Valid ranges | Parameter bounds | |
Is simulation about to start?
├── YES → Run Stage 1: preflight_checker.py
│ └── BLOCK status? → Fix issues, do NOT run simulation
│ └── WARN status? → Review warnings, document if accepted
│ └── PASS status? → Proceed to run simulation
│
Is simulation running?
├── YES → Run Stage 2: runtime_monitor.py (periodically)
│ └── Alerts? → Consider stopping, check parameters
│
Has simulation finished?
├── YES → Run Stage 3: result_validator.py
│ └── Failed checks? → Do NOT use results
│ → Run failure_diagnoser.py
│ └── All passed? → Results are valid| Metric | Conservative | Standard | Relaxed |
|---|---|---|---|
| Mass tolerance | 1e-6 | 1e-3 | 1e-2 |
| Residual growth | 2x | 10x | 100x |
| dt reduction | 10x | 100x | 1000x |
| Script | Output Fields |
|---|---|
| |
| |
| |
| |
scripts/preflight_checker.py --config simulation.jsonNote:validates required keys, numeric ranges, output-directory access, and disk space. It does not evaluate numerical stability (CFL / diffusion-Fourier). For explicit stability gating usepreflight_checker.py.skills/core-numerical/numerical-stability/scripts/cfl_checker.py
python3 scripts/preflight_checker.py \
--config simulation.json \
--required dt,dx,kappa \
--ranges "dt:1e-6:1e-2,dx:1e-4:1e-1" \
--min-free-gb 1.0 \
--jsonscripts/runtime_monitor.py --log simulation.logpython3 scripts/runtime_monitor.py \
--log simulation.log \
--residual-growth 10.0 \
--dt-drop 100.0 \
--jsonscripts/result_validator.py --metrics results.jsonpython3 scripts/result_validator.py \
--metrics results.json \
--bound-min 0.0 \
--bound-max 1.0 \
--mass-tol 1e-3 \
--json--variationalpython3 scripts/failure_diagnoser.py --log simulation.log --jsonpython3 scripts/failure_diagnoser.py --log simulation.log --jsonpython3 scripts/runtime_monitor.py --log simulation.log --json| Error | Cause | Resolution |
|---|---|---|
| File path invalid | Verify config path exists |
| Parameter is not a number | Fix config file format |
| Parameter outside bounds | Adjust parameter or bounds |
| Permission issue | Check directory permissions |
| Disk nearly full on the output volume | Free up space or reduce output |
| | Use only letters, digits, |
| Inverted/degenerate | Ensure max > min |
| | Pass a finite positive value |
| Log exceeds the 500 MB parse cap | Truncate or pre-filter the log |
| Status | Meaning | Action |
|---|---|---|
| PASS | All checks passed | Proceed with confidence |
| WARN | Non-critical issues found | Review and document |
| BLOCK | Critical issues found | Must fix before proceeding |
| Score | Meaning |
|---|---|
| 1.0 | All validation checks passed → proceed with confidence |
| 0.75+ | Most checks passed, minor issues |
| 0.5-0.75 | Significant issues, review carefully |
| < 0.5 | Major problems, do not trust results |
| No recognized metrics fields; no check ran — NOT a pass. Inspect the metrics file. |
--bound-min--bound-maxfield_minfield_maxbounds_unverifiable--variational"energy_variational": trueenergy_monotoneenergy_net_decrease| Pattern in Log | Likely Cause | Recommended Fix |
|---|---|---|
| NaN, Inf, overflow | Numerical instability | Reduce dt, increase damping |
| max iterations, did not converge | Solver failure | Tune preconditioner, tolerances |
| out of memory | Memory exhaustion | Reduce mesh, enable out-of-core |
| dt reduced | Adaptive stepping triggered | May be okay if controlled |
result_validator.py --jsonresults.statusPASSINSUFFICIENT_DATAresults.confidence_score == 1.0nullINSUFFICIENT_DATAresults.checksmass_conservedbounds_satisfiedno_nanenergy_monotoneenergy_net_decreaseresults.failed_checksbounds_unverifiablefield_minfield_max--variational"energy_variational": trueenergy_monotoneenergy_net_decrease--mass-tol1e-3runtime_monitor.py --jsonresidual_statsdt_statsalerts--residual-growth--dt-dropcore-numerical/numerical-stability/scripts/cfl_checker.pypreflight_checker.pyFAILfailure_diagnoser.py --jsonprobable_causesrecommended_fixes| Tempting shortcut | Why it's wrong / what to do |
|---|---|
| "Preflight passed, so the run is numerically stable." | |
" | An empty or unrecognized metrics file returns |
| "Energy ends lower than it started, so the dissipative run is fine." | The default |
"I asked for bounds and didn't get a | If |
| "The simulation finished without crashing, so the results are trustworthy." | Run completion is not correctness. Verify mass conservation, energy behavior, physical bounds, and a clean |
| "dt got smaller during the run, so the solver is failing." | |
| "I'll just use the default thresholds." | Defaults ( |
--required^[A-Za-z0-9_.-]+$--rangesname:min:maxmax > min--min-free-gbnaninf--residual-growth--dt-drop--bound-min--bound-maxnaninf--bound-max > --bound-min--mass-tolpreflight_checker.pyruntime_monitor.py--logresult_validator.py--metricsfailure_diagnoser.py--logpreflight_checker.pyruntime_monitor.pyresult_validator.pyfailure_diagnoser.pyeval()exec()shell=Truefailure_diagnoser.pyruntime_monitor.py--residual-pattern--dt-patternre.compileevalreferences/validation_protocol.mdreferences/log_patterns.md