Skip to main content
Glama
COMSOL Multiphysics MCP Server

COMSOL Multiphysics MCP Server

by zixuanguo89

COMSOL Multiphysics MCP Server

Python COMSOL License: MIT CI GitHub stars

GitHub: https://github.com/zixuanguo89/comsol-mcp · 274 tools · tested against real COMSOL 6.4

目前功能最全面的 COMSOL Multiphysics MCP 服务器 —— 让 AI agent 直接建模、求解、 评估、绘图、动画、导出、写报告,并复用 COMSOL 官方应用库。

The most comprehensive MCP server for COMSOL Multiphysics — build, mesh, solve, evaluate, plot, animate, export, report and reuse the official application library, all through the Model Context Protocol.

274 个工具 / tools   ·   949 个物理场接口 / physics interfaces   ·   7,343 个物理场特征类型
97 个 3D 几何特征   ·   51 个 3D 网格特征   ·   81 个研究类型   ·   121 种绘图特征   ·   86 种求解器特征
2,081 个官方应用库模型   ·   3,141 种材料 / 19 个材料库   ·   13 篇内置建模指南   ·   已验证 COMSOL 6.4 (build 293)

工具总数以 python -m comsol_mcp --check 的实时输出为准(本仓库仍在持续扩充)。 Tool count is what --check reports live; the repository keeps growing.

目录 / Table of Contents

Related MCP server: COMSOL MCP Server

1. 为什么是"最全面"的 COMSOL MCP

大多数 COMSOL 自动化工具只覆盖"建模"或"求解"的某个切片。本项目把整个 COMSOL 工作流做成 274 个 MCP 工具,并解决了让 AI agent 真正可用的三个核心问题:

  1. 完整覆盖 —— 几何、材料、物理场、多物理场耦合、网格、研究/求解器、 结果评估、绘图、动画/视频、数据导出、报告、模型库、知识库、后台任务全部覆盖; 还提供 tree_* 通用模型树层和 java_eval 原生 API 逃生舱口,理论上没有 "工具没覆盖"的死角。

  2. 可发现性 —— 从本机 COMSOL 6.4 安装中提取的完整类型目录(949 个物理场接口、 7,343 个物理场特征类型、97 个 3D 几何特征、51 个 3D 网格特征、81 个研究类型、 121 种绘图特征、86 种求解器特征、64 种数据集、33 种数值评估、5 种绘图组……) 随包离线分发。Agent 先查目录再建模型, catalog_* / phys_feature_types / tree_properties 让类型名和属性名可自省。

  3. AI 友好 —— 所有工具返回紧凑的 {"ok": ..., ...} JSON;错误带 code/hint 和"可用选项"建议;长任务走异步 job;导出产物返回绝对路径 + 自检 字段(文件大小、图片尺寸、GIF 帧数、mp4 有效性);列表有上限,避免撑爆上下文。

配套交付:安装器、4 种 MCP 客户端配置示例、DeepSeek Harness 直接接入、自动生成的 令牌级工具文档(docs/TOOL_REFERENCE.md)、用户指南与 打包冒烟测试。

2. 功能矩阵 / Feature matrix

领域 / Domain

工具数

能做什么 / Capabilities

代表工具 / Key tools

几何 / Geometry

30

3D/2D/1D/轴对称几何;所有图元(块/柱/球/锥/环/金字塔/棱柱…);布尔、拉伸、旋转、扫掠、放样、倒角/圆角、抽壳、中面、变换/阵列;工作平面;CAD/STEP/IGES/DXF/STL 导入导出;实体几何统计、包围盒、测量;框选/球选/逻辑选择

geom_primitive geom_boolean geom_extrude geom_revolve geom_sweep geom_import geom_entity_info geom_measure geom_selection_actions

材料 / Materials

14

19 个官方材料库、3,141 种材料离线检索;按名/库/类别/所需物性搜索;从库添加(支持保持 LibraryLink 或解链成可编辑副本);手动物性(各向异性张量、多物性组);物性读写;XML 材料导入;域分配

mat_library_search mat_add mat_create mat_properties mat_set_property mat_import_xml

物理场 / Physics

19

任意物理场接口(949 种);友好 BC 别名(温度/热流/对流/辐射/固定/入口/出口/接地/端口…);特征创建/删除/启停;选择集;属性读写;接口级属性;特征树内省

phys_add phys_add_bc phys_add_feature phys_properties phys_set_property phys_feature_types

多物理场 / Multiphysics

7

耦合添加/删除:热膨胀、非等温流动、电磁热、声-固耦合、流-固耦合等;子特征;属性读写

multiphysics_add multiphysics_add_feature multiphysics_properties

网格 / Mesh

22

自由四面体/三角形、映射、扫掠、边界层、尺寸预设与自定义、细化、导入;统计(单元/顶点/质量/体积)、按实体统计、质量直方图;STL/Nastran/3MF/PLY/原生导出

mesh_create_sequence mesh_free_tet mesh_sweep mesh_boundary_layers mesh_set_size mesh_stats mesh_quality mesh_export

研究 / 求解 / Study

34

稳态、瞬态、特征频率、频域、参数/材料/批量扫描、灵敏度;研究步骤任意类型;求解器配置树编辑;同步/异步求解;解对象管理;数据集绑定;求解消息与计时

study_stationary study_transient study_eigenfrequency study_parametric study_solve_async solver_configure solution_info

结果 / Results

27

全局/点/线/面/体求值;积分、平均、最值、标准差、测量、质量属性;所有解/时间/参数点批量评估;表达式合法性预检;CSV/TXT 数据导出;结果表;数据集管理

result_evaluate result_eval_point result_integrate result_minmax result_eval_all_solutions result_export_data dataset_create

绘图 / Plots

13

一/二/三维绘图组;Surface/Volume/Slice/Isosurface/Contour/Arrow/Streamline/LineGraph/Point/Mesh/Global 等;色表、标题、图例、固定色标;PNG/JPEG/BMP 导出并用 Pillow 校验尺寸;绘图数据 CSV

plot_quick plot_group_create plot_add_feature plot_export_image plot_export_plot_data

动画 / Animation

16

一步出 GIF/MP4(固定色标、防闪烁);COMSOL 原生 movie/PNG 序列;任意格式转换、拼接、缩放、加标题;预览/接触表;帧合成(无需 COMSOL);视频信息;聊天内直接展示图像与动画帧

anim_quick anim_create anim_export anim_convert anim_add_title media_frames_to_mp4 visual_view_animation

导出 / Export

9

网格、几何(STL/STEP/IGES/Parasolid/ACIS/原生)、模型 .mph、Java 源码、Plot/Touchstone 导出特征;格式能力查询

export_mesh export_geometry export_model_file export_model_java export_touchstone

报告 / Report

5

HTML / DOCX 报告(含内嵌图片);TitlePage/Section/TOC;插入绘图、表格、网格、物理场、研究等节点;生成后校验文件;Presentation/pptx

report_create report_add_section report_add_content report_generate

知识库 / Knowledge

4

13 篇内置建模指南(入门/几何/物理/材料/网格/求解/结果/绘图/动画/单位/API/排障/工作流);检索离线 COMSOL HTML 文档;按目标推荐工具序列

docs_list docs_get docs_search docs_workflow

模型库 / Model library

7

官方应用库 2,081 个模型离线索引;按关键词/物理场/研究类型/模块/维度检索;元数据(预计耗时、大小、文档);加载、批量求解并保存到工作区

library_search library_describe library_load library_run library_stats

通用模型树 / Tree

16

任意模型树节点的浏览/搜索/属性读写/子节点创建/删除/重命名/改 tag/运行/选择集/启停;通用逃生舱口

tree_children tree_properties tree_set_property tree_create tree_dump tree_find

原生 Java 通道 / java_eval

1

在 COMSOL 工作线程内执行任意 Python/Java API 代码,访问 model/jm/client/jcast/jset/...(有安全风险,见 §13)

java_eval

可视化 / Visual

2

在对话中直接显示导出的 PNG/JPEG/GIF/WebP 或动画抽样帧(filmstrip)

visual_view_image visual_view_animation

会话 / 模型生命周期

22

启动/连接/重启/停止 COMSOL;模型新建/加载/保存/另存/克隆/重命名/删除/快照;当前模型;模型描述、问题列表;能力与健康检查

session_start model_create model_load model_save model_describe health_check comsol_capabilities

参数/变量/函数/选择

15

全局参数批量读写/删除/描述;变量;解析/插值/阶跃/脉冲等全局函数;命名选择(显式/框/球/柱/逻辑组合)

parameter_set parameter_list variable_set function_create selection_create

后台任务 / Jobs

4

异步求解/批量作业:状态、等待、取消、列表;作业带模型与 JSON 日志产物

study_solve_async job_status job_wait job_cancel

类型目录 / Catalogs

7

物理场接口/特征、几何、网格、研究、绘图特征、数值/数据集/导出/求解器类型查询(离线,无需 COMSOL)

catalog_physics_interfaces catalog_physics_features catalog_plot_features catalog_types

MCP 集成 / Integration

—

stdio / HTTP(streamable-http) 传输;comsol:// 只读资源(状态/模型/参数/目录/工作区);服务器 instructions;DeepSeek Harness、Claude Desktop、Codex、opencode、Cursor/Cline 配置示例

comsol://status comsol://model/{name}/tree docs/DSH_INTEGRATION.md

合计 274 个 MCP 工具 + 4 个 comsol:// 资源 + 2 个资源模板(以 --check 为准)。

上下文预算 / Context budget:客户端上下文有限时可设 COMSOL_MCP_TOOL_PROFILE=minimal,只暴露 166 个核心工具(覆盖完整的日常 建模→求解→结果→绘图→动画流程);默认 full 暴露全部 274 个。也可以用 COMSOL_MCP_TOOL_ALLOW / COMSOL_MCP_TOOL_DENY 自定义白/黑名单。

3. 架构 / Architecture

┌──────────────────────────┐   MCP (stdio / HTTP)   ┌──────────────────────────────┐
│ MCP client                │ <────────────────────> │ comsol-mcp 服务器进程          │
│ DSH / Claude / Codex /…   │                        │  MCPServer (mcp>=2)           │
└──────────────────────────┘                        │  ├── 274 tools (自动发现)      │
                                                    │  ├── comsol:// resources     │
                                                    │  ├── 类型目录 / 知识库 / 模型库 │
                                                    │  └── App                     │
                                                    │      ├── SessionManager      │
                                                    │      ├── ModelManager        │
                                                    │      ├── 单线程 ComsolExecutor│
                                                    │      └── JobManager          │
                                                    └──────────────┬───────────────┘
                                                                   │ JPype + MPh client
                                                                   ▼
                                                    ┌──────────────────────────────┐
                                                    │ comsolmphserver.exe (独立进程) │
                                                    │  建模 / 求解 / 渲染 / 导出     │
                                                    └──────────────────────────────┘
  • 所有 COMSOL 调用串行化:MCP SDK 在线程池里跑同步工具,每个 COMSOL 调用都提交到 唯一的 ComsolExecutor 工作线程,保证 Java API 不会并发交错。

  • COMSOL 在独立进程(client-server 模式,默认):求解器崩溃不会带走 MCP 服务器, 可以 session_restart 恢复;stand-alone 模式则进程内运行、API 往返更快。

  • 长任务异步化:求解/批量作业经 JobManager 提交,返回 job_id,可轮询、等待、 协作式取消;产物与日志附着在 job 上。

  • 离线优先:类型目录、材料库索引、应用库索引、COMSOL 文档检索全部来自本机安装, 不需要联网。

详见 docs/ARCHITECTURE.md。

4. 环境要求 / Requirements

项目

要求

COMSOL Multiphysics

6.x(在 6.4 build 293、全模块授权下完成完整验证);默认安装路径 C:\Program Files\COMSOL\COMSOL64

Python

3.10+(本机验证 3.13.15;需 64 位)

Python 包

mcp>=2.0.0、mph>=1.3.1、jpype1>=1.5.0、numpy>=1.24、Pillow>=9.0

可选(MP4 动画)

imageio + imageio-ffmpeg(本机已安装,自带 ffmpeg 7.1 二进制,MP4 无需系统 ffmpeg);GIF 只需要 Pillow;pymupdf(PDF 文档)

操作系统

Windows(COMSOL 桌面版;脚本与配置以 Windows 为主);Linux 理论上可用但未验证

MCP 客户端

任意支持 stdio MCP 的客户端:DeepSeek Harness、Claude Desktop、Codex CLI、opencode、Cursor/Cline…

5. 安装 / Installation

5.1 一键安装器(推荐)/ Installer

git clone https://github.com/zixuanguo89/comsol-mcp.git
cd comsol-mcp
powershell -ExecutionPolicy Bypass -File .\install.ps1

安装器:找到 Python 3.10+ → 若系统 Python 已具备全部依赖则就地 pip install -e ., 否则创建 .venv 并安装依赖(默认走阿里云 PyPI 镜像回退)→ 运行 python -m comsol_mcp --check → 验证 comsol-mcp 控制台脚本 → 打印 stdio 启动命令 与 MCP 客户端 JSON 片段。

常用参数:-Venv(强制 venv)、-SystemSite(venv 复用系统包)、-Offline、 -CheckOnly(只校验不安装)、-IndexUrl <url>。

5.2 手动安装 / Manual

# 方式 A:源码直跑(不安装,最省事);<repo> 替换为克隆后的仓库路径
$env:PYTHONPATH = "<repo>\src"
python -m comsol_mcp --check

# 方式 B:安装为包(获得 comsol-mcp 命令)
python -m pip install -e .
python -m pip install imageio imageio-ffmpeg   # 可选:MP4 动画
comsol-mcp --check

PyPI 不可达时加镜像: --index-url https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com。

5.3 自检 / Self-check

$env:PYTHONPATH = "\\path\to\comsol-mcp\src"
& "python" -m comsol_mcp --check

输出 {"ok": true, "tool_count": 274, "tools": [...], "settings": {...}, "catalogs": {...}} 即成功(不需要 COMSOL 许可证)。打包回归测试:

& "python" tests\smoke_packaging.py
& "python" tests\smoke_packaging.py --full   # 额外验证安装后的控制台脚本

6. 快速开始 / Quick start

6.1 DeepSeek Harness (DSH)

本机 DSH Desktop profile 已配置好(stdio 启动 + serverName: comsol),改动记录、 精确 diff、验证证据与回滚方法见 docs/DSH_INTEGRATION.md。 重启 DeepSeek Harness 后新开会话,工具以 mcp__comsol__<tool> 出现,例如 mcp__comsol__comsol_capabilities、mcp__comsol__geom_primitive。

6.2 Claude Desktop / Codex / opencode / 通用客户端

直接使用 config/ 中的示例:

客户端

配置文件

放置位置

Claude Desktop

config/claude_desktop_config.json

%APPDATA%\Claude\claude_desktop_config.json

Codex CLI

config/codex_config.toml

%USERPROFILE%\.codex\config.toml

opencode

config/opencode.json

项目根目录或 ~/.config/opencode/opencode.json

Cursor / Cline / Windsurf

config/mcp.json

客户端对应位置

配置要点:command 用绝对路径的 python.exe,args 为 ["-m","comsol_mcp","--transport","stdio"],env 里显式给 PYTHONPATH 和 COMSOL_MCP_WORKDIR(MCP 客户端用干净环境启动子进程,不会继承你的 shell 变量)。 路径替换说明见 config/README.md。

6.3 手工验证 stdio 链路

$env:PYTHONPATH = "\\path\to\comsol-mcp\src"
& "python" -m comsol_mcp --transport stdio
# 或 HTTP 传输(默认 127.0.0.1:8765)
& "python" -m comsol_mcp --transport http --http-port 8765

7. 给 AI Agent 的示例提示词 / Example prompts

配置好客户端后,直接把这些话发给 AI(agent 会自动选择工具):

中文

帮我用 COMSOL 建一个 3D 稳态传热模型:0.1×0.05×0.02 m 的钢块,底面 400 K, 其余表面对流散热(h=10 W/(m²·K),环境 293.15 K),求解并告诉我最高温度, 再画一张温度云图保存为 PNG。

做一个 2D 微通道层流:通道 2 mm × 20 mm,水,入口速度 0.1 m/s,出口压力 0, 求解后给我速度场云图和沿中心线的压力曲线(PNG + CSV)。

加载 COMSOL 官方应用库里的热传导示例模型,求解,导出温度云图和一份 DOCX 报告。

把我模型的 q0 改成 1e3、5e3、1e4 W/m² 三个工况做参数扫描,把每个工况的最高温度 导出成 CSV,并做一个温度动画 GIF。

用 COMSOL 算一个悬臂梁:一端固定,自由端 100 N 向下,求最大位移和最大应力, 输出位移云图和应力云图。

English

Build a 3D steady-state heat transfer model in COMSOL: 0.1×0.05×0.02 m steel block, bottom face at 400 K, other faces convective (h=10 W/m²K, ambient 293.15 K). Solve it, report the maximum temperature, and export a PNG temperature plot.

Load the heat conduction example from the installed COMSOL application library, solve it, and generate a DOCX report with the temperature plot.

Run a parametric sweep over inlet velocity 0.01/0.05/0.1 m/s, export the pressure drop for each case to CSV, and render a GIF of the velocity field.

8. 典型工作流 / Typical workflow

session_start
  → model_create(dimension=3)
  → parameter_set({...})                      # 先集中定义参数
  → geom_primitive / geom_boolean / geom_import / geom_build
  → mat_add / mat_create + mat_assign         # 材料
  → phys_add + phys_add_bc / phys_add_feature # 物理场与边界条件
  → multiphysics_add                          # 多物理场耦合(可选)
  → mesh_create_sequence + mesh_auto_size + mesh_run
  → study_stationary / study_transient / study_parametric / …
  → result_evaluate / result_minmax / result_export_data
  → plot_quick / plot_export_image
  → anim_quick / anim_export                  # 动画(可选)
  → report_create + report_generate           # 报告(可选)
  → model_save

不确定流程时先调 docs_workflow(goal="...");不确定类型名时调 catalog_*; 不确定属性名时调 tree_properties / phys_properties / mat_properties。

9. DeepSeek Harness (DSH) 集成

DSH 通过随安装分发的 @deepseek-ai/dsh-mcp-client 插件接入 MCP 服务器。本机 desktop profile 的 cordis.patch.yml 已追加一条 insert 补丁:

- insert:
    - id: mcp-comsol
      name: '@deepseek-ai/dsh-mcp-client'
      config:
        serverName: comsol
        transport: stdio
        command: 'python'
        args: ['-m', 'comsol_mcp', '--transport', 'stdio']
        # env: PYTHONPATH / COMSOL_MCP_WORKDIR / COMSOL_MCP_COMSOL_ROOT ...
  • 修改前已备份 profile 文件;YAML 已校验;原有条目未改动。

  • 模型侧看到的工具名为 mcp__comsol__<tool>;comsol:// 资源可用 list_mcp_resources / read_mcp_resource 读取。

  • 通常需重启 DSH 生效;本次 Desktop 运行中保存补丁后已热加载成功(详见 docs/DSH_INTEGRATION.md 的验证证据与回滚方法)。

  • ⚠️ 重启提示:DSH 里正在运行的 MCP 子进程是启动那一刻的模块快照。 仓库后续新增/修改的工具(例如新增的 catalog_plot_features,当前共 274 个) 以及服务器 instructions 的更新,需要重启 DSH(或让 MCP 客户端重连)后 才会出现在新的工具列表中;当前运行中的旧快照仍按 273 个工具工作。

10. 环境变量 / Environment variables

变量

默认

说明

COMSOL_MCP_COMSOL_ROOT

自动探测

COMSOL 安装根目录,如 C:\Program Files\COMSOL\COMSOL64

COMSOL_MCP_VERSION

最新安装

指定 COMSOL 版本(如 6.4)

COMSOL_MCP_CORES

0(全部)

求解核数

COMSOL_MCP_SESSION_MODE

client-server

或 stand-alone

COMSOL_MCP_SERVER_PORT

0(随机)

COMSOL server 端口

COMSOL_MCP_CONNECT_HOST

localhost

连接主机

COMSOL_MCP_AUTOSTART

1

首次调用 COMSOL 工具时自动启动

COMSOL_MCP_KEEP_ALIVE

1

MCP 退出后保留 COMSOL

COMSOL_MCP_START_TIMEOUT

180

等待启动秒数

COMSOL_MCP_SOLVE_TIMEOUT

0(无限)

同步求解超时

COMSOL_MCP_WORKDIR

<cwd>\comsol_workspace

工作区根目录

COMSOL_MCP_ARTIFACT_ROOT / COMSOL_MCP_MODEL_ROOT

工作区子目录

产物 / 模型目录

COMSOL_MCP_LOG_LEVEL / COMSOL_MCP_LOG_FILE

INFO / <workdir>\logs\...

日志

COMSOL_MCP_MAX_OUTPUT_ITEMS

400

返回列表上限

COMSOL_MCP_TOOL_PROFILE

full

full(全部 274 个)、minimal(166 个核心工具,节省客户端上下文)或 custom

COMSOL_MCP_TOOL_ALLOW / COMSOL_MCP_TOOL_DENY

空

逗号分隔的工具名/前缀白/黑名单(如 COMSOL_MCP_TOOL_DENY=java_eval 禁用逃生舱口)

COMSOL_MCP_ALLOW_EVAL

1

设为 0/false 禁用 java_eval(推荐在共享环境关闭)

COMSOL_MCP_DOC_ROOT

自动探测

离线 COMSOL HTML 文档根目录(docs_search(scope="help") 用)

COMSOL_MCP_FFMPEG

自动探测

ffmpeg 路径(MP4)

COMSOL_MCP_CONFIG

空

JSON 设置文件路径

完整列表与 JSON 配置示例见 docs/USER_GUIDE.md。

11. 工作区与产物 / Workspace

\\path\to\comsol-mcp\comsol_workspace\
├── artifacts\<model>\<timestamp>_<operation>\   # PNG / GIF / MP4 / CSV / HTML / DOCX
├── models\                                      # 保存的 .mph
├── .scratch\                                    # 快照与临时文件
└── logs\comsol_mcp.log                          # 服务器日志

导出工具都返回绝对路径和可供自检的元数据(size、width/height、frames、 valid 等),AI agent 可以据此确认产物真实生成。

12. 故障排查 / Troubleshooting

现象

处理

找不到 COMSOL(COMSOL installation not found)

设置 COMSOL_MCP_COMSOL_ROOT 指向实际安装(如 C:\Program Files\COMSOL\COMSOL64);运行 health_check 诊断。

许可证错误 / 模块缺失

先用 COMSOL Desktop 确认许可证服务可用;session_status 查看 modules;某些模型需要特定模块授权。

JPype/JVM 错误

确认 jpype1 与 Python 位数/版本匹配;同一进程不要加载多个 JVM;重启 MCP 服务器进程。

MP4 动画失败

本机已安装 imageio + imageio-ffmpeg(自带 ffmpeg 7.1 二进制,MP4 直接可用,无需系统 ffmpeg);如缺失则 pip install imageio imageio-ffmpeg。GIF 只需要 Pillow。media_tools_status 可查看媒体工具链状态;无 ffmpeg 时动画会自动回退 GIF。

中文标签 / 中文字段名

正常现象:COMSOL 按系统语言本地化显示名,tag/类型仍是英文,工具按 tag 工作。

中文图表标题乱码

COMSOL 渲染字体限制;图表标题建议英文,或用 anim_add_title/Pillow 叠字。

工具调用超时

长求解用 study_solve_async + job_status/job_wait;MCP 客户端工具超时建议 ≥600 s。

"已有客户端连接" / 端口占用

COMSOL server 只允许一个客户端;不要并行运行两个驱动 COMSOL 的进程;用 session_connect(port=...) 复用已有 server。

客户端看不到工具

先 python -m comsol_mcp --check 验证;检查客户端配置的绝对路径/PYTHONPATH;重启客户端。

更多见 docs/USER_GUIDE.md。

13. 安全说明 / Security

  • java_eval 是任意代码执行通道:它在 COMSOL 工作线程内执行 Python 代码, 可访问 model/jm/client 及底层 Java API。只应在可信 agent / 可信提示词下使用; 可用 COMSOL_MCP_ALLOW_EVAL=0 直接禁用,或用 COMSOL_MCP_TOOL_DENY=java_eval 在工具层屏蔽;多用户环境还可 COMSOL_MCP_TOOL_PROFILE=minimal 只暴露常用 166 个工具。

  • 文件系统访问:导出/报告工具会写工作区,geom_import/model_load/report_add_content 可读取本地文件路径;请不要把 agent 指向含敏感数据的目录。

  • 不要暴露 HTTP 传输到公网:默认建议 stdio;若用 --transport http,只绑定 127.0.0.1 并加网络层访问控制。

  • 无需任何凭证:服务器不读取账号/许可证密钥,MCP 配置里不要写密钥。

  • 单客户端约束:COMSOL server 只接受一个客户端连接,避免多个自动化进程同时驱动 同一 COMSOL server。

14. 测试与验证 / Tested against real COMSOL

  • COMSOL 6.4(build 293,全模块授权) 上完成端到端验证:真实几何/材料/物理场/ 网格/求解/结果/绘图/动画/导出/报告流程,包含官方应用库模型。

  • 240+ live assertions:11 个 live 测试脚本针对真实 COMSOL 运行(当前源码中 约 500 个 check(...) 断言点,覆盖 session/model、几何、材料与网格、物理场、 研究/求解、结果、绘图与可视化、动画、模型库、MCP 协议、会话管理)。

  • 官方 2,081 个模型的应用库:完整离线索引(含物理场、研究类型、预计耗时), 可 library_search → library_load/library_run。

  • 材料库:19 个库、3,141 种材料离线索引,支持按物性搜索。

  • 打包验证(无需 COMSOL):tests/smoke_packaging.py 检查包导入、 build_server() 工具注册、python -m comsol_mcp --check、工具参考生成、 4 种客户端配置合法性、DSH profile 补丁;--full 额外在临时 venv 中安装并运行 comsol-mcp 控制台脚本。

  • python -m pytest tests/unit -q:核心逻辑单元测试(约 200 个断言)。

  • 验收矩阵与独立 QA 报告:L0–L4 验收矩阵见 docs/TEST_PLAN.md; 独立端到端 QA 的最终报告(MCP 全链路场景、真实产物、性能数据)见 docs/TEST_REPORT.md(由 qa-e2e 收尾生成, 过程记录在 docs/progress/qa.md)。

  • 独立性 / 竞品对比:与现有开源 COMSOL MCP 项目的能力对比、以及本项目为何是 独立实现且覆盖面更广,见 docs/COMPETITIVE_ANALYSIS.md。

复现:

$env:PYTHONPATH = "\\path\to\comsol-mcp\src"
& "python" tests\smoke_packaging.py
& "python" -m pytest tests\unit -q
# live 测试需要可用的 COMSOL(见 docs/DEVELOPMENT.md)

15. 文档 / Documentation

文档

内容

docs/TOOL_REFERENCE.md

自动生成的 274 个工具完整参考(描述 + 参数 + 必填项 + JSON Schema 文件)

docs/USER_GUIDE.md

逐步使用指南:首个模型、求解、结果、动画、报告、模型库、最佳实践

docs/DSH_INTEGRATION.md

DeepSeek Harness 精确配置、验证证据、重启/回滚、排障

docs/ARCHITECTURE.md

架构、线程模型、持久化、扩展方式

CONTRIBUTING.md

开发者指南:新增工具模块、live 测试、clientapi 陷阱

docs/TEST_PLAN.md

验收矩阵(L0–L4)

docs/TEST_REPORT.md

独立 QA 端到端测试报告(最终验收证据)

docs/COMPETITIVE_ANALYSIS.md

现有 COMSOL MCP 项目对比与独立性说明

config/README.md

Claude / Codex / opencode / 通用 MCP 客户端配置说明

重新生成工具参考(工具数量变化后运行):

python scripts\gen_tool_reference.py
# -> docs/TOOL_REFERENCE.md + docs/tool_reference.json

16. 许可证 / License

MIT License(Copyright © 2026 The comsol-mcp contributors),详见根目录 LICENSE。SPDX-License-Identifier: MIT。

本项目是独立的开源集成层,与 COMSOL AB 无隶属关系。COMSOL Multiphysics® 是 COMSOL AB 的商标;使用本项目仍需有效的 COMSOL 许可证。 This is an independent open-source integration and is not affiliated with COMSOL AB. COMSOL Multiphysics® is a trademark of COMSOL AB; a valid COMSOL license is still required.


English summary

comsol-mcp is the most comprehensive MCP server for COMSOL Multiphysics: it exposes the whole modelling workflow as 274 MCP tools over stdio or streamable HTTP, so an AI agent can build geometry, assign materials, add physics and multiphysics couplings, mesh, solve stationary/transient/ eigenfrequency/frequency/parametric studies, evaluate results, render plots and animations (GIF/MP4), export data/models/geometry/meshes, generate HTML/DOCX reports, and browse/search/load/solve the official application library — all driving a locally installed COMSOL 6.4 through its Java API (MPh + JPype).

Highlights

  • Complete coverage: 30 geometry, 14 materials, 19 physics, 7 multiphysics, 22 mesh, 34 study/solver, 27 result, 13 plot, 16 animation/media, 9 export, 5 report, 7 model-library, 16 model-tree, 1 java_eval escape hatch, plus session/model/parameter/selection/job/catalog/knowledge tools.

  • Discoverability from the real installation: 949 physics interfaces, 7,343 physics feature types, 97 3D geometry features, 51 3D mesh features, 81 study types, 121 plot feature types, 86 solver feature types, 64 dataset types, 33 numerical evaluation types — shipped offline.

  • Context budget: COMSOL_MCP_TOOL_PROFILE=minimal exposes a 166-tool everyday subset; the default full profile exposes all 274 tools.

  • Offline indexes: 2,081 official application-library models and 19 material libraries with 3,141 materials; 13 curated modelling guides; searchable installed COMSOL HTML documentation.

  • Reliability: all COMSOL calls serialized on one worker thread; COMSOL runs in a separate comsolmphserver process; cancellable async solve jobs; structured JSON errors with actionable hints; every artifact export returns an absolute path and validated metadata.

  • Integrations: DeepSeek Harness (profile patch, described in docs/DSH_INTEGRATION.md), Claude Desktop, Codex CLI, opencode and generic mcpServers clients (config/); comsol:// read-only MCP resources.

  • Verified against COMSOL 6.4 build 293 with all modules, 240+ live assertions (≈500 assertion sites) across 11 live test scripts, plus packaging smoke tests and unit tests.

Requirements: COMSOL 6.x (tested 6.4), Python 3.10+ (tested 3.13), mcp>=2, mph>=1.3.1, jpype1>=1.5, numpy, Pillow; imageio + imageio-ffmpeg for MP4 animation (installed here with a bundled ffmpeg; GIF needs Pillow only).

Install

powershell -ExecutionPolicy Bypass -File .\install.ps1
# or manually:
$env:PYTHONPATH = "\\path\to\comsol-mcp\src"
& "python" -m comsol_mcp --check
& "python" -m pip install -e "\\path\to\comsol-mcp"

Client configuration: see config/ (Claude Desktop, Codex, opencode, generic) and docs/DSH_INTEGRATION.md for DeepSeek Harness. Use absolute paths and pass PYTHONPATH / COMSOL_MCP_WORKDIR explicitly in the client's env block, because MCP clients start the server in a cleaned environment.

Documentation: docs/TOOL_REFERENCE.md (all 274 tools with schemas), docs/USER_GUIDE.md (worked examples), docs/ARCHITECTURE.md, docs/DEVELOPMENT.md, docs/DSH_INTEGRATION.md, docs/TEST_PLAN.md + docs/TEST_REPORT.md (acceptance and QA evidence) and docs/COMPETITIVE_ANALYSIS.md (independent-implementation comparison).

机器无关的约定:COMSOL_MCP_TOOL_PROFILE=minimal 可把工具集裁剪到 166 个常用工具 (客户端上下文受限时推荐),COMSOL_MCP_ALLOW_EVAL=0 可禁用 java_eval。

Security: java_eval executes arbitrary Python against the live COMSOL Java API — use it only with trusted agents/prompts, and set COMSOL_MCP_ALLOW_EVAL=0 (or COMSOL_MCP_TOOL_DENY=java_eval) where it is not needed. COMSOL_MCP_TOOL_PROFILE=minimal exposes a 166-tool everyday subset. Do not expose the HTTP transport publicly. A COMSOL server accepts only one client at a time.

License: MIT. COMSOL Multiphysics® is a trademark of COMSOL AB; a valid COMSOL license is required to run simulations.

Available Tools

274 tools
anim_add_titleA

Add a title bar/overlay to every frame of an existing GIF or video.

Args: source: input animation path (.gif, .mp4, .avi, .webm). title: title text (\n creates multiple lines). output: output path (.gif or .mp4); defaults to beside the input with a "_titled" suffix; format follows the output suffix. position: "top" (default) | "bottom" | "overlay-top" | "overlay-bottom". font_size: title font size in px (default 18). fps: output frame rate (default: detected from the source, else 10).

Inputs: title (required), source (required), fps, output, +2 more.

anim_combineB

Concatenate several animations (or frame sets) into one GIF/MP4.

Args: inputs: list of animation paths (.gif/.mp4) or frame directories, played in the given order. output: output path (.gif or .mp4); default auto-generated .gif. fps: output frame rate (default: detected from the first input, else 10). max_width: downscale all frames to at most this width.

Inputs: inputs (required), fps, output, max_width.

anim_convertA

Convert an animation between formats (e.g. GIF -> MP4 or MP4 -> GIF).

Args: source: input animation path. output: output path; suffix decides the container (.gif or .mp4). fps: output frame rate (default: detected from the source, else 10). max_frames: use at most this many frames.

Inputs: output (required), source (required), fps, max_frames.

anim_createA

Render a simulation animation from an existing plot group (custom pipeline).

Recommended default for building animations: exports one PNG per transient time step (plot-group property t) or per solution (property solnum) with a fixed colour range, then composes the frames into a GIF and/or MP4. Works for transient heat/flow/structural studies and for parametric sweeps, eigenfrequency and frequency-domain solution sets.

Args: plotgroup: plot group tag with the quantity to animate, e.g. "pg1". formats: ["gif"] (default), ["gif","mp4"] or ["mp4"]. MP4 requires imageio + imageio-ffmpeg (media_tools_status reports availability). fps: animation speed, frames per second (default 10). width: frame width in px (default 640). height: frame height in px (default 480). mode: "auto" (default; detects transient vs parametric from the dataset), "time" (transient time steps), "solutions" (1-based solution index), "static" (single frame). times: explicit time values for transient frames, e.g. [0,1,2,5,10] (interpolated times are supported by COMSOL). solnums: explicit 1-based solution indices, e.g. [1,2,3,4]. max_frames: cap the number of frames (evenly spaced selection). range_mode: "common" (default; one colour range for all frames, no flicker), "auto" (per-frame COMSOL range) or "manual" (use color_range). color_range: [min, max] data range for range_mode="manual", e.g. [293.15, 400.0] for a temperature animation. colortable: COMSOL colour table name, e.g. "ThermalLight" or "Rainbow". title: optional title text burned into every frame (Pillow overlay). loop: GIF loop count (0 = loop forever, default). output: explicit output file path (only when one format is requested), e.g. "C:/out/heat.gif". output_directory: directory for generated GIF/MP4 files. frames_directory: directory for intermediate PNG frames. keep_frames: keep intermediate PNG frames on disk (default false). model: model name/tag (None = current model).

Returns: JSON with frame count/directory/frames, mode used, colour range and the generated "gif"/"mp4" objects (path, size, frame count, duration, valid), plus "preview" (first frame PNG) and "primary" (best artifact path).

Inputs: plotgroup (required), fps, loop, mode, +15 more.

anim_exportA

Export a COMSOL-native animation of a plot group (movie or image sequence).

Creates result().export().create(tag, "Animation"), applies the COMSOL 6.4 Animation properties, runs it, and validates the output (GIF frame count with Pillow, video frame count with imageio).

Args: plotgroup: plot group tag to animate, e.g. "pg1" (see anim_list / plot_list). format: movie container: "gif" (no external deps, default), "avi" or "webm". output: output path. Movie: e.g. "C:/out/heat.gif". For kind="imageseq" pass the frame base path, e.g. "C:/out/frame" -> frame1.png, frame2.png, ... Omit to auto-generate under the artifact workspace. kind: "movie" (default) or "imageseq" (numbered PNG frames). fps: frames per second for movies (positive int, default 10). maxframes: number of frames (>= 2, default 25). Fewer stored solutions produce fewer frames; COMSOL samples the available range evenly. width: frame width in px (default 640, used when size="manual"). height: frame height in px (default 480). size: "manual" (default) | "current" | "hd". sweeptype: "solutions" (default) | "parameter" | "globalparameter" | "dde" | "streamline". solnumtype: parametric sweep selection: "all" (default) | "level1" | "level2" | "level3" | "inner" | "outer". solnum: explicit 1-based solution numbers to animate, e.g. [1,3,5]. looplevel: explicit loop-level solution indices, e.g. [1,2,3,4]. framesel: "all" | "number" (COMSOL default "number" = use maxframes). background: "current" | "color" | "fromtheme" | "transparent". reverse: true = play the animation backwards (time reversal). image_options: "on"/"off" — enable optional image components (title/legend/axes/logo). show_legend: plot legend on/off when image_options="on". show_title: plot title on/off when image_options="on". extra_properties: raw COMSOL Animation export properties to override, e.g. {"repeat": "forever", "resolution": "150"}. tag: explicit export feature tag (auto "anim1", "anim2", ...). model: model name/tag (None = current model).

Returns: JSON with path, size, format, frame count, dimensions, fps, duration and valid flag; for image sequences also frame_paths.

Inputs: plotgroup (required), fps, tag, kind, +18 more.

anim_export_framesA

Export a numbered PNG image sequence from a COMSOL plot group (native imageseq).

This is COMSOL's own frame exporter: it writes <base>1.png, <base>2.png, ... and is the fastest way to dump every animation frame to disk (later compose them with media_frames_to_gif / media_frames_to_mp4, or use anim_create which does both steps automatically).

Args: plotgroup: plot group tag to export, e.g. "pg1". directory: directory for the frames (default: artifact workspace). base: frame base name/path, e.g. "C:/out/frame" -> frame1.png, ...; the actual COMSOL naming is discovered automatically. maxframes: maximum number of frames to write (>= 2, default 25). width: frame width in px (default 640). height: frame height in px (default 480). solnumtype: "all" | "level1" | "level2" | "level3" | "inner" | "outer". solnum: explicit 1-based solution numbers, e.g. [1,2,3,4]. sweeptype: "solutions" (default) | "parameter" | "globalparameter". tag: explicit Animation export feature tag. model: model name/tag (None = current model).

Returns: JSON with directory, frame_paths, frame count, base path and validity.

Inputs: plotgroup (required), tag, base, model, +7 more.

anim_extract_framesB

Extract frames from a GIF/video into numbered PNG files.

Args: source: animation path (.gif, .mp4, .avi, .webm). directory: output directory (default: artifact workspace). prefix: file prefix, e.g. "frame" -> frame0001.png. max_frames: maximum number of frames to extract.

Inputs: source (required), prefix, directory, max_frames.

anim_listA

List animation export features and plot groups that can be animated.

Use this first to discover: (a) existing COMSOL Animation export features and their settings/output files, (b) every plot group with its dataset, solution, frame mode ("time"/"solutions"/"static") and frame count, and (c) whether GIF/MP4 tooling is available.

Args: model: model name/tag (None = current model).

Inputs: model.

anim_previewA

Extract a preview image of an animation (first frame and/or contact sheet).

Args: source: animation path (.gif/.mp4) or frames directory. output: output PNG path (auto-generated when omitted). contact_sheet: true = also build a grid montage of up to max_frames frames (useful to visually QA the animation). columns: contact sheet column count (default 4). max_frames: maximum frames in the contact sheet (default 24).

Inputs: source (required), output, columns, max_frames, +1 more.

anim_quickA

One-call animation: plot an expression over time/solutions and write GIF/MP4.

Creates a plot group + plot feature for expression, renders every transient time step (or every parametric solution), locks the colour range and composes a GIF (+MP4 if requested) — the fastest path from a solved model to a real animation file.

Args: expression: COMSOL expression to plot, e.g. "T", "ht.T", "u", "sqrt(u^2+v^2)". plot_type: "surface2d" (default for 2D models) | "surface3d" | "volume" | "slice" | "contour2d" | "isosurface" | "arrow2d" | "arrow3d" | "streamline" | "line" | "global" | "point". dataset: dataset tag, e.g. "dset1" (None = COMSOL default dataset). formats: ["gif"] (default) | ["gif","mp4"] | ["mp4"] (mp4 needs imageio-ffmpeg). fps: frames per second (default 10). width: frame width px (default 640). height: frame height px (default 480). mode: "auto" (default) | "time" | "solutions" | "static". times: explicit transient times, e.g. [0,2,4,6,8,10]. solnums: explicit 1-based solution indices. max_frames: cap number of frames. range_mode: "common" (default) | "auto" | "manual". color_range: [min, max] data range for range_mode="manual". colortable: COMSOL colour table, e.g. "ThermalLight". title: title text burned into each frame. output: explicit output path for a single-format run. output_directory: directory for generated GIF/MP4 files. frames_directory: directory for intermediate PNG frames. model: model name/tag (None = current model).

Returns: JSON with plotgroup, expression, frame count, colour range and the generated gif/mp4 artifact objects (path, size, frames, duration, valid).

Inputs: expression (required), fps, mode, model, +15 more.

anim_removeA

Remove a COMSOL Animation export feature from the results tree.

Args: tag: animation export feature tag, e.g. "anim1" (see anim_list). model: model name/tag (None = current model).

Inputs: tag (required), model.

anim_resizeA

Resize an animation (GIF/video) — proportional or exact dimensions.

Args: source: input animation path. output: output path (.gif or .mp4); defaults beside the input with a "_resized" suffix. width: target width in px (height follows the aspect ratio when only width is given). height: target height in px (width follows the aspect ratio when only height is given). fps: output frame rate (default: detected from the source, else 10).

Inputs: source (required), fps, width, height, +1 more.

catalog_geometry_featuresB

List geometry feature types available for a dimension (primitives, booleans, transforms, ...).

Inputs: query, dimension.

catalog_mesh_featuresC

List mesh feature types available for a dimension (FreeTet, Sweep, Size, BndLayer, ...).

Inputs: query, dimension.

catalog_physics_featuresA

List the feature types (boundary/domain conditions) allowed in a physics interface.

Args: interface: interface type name, e.g. "HeatTransfer", "SolidMechanics", "LaminarFlow", "Electrostatics", "PressureAcoustics". dimension: restrict to a dimension ("3", "2", ...) when ambiguous. query: substring filter (e.g. "flux", "inlet", "fixed").

Inputs: interface (required), query, dimension.

catalog_physics_interfacesB

List COMSOL physics interface types (932 available in COMSOL 6.4).

Args: dimension: geometry dimension filter: "3", "2", "1", "2DAxi", "Global". query: substring filter on type name or description (e.g. "heat", "electro"). limit: maximum number of results.

Inputs: limit, query, dimension.

catalog_plot_featuresB

List plot feature types (121 in COMSOL 6.4) and attribute features.

Args: query: substring filter, e.g. "surface", "streamline", "arrow". kind: "plot" for primary plot features or "attribute" for attributes (Color/Deform/Height/Filter/Transparency/...).

Inputs: kind, query.

catalog_study_featuresC

List study step and study feature types (Stationary, Transient, Eigenfrequency, ...).

Inputs: query.

catalog_typesC

List a registry of result/mesh/solver types.

Args: category: plot | plot_features | numerical | dataset | export | function | solver | common.

Inputs: category (required).

comsol_capabilitiesA

Server capabilities: session state, licensed modules, catalogs, settings.

Call this first to learn what is available without starting COMSOL.

Inputs: no named parameters.

dataset_createA

Create a result dataset (data source for plots/evaluations/exports).

Common types: Solution, CutPlane, CutLine3D, CutPoint3D, Grid3D, Surface, Volume, Embed2D, Mirror3D, Extrude2D, Revolve2D, Sector3D, Filter, Join, TimeAverage, Integral, Average, Maximum, Minimum. Full list: catalog_dataset_types.

Args: type: dataset type string, e.g. "CutPlane". tag: dataset tag (None = auto, e.g. cpl1). Must be unique. source: source dataset tag for derived datasets (e.g. "dset1"); for type="Solution" this is the solution tag (e.g. "sol1"). properties: additional properties, e.g. {"quickplane": "xy", "quickz": "0.01"}. Plane coordinates use quickx/quicky/quickz. model: model name/tag (None = current model).

Inputs: type (required), tag, model, source, +1 more.

dataset_infoA

Describe one dataset: type, label, source solution, and all properties.

Args: tag: dataset tag, e.g. "dset1" or "cpl1" (see dataset_list). include_properties: include the full COMSOL property dictionary. model: model name/tag (None = current model).

Inputs: tag (required), model, include_properties.

dataset_listB

List all result datasets (tag, label, COMSOL type, source dataset/solution).

Args: model: model name/tag (None = current model).

Inputs: model.

dataset_removeA

Remove a result dataset by tag (does not affect the solution data).

Args: tag: dataset tag to remove, e.g. "cpl1" (see dataset_list). model: model name/tag (None = current model).

Inputs: tag (required), model.

dataset_set_propertyA

Set one property on an existing dataset (generic escape hatch).

Args: tag: dataset tag (e.g. "cpl1"). name: COMSOL property name (dataset_info lists valid ones), e.g. "quickz". value: property value ("0.01", 0.01, ["0","1"], ...). model: model name/tag (None = current model).

Inputs: tag (required), name (required), value (required), model.

docs_getA

Return one curated COMSOL guide as Markdown text.

Available guides: getting_started, workflow_overview, geometry_guide, physics_guide, materials_guide, meshing_guide, study_solver_guide, results_guide, plotting_guide, animation_guide, troubleshooting, api_cheatsheet, units_and_expressions.

Args: name: guide name or alias (e.g. "geometry", "mesh", "study", "results", "animation", "api", "units"). Call docs_list for the full list.

Inputs: name (required).

docs_listA

List the curated COMSOL guides bundled with this server.

Use this first when you need COMSOL domain knowledge (modelling workflow, geometry/physics/materials/mesh/study/results/plot/animation guides, API quirks, units, troubleshooting). Then call docs_get(name=...) to read one.

Inputs: no named parameters.

docs_workflowA

Recommend an ordered MCP tool sequence and guides for a modelling goal.

Curated workflows exist for steady/transient heat transfer, structural mechanics, fluid flow, acoustics, electromagnetics, wave optics, particle tracing, parametric sweeps, animations and starting from an installed example model.

Args: goal: free text, e.g. "steady heat transfer", "stress analysis of a bracket", "laminar flow in a channel", "animate temperature", "parametric sweep". Omit to list all available workflows.

Inputs: goal.

export_geometryA

Export a finalized geometry to STL, STEP, IGES, Parasolid, ACIS or native.

Uses COMSOL's geometry export tool: setType(...) then geom.export(path). The file is validated on disk.

Args: type: stl/stlbin (default), stlascii, step, iges, parasolidbin (.x_b), parasolidascii (.x_t), acisbin (.sab), acisascii (.sat), nativebin (.mphbin), nativeascii (.mphtxt). tag: geometry sequence tag (default "geom1"). path: output file path (auto under artifact root when omitted). component: component owning the geometry (default "comp1"). selection: optional geometry object numbers to export; omit for all. model: model name/tag (None = current model).

Notes: STEP/IGES/Parasolid/ACIS need the CAD Import Module or a CAD LiveLink license; STL and native formats work with the base installation. STL exports the boundary surface of the geometry.

Example: export_geometry("step", path="C:/out/part.step") export_geometry("stl", path="C:/out/part.stl")

Inputs: tag, path, type, model, +2 more.

export_listC

List result export features and available mesh/geometry export tools.

Args: model: model name/tag (None = current model).

Inputs: model.

export_meshA

Export a mesh to a file (STL, Nastran, 3MF, PLY, COMSOL native).

Uses COMSOL's mesh export tool: sets type, optional stlformat and selection, then calls mesh.export(path). The file is validated on disk (existence and byte size).

Args: tag: mesh tag (default "mesh1"; see export_list for tags). type: stl/stlbin (default), stlascii, nastran, 3mf, plybin, plyascii, nativebin (.mphbin), nativeascii (.mphtxt), sectionwise. vtu is not supported by COMSOL 6.4 clientapi. path: output file path (auto under artifact root when omitted). component: component tag owning the mesh; when omitted the model-level mesh(tag) accessor is tried first, then each component. selection: optional entity numbers to export (e.g. domain numbers). Omit for the whole mesh. stl_format: optional "binary"/"text" STL flavour. model: model name/tag (None = current model).

Example: export_mesh("mesh1", type="stl", path="C:/out/mesh.stl")

Inputs: tag, path, type, model, +3 more.

export_model_fileA

Save the model as a COMSOL .mph file and report the written size.

Args: path: output .mph path (auto under <model_root>/exports/ when omitted). model: model name/tag (None = current model).

Returns: {"path","size","exists","format":"mph"}.

Inputs: path, model.

export_model_javaA

Export the model as a COMSOL Java model file (.java source).

Verified live in COMSOL 6.4: model.java.save(path, "java") writes a compilable Java class that rebuilds the model (a few KB; does not contain the solution data). Use export_model_file for a full .mph.

Args: path: output .java path (auto under artifact root when omitted). model: model name/tag (None = current model).

Returns: {"path","size","exists","format":"java"}.

Inputs: path, model.

export_plotA

Create (optionally run) a result Plot export feature.

The Plot export writes a plot group's raw data file. Available properties are returned so agents can discover the exact ones for their COMSOL version; property names can be passed via properties.

Args: tag: export feature tag. plotgroup: plot group tag to export (e.g. "pg1"). path: output file path; when given it is set with the first accepted filename property (filename / plotfilename). properties: extra properties for the export feature. run: run the export immediately (default True). model: model name/tag (None = current model).

Returns: {"tag", "type", "properties", "ran", "path", "size", "exists"}.

Inputs: run, tag, path, model, +2 more.

export_removeB

Remove a result export feature (Image/Plot/Touchstone/...).

Args: tag: result export feature tag. model: model name/tag (None = current model).

Inputs: tag (required), model.

export_touchstoneA

Create (optionally run) a Touchstone (S-parameter) export feature.

Touchstone export is only meaningful for RF models with S-parameters (ElectromagneticWaves/Electrical Circuit terminals). Creating the feature works on any model; running it requires such a model.

Args: tag: export feature tag. path: output Touchstone path; tried with the filename properties of the feature (filename / touchstonefilename). plotgroup: optional plot group tag to bind. properties: extra properties, e.g. {"touchstoneversion": "1.0"}, {"referenceimpedance": "50[ohm]"}, {"smatrix": "..."}. run: run the export immediately (default True). model: model name/tag (None = current model).

Returns: {"tag", "type", "properties", "ran", "path", "size", "exists"}.

Inputs: run, tag, path, model, +2 more.

export_typesB

List file-export formats supported by COMSOL 6.4 (mesh, geometry, model).

vtu is NOT accepted by COMSOL 6.4's clientapi MeshExport in live testing; use nativeascii/stlbin/nastran/3mf instead.

Inputs: no named parameters.

function_createB

Create a global function (analytic, interpolation, step, ramp, ...).

Args: name: function name (used as the function tag; callable as name(t)). function_type: COMSOL function type, e.g. Analytic, Interpolation, Piecewise, Step, Ramp, GaussianPulse, Random, Wave, Rectangle. expression: analytic expression, e.g. "sin(2pif0*t)". args: argument list, e.g. "t" (default "t"). filename: data file for Interpolation / External functions. properties: any additional feature properties to set.

Inputs: name (required), args, model, filename, +3 more.

function_listC

List global functions with their types and expressions.

Inputs: model.

function_removeC

Remove a global function by tag/name.

Inputs: name (required), model.

geom_addA

Create any geometry feature (type from the geometry catalog).

Args: feature_type: COMSOL geometry feature type, e.g. "Block", "Cylinder", "Difference", "Array", "BoxSelection", "Fillet3D", "Import". Invalid types return suggestions from the catalog. tag: feature tag (None = generated from the catalog tag prefix). label: optional display label. properties: dict of feature properties, e.g. {"size": ["0.1","0.05","0.02"]}. build: build the sequence after creating the feature (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: feature_type (required), tag, build, label, +4 more.

geom_bboxA

Return the bounding box of the geometry (or of selected objects).

Args: geometry: geometry sequence tag (default "geom1"). objects: object names to include (None = whole geometry). model: model name/tag (None = current model).

Inputs: model, objects, geometry.

geom_booleanB

Combine geometric objects with a Boolean operation.

Args: operation: Union | Intersection | Difference | Compose | Partition (case-insensitive; "difference" removes subtract from input). input: object names to combine, e.g. ["blk1","cyl1"] or ["blk1"]. subtract: objects to subtract (Difference only), e.g. ["cyl1"]. formula: set formula for Compose, e.g. "blk1+cyl1-blk2". keep: keep input objects (Union/Intersection/Compose). intbnd: keep interior boundaries ("on"/"off", bool accepted). properties: extra properties, e.g. {"keepadd": "on"}. tag: feature tag (None = automatic, e.g. dif1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: operation (required), tag, keep, build, +9 more.

geom_buildB

Build a geometry sequence (all features or up to one feature).

Args: geometry: geometry sequence tag (default "geom1"). upto: build only features up to and including this feature tag (None = all). model: model name/tag (None = current model). Returns entity counts, bounding box, object names and any build problems.

Inputs: upto, model, geometry.

geom_chamferA

Bevel corners/edges with a chamfer (2D vertices or 3D edges).

Args: entities: vertices to chamfer in 2D as {"object": [vertex numbers]}, or edges in 3D as {"object": [edge numbers]}. objects: object names (for a flat entity list). distance: chamfer distance in length units (2D "dist"; 3D uses the COMSOL Chamfer3D radius-like property with the same value). properties: extra COMSOL properties (may override distance). tag: feature tag (None = automatic, e.g. cha1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, build, label, model, +6 more.

geom_createA

Create a new geometry sequence for a component.

Args: geometry: tag of the new geometry (must be unique in the model), e.g. "geom2". component: component tag (None = first component, usually "comp1"). dimension: 3 (3D), 2 (2D), 1 (1D), or "2Daxi" for axisymmetric 2D. axisymmetric: mark a 2D geometry as axisymmetric (same as dimension="2Daxi"). model: model name/tag (None = current model).

Inputs: model, geometry, component, dimension, +1 more.

geom_delete_featureA

Delete a feature from a geometry sequence.

Args: tag: feature tag to delete (e.g. "cyl1"; the automatic "fin" cannot be deleted). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

Inputs: tag (required), model, geometry.

geom_entity_infoA

Enumerate geometry entities with bbox, center and measure (area/volume/length).

Use this to choose entity numbers for boundary conditions, e.g. find the top faces of a block (filter_bbox with zmin=zmax=0.02).

Args: entity_dim: 3 = domains, 2 = boundaries/faces, 1 = edges, 0 = points (in 2D use 2 = domains, 1 = boundaries, 0 = points). filter_bbox: optional [xmin,xmax,ymin,ymax(,zmin,zmax)] with null for unbounded sides, e.g. [null,null,null,null,0.019,0.021]. condition: how to compare an entity bbox with filter_bbox: "inside" (default), "intersects", or "center". tol: tolerance for the bbox comparison (in geometry length units). limit: maximum number of entities returned (default 100, max 500). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

Inputs: tol, limit, model, geometry, +3 more.

geom_exportB

Export geometry objects to a CAD/mesh file (STL, STEP, IGES, DXF, ACIS...).

Args: export_type: stl | stlascii | step | iges | dxf | acisbin | acisascii | parasolidbin | parasolidascii | nativebin | nativeascii. (VTK/3MF are not supported by COMSOL geometry export.) path: output file path; when omitted the file goes to the artifact workspace with an automatic name. objects: geometry object names to export (None = current objects). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model). Returns the absolute file path, size and confirmed existence.

Inputs: path, model, objects, geometry, +1 more.

geom_extrudeA

Extrude 2D work-plane objects (or planar faces) into 3D.

Args: distance: extrusion distance expression/humber, e.g. 0.2 or "0.2". A list creates several layers, e.g. [0.1, "0.2"]. input_objects: work-plane tags/objects to extrude (None = objects of the last preceding work plane). scale: scale factor of the extrusion top (optional). twist: twist angle in degrees (optional). properties: extra COMSOL properties for the Extrude feature. tag: feature tag (None = automatic, e.g. ext1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, build, label, model, +7 more.

geom_filletA

Round corners/edges with a fillet (2D vertices or 3D edges).

Args: entities: vertices to fillet in 2D as {"object": [vertex numbers]}, or edges in 3D as {"object": [edge numbers]}. A flat list is accepted when the geometry has exactly one object. objects: object names (needed for a flat entity list with several objects). radius: fillet radius in geometry length units, e.g. 0.1. properties: extra COMSOL properties. tag: feature tag (None = automatic, e.g. fil1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, build, label, model, +6 more.

geom_get_propertiesB

Return all properties of a geometry feature (with value types).

Args: tag: feature tag (e.g. "blk1"). include_allowed: include allowed values (validates enums such as "on"/"off"). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

Inputs: tag (required), model, geometry, include_allowed.

geom_importB

Import a CAD or mesh file into the geometry sequence (STEP/IGES/DXF/STL...).

Args: filename: absolute path to the file (STL, STEP, IGES, DXF, mphbin, ...). tag: feature tag (None = automatic, e.g. imp1). label: display label. properties: extra Import properties, e.g. {"importtype": "full3d", "type": "cad", "repairgeom": "on"} (COMSOL auto-detects most formats). build: build after importing (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: filename (required), tag, build, label, +4 more.

geom_listA

List the geometry sequences of all components with their settings.

Args: model: model name/tag (None = current model). Returns per-geometry dimension, axisymmetry, length unit, feature count, entity counts (if built) and bounding box.

Inputs: model.

geom_loftB

Loft between a list of profile faces/edges/points.

Args: profiles: geometry object names used as loft profiles, in order, e.g. ["wp1", "wp2"] or named-selection tags. properties: extra COMSOL properties (e.g. {"unite": "on"}). tag: feature tag (None = automatic, e.g. loft1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, build, label, model, +4 more.

geom_measureA

Measure volume/area/length/bbox of selected entities on the finalized geometry.

Args: entity_dim: 3 = domains (volume), 2 = boundaries/faces (area), 1 = edges (length), 0 = points (coordinates). In 2D: 2 = domains (area), 1 = boundaries (length), 0 = points. entities: 1-based global entity numbers (None = all entities of that dimension). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model). Returns the primary metric (volume/area/length), bbox, vertex coords and the selected entity list.

Inputs: model, entities, geometry, entity_dim.

geom_midsurfaceB

Extract the midsurface of thin solid objects (3D).

Args: objects: solid object names to extract the midsurface from (None = all current objects). properties: extra COMSOL properties (e.g. {"keep": "on"}). tag: feature tag (None = automatic, e.g. mid1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, build, label, model, +4 more.

geom_primitiveA

Create a primitive geometry object with ergonomic aliases.

Args: kind: Block | Cylinder | Sphere | Cone | Torus | Pyramid | Hexahedron | Tetrahedron | Ellipsoid | Helix | Point | LineSegment | Polygon | Rectangle | Square | Circle | Ellipse | Interval (aliases: box, ball, rect, disk, line...). size: size expressions; Block [l,w,h], Rectangle [w,h], Square/Interval scalar. Units follow the geometry length unit, e.g. ["0.1","0.05","0.02"]. pos: position [x,y] or [x,y,z] (base point; see base property). r: radius (Cylinder/Sphere/Cone/Circle/Torus major radius). h: height (Cylinder/Cone). axis: axis direction vector (3 values) or "x"/"y"/"z". rot: rotation angle in degrees (about pos / z-axis). rmin: minor radius (Torus/Helix). rmaj: major radius (Torus/Helix; overrides r for those kinds). semiaxes: Ellipsoid semi-axes [a,b,c] (overrides r). turns: Helix number of turns. points: Hexahedron 3x8 / Tetrahedron 3x4 coordinate matrix (rows x,y,z) or LineSegment endpoints [[x1,y1(,z1)],[x2,y2(,z2)]]. connames: LineSegment coordinate overrides {"coord1": [...], "coord2": [...]}. properties: extra/override COMSOL properties, e.g. {"base": "center"}. tag: feature tag (None = automatic, e.g. blk1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: kind (required), h, r, pos, +16 more.

geom_rename_featureB

Change a feature's display label and/or its tag.

Args: tag: current feature tag. label: new display label (None = keep). new_tag: new programmatic tag (None = keep). Referenced selections may need updating afterwards. geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

Inputs: tag (required), label, model, new_tag, +1 more.

geom_reorder_featureB

Move a feature to a new position in the geometry build order.

Args: tag: feature tag to move. index: target 0-based position among user features (0 = first). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

Inputs: tag (required), index (required), model, geometry.

geom_revolveB

Revolve 2D work-plane objects into 3D.

Args: angle: revolution angle in degrees (360 = full revolution). input_objects: work-plane tags/objects to revolve (None = last work plane). pos: point on the axis in the work-plane local system, e.g. [0, 0]. axis: axis direction in the work-plane local system, e.g. [0, 1]. properties: extra COMSOL properties (e.g. {"axistype": "2d"}). tag: feature tag (None = automatic, e.g. rev1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: pos, tag, axis, angle, +7 more.

geom_run_featureA

Build the geometry up to and including one feature.

The returned counts reflect the current build state; call geom_build afterwards to build (and finalize) the whole sequence.

Args: tag: feature tag to run up to (e.g. "blk1", "dif1"). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

Inputs: tag (required), model, geometry.

geom_selection_actionsA

Create a geometry-sequence selection feature and return matched entity numbers.

The returned numbers are GLOBAL entity numbers of the finalized geometry (the same numbering physics boundary conditions use), so they can be passed straight to physics/material/feature selections.

Args: selection_type: BoxSelection | BallSelection | CylinderSelection | DiskSelection | ExplicitSelection | AdjacentSelection | UnionSelection | IntersectionSelection | DifferenceSelection | ComplementSelection | LogicalExpressionSelection. tag: selection feature tag (None = automatic, e.g. boxsel1). entity_dim: entity dimension to select: 3=domains, 2=boundaries, 1=edges, 0=points, -1=whole objects (default 2). entities: explicit entities for ExplicitSelection as {"object": [ids]}. xmin/xmax/ymin/ymax/zmin/zmax: box limits (BoxSelection); null = unbounded. condition: intersects | inside | somevertex | allvertices. pos: position for BallSelection ([x,y,z]) or CylinderSelection/DiskSelection (Disk: [x,y]; Cylinder: 3D base point). r: radius (Ball/Cylinder/Disk) or cylinder outer radius. axis: axis for CylinderSelection, e.g. ["0","0","1"] or "z". input/add/subtract: tags of preceding selection features used by the set-operation selections (Union/Intersection/Difference/Complement/ Adjacent/LogicalExpression). expression: logical expression for LogicalExpressionSelection, e.g. "sel1&!sel2" (use input tags). cumulative: also create a cumulative selection with this tag and let the new feature contribute to it. properties: extra selection feature properties (e.g. {"selshow": "off"}). label: display label. build: build the geometry after creating the selection (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: selection_type (required), r, add, pos, +21 more.

geom_set_propertiesA

Set properties on a geometry feature (expressions may include units).

Args: tag: feature tag (e.g. "blk1"). properties: dict of property name -> value, e.g. {"size": ["0.2","0.1","0.05"]} or {"r": "0.01"}. Invalid names return the available properties. build: rebuild the geometry after setting (default false). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

Inputs: tag (required), properties (required), build, model, +1 more.

geom_statsB

Summarize a geometry: space dimension, entity counts, bbox, objects.

Args: geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model). Entity dimensions: 3 = domains, 2 = boundaries (faces), 1 = edges, 0 = points.

Inputs: model, geometry.

geom_sweepA

Sweep faces/edges/points along a spine curve.

Args: entities: entities to sweep as {"object": [entity numbers]}, e.g. {"blk1": [3]}; or a flat list with a single object in the geometry. entity_dim: dimension of the entities to sweep (default 2 = faces). spine: spine edges as {"object": [edge numbers]}, e.g. {"ls1": [1]}. properties: extra COMSOL properties (e.g. {"keep": "on"}). tag: feature tag (None = automatic, e.g. swe1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, build, label, model, +6 more.

geom_thickenA

Thicken surfaces/boundaries into a solid shell (3D) or 2D thicken.

In 3D the COMSOL Thicken feature operates on whole SURFACE objects (e.g. a primitive created with properties={"type": "surface"}) and turns them into solid shells; in 2D Thicken2D operates on boundary edges.

Args: objects: surface object names to thicken (3D), e.g. ["blk1"] (None = all current objects). In 2D these are ignored. entities: boundaries to thicken as {"object": [edge numbers]} (2D only). entity_dim: entity dimension for the 2D selection (default 1 = boundaries). thickness: total thickness (symmetric offset), e.g. 0.002. offset: "symmetric" (default) or "asymmetric". upthick: upward thickness for asymmetric offset. downthick: downward thickness for asymmetric offset. keep: keep input objects. properties: extra COMSOL properties. tag: feature tag (None = automatic, e.g. thi1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, keep, build, label, +11 more.

geom_transformA

Move, copy, rotate, scale, mirror, array or rigidly transform objects.

Args: operation: Move | Copy | Rotate | Scale | Mirror | Array | RigidTransform. objects: object names to transform (e.g. ["blk1"]). displ: translation vector for Move/Copy/Array, e.g. ["0.1","0","0"]. pos: center point for Rotate/Scale/Mirror, e.g. ["0.05","0.025","0"]. axis: axis/normal vector for Rotate/Mirror, e.g. ["0","0","1"] or "z". rot: rotation angle in degrees (Rotate/RigidTransform). factor: scale factor (Scale), scalar or [sx,sy,sz]. size: array size (Array): integer (linear) or [n1,n2,n3] (rectangular/3D). properties: extra COMSOL properties (e.g. {"keep": "on"}). tag: feature tag (None = automatic, e.g. mov1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: operation (required), pos, rot, tag, +11 more.

geom_validateA

Check a geometry sequence for problems (optionally rebuild first).

Args: geometry: geometry sequence tag (default "geom1"). build: run the sequence first to collect build errors (slower but thorough). model: model name/tag (None = current model).

Inputs: build, model, geometry.

geom_workplaneB

Create a work plane (and optionally 2D features inside it).

Args: quickplane: coordinate plane of a quick work plane: xy | yz | zx | yx | zy | xz. quickx/quicky/quickz: offset coordinate of the plane (depends on quickplane). planetype: advanced work plane definition type (None = "quick"). features: 2D features created inside the work plane, each a dict like {"type": "Rectangle", "size": ["1","0.5"], "pos": ["0","0"]}. Supported keys: type, tag, label, properties (+ the primitive aliases size/pos/r/rot/semiaxes). properties: extra WorkPlane properties. tag: feature tag (None = automatic, e.g. wp1). label: display label. build: build the sequence after creating/building the plane (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

Inputs: tag, build, label, model, +9 more.

health_checkA

Check Python packages, COMSOL installation, license and workspace readiness.

Inputs: no named parameters.

java_evalA

Execute Python code against the live COMSOL Java API (escape hatch).

    The code runs inside the COMSOL worker thread. Assign to ``result`` to
    return a value. Example:
        code='''m = model.java

g = m.geom("geom1") g.run() result = {"domains": g.getNDomains(), "boundaries": g.getNBoundaries()}''' -> {"domains": 1, "boundaries": 6}

    Args:
        code: Python source. Names available: model, jm, client, mph, jcast,
              jset, jget, jprops, tree, jsonify, np.
        model: model name/tag for ``model`` (None = current model).
        timeout_s: advisory timeout for the tool call.

Inputs: code (required), model, timeout_s.

job_cancelB

Request cancellation of a background job.

Cancellation is cooperative: it stops multi-step jobs between steps and is ignored (documented) by a single monolithic COMSOL solve.

Inputs: job_id (required).

job_listA

List background jobs (solves, animations, batch evaluations).

Args: status: filter by pending | running | success | error | cancelled. limit: maximum number of jobs to return (newest first).

Inputs: limit, status.

job_statusC

Return the status / progress of a background job.

Inputs: job_id (required), include_result.

job_waitB

Wait up to timeout_s seconds for a job to finish, then return its status.

Inputs: job_id (required), timeout_s.

library_categoriesB

Module and category counts for the installed COMSOL model library.

Inputs: no named parameters.

library_describeA

Full metadata for one library model: physics, studies, documentation, cost.

Args: id_or_path: library id from library_search/library_list (e.g. "Heat_Transfer_Module/Tutorials,_Conduction/heat_conduction_in_slab"), a unique model stem, or an absolute path to any .mph file.

Inputs: id_or_path (required).

library_listA

Browse installed COMSOL example models grouped by module.

Args: module: module folder filter, substring/case-insensitive, e.g. "Heat_Transfer_Module", "ACDC", "Structural". dimension: "3D"/"3", "2D"/"2", "1D"/"1", or "unknown". category: category sub-folder filter, e.g. "Tutorials", "Verification", "Applications", "Phase_Change". limit: models returned per page (1-500, default 50). offset: page offset for paging through large result sets.

Inputs: limit, module, offset, category, +1 more.

library_loadA

Load an installed COMSOL example model (.mph) into the running session.

The original file is opened read-only; use model_save / library_run to write a copy into the workspace. Models with companion .mphbin data must be loaded from their installed path (this tool always does that).

Args: id_or_path: model id (from library_search) or absolute .mph path. name: optional name for the loaded model (default: file stem).

Inputs: id_or_path (required), name.

library_runA

Load a library model, solve it, and save a solved copy to the workspace.

Synchronous and blocking (all COMSOL work is serialised) -- intended for small models: check time_s in library_search/library_describe and prefer quick_only=true models for interactive use. Heavy models can take minutes.

Args: id_or_path: model id (from library_search) or absolute .mph path. study: optional study tag/name to solve (e.g. "std1"); default = all studies. save_path: target .mph path; default = workspace artifact root <artifact_root>/<model>/<timestamp>_library_run/<model>_solved.mph. name: optional model name in the COMSOL session (default: file stem).

Inputs: id_or_path (required), name, study, save_path.

library_statsB

Statistics of the installed model library: model counts, dimensions, study types.

Inputs: no named parameters.

mat_addA

Add (copy) a material from a COMSOL material library to a component.

Reproduces the GUI "Add Material from Library" workflow: creates a LibraryLink material, loads the library values with reload() and by default unlinks it into an ordinary editable material with real library expressions (including temperature-dependent functions).

Args: name: exact library material name, e.g. "Copper", "Silicon", "Water, liquid" (see mat_library_search / mat_library_list). A full path such as "comsol_basic_material_lib.copper" also works. library: library id or label to disambiguate ("Built-in", "Fluids", "Optical", ...). Recommended when a name exists in several libraries (e.g. "Air"). component: component tag (default "comp1"); pass "" or "global" to create a global material under model definitions. selection: domain numbers to assign the material to (3D: domains, 2D: domains). Omit to leave the material unassigned. named: named selection tag to assign instead of selection. all_domains: true = assign all domains. unlink: true (default) = editable copy; false = keep it as a live library link (read-only, updates with the library). label: custom display name (default: the library material name). tag: custom material tag (default auto mat1, mat2, ...). properties: optional property overrides applied to the Basic group, e.g. {"density": "8000[kg/m^3]"}. model: model name/tag (None = current model). Returns: {"tag", "label", "material_path", "library", "match_type", "alternatives", "properties" (key values), "selection"}.

Inputs: name (required), tag, label, model, +7 more.

mat_assignB

Assign a material to domains (explicit numbers, named selection or all).

In COMSOL, materials are assigned to domains (3 in 3D, 2 in 2D).

Args: tag: material tag, e.g. "mat1". entities: domain entity numbers, e.g. [1, 2]. named: named selection tag (created with selection tools). all_domains: true = assign every domain. component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

Inputs: tag (required), model, named, entities, +2 more.

mat_createA

Create a manual material with explicit properties (no library needed).

Args: name: material display name, e.g. "My alloy" (becomes the label). properties: Basic-group properties (def group), values are COMSOL expressions with units, e.g. {"thermalconductivity": "400[W/(mK)]", "density": "8960[kg/m^3]", "heatcapacity": "385[J/(kgK)]"}. Anisotropic tensors can be given as lists of 9 values. groups: extra property groups, e.g. {"Enu": {"E": "200[GPa]", "nu": "0.3"}}; group tags use COMSOL's built-in types ("Enu" = Young's modulus and Poisson's ratio, "linzRes", "idealGas", ...). material_type: "Common" (default, works for all physics) | "Solid" | "Fluid" | "PorousMedia" | "Multiphase" | "Switch" | "External" | "LayeredMaterial" | ... component: component tag (default "comp1"); "" or "global" = global. selection: domain numbers to assign the material to. named: named selection tag to assign instead of selection. all_domains: true = assign all domains. tag: material tag (default auto mat1, ...). label: custom label (default: name). model: model name/tag (None = current model). Example: mat_create(name="Steel custom", properties={"density": "7850[kg/m^3]", "thermalconductivity": "44.5[W/(mK)]", "heatcapacity": "475[J/(kgK)]"}, selection=[1])

Inputs: name (required), tag, label, model, +7 more.

mat_get_selectionB

Read the domain selection of a material.

Args: tag: material tag, e.g. "mat1". component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

Inputs: tag (required), model, component.

mat_import_xmlA

Import materials from a COMSOL material XML file (.xml) into the model.

The XML file may contain one or more <material> definitions in COMSOL's Model XML format (the same format as comsol_optical_lib.xml). When tags is omitted every material tag found in the file is imported.

Args: path: absolute path to the material XML file. tags: material tags inside the XML file to import (None = all). component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

Inputs: path (required), tags, model, component.

mat_library_categoriesA

List material-library categories (GUI folders) with material counts.

Args: library: restrict to one library id/label; omit to list all libraries. limit: maximum number of category rows returned. Example: mat_library_categories(library="Fluids") -> Gases (12), Liquids (13)

Inputs: limit, library.

mat_library_infoA

Show full offline catalog data for one library material.

Returns the exact library path (<library>.<tag>) used by :func:mat_add, all property groups with their expressions, and the material functions involved (e.g. k(T)), plus alternatives when the name exists in several libraries.

Args: name: material display name ("Copper"), tag ("copper") or full path ("comsol_basic_material_lib.copper"). library: optional library id/label to disambiguate (e.g. "Fluids").

Inputs: name (required), library.

mat_library_listA

List material libraries, or the materials of one library.

The catalog is built offline from the COMSOL installation (3141 materials in 19 libraries for COMSOL 6.4) and needs no running COMSOL session.

Args: library: library id or label, e.g. "comsol_basic_material_lib" or "Built-in" / "Fluids" / "AC/DC" / "Optical". Omit to list libraries. category: optional category filter (e.g. "Gases", "Liquids", "Rare earth permanent magnets") when listing materials. query: optional name/tag substring filter. limit: maximum number of materials to return (default 100, max 1000). offset: pagination offset. Returns: {"libraries": [...]} when no library is given, otherwise {"library": ..., "total": N, "materials": [{name, path, category, ...}]}.

Inputs: limit, query, offset, library, +1 more.

mat_listA

List the materials of a component (and optionally global materials).

Args: component: component tag (default "comp1"); "" or "global" lists only global materials. include_global: also list global-definition materials. model: model name/tag (None = current model).

Inputs: model, component, include_global.

mat_propertiesA

Read all property groups and property values of a material.

For library materials the library link is refreshed (reload()) first so the real library values are shown.

Args: tag: material tag, e.g. "mat1" (see mat_list). component: component tag (default "comp1"); "" or "global" for global materials. group: read only this property group tag ("def", "Enu", ...). include_descriptions: include COMSOL's per-property descriptions (localized to the COMSOL installation language). model: model name/tag (None = current model). Example: mat_properties(tag="mat1", group="def") -> properties.thermalconductivity = "400[W/(m*K)]", density = "8960[kg/m^3]"

Inputs: tag (required), group, model, component, +1 more.

mat_removeB

Remove a material from a component (or from global definitions).

Args: tag: material tag, e.g. "mat1". component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

Inputs: tag (required), model, component.

mat_renameA

Rename a material's display label and/or change its tag.

Args: tag: current material tag, e.g. "mat1". label: new display name shown in COMSOL (e.g. "Copper (annealed)"). new_tag: new material tag, e.g. "copper" (references in tree paths change; selections are kept). component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

Inputs: tag (required), label, model, new_tag, +1 more.

mat_set_propertyA

Set one material property (a COMSOL expression with units).

Args: tag: material tag, e.g. "mat1". property: property name, e.g. "thermalconductivity", "density", "heatcapacity", "youngsmodulus". Use mat_properties first to see valid names for the material. value: expression string ("400[W/(m*K)]"), number, or list of expressions for anisotropic/array properties (9 values for a 3x3 tensor). group: property group tag (default "def" = Basic). index: optional index for setting one element of an array property. component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model). Example: mat_set_property(tag="mat1", property="density", value="8000[kg/m^3]")

Inputs: tag (required), value (required), property (required), group, +3 more.

media_frames_to_gifA

Compose PNG/JPG image frames into an animated GIF (Pillow; no COMSOL needed).

Args: frames: list of image paths, or a one-element list containing a frames directory, e.g. ["C:/out/frames"] (files are sorted naturally). output: output .gif path (auto-generated when omitted). fps: frames per second (default 10; converted to GIF frame duration). loop: 0 = loop forever (default), n = repeat n times. optimize: optimise the GIF palette/file size. title: optional title text drawn on every frame. title_position: "top" (default) | "bottom" | "overlay-top" | "overlay-bottom". title_font_size: title font size px (default 18). max_width: downscale frames wider than this. max_frames: keep at most this many frames (evenly spaced). hold_last_s: extra seconds to show the last frame.

Inputs: frames (required), fps, loop, title, +7 more.

media_frames_to_mp4A

Compose PNG/JPG image frames into an H.264 MP4 (imageio + imageio-ffmpeg).

Requires imageio and imageio-ffmpeg (check media_tools_status). Frames are padded to even dimensions automatically (H.264 requirement).

Args: frames: list of image paths or a one-element frames directory list. output: output .mp4 path (auto-generated when omitted). fps: frames per second (default 10). quality: imageio-ffmpeg quality 0..10 (8 = good, default). title: optional title text drawn on every frame. title_position: "top" (default) | "bottom" | "overlay-top" | "overlay-bottom". max_width: downscale frames wider than this. max_frames: keep at most this many frames (evenly spaced). hold_last_s: extra seconds to show the last frame.

Inputs: frames (required), fps, title, output, +5 more.

media_infoA

Probe an animation or image: frame count, duration, fps, dimensions, size.

Args: path: media file path (.gif, .mp4/.avi/.webm/.mov or .png/.jpg/.bmp).

Inputs: path (required).

media_tools_statusA

Report media tooling availability: Pillow, imageio, imageio-ffmpeg, ffmpeg.

Use before requesting MP4 output; GIF output only needs Pillow.

Inputs: no named parameters.

mesh_add_featureA

Create a mesh feature of any COMSOL type (generic escape hatch).

Valid types come from catalog_mesh_features (e.g. FreeTet, FreeTri, Map, Sweep, BndLayer, Size, SizeExpression, Distribution, Refine, Import, CopyFace, CornerRefinement, Vertex, ...).

Args: feature_type: COMSOL mesh feature type, e.g. "FreeTet". mesh: mesh sequence tag (None = first). tag: feature tag (None = auto from the type, e.g. "ftet1"). properties: feature properties, e.g. {"method": "delaunay"}. Property names must match COMSOL's; use mesh_features to read the available names of existing features. selection: geometric entity numbers to select. named: named selection tag to select instead. all_entities: select all entities of entity_dim. entity_dim: selection dimension (3=domains, 2=boundaries, 1=edges, 0=points). Default depends on the feature type (FreeTet=domains, FreeTri/Map=boundaries in 3D, BndLayerProp=boundaries). parent: parent feature tag for child features (e.g. BndLayerProp under a BndLayer, CornerProp under CornerRefinement). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: feature_type (required), tag, mesh, model, +7 more.

mesh_auto_sizeB

Use a COMSOL predefined mesh size (1 = extremely fine ... 9 = extremely coarse).

Args: size: predefined size level 1..9 (default 5 = normal). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, size, model, component.

mesh_boundary_layersA

Add boundary layers (prism elements) on selected boundaries.

Creates a BndLayer feature (selecting domains) with a BndLayerProp child (selecting faces). COMSOL only generates the layers when the child has a face selection, so this tool always assigns one (all faces by default).

Args: layers: number of boundary layers (default 3). stretching: stretching factor between consecutive layers (default 1.2). thickness: first-layer thickness or total thickness, e.g. "0.01" or "1[mm]"; omit to keep COMSOL's automatic thickness. thickness_type: "first" (default, thickness = first layer height) or "total" (thickness = total boundary-layer thickness). domains: domain numbers that receive boundary layers (default all). boundaries: face numbers that get layers (default all faces). named: named selection for the domains. all_domains: apply to all domains (default true). all_boundaries: apply to all boundaries (default true). properties: extra BndLayer/BndLayerProp properties, e.g. {"sharpcorners": "split", "method": "latest"}. mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_boundary_layers(layers=4, stretching=1.3, thickness="0.005", boundaries=[1, 2, 3])

Inputs: mesh, model, named, layers, +9 more.

mesh_buildB

Build (or rebuild) the mesh — alias of mesh_run.

Args: mesh: mesh sequence tag (None = first). feature: optional feature tag to validate before building. component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, model, feature, component.

mesh_clearB

Clear the built mesh data (keep the sequence and its features).

Args: mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, model, component.

mesh_create_sequenceA

Create a mesh sequence on a geometry.

Args: geometry: geometry tag to mesh, e.g. "geom1" (None = first geometry of the first component). tag: mesh sequence tag (None = auto "mesh1", "mesh2", ...). component: component tag (None = first component containing a geometry). auto_size: predefined mesh size 1 (extremely fine) ... 9 (extremely coarse). automatic: true = COMSOL automatic mesh (default), false = user-controlled. model: model name/tag (None = current model). Example: mesh_create_sequence(geometry="geom1", auto_size=5)

Inputs: tag, model, geometry, auto_size, +2 more.

mesh_element_countsA

Element counts per geometric entity (domains for tets, boundaries for tris).

Useful to verify which domains/boundaries are meshed and whether a simple geometry was meshed as expected.

Args: mesh: mesh sequence tag (None = first). types: element types to count ("tet", "tri", "quad", "hex", "prism", "edg", "vtx"); None = all present types. max_entities: cap on reported entities per type (default 200). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, model, types, component, +1 more.

mesh_exportA

Export the built mesh to a file (STL, NASTRAN, 3MF, PLY, native, ...).

Args: path: target file path (absolute, or relative to the artifact root). When omitted a timestamped file under <artifact_root>/mesh/ is created. The correct extension is appended when missing. format: "stl" (default, binary STL) | "stlbin" | "stlascii" | "nastran" | "3mf" | "ply" | "native" | "sectionwise". COMSOL 6.4 has no VTU mesh export. stl_format: for STL exports: "binary" (default) or "text". mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Returns: {"path": "", "size": , "export_type": ...}.

Inputs: mesh, path, model, format, +2 more.

mesh_featuresA

List the features (and child features) of a mesh sequence.

Includes each feature's type, tag, label, selection and current properties (build metadata omitted).

Args: mesh: mesh sequence tag (None = first mesh sequence in the model). component: component tag (None = auto-detect from the mesh tag). model: model name/tag (None = current model).

Inputs: mesh, model, component.

mesh_free_tetA

Create (or configure) a FreeTet feature and select domains to mesh.

Args: properties: FreeTet properties, e.g. {"method": "delaunay"} or {"optlevel": "high"}. Known names: method, smoothcontrol, smoothmaxiter, smoothmaxdepth, optlevel, numlayer, xscale/yscale/zscale, ... selection: domain numbers to mesh (default all domains). named: named selection of domains instead of selection. all_domains: mesh all domains (default true; ignored when selection/named given). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, model, named, component, +3 more.

mesh_free_triB

Create (or configure) a FreeTri feature (2D domains, or 3D boundaries).

Args: properties: FreeTri properties, e.g. {"method": "delaunay", "smoothmaxiter": "4"}. selection: entity numbers to mesh (2D: domains; 3D: boundaries). named: named selection instead of selection. all_entities: select all entities of the chosen dimension (default true). entity_dim: selection dimension (2D geometry: 2 = domains; 3D geometry: 2 = boundaries). Default is handled per dimension. mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, model, named, component, +4 more.

mesh_importA

Import a mesh into a mesh sequence (COMSOL Import mesh feature).

COMSOL imports meshes from another mesh sequence, a geometry or a result dataset. The source is configured through feature properties — e.g. source="sequence" plus properties={"sequence": "mesh1"}, or source="dataset" plus properties={"dataset": "dset1"}.

Args: mesh: target mesh sequence tag (None = first). source: source kind ("sequence", "geom", "dataset"); optional. properties: extra Import properties (sequence, geom, dataset, ...). tag: feature tag (default auto "imp1"). selection: domain/entity numbers for the import feature. named: named selection instead of selection. all_entities: select all entities of entity_dim. entity_dim: selection dimension (default: geometry dimension). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: tag, mesh, model, named, +6 more.

mesh_listA

List mesh sequences with their geometry, features and element counts.

Args: component: restrict to one component tag (None = all components). model: model name/tag (None = current model).

Inputs: model, component.

mesh_mappedA

Create a mapped mesh feature (quadrilateral/hexahedral surfaces).

In 2D the mapped mesh covers domains (quad elements); in 3D it maps boundary faces. The mapped region needs a compatible shape (4 edges); COMSOL reports a clear error otherwise.

Args: properties: Map properties, e.g. {"interpmethod": "auto"}. selection: domain/face numbers to map. named: named selection instead of selection. all_entities: select all domains/faces of the chosen dimension (default true). entity_dim: selection dimension (default 2: domains in 2D geometry, boundaries in 3D geometry). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, model, named, component, +4 more.

mesh_qualityB

Mesh quality: min/mean quality and a quality-distribution histogram.

Args: mesh: mesh sequence tag (None = first). bins: number of histogram bins (default 10). mesh_type: element type to analyse ("tet", "tri", "quad", "hex", "prism"); None = all element types present. component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: bins, mesh, model, component, +1 more.

mesh_removeC

Remove an entire mesh sequence from its component.

Args: mesh: mesh sequence tag, e.g. "mesh1". component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh (required), model, component.

mesh_remove_featureB

Remove one mesh feature (and its child features) from a sequence.

Args: mesh: mesh sequence tag (None = first). feature: feature tag to remove, e.g. "ftet1". component: component tag (None = auto-detect). model: model name/tag (None = current model).

Inputs: mesh, model, feature, component.

mesh_runA

Build the mesh sequence (shortcut for the COMSOL "Build All").

Args: mesh: mesh sequence tag (None = first). feature: optional feature tag; when given it is validated and the whole sequence is built (COMSOL builds all features in order). component: component tag (None = auto-detect). model: model name/tag (None = current model). Returns: {"ran", "n_elem", "n_elem_by_type", "n_vertex", "min_quality", "mean_quality", "is_complete", ...}

Inputs: mesh, model, feature, component.

mesh_set_propertyA

Set properties on an existing mesh feature (e.g. FreeTet method, BL layers).

Args: mesh: mesh sequence tag (None = first). feature: mesh feature tag, e.g. "ftet1" (None = the last feature). property: one property name, e.g. "method", "blnlayers". value: value for property. properties: alternatively a dict of several properties. component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_set_property(feature="ftet1", properties={"method": "delaunay"})

Inputs: mesh, model, value, feature, +3 more.

mesh_set_sizeA

Set explicit mesh size properties (hmax, hmin, growth rate, ...).

When user_controlled=True (default) the sequence is switched to a user-controlled mesh (automatic(false)), which is required for manual sizes to take effect. Without selection the global size feature is edited; with a selection a localized Size feature is created.

Args: hmax: maximum element size, e.g. "0.05" (model length unit) or "5[mm]". hmin: minimum element size. hgrad: maximum element growth rate (e.g. "1.5"). hcurve: curvature factor (e.g. "0.6"). hnarrow: resolution of narrow regions (e.g. "0.5"). hauto: predefined size level 1..9 (sets automatic sizing). mesh: mesh sequence tag (None = first). feature: existing size feature tag to edit (None = global "size"). selection: domain/boundary numbers for a localized size feature. named: named selection tag for the size feature. all_entities: apply the localized size to all entities. entity_dim: selection dimension for the localized size (default geom dim). user_controlled: switch the sequence to a user-controlled mesh (default true). component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_set_size(hmax="0.02", hmin="0.002", hgrad="1.3")

Inputs: hmax, hmin, mesh, hauto, +11 more.

mesh_statsB

Mesh statistics: element/vertex counts, quality, type flags, volume.

Args: mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Returns: {"n_elem", "n_elem_by_type", "n_vertex", "min_quality", "mean_quality", "has_second_order_elements", "is_complete", ...} plus mesh problems. Note: the clientapi has no max-quality getter.

Inputs: mesh, model, component.

mesh_sweepA

Create a swept mesh feature (hexahedral/prism elements along a sweep path).

Args: properties: Sweep properties, e.g. {"element": "hex", "sweeppath": "auto"} (element: "hex" | "hexdominant" | "prism"; default hexdominant). domains: domain numbers to sweep (default all domains). named: named selection of domains instead of domains. source_faces: source boundary numbers (optional; COMSOL picks the source automatically from the domain topology by default). target_faces: target boundary numbers (optional). all_domains: sweep all domains (default true; ignored when domains/named given). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_sweep(domains=[1], source_faces=[1], properties={"element": "hex"})

Inputs: mesh, model, named, domains, +5 more.

model_cloneC

Clone a model under a new name (saved/loaded through a temporary file).

Inputs: model, new_name.

model_createB

Create a new empty COMSOL model with a component and a geometry sequence.

Args: name: model name (None = automatic "Model N"). dimension: geometry dimension: 3 (3D), 2 (2D), 1 (1D), or 2 with dimension=2 plus axisymmetric handled by physics setup. component: component tag (default comp1). geometry: geometry sequence tag (default geom1).

Inputs: name, geometry, component, dimension.

model_describeB

Describe a model: components, physics, materials, meshes, studies, results.

Inputs: model.

model_listA

List all models currently loaded in COMSOL and mark the current one.

Inputs: no named parameters.

model_loadB

Load a .mph model file into COMSOL.

Args: path: absolute path to the .mph file. name: optional name to register the model under.

Inputs: path (required), name.

model_open_guiA

Open a model in the COMSOL Desktop GUI (interactive inspection/editing).

Saves the current in-memory state first (unless path is given), then launches comsol.exe -open <file> detached. Useful for a human to inspect what the AI built, or to continue interactively.

Inputs: path, model.

model_parameters_dumpB

Return all model parameters as {name: expression} plus evaluated values.

Inputs: model.

model_problemsC

List model problems/warnings reported by COMSOL (physics, mesh, solver).

Inputs: model.

model_removeB

Remove a model from COMSOL memory (does not delete files on disk).

Inputs: model.

model_renameC

Rename a loaded model.

Inputs: model, new_name.

model_saveA

Save a model to an .mph file.

Args: model: model name/tag (None = current model). path: target file path. When omitted, saves into the workspace model root. versioned: add a timestamp suffix (keeps previous versions). tag: custom suffix instead of the timestamp.

Inputs: tag, path, model, versioned.

model_set_currentB

Select the current model (used by tools that omit the model argument).

Inputs: model.

model_snapshotB

Save an internal snapshot of a model (used before risky changes).

Snapshots live in the scratch directory and can be reloaded with model_load.

Inputs: tag, model.

multiphysics_addA

Add a multiphysics coupling between existing physics interfaces.

Common types (live-verified): ThermalExpansion (heat+solid), NonIsothermalFlow (heat+flow), ElectromagneticHeating (heat+EM waves), AcousticStructureBoundary (acoustics+structure), FluidStructureInteractionBC (flow+structure). The coupling type is attempted on COMSOL; unknown types return close matches.

Args: type: coupling type, e.g. "ThermalExpansion", "NonIsothermalFlow". tag: coupling tag (None = conventional prefix + number, e.g. "te1"). label: optional display label. geom: geometry tag the coupling operates on (None = first geometry). entity_dim: entity dimension for boundary couplings (2 in 3D, 1 in 2D); None tries the 3-argument form first. component: component tag (None = first component). model: model name/tag (None = current model).

Inputs: type (required), tag, geom, label, +3 more.

multiphysics_add_featureB

Create a sub-feature inside a multiphysics coupling.

Args: coupling: coupling tag/label (e.g. "te1"). feature_type: COMSOL sub-feature type valid for that coupling. tag: sub-feature tag (None = auto). label: optional display label. entity_dim: entity dimension (None = COMSOL default). model: model name/tag (None = current model).

Inputs: coupling (required), feature_type (required), tag, label, +2 more.

multiphysics_get_featuresB

List multiphysics couplings with their sub-features.

Args: coupling: coupling tag/label (None = all couplings). include_properties: include each coupling's property values. model: model name/tag (None = current model).

Inputs: model, coupling, include_properties.

multiphysics_listB

List multiphysics couplings (e.g. ThermalExpansion, NonIsothermalFlow).

Args: model: model name/tag (None = current model).

Inputs: model.

multiphysics_propertiesB

Return all properties of a multiphysics coupling (values bounded).

Args: coupling: coupling tag/label (e.g. "te1"). model: model name/tag (None = current model).

Inputs: coupling (required), model.

multiphysics_removeB

Remove a multiphysics coupling.

Args: coupling: coupling tag or label (e.g. "te1"). model: model name/tag (None = current model).

Inputs: coupling (required), model.

multiphysics_set_propertyB

Set one property on a multiphysics coupling.

Args: coupling: coupling tag/label (e.g. "te1"). name: property name (e.g. "InputType", "Heat_physics", "Solid_physics"). value: new value, e.g. "SecantCoefficient" or "ht". model: model name/tag (None = current model).

Inputs: name (required), value (required), coupling (required), model.

parameter_descriptionsC

Return the description text of every parameter.

Inputs: model.

parameter_getC

Get a global parameter expression (or its evaluated numeric value).

Inputs: name (required), model, evaluate.

parameter_listC

List all global parameters as a name鈫抏xpression mapping.

Inputs: model, evaluate.

parameter_removeC

Remove one or more global parameters.

Inputs: names (required), model.

parameter_setB

Define or update global model parameters.

Args: values: mapping of parameter name to expression/number, e.g. {"L": "0.1[m]", "T0": "293.15[K]", "n": 10}. descriptions: optional mapping of parameter name to description text.

Inputs: values (required), model, descriptions.

phys_addA

Add a physics interface to a component (e.g. HeatTransfer, SolidMechanics).

The interface type is validated against the COMSOL 6.4 catalog; an unknown type returns close matches. The target geometry's space dimension is checked as well (e.g. LaminarFlow needs 2D/3D).

Args: type: catalog interface type, e.g. "HeatTransfer", "SolidMechanics", "LaminarFlow", "Electrostatics", "PressureAcoustics", "ElectromagneticWavesFrequencyDomain", "DilutedSpecies". Tag prefixes ("ht") and descriptions are accepted too. tag: interface tag (None = catalog default prefix + number, e.g. "ht"). label: optional display label (e.g. "Heat Transfer in Solids"). geom: target geometry tag (None = first geometry of the component). component: component tag (None = first component). extra_dims: optional extra-dimension tags for reduced models. model: model name/tag (None = current model).

Inputs: type (required), tag, geom, label, +3 more.

phys_add_bcA

Create a boundary/domain condition through a friendly alias.

Aliases map to the real COMSOL feature type and property names, and pre-set any required switches (e.g. convection sets HeatFluxType=ConvectiveHeatFlux, radiation sets epsilon_rad_mat=userdef). If bc is not a known alias it may still be a raw COMSOL feature type valid for that interface.

Verified aliases by interface type: HeatTransfer: temperature(T0), heat_flux(q0_input), convection(h,Text), radiation(epsilon_rad,Tamb), heat_source(Q0), initial(Tinit), insulation; SolidMechanics: fixed, prescribed_displacement(Direction+U0 vector), roller, initial(u), and three load types: boundary_load with F/load = per-area traction [N/m^2] (ForceArea + forceReferenceArea), total_force/force = total force [N] (TotalForce + force), pressure/p = normal pressure [Pa] (FollowerPressure + pressure); pressure_load(p) = normal pressure shortcut; body_load with F/load = per-volume force [N/m^3] (ForceVolume + forceReferenceVolume) or total_force/force = total force [N]; note: on a COMSOL BoundaryLoad/BodyLoad the property "F" is only the DERIVED resultant force - it does not apply a load, so these aliases write the real input properties instead; LaminarFlow: inlet(U0in), outlet(p0), wall, symmetry, volume_force(F), initial; Electrostatics: ground, electric_potential(V0), surface_charge(rhoqs), space_charge(rhoq), zero_charge, initial(V); ConductiveMedia (electric currents): terminal(TerminalType,V0,I0), ground, electric_potential(V0), normal_current_density(nJ), initial(V2); PressureAcoustics: sound_hard, sound_soft, normal_velocity(nvel), impedance(Zn), pressure(p0), initial(p2); ElectromagneticWavesFrequencyDomain: pec, pmc, port(PortName,Pin), scattering(IncidentField), initial(E); DilutedSpecies: concentration(c0), inflow(c0), outflow, no_flux, reactions(R_c), initial(initc).

Args: interface: interface tag/label/type (e.g. "ht"). bc: alias name (e.g. "temperature") or a raw COMSOL feature type. selection: entity list, "all", or a named-selection tag. named_selection: named selection tag to assign. all_entities: select all entities of the condition's dimension. properties: property values using real COMSOL names or documented aliases, e.g. {"T0": "400[K]"} or {"T": "400[K]"}. tag: new feature tag (None = auto). label: optional display label. entity_dim: override the entity dimension (3=domains, 2=boundaries). model: model name/tag (None = current model).

Inputs: bc (required), interface (required), tag, label, +6 more.

phys_add_featureA

Create a physics feature (boundary condition, domain setting, ...).

feature_type must be a COMSOL type valid for the interface (verified against the catalog and, ultimately, COMSOL). Use parent to create a sub-feature inside an existing feature (e.g. Plasticity under the Linear Elastic Model).

Args: interface: interface tag/label/type (e.g. "ht"). feature_type: COMSOL feature type, e.g. "TemperatureBoundary", "HeatFluxBoundary", "HeatSource", "Fixed", "InletBoundary". tag: new feature tag (None = auto "prefixN"). label: optional display label. entity_dim: entity dimension (3=domains, 2=boundaries, 1=edges, 0=points in 3D; None = domain dimension of the geometry). selection: entity list (e.g. [1,2,3]), "all", or a named-selection tag. named_selection: named selection tag to assign instead of entities. all_entities: select all entities of the feature's dimension. properties: property dict, e.g. {"T0": "400[K]"}. parent: parent feature tag (or nested path "lemm1/pl1") for sub-features. model: model name/tag (None = current model).

Inputs: interface (required), feature_type (required), tag, label, +7 more.

phys_featuresB

Return the nested feature tree of a physics interface.

Every node has tag, label, COMSOL type, active state, entity dimension, selected entities / named selection. Sub-features (e.g. "Plasticity" under the Linear Elastic Model) appear as nested children.

Args: interface: interface tag/label/type (e.g. "ht"). include_properties: also return every property value (can be large). model: model name/tag (None = current model).

Inputs: interface (required), model, include_properties.

phys_feature_typesA

List the feature types COMSOL allows inside a physics interface.

Uses the shipped COMSOL 6.4 catalog (no COMSOL connection needed), with tag prefix and description for each type.

Args: interface: interface type, tag prefix or description (e.g. "HeatTransfer" or "ht"). dimension: restrict to a space dimension: 3, "2D", "2daxi", "S3D", ... (None = union over all dimensions). query: optional case-insensitive substring filter on type/description. limit: maximum number of feature types returned (default 500).

Inputs: interface (required), limit, query, dimension.

phys_get_selectionB

Show the entity dimension and selected entities of a physics feature.

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). model: model name/tag (None = current model).

Inputs: feature (required), interface (required), model.

phys_infoA

Show one physics interface: type, label, geometry, dimension, features, dependent-variable fields, interface-level property groups and BC aliases.

Args: interface: interface tag, label or type (e.g. "ht"). model: model name/tag (None = current model).

Inputs: interface (required), model.

phys_interface_propertiesA

List interface-level property groups and their properties.

These are the settings shown directly on the physics-interface node in COMSOL (e.g. "EquationForm" / advanced settings, "PhysicalModelProperty" / physical model, "ShapeProperty" / shape functions), not feature properties.

Args: interface: interface tag/label/type (e.g. "ht"). include_values: include current values (values are truncated). model: model name/tag (None = current model).

Inputs: interface (required), model, include_values.

phys_interfaces_catalogA

Search the catalog of physics interface types available in COMSOL 6.4.

Args: dimension: restrict to a space dimension: 3, "2D", "2daxi", ... or None. query: case-insensitive substring filter on type/description (e.g. "heat", "flow", "acoustic"). limit: maximum number of interfaces returned (default 200).

Inputs: limit, query, dimension.

phys_listB

List every physics interface in the model.

Returns, per interface: component, tag, label, type (e.g. "HeatTransfer"), target geometry tag, space dimension, feature count and active state.

Args: model: model name/tag (None = current model).

Inputs: model.

phys_list_featuresA

Return a flat list of all physics features (including sub-features).

Nested features carry a parent tag. Useful to quickly find feature tags for phys_set_property / phys_set_selection.

Args: interface: interface tag/label/type (e.g. "ht"). include_properties: also return property values for every feature. model: model name/tag (None = current model).

Inputs: interface (required), model, include_properties.

phys_propertiesB

Return all properties of a physics feature (values bounded).

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"); nested paths use "a/b". model: model name/tag (None = current model).

Inputs: feature (required), interface (required), model.

phys_removeA

Remove a physics interface (and all its features) from the model.

Args: interface: interface tag, label or type (e.g. "ht"). model: model name/tag (None = current model).

Inputs: interface (required), model.

phys_remove_featureA

Remove a physics feature (COMSOL default/required features cannot be removed).

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). model: model name/tag (None = current model).

Inputs: feature (required), interface (required), model.

phys_renameB

Rename a physics interface (display label and/or programmatic tag).

Args: interface: current interface tag or label. new_label: new display label shown in the COMSOL GUI (optional). new_tag: new programmatic tag (optional; must be unique). model: model name/tag (None = current model).

Inputs: interface (required), model, new_tag, new_label.

phys_set_interface_propertyA

Set one interface-level property (inside a Physics.prop() group).

Args: interface: interface tag/label/type (e.g. "ht"). name: property name, e.g. "form" (EquationForm) or "Tref" (PhysicalModelProperty). value: new value, e.g. "Automatic" or "300[K]". group: property group tag/label; when omitted the property is searched across all groups and must be unambiguous. model: model name/tag (None = current model).

Inputs: name (required), value (required), interface (required), group, +1 more.

phys_set_propertyA

Set one property on a physics feature (e.g. T0 of a temperature BC).

Invalid property names return the available properties and close matches. Expressions use COMSOL unit syntax: "400[K]", "1e4[W/m^2]".

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag or label (e.g. "temp1"). name: COMSOL property name (e.g. "T0", "q0_input", "h", "V0"). value: property value (string with units, number, bool or list). model: model name/tag (None = current model).

Inputs: name (required), value (required), feature (required), interface (required), +1 more.

phys_set_selectionA

Assign entities (or a named selection / all entities) to a feature.

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). entities: entity numbers [1,2,3], "all", or a named-selection tag. named: named selection tag (alternative to entities). all_entities: select every entity of the feature's dimension. model: model name/tag (None = current model).

Inputs: feature (required), interface (required), model, named, +2 more.

phys_toggle_featureA

Enable/disable a physics feature (None = flip its current state).

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). active: True=enable, False=disable, None=toggle. model: model name/tag (None = current model).

Inputs: feature (required), interface (required), model, active.

plot_add_featureA

Add a plot feature (or an attribute) to a plot group.

Args: plotgroup: target plot group tag (see plot_list). feature_type: COMSOL plot type, e.g. Surface, Volume, Slice, Isosurface, Contour, ArrowSurface, ArrowVolume, ArrowLine, Streamline, Line, Point, Mesh, LineGraph, PointGraph, Global. Attributes Deform/Height/Filter/Transparency require parent. See plot_types. tag: feature tag (auto e.g. surf1 when omitted). parent: plot feature tag when adding an attribute (e.g. "surf1"), or a nested path for deeper nodes ("surf1/def1"). expr: expression to plot. Scalar e.g. "T", "ht.T", or vector components comma-separated "ht.dfluxx,ht.dfluxy,ht.dfluxz". Arbitrary COMSOL expressions incl. units might work, e.g. "T-293.15[K]". properties: extras such as colortable ("Rainbow", "ThermalLight"), colorlegend (on/off), unit, rangecoloractive/rangecolormin/rangecolormax, smooth, title. Values may be strings or numbers. label: display label for the feature. model: model name/tag (None = current model).

Example: plot_add_feature("pgT", "Surface", expr="T", properties={"colortable": "ThermalLight"})

Inputs: plotgroup (required), feature_type (required), tag, expr, +4 more.

plot_attach_datasetA

Point an existing plot group at another dataset.

Useful to re-render the same plot for a cut plane (cpl1), cut line (cln1), mesh dataset or a different solution.

Args: plotgroup: plot group tag. dataset: dataset tag, e.g. "dset1", "cpl1", "cln1". model: model name/tag (None = current model).

Inputs: dataset (required), plotgroup (required), model.

plot_export_imageA

Render plot group(s) and export image file(s), validated with Pillow.

Exports COMSOL's Image feature with the exact clientapi properties: plotgroup, imagetype, <type>filename (pngfilename / jpegfilename / bmpfilename / epsfilename / gltffilename), width/height (px when unit="px"), unit, resolution (dpi), optional size preset, background, antialias.

Args: plotgroup: single plot group tag to export (e.g. "pg1"). path: output file path. For a single plot group a .png/.jpg path is used as-is; when omitted a unique path under <artifact_root>/<model>/<timestamp>_plots/ is generated. For multiple plot groups this is treated as a directory. width: image width in px (default 1200). height: image height in px (default 900). unit: px (default) | mm | in. dpi: optional COMSOL resolution property (e.g. 150). imagetype: png (default) | jpeg | bmp | eps | gltf. eps only works for 1D plot groups; gltf is 3D-only and may not be produced in headless COMSOL 6.4. size: optional COMSOL size preset manualprint/manualweb/ current/presentation; leave empty to honour width/height. background: current | color | transparent. antialias: on | off. plotgroups: export several plot groups in one call (list of tags); alternatively omit both plotgroup and plotgroups to export every plot group in the model. model: model name/tag (None = current model).

Returns: For one group: {"path","size","width","height","format","valid", "plotgroup", ...} measured on the written file. For several: {"images": [ ... ], "count", "directory"}.

Inputs: dpi, path, size, unit, +8 more.

plot_export_plot_dataA

Export the raw rendered data vectors of a plot feature to CSV.

COMSOL returns the data it renders per feature: for a LineGraph the y-values (data type "Height"), for a 3D Surface the expression values ("Color"). The CSV has one column per data vector (header = data type name). This complements result_export_data (Data export feature, owned by the results tools).

Args: plotgroup: plot group tag to read data from. feature: plot feature tag (defaults to the first feature). path: output CSV path (auto under artifact root when omitted). max_points: cap values written per column. model: model name/tag (None = current model).

Returns: {"path","size","rows","columns","headers","feature","data_types"}.

Inputs: plotgroup (required), path, model, feature, +1 more.

plot_featuresA

List the plot features (and their attributes) of one plot group.

Args: plotgroup: plot group tag, e.g. "pg1" (see plot_list). model: model name/tag (None = current model).

Inputs: plotgroup (required), model.

plot_group_createA

Create an empty plot group at the results root.

Args: plotgroup_type: PlotGroup3D (default) | PlotGroup2D | PlotGroup1D | PolarGroup | SmithGroup. tag: plot group tag (auto pg1, pg2... when omitted). dataset: dataset tag the group renders, e.g. "dset1" (default solution), "cpl1" (cut plane), "cln1" (cut line). When omitted COMSOL uses the default solution dataset. title: plot title shown in the image / report. properties: extra plot-group properties, e.g. {"showlegends": "off", "title": "..."}. model: model name/tag (None = current model).

Example: plot_group_create("PlotGroup3D", tag="pgT", dataset="dset1", title="Temperature (K)")

Inputs: tag, model, title, dataset, +2 more.

plot_listB

List the plot groups (result features) in a model.

Args: model: model name/tag (None = current model).

Inputs: model.

plot_propertiesA

Read all properties of a plot group or plot feature (JSON).

Args: plotgroup: plot group tag. feature: plot feature tag or nested path; omit for the group itself. model: model name/tag (None = current model).

Inputs: plotgroup (required), model, feature.

plot_quickA

One-call plot: create group + feature, render, export a validated image.

Args: expr: COMSOL expression to plot, e.g. "T", "ht.T", "u,v,w" (vector components comma-separated for arrows / streamlines). plot_type: surface (3D, default) | volume | slice | isosurface | contour | arrow_surface | arrow_volume | arrow_line | streamline | line | point | global | surface2d | contour2d | arrow2d. dataset: dataset tag (e.g. "dset1", "cpl1", "cln1"); COMSOL default solution dataset when omitted. title: plot title. colortable: color table, e.g. "Rainbow", "ThermalLight", "GrayScale", "Wave". width: image width px (default 1200). height: image height px (default 900). imagetype: png (default) | jpeg | bmp. path: output image path (auto under artifact root when omitted). plotgroup: reuse this plot group tag instead of creating a new one. model: model name/tag (None = current model).

Returns: {"ok", "plotgroup", "feature", "plot_type", "path", "size", "width", "height", "format", "valid"}.

Example: plot_quick("T", plot_type="surface", colortable="ThermalLight", title="Temperature")

Inputs: expr (required), path, model, title, +7 more.

plot_removeA

Remove a plot group entirely, or one plot feature/attribute.

Args: plotgroup: plot group tag. feature: feature tag or nested path to remove; omit to remove the whole plot group. model: model name/tag (None = current model).

Inputs: plotgroup (required), model, feature.

plot_runB

Render a plot group (or a single plot feature) and report timing.

Rendering is needed before exporting images (though plot_export_image also triggers rendering automatically when COMSOL requires it).

Args: plotgroup: plot group tag. feature: optional plot feature tag to render alone. model: model name/tag (None = current model).

Inputs: plotgroup (required), model, feature.

plot_set_propertiesA

Set properties on a plot group or on one of its plot features.

Invalid property names return the complete list of available properties read live from the node (use plot_properties to inspect first).

Args: plotgroup: plot group tag. properties: mapping of COMSOL property -> value, e.g. {"colortable": "Rainbow", "colorlegend": "on"} on a feature, or {"title": "My plot", "showlegends": "off"} on a group. feature: plot feature tag (or nested "surf1/def1"). When omitted the properties are set on the plot group itself. model: model name/tag (None = current model).

Example: plot_set_properties("pg1", {"showlegends": "off", "title": "T [K]"}) plot_set_properties("pg1", {"colortable": "ThermalLight"}, feature="surf1")

Inputs: plotgroup (required), properties (required), model, feature.

plot_typesA

List valid plot group types, plot feature types and quick-plot aliases.

Use this before plot_group_create / plot_add_feature to pick valid type strings for COMSOL 6.4. Attribute features (Deform, Height, Filter, Transparency) must be added with parent=<plot feature tag>.

Inputs: no named parameters.

report_add_contentA

Add a content node (plot, mesh, table, text, ...) inside a Section.

Content nodes reference existing model nodes through their noderef property (verified live: PlotGroup, Mesh, Geometry, Physics, Study, Parameter, Table, DerivedValues all accept noderef).

Args: report: report tag. section: target section tag (see report_add_section). content_type: PlotGroup (e.g. insert a rendered plot) | Table | DerivedValues | Mesh | Geometry | Physics | Study | Parameter | Graphics | Heading | Text | StringDataField | DataSet | Material | Model | Variables | Functions. tag: content node tag (auto when omitted). noderef: tag of the referenced node inside the model, e.g. "pg1" for a PlotGroup, "mesh1" for Mesh, "geom1" for Geometry, "ht" for Physics, "std1" for Study. text: text content for Text nodes (sets the text property). properties: extra properties to set on the content node (e.g. {"caption": "Temperature", "imagetype": "png"}). model: model name/tag (None = current model).

Returns: {"tag", "label", "type", "report", "section", "noderef"}.

Inputs: tag, text, model, report, +4 more.

report_add_sectionA

Add a top-level report section node (Section/TitlePage/TableOfContents).

Args: report: report tag (see report_list). section_type: Section (default, a content container) | TitlePage | TitleSlide | SectionSlide | TableOfContents. heading: section heading / page title. tag: node tag (auto e.g. sec1 when omitted). model: model name/tag (None = current model).

Returns: {"tag", "label", "type", "report"}.

Inputs: tag, model, report, heading, +1 more.

report_createA

Create a report feature and configure its output template/format.

COMSOL 6.4 facts discovered live: the template property accepts only "default" or "custom" (the old brief/intermediate/ complete names are NOT valid), and a Report supports only format = html or docx (PDF is not available through the clientapi). Add content with report_add_section / report_add_content, then write the file with report_generate.

Args: tag: report tag (default "rpt1"). report_type: Report (default) | Presentation | Template. template: "default" (default) or "custom" (with an imported template file). Ignored for Presentation/Template nodes. format: html (default) | docx for Report; Presentation uses pptx. Can be overridden in report_generate. title: optional title; creates a TitlePage content node carrying it. model: model name/tag (None = current model).

Returns: {"tag", "label", "type", "format", "template", "title_node"}.

Inputs: tag, model, title, format, +2 more.

report_generateA

Write the report to an HTML or DOCX file and verify it on disk.

A report with no content sections produces NO file (COMSOL returns without writing); add at least one Section with report_add_section / report_add_content first. HTML reports also create a sibling <stem>_files/ directory with the embedded PNGs.

Args: report: report tag (see report_list). path: output file path; extension chooses the format unless format is given. Defaults to <artifact_root>/<model>/<timestamp>_reports/<tag>.html. format: html | docx (Report nodes; Presentation uses pptx). model: model name/tag (None = current model).

Returns: {"path","size","format","exists","assets_dir","assets"}.

Inputs: path, model, format, report.

report_listB

List report features (Report/Presentation/Template) in the model.

Args: model: model name/tag (None = current model).

Inputs: model.

result_available_expressionsA

Check which candidate expressions are valid, with their physical units.

Each candidate is evaluated with the API-only Interp feature at a point (default: geometry centre), so field expressions are tested in their native spatial scope. Returns ok/error, unit and value per candidate -useful before wiring expressions into plots/exports.

Args: candidates: candidate expressions, e.g. ["T", "ht.ntflux", "u", "1+"]. dataset: dataset tag (None = first solution dataset). coords: point [[x, y, z]] used for the probe (default = geometry centre). model: model name/tag (None = current model).

Inputs: candidates (required), model, coords, dataset.

result_averageA

Average expressions over domains, boundaries or edges.

Dimension-aware COMSOL types (verified): 3D -> AvVolume / AvSurface / AvLine; 2D -> AvSurface (domains) / AvLine (boundaries).

Args: expressions: expressions to average, e.g. ["T"]. kind: "volume"/"domain", "surface"/"boundary" or "line"/"edge" (2D: boundaries). dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (default = all). named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

Inputs: expressions (required), kind, model, table, +4 more.

result_createA

Create a raw derived-value feature (advanced; low-level escape hatch).

Prefer result_evaluate / result_integrate / result_average / result_minmax for normal use. type is one of catalog_numerical_types (e.g. "IntVolume", "EvalGlobal", "MassProperties", "Eval", "Interp", "Global").

Args: type: numerical feature type. tag: feature tag (None = auto "evN"). dataset: dataset tag to evaluate on (None = COMSOL default). expressions: COMSOL result expressions, e.g. ["T", "ht.ntflux"]. entities: entity selection (list of ints), or "all". named_selection: name of a model selection to use instead of entities. solnum: 1-based solution number(s) to evaluate (None = all). table: table tag to store the result in (result_table_create). properties: raw COMSOL properties to set (dataset_info/tree_properties). run: run the feature immediately (default False). model: model name/tag (None = current model).

Inputs: type (required), run, tag, model, +7 more.

result_eval_all_solutionsA

Evaluate an expression for every solution/time in a dataset.

The evaluation matrix columns are the solutions of the dataset (e.g. a transient dataset with N stored times) and the response adds a compact solutions list mapping solnum -> time/parameter value. Defaults to a domain average (3D: AvVolume, 2D: AvSurface), which works for field variables; pass eval_type="global" for global-scope expressions.

Args: expressions: expressions, e.g. ["T"]. eval_type: alias like "average", "integral", "global", "max", "min" or an exact numerical type. kind: dimension for the alias: "volume"/"domain", "surface"/"boundary" or "line" (2D: boundaries). dataset: dataset containing all solutions (e.g. "dset2" after a transient solve). None = default dataset. entities: entity numbers of that dimension (default = all). named_selection: named selection instead of entities. model: model name/tag (None = current model).

Inputs: expressions (required), kind, model, dataset, +3 more.

result_eval_globalA

Evaluate GLOBAL-scope expressions (parameters, global variables).

EvalGlobal works in the model's global scope: parameters, global variables/expressions, global ODE variables. Field variables (e.g. "T" of a 3D heat model) are NOT defined in global scope -use result_eval_point / result_integrate / result_average / result_minmax for fields. Example: expressions=["T0", "2*T0"] after setting parameter T0=400[K] returns [400.0, 800.0] with units [K, K].

Args: expressions: global expressions, e.g. ["T0", "2*T0"]. dataset: dataset tag (None = default solution dataset). solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

Inputs: expressions (required), model, table, solnum, +1 more.

result_eval_lineA

Evaluate on a line: pointwise along a CutLine dataset or line integrals.

  • dataset given (e.g. a CutLine3D dataset): Interp at all line points, returns coordinates + values + min/max/mean.

  • entities/named_selection given: line entities (dimension 1) evaluated with the kind operation: "integral" (IntLine), "average" (AvLine), "max"/"min", "stddev", "measure".

Args: expressions: expressions, e.g. ["T"]. dataset: CutLine3D dataset tag for pointwise sampling along the line. entities: line entity numbers (None = all line entities with kind op). named_selection: named line selection. kind: "integral" (default for entities is average), "average", "max", "min", "stddev", "measure". solnum: 1-based solution number(s) (None = all). max_points: cap on returned points for dataset sampling. model: model name/tag (None = current model).

Inputs: expressions (required), kind, model, solnum, +4 more.

result_eval_pointA

Evaluate expressions at arbitrary coordinates (or at geometry points).

Coordinate evaluation uses the API-only Interp feature (verified working on Solution and CutLine/CutPlane datasets). Geometry-point evaluation uses EvalPoint with point entity numbers.

Args: expressions: expressions to evaluate, e.g. ["T"]. coords: [[x, y, z], ...] coordinates (3 components for 3D, 2 for 2D). Evaluated with Interp; results include the coordinates. dataset: dataset tag; for coords usually the solution dataset (e.g. "dset1", or "dset2" for a transient solution at all times). entities: geometry point numbers for EvalPoint (e.g. [1, 2]); use instead of coords. Point entities have dimension 0. named_selection: named point selection for EvalPoint. solnum: 1-based solution number(s) (None = all solutions). model: model name/tag (None = current model).

Inputs: expressions (required), model, coords, solnum, +3 more.

result_eval_surfaceA

Evaluate a field on a surface/cut-plane dataset (pointwise values on it).

Uses the API-only Interp feature with the given dataset (create it with dataset_create, e.g. type="CutPlane"). Returns coordinates and values at the dataset points plus min/max/mean per expression.

Args: expressions: expressions to evaluate, e.g. ["T"]. dataset: CutPlane/Surface dataset tag (e.g. "cpl1"). solnum: 1-based solution number(s) (None = all). max_points: cap on returned points (default 200). model: model name/tag (None = current model).

Inputs: dataset (required), expressions (required), model, solnum, +1 more.

result_evaluateA

Generic result evaluation with an explicit evaluation type.

One tool for all COMSOL 6.4 evaluation types. eval_type accepts friendly aliases (below) or an exact type string from catalog_numerical_types.

Aliases: global, point/interp (arbitrary coordinates), eval_point (geometry points), field/domain (whole solution field), int_volume, int_surface, int_line, av_volume, av_surface, av_line, max_volume, max_surface, max_line, min_volume, min_surface, min_line, stddev_*, measure_volume, measure_surface, measure_line, measure_distance, mass/mass_properties, api_global.

Units are reported per expression; complex results include imaginary rows. Results are capped at max_output_items.

Args: eval_type: alias or exact numerical type (e.g. "av_volume", "EvalGlobal"). expressions: COMSOL result expressions, e.g. ["T"] or ["ht.ntflux"]. Required except for the Measure* types. dataset: dataset tag (None = feature default, usually the first solution dataset). For "field" use a solution dataset; for "point" use a solution dataset and pass coords. entities: entity numbers of the feature dimension (3=domains, 2=boundaries, 1=edges, 0=points in 3D), or "all" (default for volume/surface/line integrals/averages/min/max/measures). named_selection: named selection tag instead of entities. coords: for "point"/"interp": [[x, y, z], ...] evaluation coordinates. solnum: 1-based solution number(s), e.g. [2] or [1,2,3] (None = all). table: table tag to store the result in (adds "table" payload). properties: extra raw COMSOL properties. model: model name/tag (None = current model).

Inputs: eval_type (required), model, table, coords, +6 more.

result_eval_volumeA

Evaluate a field on all mesh nodes of a solution dataset (pointwise).

API-only Eval feature: returns the expression sampled at every mesh node of the dataset (not an integral). Output includes per-expression min/max/mean and a capped value list. For volume integrals/averages use result_integrate(result_kind="volume") / result_average.

Args: expressions: expressions to evaluate, e.g. ["T"]. dataset: dataset tag that maps directly to a solution ("dset1"). max_points: cap on returned points (default 200). solnum: 1-based solution number(s) (None = all). model: model name/tag (None = current model).

Inputs: expressions (required), model, solnum, dataset, +1 more.

result_export_dataA

Export expression data to a CSV/TXT file (COMSOL Data export).

Writes mesh-node/dataset-point values with a COMSOL comment header that contains the units (e.g. % X,Y,Z,T (K)). Files are written into the artifact workspace unless filename is absolute. The response includes the path, column names with units, row count and a preview.

Args: expressions: expressions to export, e.g. ["T"]. dataset: dataset tag (None = default solution dataset). CutPlane / CutPoint datasets work and export their points. filename: output path; relative paths go to the artifact workspace. Extension .csv or .txt (default .csv). coords: optional explicit coordinates -> creates a temporary CutPoint3D dataset and exports the values at those points. solnum: 1-based solution number(s) (None = all); for multi-solution datasets every selected solution becomes a block in the file. model: model name/tag (None = current model).

Inputs: expressions (required), model, coords, solnum, +2 more.

result_integrateA

Integrate expressions over domains, boundaries or edges.

Dimension-aware COMSOL types (verified): 3D -> IntVolume (domains) / IntSurface (boundaries) / IntLine (edges); 2D -> IntSurface (domains) / IntLine (boundaries). Physical unit includes the integration measure, e.g. "m^3K" for T over a 3D volume or "m^2K" over a 2D domain.

Args: expressions: expressions to integrate, e.g. ["T"]. kind: "volume"/"domain" (domains), "surface"/"boundary" (boundaries) or "line"/"edge" (edges; 2D: boundaries). dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (3=domains, 2=boundaries, 1=edges in 3D; 2D: 2=domains, 1=boundaries); default = all entities of that dimension. named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

Inputs: expressions (required), kind, model, table, +4 more.

result_mass_propertiesA

Volume, mass (and center-of-mass unit) of selected domains.

Uses the COMSOL MassProperties feature (verified working with the default three-expression set ["1", "comp1.spatial.rho", "1/1[m^2]"]). Returned rows are [volume, mass]; units ["m^3", "kg"]. The third unit ("m") belongs to the (optional) center-of-mass expression.

Args: dataset: dataset tag (None = default solution dataset). entities: domain numbers (default = all domains). named_selection: named domain selection instead of entities. expressions: optional explicit 3 expressions (volume, mass, arm); default is COMSOL's density-based set. Must have length 3. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

Inputs: model, table, solnum, dataset, +3 more.

result_measureA

Measure volume / area / line length / distance between two points.

Dimension-aware COMSOL types (verified): 3D -> MeasureVolume (domains) / MeasureSurface (boundaries) / MeasureLine (edges); 2D -> MeasureSurface (domain area) / MeasureLine (boundary length). "distance" always uses MeasureDistance with exactly two point entities.

Args: kind: "volume"/"domain", "surface"/"boundary", "line"/"edge" or "distance" ("distance" needs exactly two point entities). dataset: dataset tag (None = default solution dataset). entities: entity numbers; for "distance" exactly two point entities. named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

Inputs: kind, model, table, solnum, +3 more.

result_minmaxA

Maximum and/or minimum of expressions over domains/boundaries/edges.

Dimension-aware COMSOL types (verified): 3D -> MaxVolume/MaxSurface/ MaxLine (Min* alike); 2D -> MaxSurface (domains) / MaxLine (boundaries).

Args: expressions: expressions, e.g. ["T"]. kind: "volume"/"domain", "surface"/"boundary" or "line"/"edge" (2D: boundaries). mode: "both" (default), "max" or "min". dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (default = all). named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). model: model name/tag (None = current model).

Inputs: expressions (required), kind, mode, model, +4 more.

result_numerical_listB

List derived-value ("Numerical") evaluation features in the model.

Args: model: model name/tag (None = current model).

Inputs: model.

result_removeC

Remove an evaluation/table/export/dataset node by tag.

Args: tag: node tag (e.g. "ev1", "tbl1", "data1", "cpl1"). kind: "numerical" (derived values), "table", "export" or "dataset". model: model name/tag (None = current model).

Inputs: tag (required), kind, model.

result_solution_valuesB

Return solution/time/parameter values behind result datasets.

For each dataset the referenced solution is resolved and its stored parameter values are returned: time values for transient studies (pvals, e.g. [0, 0.5, 1, 2]) or parameter tuples for parametric sweeps, plus solution level names/descriptions.

Args: dataset: dataset tag to inspect (None = all datasets). model: model name/tag (None = current model).

Inputs: model, dataset.

result_stddevA

Standard deviation of expressions over domains/boundaries/edges.

Dimension-aware COMSOL types (verified): 3D -> StdDevVolume / StdDevSurface / StdDevLine; 2D -> StdDevSurface (domains) / StdDevLine (boundaries).

Args: expressions: expressions, e.g. ["T"]. kind: "volume"/"domain", "surface"/"boundary" or "line"/"edge" (2D: boundaries). dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (default = all). named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). model: model name/tag (None = current model).

Inputs: expressions (required), kind, model, solnum, +3 more.

result_table_createA

Create a result table, optionally with column headers and numeric rows.

Tables are normally filled by evaluation features: pass the table tag to result_integrate/result_average/result_minmax (table="tbl1"). This tool also allows creating a table with explicit data.

Args: tag: table tag (None = auto "tblN"). headers: column headers, e.g. ["t", "T_avg"] (units may be appended in parentheses like "T (K)"). rows: numeric rows, e.g. [[0, 293.15], [1, 310.2]]. model: model name/tag (None = current model).

Inputs: tag, rows, model, headers.

result_table_readA

Read a result table: column headers, real (and imaginary) rows.

Args: tag: table tag (None = use the most recently created table). max_rows: cap on returned rows (default 100). model: model name/tag (None = current model).

Inputs: tag, model, max_rows.

selection_createC

Create a named selection on a component (usable by any physics feature).

Args: name: selection tag. entity_dim: 3 = domains, 2 = boundaries/faces, 1 = edges, 0 = points. geometry: geometry sequence tag to attach to. kind: Explicit | Box | Ball | Cylinder | Disk | Adjacent | Union | Intersection | Difference | Complement | LogicalExpression. entities: explicit entity numbers (for Explicit selections). properties: extra properties, e.g. {"xmin": "-1", "xmax": "1", "zmin": "0"} for Box selections, or {"condition": "inside"}.

Inputs: name (required), entity_dim (required), kind, model, +3 more.

selection_getC

Show the entities contained in a named selection.

Inputs: name (required), model.

selection_listC

List named selections of every component.

Inputs: model.

selection_removeC

Remove a named selection.

Inputs: name (required), model.

server_infoA

Return server version, settings paths and workspace layout.

Inputs: no named parameters.

session_connectB

Connect to an already running COMSOL server (comsolmphserver).

Args: port: TCP port the COMSOL server listens on (default COMSOL port is 2036). host: hostname or IP of the server (default localhost).

Inputs: port (required), host.

session_killA

Force-kill the managed COMSOL server process (escape hatch).

Use when a solve hangs and job_cancel cannot stop it. Afterwards call session_start to bring COMSOL back (models must be reloaded/saved first).

Inputs: no named parameters.

session_restartA

Restart the COMSOL server process and reconnect (recovery / clean state).

All models are unloaded by COMSOL; save them with model_save first and reload afterwards with model_load.

Inputs: cores, version.

session_startA

Start COMSOL and connect (client-server mode by default).

Args: cores: number of solver cores (None/0 = all available cores). version: COMSOL version string such as "6.4" (None = newest installed). port: server port (0/None = pick a free port automatically). standalone: true = run COMSOL in-process (faster, less isolated). Returns session status including version, licensed modules and loaded models.

Inputs: port, cores, version, standalone.

session_statusA

Return COMSOL session state, version, licensed modules and loaded models.

Inputs: no named parameters.

session_stopB

Disconnect the client and shut down the managed COMSOL server.

Inputs: no named parameters.

solution_infoA

Detailed information about one stored solution.

Includes: solution type (Stationary/Time/Parametric/Eigenfrequency/...), solver-sequence tag/type, attached study, storage size, DoF count, dependent fields and their DoFs, solution loop levels (t, k, lambda), solution numbers, parameter values, result datasets that use it, and solver warning/error messages.

Args: solution: solution tag (e.g. "sol1"; None = the only solution). model: model name/tag (None = current model).

Inputs: model, solution.

solution_listA

List stored solutions with type, DoFs, solution counts, datasets, messages.

Args: model: model name/tag (None = current model).

Inputs: model.

solution_removeC

Remove a stored solution (solver sequence) from the model.

Args: solution: solution tag (e.g. "sol1"). model: model name/tag (None = current model).

Inputs: solution (required), model.

solution_selectB

Point a result dataset at a stored solution (dataset "solution" property).

Args: solution: solution tag (e.g. "sol1"). dataset: result dataset tag (e.g. "dset1"; None = the only dataset). model: model name/tag (None = current model).

Inputs: solution (required), model, dataset.

solver_configureA

Generic solver-configuration access: list features, add one, set properties.

One tool for all low-level solver edits:

  • with just sequence -> feature tree of the sequence;

  • with add_feature_type -> create a feature (optionally under parent);

  • with feature + properties -> edit an existing feature.

Args: sequence: solver sequence tag (None = the only one). feature: existing feature path to edit, e.g. "s1/d2". properties: properties to set on feature (or on the new feature). add_feature_type: feature type to create, e.g. "Direct", "FullyCoupled". add_tag: tag for the new feature (None = automatic). parent: parent feature path for the new feature (None = sequence root). model: model name/tag (None = current model).

Inputs: model, parent, add_tag, feature, +3 more.

solver_feature_addA

Add a solver-configuration feature to a solver sequence.

Args: sequence: solver sequence tag (None = the only one). feature_type: COMSOL solver feature type: "FullyCoupled", "Segregated", "Direct", "Iterative", "Multigrid", "SOR", "Jacobi", "IncompleteLU", "Stationary", "Time", "Eigenvalue", "StudyStep", "Variables", ... (catalog_types("solver")). tag: feature tag (None = automatic from the type, e.g. "fc1"). parent: parent feature path (None = the sequence root). Linear solvers/coupling features usually belong inside a solver feature, e.g. parent="s1". properties: feature properties to set, e.g. {"linsolver": "pardiso"} for a Direct feature. model: model name/tag (None = current model).

Inputs: feature_type (required), tag, model, parent, +2 more.

solver_feature_listA

List the solver-configuration feature tree of a solver sequence.

Args: sequence: solver sequence tag (None = the only one). parent: optional feature path to start from, e.g. "s1". depth: recursion depth for nested features (default 2). model: model name/tag (None = current model).

Inputs: depth, model, parent, sequence.

solver_feature_propertiesA

Show type, messages and properties of a solver-configuration feature.

Args: sequence: solver sequence tag (None = the only one). feature: feature path inside the sequence, e.g. "s1", "s1/fc1", "v1". include_properties: include the full property dict (default true). model: model name/tag (None = current model).

Inputs: feature (required), model, sequence, include_properties.

solver_feature_removeA

Remove a solver-configuration feature (COMSOL 6.4 limitation).

Args: sequence: solver sequence tag (None = the only one). feature: feature path inside the sequence, e.g. "s1/d2". model: model name/tag (None = current model).

Note: COMSOL 6.4's client API refuses to delete solver-configuration features ("cannot remove feature"); this tool reports that as a documented limitation. To restructure a solver sequence, remove and recreate it (solver_sequence_remove + solver_sequence_create).

Inputs: feature (required), model, sequence.

solver_feature_setB

Set properties of a solver-configuration feature.

Args: sequence: solver sequence tag (None = the only one). feature: feature path inside the sequence, e.g. "s1" or "s1/fc1". properties: property name -> value, e.g. {"linsolver": "pardiso"}, {"maxiter": 200}, {"stol": 1e-4}. model: model name/tag (None = current model).

Inputs: feature (required), properties (required), model, sequence.

solver_runB

Run a solver sequence (runAll / runFrom / runFromTo).

Args: sequence: solver sequence tag (None = the only one). mode: "all" (default, SolverSequence.runAll), "from" (runFrom), or "from_to" (runFromTo). from_feature: feature tag to start from (mode="from"/"from_to"), e.g. "st1" or "s1". to_feature: feature tag to stop at (mode="from_to"). generate_plots: ask runAll to create plots (where supported). model: model name/tag (None = current model).

Inputs: mode, model, sequence, to_feature, +2 more.

solver_sequence_createA

Create a solver sequence for a study (automatic or explicit/manual).

Args: study: study tag (None = the only study in the model). mode: "auto" (Study.createAutoSequences; COMSOL default settings) or "manual" (explicit StudyStep + Variables + solver feature sequence). sequence_tag: tag for a manual sequence (None = automatic "sol1", ...). sequence_type: for mode="auto": "all" (default), "sol" or "jobs". solver_feature_types: for mode="manual": extra feature types to add inside each solver feature, e.g. ["Direct", "FullyCoupled"]. attach: attach the manual sequence to the study (default true). model: model name/tag (None = current model).

Inputs: mode, model, study, attach, +3 more.

solver_sequence_listB

List the solver sequences ("Solver Configurations") of the model.

Args: model: model name/tag (None = current model).

Inputs: model.

solver_sequence_removeB

Remove a solver sequence (solution object) from the model.

Args: sequence: solver sequence tag (e.g. "sol1"). model: model name/tag (None = current model).

Inputs: sequence (required), model.

study_add_stepA

Add a study step to an existing study (any COMSOL 6.4 study-step type).

Args: study: study tag. step_type: COMSOL study-step type, e.g. "Stationary", "Transient", "Eigenfrequency", "Frequency", "ModeAnalysis", "Parametric", "MaterialSweep", "BatchSweep", "Sensitivity", "Optimization". tag: step tag (None = automatic, e.g. "stat", "time", "eig"). label: optional display label. properties: step properties to set, e.g. {"tlist": "range(0,0.1,1)"} for Transient, {"neigs": 6} for Eigenfrequency, {"plist": ["10", "20", "30"]} for Frequency. model: model name/tag (None = current model).

Inputs: study (required), step_type (required), tag, label, +2 more.

study_add_sweepA

Add a sweep study step (parametric / material / batch / sensitivity / ...).

The sweep step is inserted before the solving step; if study does not exist it is created. When the study has no other steps, a Stationary solver step is appended automatically.

Args: pname: parameter name(s) to sweep, e.g. "k" or ["k", "Q0"]. plist: parameter values: list like ["1", "2", "3"], a comma string "1,2,3", a range(...) expression, or a flat list for multi-parameter sweeps. Values may carry units ("1[W/(mK)]"). punit: optional unit(s) for the sweep values, e.g. "W/(mK)". sweep_type: "Parametric" (default), "MaterialSweep", "BatchSweep", "ClusterSweep", "Sensitivity", "Optimization", ... study: study tag (None = auto-create one, e.g. "std_param1"). step_tag: tag for the sweep step (None = automatic). properties: extra study-step properties to set on the sweep step. add_solver_step: append a solver step when the study has no other step. solver_step_type: type of that solver step (default "Stationary"). solver_step_properties: properties for the appended solver step. model: model name/tag (None = current model).

Example: study_add_sweep(pname="k", plist=["1", "5", "10"], punit="W/(m*K)", study="std_parametric")

Inputs: plist (required), pname (required), model, punit, +7 more.

study_createA

Create an empty study, optionally with study steps.

Args: study: tag for the new study (None = automatic, e.g. "std1"). steps: list of step specs, each {"tag": "stat", "type": "Stationary", "properties": {...}}. type must be a COMSOL study-step type (call catalog_study_features for the full list of 81 types). label: optional display label (e.g. "Stationary heat transfer"). model: model name/tag (None = current model).

Example: steps=[{"tag": "time", "type": "Transient", "properties": {"tlist": "range(0,0.1,1)"}}, {"tag": "stat", "type": "Stationary"}]

Inputs: label, model, steps, study.

study_duplicateA

Duplicate a study node (best effort - unsupported by COMSOL 6.4 API).

Args: study: tag of the study to duplicate. new_tag: tag for the copy (None = automatic "_copy"). model: model name/tag (None = current model).

Note: the COMSOL 6.4 client API rejects Study.duplicate()/copy() with "unsupported operation"; this tool then returns an actionable error and suggests model_clone. It is kept for future COMSOL versions.

Inputs: study (required), model, new_tag.

study_eigenfrequencyB

Create an Eigenfrequency study (n eigenvalues) and (by default) solve it.

Args: neigs: number of eigenvalues/modes to compute (default 6). shift: eigenvalue shift expression, e.g. "0" or "10[Hz]" (None = COMSOL default). eigmethod: eigenvalue solver method, e.g. "manual" or "iterative". study: study tag (None = automatic "std_eig1"). properties: extra Eigenfrequency step properties. solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

Inputs: label, model, neigs, shift, +5 more.

study_enable_physicsA

Enable/disable physics interfaces for a study step ("Solve for" list).

Args: study: study tag. step: study-step tag (None = the first step). physics: physics tags or paths, e.g. ["ht"] or ["/physics/ht"] (None = every physics interface in the model). enabled: true = solve for the physics, false = deactivate it. model: model name/tag (None = current model).

Inputs: study (required), step, model, enabled, +1 more.

study_frequencyA

Create a Frequency-domain (harmonic) study and (by default) solve it.

Args: frequencies: frequency list: a "range(10,10,100)" expression (10 Hz to 100 Hz in 10 Hz steps), a list ["10", "20", "50"], or a comma string "10,20,50". punit: frequency unit, e.g. "Hz" (default COMSOL unit). study: study tag (None = automatic "std_freq1"). properties: extra Frequency step properties. solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

Inputs: label, model, punit, solve, +4 more.

study_listA

List every study in a model with its steps, options, solutions and timings.

Args: model: model name/tag (None = current model).

Inputs: model.

study_logA

Computation timing / solver messages / solution statistics for a study.

COMSOL 6.4's client API does not expose the textual solver log; this returns the machine-readable substitute: last computation time/date/ version, expected computation time, per-solver-sequence warning/error/ information messages, stored solution numbers/levels, and model problems.

Args: study: study tag (None = the only study in the model). model: model name/tag (None = current model).

Inputs: model, study.

study_parametricA

Create a parameter sweep study (Parametric step + solver) and solve it.

Args: pname: parameter name(s) to sweep, e.g. "k" or ["k", "Q0"]. plist: parameter values, e.g. ["1", "5", "10"], "1,5,10" or "range(1,1,10)". Values may include units ("1[W/(mK)]"). punit: optional unit(s) for the values, e.g. "W/(mK)". sweep_type: "Parametric" (default), "MaterialSweep", "BatchSweep", ... study: study tag (None = automatic "std_param1"). solver_step_type: physical solver step appended after the sweep (default "Stationary"; use "Transient" for transient sweeps). solver_step_properties: properties for that solver step. solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

Inputs: plist (required), pname (required), label, model, +7 more.

study_propertiesB

Detailed description of one study: steps, options, solutions, timings.

Args: study: study tag (None = the only study in the model). model: model name/tag (None = current model).

Inputs: model, study.

study_removeB

Remove a study from the model tree (its solver sequences are kept).

Args: study: study tag. model: model name/tag (None = current model).

Inputs: study (required), model.

study_set_optionsB

Configure study-level output options (default plots, convergence, storage).

Args: study: study tag (None = the only study in the model). gen_plots: generate default plots after solving. gen_conv: store convergence plots. store_solution: store the solution in the study node. store_complete_history: record the complete solver history. gen_intermediate_plots: generate intermediate plots during solving. plot_undefined_values: plot undefined values. model: model name/tag (None = current model).

Inputs: model, study, gen_conv, gen_plots, +4 more.

study_set_propertyA

Set properties on a study step (time list, frequencies, eigenvalues, ...).

Args: study: study tag. step: study-step tag (see study_steps). properties: property name -> value, e.g. {"tlist": "range(0,0.05,0.5)"} (Transient time list; string expressions are accepted and expanded by COMSOL), {"plist": ["10", "20", "30"], "punit": ["Hz"]} (frequency), {"neigs": 6, "shift": "10[Hz]"} (eigenfrequency), {"pname": ["k"], "plist": ["1", "5", "10"]} (parametric sweep). model: model name/tag (None = current model).

Property values: strings for expressions, numbers for numeric fields, lists of strings for string arrays. Read current values with study_steps or tree_properties.

Inputs: step (required), study (required), properties (required), model.

study_solveA

Solve a study synchronously and report timings, solutions and messages.

Long solves block the COMSOL worker; use study_solve_async for simulations longer than ~30 s. Every call reports the wall-clock elapsed_s, the attached solver sequence tags, new datasets/plots, COMSOL's own last_computation_time and solver warnings/errors.

Args: study: study tag (None = the only study in the model). generate_plots: switch on the "Plot" option of every study step so that default plot groups are created (otherwise the client API creates none). run_no_gen: use study.runNoGen() (reuse existing solver sequences instead of regenerating them). model: model name/tag (None = current model).

Returns: study, model, elapsed_s, solution_tags, new_datasets, new_plots, solution_stats (type/size/DoFs/solution counts), last_computation_time/ date/version, warnings and errors.

Inputs: model, study, run_no_gen, generate_plots.

study_solve_asyncA

Start a background solve job and return immediately with a job_id.

Poll progress with job_status / study_solve_wait / job_wait. The job solves one study or a list of studies sequentially; the saved model (.mph) and a JSON solve log are attached as job artifacts.

Cancellation is cooperative (job_cancel): it is honored between studies/steps; a single monolithic COMSOL solve cannot be interrupted (use session_kill as the hard-stop escape hatch).

Args: study: one study tag to solve (None = all studies of the model). studies: list of study tags to solve sequentially (alternative to study; use it to get cancellation between parameter points). generate_plots: generate default plot groups after each solve. save_model: save the model to <artifacts>/.../<model>.mph and attach it to the job (default true). model: model name/tag (None = current model).

Example: job = study_solve_async(study="std_time") # then: study_solve_wait(job["job_id"], timeout_s=180)

Inputs: model, study, studies, save_model, +1 more.

study_solve_waitA

Wait for a background solve job (see study_solve_async) and return it.

Args: job_id: job id returned by study_solve_async. timeout_s: maximum seconds to wait (default 120; use several polls for longer solves).

Returns the job status/progress plus the solve result and artifacts when finished. Does not consume the COMSOL worker thread.

Inputs: job_id (required), timeout_s.

study_stationaryB

Create a Stationary study and (by default) solve it immediately.

Args: study: study tag (None = automatic "std_stat1"). properties: Stationary step properties (e.g. {"stol": 1e-4, "plot": "on"}). solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

Inputs: label, model, solve, study, +2 more.

study_stepsA

List the steps of a study with their type, active state and key properties.

Args: study: study tag (None = the only study in the model). include_properties: include the curated key properties (tlist, pname, plist, neigs, shift, plot, stol, ...). property_names: explicit list of property names to include instead. include_all_properties: return all step properties (large, ~200 each). model: model name/tag (None = current model).

Inputs: model, study, property_names, include_properties, +1 more.

study_transientA

Create a time-dependent study with a time list and (by default) solve it.

Args: times: COMSOL time list expression, e.g. "range(0,0.1,1)" (0 s to 1 s in 0.1 s steps) or "range(0,0.05,0.5)". A list of values such as [0, 0.1, 0.2] is also accepted. study: study tag (None = automatic "std_time1"). properties: extra Transient step properties (e.g. {"tunit": "s"}). solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

Inputs: label, model, solve, study, +3 more.

table_listA

List result tables (tag, label, rows, columns).

Args: model: model name/tag (None = current model).

Inputs: model.

tree_childrenA

List the child nodes of a model-tree node (groups, features, properties).

Args: path: node path such as "physics/ht" or "geometries/geom1/blk1". Empty string lists the model root groups. model: model name/tag (None = current model).

Inputs: path, model.

tree_createB

Create a child feature under a container node (generic escape hatch).

Examples: path="physics/ht", feature_type="HeatFluxBoundary", extra_args=[2]; path="functions", feature_type="Analytic"; path="plots", feature_type="PlotGroup3D". Use the catalog tools to discover valid feature types.

Inputs: path (required), feature_type (required), tag, label, +2 more.

tree_dumpC

Dump a bounded JSON tree of part of the model tree.

Inputs: root, model, max_depth, include_properties.

tree_findC

Search the model tree for nodes whose label or tag matches a regex.

Args: pattern: regular expression, e.g. "temp|T0" or "^ht". root: subtree to search from ("" = whole model). max_depth: recursion depth limit.

Inputs: pattern (required), root, model, max_depth.

tree_get_propertyC

Read one property from a node.

Inputs: name (required), path (required), model.

tree_infoB

Show a node's tag, label, feature type, active state and selection.

Args: path: model-tree path (e.g. "physics/ht/temp1"). model: model name/tag (None = current model). include_properties: also return all property values (can be large). include_children: also return child nodes.

Inputs: path, model, include_children, include_properties.

tree_propertiesC

Return all settable property names and values of a node.

Inputs: path (required), model.

tree_removeC

Remove a feature node from the model tree.

Inputs: path (required), model.

tree_renameC

Rename a node (display label, not tag).

Inputs: path (required), new_label (required), model.

tree_retagC

Change a node's tag (programmatic identifier).

Inputs: path (required), new_tag (required), model.

tree_runC

Execute the node's run action (build geometry, generate mesh, run study, ...).

Inputs: path (required), model.

tree_selection_getC

Show the entities / named selection assigned to a node.

Inputs: path (required), model.

tree_selection_setB

Assign entities to a node's selection.

Args: path: feature node path (e.g. "physics/ht/temp1"). entities: list of entity numbers, a named-selection tag, or "all". Pass null/empty to clear the selection.

Inputs: path (required), model, entities.

tree_set_propertiesC

Set multiple properties on one node in a single call.

Inputs: path (required), properties (required), model.

tree_set_propertyB

Set one property on a node.

value may be a string (expressions with units, e.g. "300[K]"), a number, a boolean, or a list (e.g. ["1","1","1"] for sizes). Use tree_properties first to discover property names.

Inputs: name (required), path (required), value (required), model.

tree_toggleC

Enable/disable a feature node (None = flip).

Inputs: path (required), model, active.

variable_listC

List global variables.

Inputs: model.

variable_removeC

Remove a global variable.

Inputs: name (required), model.

variable_setC

Define a global variable expression (name = expression).

Inputs: name (required), expression (required), model, selection.

visual_view_animationA

Display sampled frames of a COMSOL animation (GIF/MP4/AVI/WebM) as a filmstrip.

Returns up to frames image content blocks (evenly sampled) plus a summary (frame count, duration, fps when available). Useful to review an animation produced by the anim_* tools without opening an external player.

Args: path: absolute path to the GIF/MP4/AVI/WebM file. frames: number of frames to sample (1-12). max_width: downscale each sampled frame to this width.

Inputs: path (required), frames, max_width.

visual_view_imageA

Display an exported COMSOL image inline (PNG/JPEG/BMP/GIF/WebP).

Use the path returned by plot_export_image / plot_quick / export tools. Returns the image itself as MCP image content plus a short text summary.

Args: path: absolute path to the image file. max_width: downscale to this pixel width to keep payloads small (0 = original).

Inputs: path (required), max_width.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 274 tools

    Disambiguation3/5

    The tools are grouped by domain, but there are many overlapping or alias-like entries such as mesh_run/mesh_build, export_mesh/mesh_export, geom_export/export_geometry, and generic evaluators alongside specialized result_eval_* tools. Descriptions often clarify the intended use, but with 274 tools an agent faces a high risk of selecting a near-duplicate or lower-level escape hatch instead of the intended tool.

    Naming Consistency5/5

    Nearly all tools use a consistent snake_case prefix_action or prefix_noun convention grouped by domain: geom_*, mesh_*, phys_*, mat_*, study_*, solver_*, plot_*, result_*, anim_*, and so on. A few generic names like java_eval, health_check, and server_info deviate slightly, but the overall naming pattern is highly predictable.

    Tool Count1/5

    A 274-tool surface is far beyond what is appropriate for reliable tool selection, even for a broad domain like COMSOL Multiphysics. The set contains many aliases, specialized shortcuts, low-level escape hatches, and duplicated export paths, making the surface feel sprawling rather than well-scoped.

    Completeness5/5

    The toolset covers the full simulation lifecycle: model/session management, parameters, geometry, selections, materials, physics, multiphysics couplings, meshing, studies, solver configuration, results evaluation, plots, animations, exports, reports, libraries, and documentation. The few limitations noted, such as unsupported study duplication or solver-feature deletion, are COMSOL API constraints rather than missing surface coverage.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to automate multiphysics simulations in COMSOL Multiphysics, covering model management, geometry building, physics configuration, and results visualization. It supports complex simulation workflows through the MCP protocol and includes integrated knowledge retrieval for documentation and troubleshooting.
      93
      1,036
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to automate COMSOL Multiphysics simulations, including model management, geometry building, physics configuration, meshing, solving, and results visualization through the MCP protocol.
      78
      MIT
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI agents to automate COMSOL Multiphysics simulations, including model management, geometry building, physics configuration, meshing, solving, and results visualization via the MCP protocol.
      MIT
    • A
      license
      C
      quality
      Not graded
      maintenance
      Enables AI agents to read and write .mph model files, control the COMSOL desktop GUI in real time, and run complete modeling, meshing, solving, and post-processing workflows.
      23
      1
      MIT