LumericalFDTD Simulation logo

LumericalFDTD Simulation

Community
Lex669
LumericalFDTD-simulation

执行 Ansys Lumerical FDTD 仿真脚本、自动迭代 debug、提取结果数据。当你需要运行FDTD仿真、调试仿真错误、提取.npz结果时使用此skill。 Execute Ansys Lumerical FDTD simulation scripts with automated debug loops and result extraction. Use when running FDTD simulations, debugging errors, or extracting .npz results.

Overview

PublisherLex669
RepositoryLumericalFDTD-skill
Skill nameLumericalFDTD-simulation
Stars
45
Forks
5
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Lex669 on GitHub. Read the source before you install it.

Installation

Install the LumericalFDTD Simulation AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Lex669/LumericalFDTD-skill/tree/main/skills/LumericalFDTD-simulation
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Lex669/LumericalFDTD-skill.git /tmp/LumericalFDTD-skill
mkdir -p .claude/skills
cp -r /tmp/LumericalFDTD-skill/skills/LumericalFDTD-simulation .claude/skills/LumericalFDTD-simulation
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable LumericalFDTD Simulation in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads LumericalFDTD Simulation on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so LumericalFDTD Simulation is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

FDTD 仿真执行器

职责范围

本 skill 仅负责仿真执行阶段:环境探测、运行仿真、错误修复、结果提取。输出 .fsp 和 .npz 文件。

不负责:结构建模(→ LumericalFDTD-modeling)、数据分析与绘图(→ LumericalFDTD-analysis)、端到端全流程(→ LumericalFDTD)。

前置条件

仿真脚本 *_sim.py(或 *_model.py 加上 fdtd.run() 和 fdtd.save() 调用)必须已存在。若不存在,先使用建模 skill。

环境探测(本会话首次执行)

1. 探测操作系统

  • Windows: python.exe,路径含盘符,反斜杠分隔
  • Linux: python 或 python3,正斜杠分隔

2. 定位 Lumerical Python 解释器

按以下优先级尝试:

Windows 常见路径:

C:\Apps\ANSYS Inc\v252\Lumerical\python\python.exe
C:\Program Files\ANSYS Inc\v252\Lumerical\python\python.exe
C:\Program Files\Lumerical\v252\python\python.exe

Linux 常见路径:

/opt/ansys_inc/v252/Lumerical/python/python
/opt/lumerical/v252/python/python
/usr/local/lumerical/v252/python/python

若所有默认路径都不存在,向用户询问实际安装路径和版本号。

3. 调用方式

PowerShell(路径含空格时用 & 操作符):

powershell
& '{PYTHON_PATH}' 'script.py'

Bash / Git Bash(& 不支持,直接调用):

bash
'path/to/python.exe' 'script.py'

仿真执行

执行步骤

# 步骤 1:运行仿真脚本(耗时最长)
bash: & 'PYTHON_PATH' 'path/to/project_sim.py'

# 步骤 2:确认输出
bash: ls path/to/project/data/
# 预期:results.npz 等文件

# 步骤 3:检查日志
bash: cat path/to/project/fsp/*_p0.log
# 确认无致命错误

超时设置

仿真规模timeout
简单 2D300,000ms (5 分钟)
中等 3D1,200,000ms (20 分钟)
大型参数扫描6,000,000ms (100 分钟)

错误处理循环(最多 5 次重试)

重试次数 = 0
while 仿真未成功 and 重试次数 < 5:
    运行 sim.py
    if 报错:
        读取 ../LumericalFDTD/references/common-errors.md
        根据错误类型定位解决方案
        修复脚本
        重试次数 += 1
    else:
        检查 .npz 存在 → 继续
        检查 .fsp 存在 → 继续

if 重试次数 >= 5:
    向用户报告:自动修复已达上限,需人工介入
    列出所有尝试过的修复及对应错误信息

绝对禁止:创建完 .py 文件后直接告诉用户"脚本已创建,请自行运行"。必须亲自执行。

结果提取

仿真成功后提取关键数据:

python
# 在 with 块内提取
E = fdtd.getresult("monitor_name", "E")       # 电场
Ex = fdtd.getresult("monitor_name", "Ex")     # x 分量
T = fdtd.getresult("monitor_name", "T")       # 透射率

# 保存为 .npz
np.savez(os.path.join(data_dir, "results.npz"),
         E=E, Ex=Ex, T=T,
         x=x, y=y, z=z,
         wavelengths=wavelengths,
         metadata={...})

关键注意事项:

  • getresult 返回大数据时先存到本地变量,避免重复获取
  • Quasi-2D 数据形状:I = [nx, ny, 1, nfreq],沿 y 求和得 1D profile
  • 宽带波长:wavelengths[0] = 最长波,[-1] = 最短波
  • 切片结果用 .copy() 避免污染原始数据

完成定义

  • .fsp 文件已生成于 fsp/ 目录
  • .npz 数据文件已生成于 data/ 目录
  • 仿真日志无致命错误
  • (可选)生成 _sim.py 完整脚本(含 run 和数据保存)

参考文档

参考文件何时读取
../LumericalFDTD/references/common-errors.md运行报错排查时
../LumericalFDTD/references/api-reference.md需要会话管理、数据传递、远程 API 等高级功能时

Frequently asked questions

What does the LumericalFDTD Simulation AI skill do?

执行 Ansys Lumerical FDTD 仿真脚本、自动迭代 debug、提取结果数据。当你需要运行FDTD仿真、调试仿真错误、提取.npz结果时使用此skill。 Execute Ansys Lumerical FDTD simulation scripts with automated debug loops and result extraction. Use when running FDTD simulations, debugging errors, or extracting .npz results.

Why use LumericalFDTD Simulation on TypingMind?

Because you install it once and use it with any model. LumericalFDTD Simulation is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install LumericalFDTD Simulation in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Lex669/LumericalFDTD-skill/tree/main/skills/LumericalFDTD-simulation. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use LumericalFDTD Simulation?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with LumericalFDTD Simulation?

As many as you like. As long as a model supports skills, you can use LumericalFDTD Simulation with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the LumericalFDTD Simulation AI skill free?

Yes. It is published on GitHub by Lex669 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇