
DualSPHysics MCP
io.github.vegetableno1由 GitHub 帳號 vegetableno1 發布v0.2.0更新於 Oct 24, 2026
Agent toolchain for the DualSPHysics SPH solver: case creation, runs, post-processing, validation.
概覽
封裝本機 DualSPHysics SPH 工具鏈,讓助理設計、執行、後處理並驗證二維潰壩模擬。
- 可以做什麼
- 檢查本機 DualSPHysics 安裝:找出 GenCase、求解器、PartVTK 與 MeasureTool,並回報版本與安裝提示
- 以結構化參數建立、修改與讀回二維潰壩案例,並估算粒子數
- 以 GenCase 離散化案例,並將 CPU 求解器以背景工作啟動
- 輪詢工作進度、模擬時間、吞吐量與預計完成時間
- 將粒子輸出轉為 ParaView 可讀的 VTK 檔,並在指定點取樣成 CSV 時間序列
- 將潰壩湧潮前緣與內建的 Koshizuka & Oka (1996) 實驗比對,給出逐時刻誤差與 MAE/RMSE/最大值
- 適用情境
- 適合在本機執行 DualSPHysics、希望由助理反覆調整潰壩案例設定、啟動並監控求解工作,並與參考實驗比對結果的情境,不必手寫 XML 或命令列。
- 執行需求
- 在桌機上以本機程序執行,需要 Python 3.10+(PyPI 套件,可用 uvx 啟動)。另需自行安裝 DualSPHysics:GenCase、CPU 求解器、PartVTK 與 MeasureTool 執行檔,透過 DSPH_GENCASE、DSPH_SOLVER、DSPH_PARTVTK、DSPH_MEASURETOOL、PATH 或常見安裝路徑尋找。可選 DSPH_JOBS_DIR 與 DSPH_OMP_THREADS。無需驗證。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 DualSPHysics MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
DualSPHysics MCP
Language: English | 中文
[Listed on mcpservers.org] [vegetableno1/DualSPHysics-mcp MCP server] [CI]
Design, run, and verify DualSPHysics simulations from an AI agent — not just stare at them.
Ten Model Context Protocol tools wrap a local DualSPHysics SPH toolchain end to end: design cases as structured parameters (no hand-written XML, no solver needed to iterate), run them as background CPU jobs with progress, throughput and the solver's own ETA on tap, post-process into ParaView-ready VTK and CSV time series, and verify a 2D dam-break against the Koshizuka & Oka (1996) experiment with per-time errors and MAE / RMSE / max.
The server only launches the DualSPHysics command-line tools as subprocesses; DualSPHysics itself is not distributed here — it is free LGPL-2.1-or-later software, this package neither links nor redistributes its code or binaries, so the MIT licence carries no extra obligations. If you publish work using DualSPHysics, cite Dominguez et al. (2022), Computational Particle Mechanics 9:867–895, doi:10.1007/s40571-021-00404-2.
Tools
Working chain: check_environment → create_case → describe_case →
gencase → run_case → poll job_status → partvtk + measure_tool →
validate_dambreak. Vocabulary, three guards and particle-estimate
arithmetic: docs/case-generation.md.
Domain contracts
Behaviours of the wrapped tools that their -h output does not tell you:
- Geometry outside the domain box is silently clipped by GenCase (exit 0, no warning) —
create_casecontainment-checks every domain. - DualSPHysics CSVs default to semicolon separators;
measure_toolforces commas unless the caller passes their own-csvsep. - MeasureTool points files reject leading
#comment lines; MeasureTool errors print on stdout, not stderr. Time/SecinRun.outis wall-clock seconds per simulated second — not steps/second; the row tail is the solver's projected finish.Run.outrow formats differ between solver v5.0/v5.2 and v5.4; the parser handles both.
All fourteen contracts (formats, exit codes): docs/domain-contracts.md.
Install
Python 3.10+. The binaries are discovered from DSPH_* environment
variables, PATH, or conventional install roots (/opt, /usr/local, ~/softwares, ~, cwd → <root>/DualSPHysics*/bin/linux).
Getting the solver (the GitHub repository ships GenCase / PartVTK / MeasureTool prebuilt but not the solver):
- Full package from https://dual.sphysics.org/downloads/, or
git clone https://github.com/DualSPHysics/DualSPHysicsand build the CPU solver withmake -f Makefile_cpu(g++ only, no CUDA needed), then copy the prebuilt tools frombin/linux/.
Configure through environment variables (no .env parsing; see .env.example
— the same paths appear in examples/mcp_config.example.json):
Run
Client registration templates: examples/mcp_config.example.json:
Example: 2D dam-break validation (Koshizuka & Oka 1996)
examples/dambreak_val2d/ holds the showcase: the official validation layout
(dp = 0.01 m; 1 m × 2 m water column in a 4 m × 3 m tank; TimeMax = 2 s,
TimeOut = 0.01 s; Verlet / Wendland / artificial viscosity 0.02 / Fourtakas
DDT 0.1), regenerated by gen_dambreak_val2d.py (MIT), a surge-front
MeasureTool points file (401 points along z = 0.03 m), and the digitised
experiment.
Measured on this case (GenCase v5.4.354 / solver v5.4.355, 8 CPU threads, i5-10210U):
[Simulated surge front vs the 1996 experiment]
The residual is SPH physics, not a measurement artefact: the front extraction
tracks the solver's own SWL gauge (mean deviation 8 mm < 10 mm point spacing),
and the experiment ends at X/a ≈ 4.13 — beyond the 4 m tank — so the
comparison saturates after wall impact (validate_dambreak notes impact_time_s).
Agent transcript:
validate_dambreak reports per-time errors plus MAE / RMSE / max in metres
and as % of the 1 m column. The figure comes from
examples/make_validation_figure.py; examples/render_dambreak.py turns the
same run's Part_*.vtk into an MP4 animation (dev dependencies).
Tests
The suite is green without any solver installed (discovery, command
construction, log-fixture parsing, validation math, case generation, stdio
end-to-end). Tests marked solver exercise a real local toolchain and
auto-skip otherwise.
Contents
src/dualsphysics_mcp/— MCP server, tool discovery and config, error codes, the ten tools intools/.examples/— validation case,create_case_demo.py, figure + animation scripts, client template.tests/— pytest suite (solver tests auto-skip).
Repository rules
- Committed: source, tests, examples, documentation, templates.
- Not committed: DualSPHysics binaries or sources (LGPL work stays out),
virtual environments,
.env, job outputs and generated results. - Experiment values in
examples/dambreak_val2d/are digitised facts cited to Koshizuka & Oka (1996) as shipped with the DualSPHysics examples; the generated case XML and all code here are original MIT content — details in CONTRIBUTING.md.
來源:README.md,提交 ac42bff
工具
0版本歷史
2- v0.2.0最新Sep 25, 2026
- v0.1.1Sep 22, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分