Token导航 LogoToken导航TokenDH.com
Open Fem Agent logo
运维云端stdio官方级别未说明来源级核验

Open Fem Agent

MCP Server

开源有限元模型协议服务器,连接AI编码代理与多种有限元求解器,支持操作、耦合和开发新求解能力。

工具数

12

提示词数

0

GitHub Stars

2

资源数

0
PythonClaude开源工具ClaudeCursorWindsurf

安装说明

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

作者 / 组织

alhermann

提供方

alhermann

最后核验

2026/5/17 20:21

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python3 -m venv .venv && source .venv/bin/activate

详细介绍

打开FEM代理

开源 模型上下文协议(MCP)服务器 其将AI编码代理连接到8个独立的有限元代码。任何兼容MCP的AI工具(Claude Code、Cursor、Windsurf、GitHub Copilot)都可以 操作 求解器, 一对 它们跨越代码,以及 开发 新的求解器功能——全部通过一个协议实现。

关键数字

度量
FEM后端7工作 (FEniCSx、deal.II、4C、NGSolve、scikit fem、Kratos、DUNE fem)
MCP工具13 整合工具
物理类型194 跨越所有后端
耦合模式7 (热DD、泊松DD、单向TSI、双向TSI、松弛研究、L型支架、预CICE)
支持的求解器对20 用于领域分解(任何Python求解器+任何后端)
测试209通过
E2E压力测试24已完成 (24次通过)

快速开始

1.克隆并安装

git clone  && cd open-fem-agent
python3 -m venv .venv && source .venv/bin/activate
pip install -e .

2.安装求解器后端(选择所需内容)

# pip-installable (any combination)
pip install ngsolve scikit-fem dune-fem
pip install KratosMultiphysics KratosStructuralMechanicsApplication

# FEniCSx (requires conda)
conda create -n fenics -c conda-forge fenics-dolfinx
# or: pip install fenics-dolfinx (if available for your platform)

# deal.II (system package)
sudo apt install libdeal.ii-dev   # Ubuntu/Debian

# 4C Multiphysics (build from source — see 4C documentation)

3.连接到您的AI工具

MCP服务器作为stdio进程运行。每个AI工具都有自己的注册方式。

克劳德代码 (推荐--支持评论家工作流的子代理生成):

# From the project root:
claude mcp add open-fem-agent \
  .venv/bin/python -- -m server \
  -e PYTHONPATH=src \
  -e PYVISTA_OFF_SCREEN=true

或手动创建 .claude/settings.json 在项目目录中:

{
  "mcpServers": {
    "open-fem-agent": {
      "type": "stdio",
      "command": ".venv/bin/python",
      "args": ["-m", "server"],
      "cwd": "src",
      "env": {
        "PYTHONPATH": "src",
        "PYVISTA_OFF_SCREEN": "true"
      }
    }
  }
}

光标:

前往“设置”>“MCP服务器”>“添加服务器”,然后输入:

  • 姓名: open-fem-agent
  • 命令: /path/to/open-fem-agent/.venv/bin/python
  • Args: -m server
  • 工作目录: /path/to/open-fem-agent/src
  • 环境: PYTHONPATH=src, PYVISTA_OFF_SCREEN=true

帆板运动:

添加到您的Windsurf MCP配置中(设置>MCP):

{
  "open-fem-agent": {
    "command": "/path/to/open-fem-agent/.venv/bin/python",
    "args": ["-m", "server"],
    "cwd": "/path/to/open-fem-agent/src",
    "env": { "PYTHONPATH": "src", "PYVISTA_OFF_SCREEN": "true" }
  }
}

OpenAI Codex/任何MCP客户端:

服务器通过stdio与标准MCP通信。为您的客户指出:

command: .venv/bin/python -m server
cwd: src/
env: PYTHONPATH=src

4.验证

source .venv/bin/activate
cd src && python -m server  # should start without errors (Ctrl+C to stop)

# Run tests
cd .. && pytest tests/ -v

5.可选:配置求解器源访问

要启用开发人员模式(源代码浏览、修改、重建),请将求解器路径添加到MCP环境中。看 .claude/settings.json.example 对于模板。

环境变量

从pip/conda安装中自动检测求解器后端。对于编译的求解器或源代码级开发访问,请在MCP设置中设置这些:

变量目的示例
FOURC_ROOT4C源树/home/user/4C
FOURC_BINARY4C二进制路径/home/user/4C/build/4C
DEALII_ROOT交易。II来源/opt/dealii
FENICS_ROOTFEniCSx来源/home/user/dolfinx
NGSOLVE_ROOTNGSolve来源/home/user/ngsolve
KRATOS_ROOT奎托斯来源/home/user/Kratos
DUNE_ROOTDUNE有限元源/home/user/dune-fem
SKFEM_ROOTscikit有限元源/home/user/scikit-fem

当a *_ROOT 设置变量后,代理可以浏览、修改和重建求解器源代码(开发人员模式)。

建筑

User --> AI Agent (any MCP client) --> MCP Protocol --> Open FEM Agent
                                                          |
                  +-------------+-------------+-----------+--------+--------+--------+
                  |             |             |           |        |        |        |
               FEniCSx      deal.II        4C        NGSolve  skfem    Kratos   DUNE
              (Python)       (C++)       (YAML)     (Python) (Python) (JSON)  (Python)

三种操作模式

1.操作:运行模拟

代理生成求解器特定的输入,运行模拟并验证结果。

2.耦合:多求解器工作流

不同有限元代码之间的域分解、场传递和多物理场耦合。

3.开发:扩展求解能力

当求解器缺少所需的功能时,代理可以读取源代码、实现缺失的部分、重建和测试。

MCP工具

工具目的
prepare_simulation一次通话中的知识+示例+模板
run_simulation执行基于Python的求解器(FEniCS、NGSolve、scikit fem、DUNE)
run_with_generator生成输入+运行编译的求解器(4C、deal.II、Kratos)
knowledge物理知识、陷阱、材料、耦合文档
discover列出求解器,检查可用性,能力矩阵
examples求解器测试套件中的真实测试文件和模板
coupled_solve交叉求解器域分解(20个求解器对组合)
transfer_field在求解器输出之间提取和传输字段
visualize现场统计、绘图、自动验证
generate_meshGmsh网格生成(L域、带孔板、通道)
developer源架构、文件浏览、扩展点
session_insights回顾会话模式,贡献知识

测试基准

这些基准测试是使用新的人工智能代理进行的端到端压力测试。每个提示都逐字逐句地提供给代理人,没有额外的指导。

单解算器基准测试(9/9通过)

#提示求解器结果
1Solve the lid-driven cavity problem at Re=400 using FEniCS and visualize the vortex structure in ParaView.FEniCS通过
2Run a 3D magnetostatics problem in NGSolve: a permanent magnet inside a steel housing. Show the B-field distribution.NGSolve通过
3Simulate a cantilever beam with Neo-Hookean hyperelastic material under large deformation using deal.II. Apply 30% compression.交易。II通行证
4Run an eigenvalue analysis on an L-shaped membrane in scikit-fem. Find the first 10 eigenfrequencies and compare against known values.scikit有限元通过
5Simulate fluid-structure interaction of a flexible flag behind a cylinder in 4C.4C通行证
6Solve a transient reaction-diffusion system (Turing patterns) on a unit square using DUNE-fem. Show the pattern evolution.DUNE fem通过
7Simulate a 3D cantilever beam subjected to a sudden tip load using Kratos Multiphysics. Track the tip displacement over time and compare the oscillation frequency against the analytical first natural frequency.奎托斯通行证
8Simulate 2D flow past a circular cylinder at Re=100 using FEniCS. Run long enough to capture periodic vortex shedding and measure the Strouhal number. Compare against the accepted value St~0.164.FEniCS通过
9Solve the Poisson equation with a known analytical solution on a 3D unit cube using NGSolve. Run an h-convergence study with 4 mesh refinement levels and verify optimal L2 convergence rate for P1 and P2 elements.NGSolve通过

交叉求解器验证(2/2通过)

#提示求解器结果
10Solve Stokes flow in a backward-facing step on FEniCS, NGSolve, and scikit-fem. Compare the reattachment length.3个求解器通过
11Run linear elasticity on a plate with a circular hole under uniaxial tension. Compare stress concentration factor across deal.II, FEniCS, and 4C.3个求解器通过

多求解器耦合(4/4通道)

#提示求解器结果
12Solve heat conduction on an L-domain with FEniCS, transfer the temperature field to NGSolve, and solve thermoelasticity there. Show the thermal stress distribution.FEniCS+NSolve通过
13Run a Poisson problem with domain decomposition: left half on DUNE-fem, right half on scikit-fem. Iterate until convergence.DUNE+scikit有限元通过
14Simulate a heated steel beam in 4C (TSI one-way) and independently verify the thermal expansion using FEniCS. Compare displacements.4C+费用通过
15Model electromagnetic wave scattering in NGSolve around an obstacle, then use the Joule heating field as a thermal load in a Kratos structural analysis.NGSolve+奎托斯通行证

高级(7/7通过)

#提示求解器结果
16Run a poroelasticity consolidation problem in 4C (Terzaghi's problem) and verify against the analytical solution.4CPASS(重新运行:沉降0.1%,压力\<0.4%误差,代理导出正确BULKMODULUS→阿尔法映射)
17Simulate crack propagation in a double-cantilever beam using 4C peridynamics and compare the energy release rate against LEFM predictions.4CPASS(G_eff=G_Ic精确值,CMOD为LEFM的8.5%)
18Set up a fluid-beam interaction problem in 4C: flow around a slender elastic beam. Monitor the beam tip displacement over time.4CPASS(4.36mm尖端偏转,单调增长)
19Simulate gravity-driven packing of 500 spherical particles into a cylindrical container using Kratos DEM. Measure the final packing fraction and compare against the random close packing limit (~0.64).奎托斯通行证
20Compute the first 6 electromagnetic resonant frequencies of a 3D rectangular cavity using NGSolve Nédélec elements. Compare against the analytical TM/TE mode frequencies.NGSolve通过(所有6种模式都匹配\<10⁻⁶ 相对误差)
21Generate a 3D thick-walled cylinder mesh with Gmsh, then solve internal pressure loading with Neo-Hookean material in FEniCS. Compare the radial displacement against the analytical Lamé solution at small strain.FEniCSPASS(L2误差与Lamé、P2曲线元素相比为0.42%)

求解器选择和代理智能(1/1通过)

#提示选择求解器结果
22Solve the heat equation on a unit square with T=1 on the left, T=0 on the right, and zero-flux top/bottom. Pick the best solver and verify against the analytical solution.FEniCS(自动选择)通过(L2误差=7e-15,机器精度)
23Simulate two elastic blocks being pressed together with contact. Use whichever solver is most appropriate.4C(自动选择)PASS(砂浆惩罚接触,10个加载步骤,应力集中1.66x)
24Set up a simple fluid-structure interaction problem in Kratos using the CoSimulation application: flow in a channel with a flexible wall segment. Monitor the wall deflection.奎托斯PASS(14次艾特肯迭代,13.99mm偏转,与梁理论相比为1.3%)

贡献

我们欢迎改善 多用途的 Open FEM Agent的功能。关键原则:

每一项改进都必须使所有模拟受益,而不是针对特定示例进行微调。

如何做出贡献

  1. 报告代理行为 --使用AI工具和求解器设置运行任何基准测试提示(或您自己的)。报告:

- 你使用了哪种人工智能工具(克劳德代码、光标、风帆等) - 你给出的确切提示 - 什么有效,什么无效 - 代理人的回顾(问下面的汇报问题)

  1. 提高求解器知识 -添加陷阱、元素目录或API文档,以帮助任何代理正确设置模拟。专注于代理人必须通过反复试验发现的事情。
  1. 添加求解器后端 --实施 SolverBackend 新FEM代码的接口。
  1. 膨胀联轴器 --在中为新的求解器对添加脚本生成器 src/tools/coupling.py.

什么不该贡献

  • 基准特定参数数据库(代理应针对每个问题进行研究)
  • 特定于模型的模板(例如“Turek Hron FSI2模板”)——这些是微调
  • 硬编码路径或机器特定配置

汇报问题(每次压力测试后提问)

- "What went wrong and what workarounds did you have to use?"
- "Which MCP tools were useful and which were missing or unhelpful?"
- "What information did you have to look up online that should have been available through the MCP?"
- "What parameters did you struggle with and why?"
- "If you had to do this again, what would you do differently?"

将答案反馈为对MCP知识和工具的通用改进。

AI工具兼容性

MCP服务器可与任何兼容MCP的AI工具配合使用。代理指令以多种格式提供:

文件AI工具
CLAUDE.md克劳德代码
AGENTS.md交叉工具标准
.cursorrules光标
.windsurfrules风帆冲浪
.github/copilot-instructions.mdGitHub副本

许可证

麻省理工学院

引用

如果您在研究中使用Open FEM Agent,请引用:

@article{openfem2026,
  title={Open FEM Agent: An Open-Source Multi-Solver MCP Server for LLM-Driven Finite Element Simulation},
  year={2026},
}

目录标签

目录标签

PythonClaude开源工具有限元分析本地部署AI辅助开发多物理场耦合模型协议

支持客户端

ClaudeCursorWindsurf

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

12

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP