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 分