Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

differentiation-schemes差异化方案

Agent Skill

differentiation-schemes 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

618

周安装

25

GitHub Stars

31

下载量

194
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:differentiation-schemes(差异化方案)
来源仓库:https://github.com/heshamfs/materials-simulation-skills
仓库路径:skills/differentiation-schemes
安装命令:
npx skills add https://github.com/heshamfs/materials-simulation-skills --skill differentiation-schemes
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/heshamfs/materials-simulation-skills --skill differentiation-schemes

简介

differentiation-schemes 协助选择数值仿真中的离散化差分格式。

  • 根据场光滑性、网格类型和边界条件推荐合适算法。
  • 生成 stencil 并评估截断误差阶数,指导精度控制。
  • 依赖 NumPy 进行 stencil 计算,无需额外重负荷依赖。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Differentiation Schemes

Goal

Provide a reliable workflow to select a differentiation scheme, generate stencils, and assess accuracy for simulation discretization.

Requirements

  • Python 3.8+
  • NumPy (for stencil computations)
  • No heavy dependencies

Inputs to Gather

InputDescriptionExample
Derivative orderFirst, second, etc.1 or 2
Target accuracyOrder of truncation error2 or 4
Grid typeUniform, nonuniformuniform
Boundary typePeriodic, Dirichlet, Neumannperiodic
SmoothnessSmooth or discontinuoussmooth

Decision Guidance

Scheme Selection Flowchart

Is the field smooth?
├── YES → Is domain periodic?
│   ├── YES → Use central differences or spectral
│   └── NO → Use central interior + one-sided at boundaries
└── NO → Are there shocks/discontinuities?
    ├── YES → Use upwind, TVD, or WENO
    └── NO → Use central with limiters

Quick Reference

SituationRecommended Scheme
Smooth, periodicCentral, spectral
Smooth, boundedCentral + one-sided BCs
Advection-dominatedUpwind
Shocks/frontsTVD, WENO
High accuracy neededCompact (Padé), spectral

Script Outputs (JSON Fields)

ScriptKey Outputs
scripts/stencil_generator.pyoffsets, coefficients, order, accuracy
scripts/scheme_selector.pyrecommended, alternatives, notes
scripts/truncation_error.pyerror_scale, order, notes

Workflow

  1. Identify requirements - derivative order, accuracy, smoothness
  2. Select scheme - Run scripts/scheme_selector.py
  3. Generate stencils - Run scripts/stencil_generator.py
  4. Estimate error - Run scripts/truncation_error.py
  5. Validate - Test with manufactured solutions or grid refinement

Conversational Workflow Example

User: I need to discretize a second derivative for a diffusion equation on a uniform grid. I want 4th-order accuracy.

Agent workflow:

  1. Select appropriate scheme: python3 scripts/scheme_selector.py --smooth --periodic --order 2 --accuracy 4 --json
  2. Generate the stencil: python3 scripts/stencil_generator.py --order 2 --accuracy 4 --scheme central --json
  3. Result: 5-point stencil with coefficients [-1/12, 4/3, -5/2, 4/3, -1/12] / dx².

Pre-Discretization Checklist

  • Confirm derivative order and target accuracy
  • Choose scheme appropriate to smoothness and boundaries
  • Generate and inspect stencils at boundaries
  • Estimate truncation error vs physics scales
  • Verify with grid refinement study

CLI Examples

# Select scheme for smooth periodic problem
python3 scripts/scheme_selector.py --smooth --periodic --order 1 --accuracy 4 --json

# Generate central difference stencil for first derivative
python3 scripts/stencil_generator.py --order 1 --accuracy 2 --scheme central --json

# Generate 4th-order second derivative stencil
python3 scripts/stencil_generator.py --order 2 --accuracy 4 --scheme central --json

# Estimate truncation error
python3 scripts/truncation_error.py --dx 0.01 --order 2 --accuracy 2 --scale 1.0 --json

Error Handling

ErrorCauseResolution
order must be positiveInvalid derivative orderUse 1, 2, 3,...
accuracy must be even for centralOdd accuracy requestedUse 2, 4, 6,...
Unknown schemeInvalid scheme typeUse central, upwind, compact

Interpretation Guidance

Stencil Properties

PropertyMeaning
Symmetric offsetsCentral scheme (no directional bias)
Asymmetric offsetsOne-sided or upwind scheme
More pointsHigher accuracy but wider stencil

Truncation Error Scaling

Accuracy OrderError Scales AsRefinement Factor
2nd orderO(dx²)2× refinement → 4× error reduction
4th orderO(dx⁴)2× refinement → 16× error reduction
6th orderO(dx⁶)2× refinement → 64× error reduction

Common Stencils

DerivativeAccuracyPointsCoefficients (× 1/dx or 1/dx²)
1st23[-1/2, 0, 1/2]
1st45[1/12, -2/3, 0, 2/3, -1/12]
2nd23[1, -2, 1]
2nd45[-1/12, 4/3, -5/2, 4/3, -1/12]

Security

Input Validation

  • --order (derivative order) is validated as a positive integer with an upper bound
  • --accuracy is validated as a positive even integer for central schemes
  • --scheme is validated against a fixed allowlist (central, upwind, compact)
  • --dx and --scale are validated as finite positive numbers
  • No user-supplied strings are interpolated into code paths or shell commands

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 scripts (stencil_generator.py, scheme_selector.py, truncation_error.py) with explicit argument lists
  • Write: Used to save generated stencil coefficients or scheme recommendations; 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)
  • Stencil computation uses only NumPy linear algebra on small, bounded matrices (stencil width limited by accuracy order)
  • All output is deterministic JSON with no shell-interpretable content

Limitations

  • Boundary handling: Stencil generator provides interior stencils; boundaries need special treatment
  • Nonuniform grids: Standard stencils assume uniform spacing
  • Spectral: Not covered by stencil generator

References

  • references/stencil_catalog.md - Common stencils
  • references/boundary_handling.md - One-sided schemes
  • references/scheme_selection.md - FD/FV/spectral comparison
  • references/error_guidance.md - Truncation error scaling

Version History

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

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.24%
按下载量换算76

Claude

30.61%
按下载量换算59

Cursor

18.34%
按下载量换算36

Gemini CLI

8.79%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/heshamfs/materials-simulation-skills --skill differentiation-schemes 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills