Physverify

io.github.rcgiri-physics由 GitHub 账号 rcgiri-physics 发布v0.5.1更新于 Oct 26, 2026

Runs physverify checks on physics code. It runs the code it checks: use on trusted code only.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

对物理仿真代码运行 physverify 数值验证检查,并返回通过/失败结果的 JSON 报告。

可以做什么
  • 对物理仿真代码运行验证检查:制造解、收敛阶、守恒量、极限与精确性。
  • 可指定定义 checks() 的规范文件,也可在项目目录下自动查找 verify_*.py 文件。
  • 返回 JSON 报告,按检查类别、标签和状态列出结果。
适用场景
适合在开发或审查 ODE/PDE 求解器时使用,让助手确认仿真是否以所声称的精度阶收敛、是否守恒应有的量,而不只是能跑通。最适用于 ODE,PDE 目前仅支持一维。
运行要求
作为本地进程运行,从 PyPI 安装(pip install physverify),需要 Python 和 NumPy。未声明账号、API 密钥或环境变量。待检查代码需位于本机,且代码需能加入源项或提供包装层。
安装前请注意
它会执行所检查的代码,因此只应用于可信代码。PASS 仅表示这些检查未发现问题,其独立性取决于所写的参考解。给出的结果仅针对有限样本,并非缺陷率。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Physverify,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

physverify

[tests] [PyPI] [Python] [DOI] [Docs]

Checks that a simulation solves the equations it claims, at the order of accuracy it claims, not just that it runs.

physverify is actively evolving (v0.7.0), welcoming contributions and test cases from the computational physics community. Status: under active development and maintenance, tested on a growing corpus of public physics codes; releases come at milestones. Scope: numerical solutions of ODEs and PDEs (time integration, convergence, conservation), plus a few Monte Carlo checks. It needs only NumPy.

[The check loop: your solver and an independent description of the physics go in; physverify runs the solver at several resolutions, measures the error and reports a verdict with a reason]

bash
pip install physverifyphysverify demo

The demo checks a correct solver (all checks pass), then the same solver with the damping 10% too large (all fail):

[Error against step size: the correct solver follows the slope-2 line, the broken one levels off]

New to this? Start here walks through installation and a first check in about ten minutes, with a prompt to paste if you use an AI coding assistant.

Use it on your own code

  • Any project, no set-up: physverify scan PATH reads the code (it runs nothing) and flags Runge-Kutta methods that do not have their stated order (written as tables, as class attributes or as stages in code), grid spacings that do not match their grid, near-miss physical constants, and inverse function pairs worth a round-trip test.
  • An ODE solver: physverify init verify_solver.py --solver mysolver --order 4 writes a spec; fill in the equations (from the physics, not from your code) and run physverify run verify_solver.py.
  • A Runge-Kutta table: check_tableau(A, b, c, claimed=3) from physverify.butcher checks its order, stage order and stability from the coefficients alone.
  • Errors you already have: check_order(hs, errors, expected=2) gives PASS, FAIL or INCONCLUSIVE with a reason.

Run it in CI

A failed check fails the job, like a broken unit test (CI guide: options, pre-commit, pytest):

yaml
      - uses: rcgiri-physics/[email protected]        with:          specs: tests/verify_*.py

Getting started · Recipes · What a PASS means · Troubleshooting · API

Does it catch bugs?

Of 37 bugs seeded into five small solvers, it flagged 35 (plain "compare with one answer" tests: 27), with no false alarms. The bugs and checks were written by the same person, so this shows the tool works as designed, not how it does on other people's code. On public physics repositories, 74 defects were reported to authors; 14 of them were found by a physverify check as such, 11 by simply running the code, and the rest by the per-repository test scripts or by reading the code. physverify scan alone, with no script, now finds 18 of the 74, up from 2 in its first version, and found 7 new defects in the same repositories (which found what). The counts describe that sample only and are not a bug rate. Details: results, and results/README.md to regenerate every table.

Limits

Works best for ODEs; PDEs only in 1D so far. Your code needs a way to add a source term, or a small wrapper that can itself be wrong. A PASS means these checks found nothing wrong; it does not prove the simulation correct, and it is only as independent as the reference you wrote: see What a PASS means.

Contributing, citing, licence

Help is welcome: a trial report on your own solver, seeded bugs written by someone other than the author, adapters, documentation. See CONTRIBUTING.md, the code of conduct, SUPPORT.md for help, SECURITY.md on running untrusted code, and AGENTS.md for AI assistants. To cite, use doi:10.5281/zenodo.23534512 or CITATION.cff. Changes: CHANGELOG.md; plans: ROADMAP.md. The methods are standard and other tools do parts of this, some better (NodePy for Runge-Kutta analysis); see related work and credits. MIT licence, copyright (c) 2026 Ram Chandra Giri.

来源:README.md,提交 6217271

工具

1

run_checks

Run physverify verification checks (manufactured solutions, order of convergence, invariants, limits, exactness) on physics simulation code. Takes spec files that define checks(); with no specs given, finds verify_*.py files under `project`. Returns a JSON report: per check family, label, status (PASS, EXACT, FAIL, INCONCLUSIVE, ERROR, SKIP), message, observed and expected order, step sizes and errors.

输入参数specsproject

版本历史

1
  1. v0.5.1最新Oct 25, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分