返回技能列表

convergence-study

HeshamFS
更新于 2 days ago
5 次查看
40
3
40
在 GitHub 上查看
文档general

关于

This skill performs automated convergence analysis for numerical simulations, computing observed orders of accuracy and estimating discretization errors using Richardson extrapolation and Grid Convergence Index (GCI) calculations. It helps developers verify mesh adequacy, check asymptotic convergence, and prepare formal verification reports per ASME V&V 20 standards. Use it whenever you need to assess solution accuracy or determine if your grid resolution is sufficient.

快速安装

Claude Code

推荐
主要方式
npx skills add HeshamFS/materials-simulation-skills -a claude-code
插件命令备选方式
/plugin add https://github.com/HeshamFS/materials-simulation-skills
Git 克隆备选方式
git clone https://github.com/HeshamFS/materials-simulation-skills.git ~/.claude/skills/convergence-study

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Convergence Study

Goal

Provide script-driven convergence analysis for verifying that numerical solutions converge at the expected rate as the mesh or timestep is refined.

Requirements

  • Python 3.8+
  • NumPy (not required; scripts use only math stdlib)

Inputs to Gather

InputDescriptionExample
Grid spacingsSequence of mesh sizes (coarse to fine)0.4,0.2,0.1,0.05
Timestep sizesSequence of dt values0.04,0.02,0.01
Solution valuesQoI at each refinement level1.16,1.04,1.01,1.0025
Expected orderFormal order of the numerical scheme2.0
Safety factorGCI safety factor (1.25 default)1.25

Script Outputs (JSON Fields)

ScriptKey Outputs
scripts/h_refinement.pyresults.observed_orders, results.mean_order, results.richardson_extrapolated_value, results.convergence_assessment
scripts/dt_refinement.pySame as h_refinement but for temporal convergence
scripts/richardson_extrapolation.pyresults.extrapolated_value, results.error_estimate, results.observed_order
scripts/gci_calculator.pyresults.observed_order, results.gci_fine, results.gci_coarse, results.asymptotic_ratio, results.in_asymptotic_range

Workflow

  1. Run grid/timestep refinement study with at least 3 levels
  2. Compute observed convergence order with h_refinement.py or dt_refinement.py
  3. Compare observed order to expected order of the scheme
  4. Estimate discretization error via Richardson extrapolation
  5. Report GCI for formal solution verification using gci_calculator.py
  6. Document convergence results and any anomalies

Decision Guidance

Do you have 3+ refinement levels?
+-- YES --> Run h_refinement.py or dt_refinement.py
|           +-- Observed order matches expected? --> Solution verified
|           +-- Order too low? --> Check: pre-asymptotic, coding error, insufficient resolution
|           +-- Order too high? --> Check: superconvergence or cancellation effects
+-- NO (only 2 levels) --> Use richardson_extrapolation.py with assumed order
                           (less reliable without order verification)

CLI Examples

# Spatial convergence with 4 grid levels
python3 scripts/h_refinement.py --spacings 0.4,0.2,0.1,0.05 --values 1.16,1.04,1.01,1.0025 --expected-order 2.0 --json

# Temporal convergence with 3 timestep levels
python3 scripts/dt_refinement.py --timesteps 0.04,0.02,0.01 --values 2.12,2.03,2.0075 --expected-order 2.0 --json

# Richardson extrapolation with assumed 2nd-order
python3 scripts/richardson_extrapolation.py --spacings 0.02,0.01 --values 1.0032,1.0008 --order 2.0 --json

# GCI for 3-mesh verification
python3 scripts/gci_calculator.py --spacings 0.04,0.02,0.01 --values 1.0128,1.0032,1.0008 --json

Error Handling

ErrorCauseResolution
spacings and values must have the same lengthMismatched input arraysProvide equal-length lists
At least 2 refinement levels requiredToo few data pointsAdd more refinement levels
Exactly 3 refinement levels requiredGCI needs 3 levelsProvide fine/medium/coarse
Oscillatory convergence detectedNon-monotone convergenceCheck mesh quality or scheme

Interpretation Guidance

ScenarioMeaningAction
Observed order matches expectedSolution in asymptotic rangeReport GCI, extrapolate
Observed order < expectedPre-asymptotic or coding bugRefine further or debug
Negative observed orderSolution divergingCheck implementation
GCI asymptotic ratio near 1.0Grids in asymptotic rangeResults are reliable
GCI asymptotic ratio far from 1.0Not in asymptotic rangeRefine further

Security

Input Validation

  • All numeric parameters (spacings, timesteps, values, expected-order, order) are validated as finite positive numbers
  • Comma-separated value lists are length-matched (spacings and values must have equal length) and capped at 10,000 entries
  • GCI calculator enforces exactly 3 refinement levels; Richardson extrapolation requires at least 2
  • Safety factor is validated as a finite number greater than 1.0

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

  • Bash: Used to execute the four Python analysis scripts (h_refinement.py, dt_refinement.py, richardson_extrapolation.py, gci_calculator.py) with explicit argument lists
  • Read: Used to inspect script source and reference documentation

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 (math module); no pickle loading or deserialization of untrusted data
  • Minimal tool surface (Bash and Read only) limits the agent's ability to modify the filesystem

References

  • references/convergence_theory.md - Formal convergence order, log-log analysis, asymptotic range
  • references/gci_guidelines.md - Roache's GCI method, ASME V&V 20, safety factors

GitHub 仓库

HeshamFS/materials-simulation-skills
路径: skills/core-numerical/convergence-study
0
agent-skillsagentscli-toolscomputational-sciencellmmaterials-science

相关推荐技能

railway-docs

文档

Railway Docs Skill可实时获取最新的Railway官方文档,确保回答的准确性。当开发者询问Railway功能特性、工作原理或分享docs.railway.com链接时,应优先使用此技能。它通过专门的LLM优化文档源提供最新信息,避免依赖过时记忆来回答技术问题。

查看技能

n8n-code-python

文档

该Skill为在n8n平台的Python代码节点中编写代码提供专家指导,特别适用于需要使用_input/_json/_node语法、Python标准库或了解n8n中Python限制的场景。它强调JavaScript应作为首选方案,仅当需要特定Python功能或对Python语法更熟悉时才使用Python。Skill提供了快速入门模板和关键注意事项,帮助开发者在n8n中高效编写Python代码。

查看技能

archon

文档

Archon Skill为开发者提供了基于RAG的语义搜索和项目任务管理功能,可通过REST API访问知识库。它支持文档搜索、网站爬取、文件上传和版本控制,适用于技术文档查询和项目管理场景。首次使用时需要配置Archon主机地址,建议在处理外部文档时优先使用该Skill。

查看技能

n8n-code-javascript

文档

这个Skill为n8n工作流中的JavaScript代码节点提供专业指导,涵盖数据处理、HTTP请求和日期操作等核心场景。它详细解释了如何正确使用n8n特有的`$input`/`$json`语法、`$helpers`工具以及DateTime对象,并包含关键的错误排查和模式选择建议。开发者通过该Skill能快速掌握Code节点的正确返回格式、数据访问方法和常见陷阱解决方案。

查看技能