XIAN-FEM-2026June/3D opticsfem-master/README.md

67 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# OpticsFEM3D
三维矢量有限元光学电磁仿真程序(一阶 Nedelec 边元)。
## 支持的问题类型
| FemType | 说明 | 网格 | 状态 |
|---------|------|------|------|
| 03 | 二维问题(本征/散射) | `Mesh_2D` | 遗留接口,与 2D 版相同 |
| **4** | **三维一阶散射SBC** | **`Mesh_3D`** | **当前主算例** |
## 快速开始FemType = 4
### 环境
- Windows 10/11 x64
- Visual Studio 202618工作负载使用 C++ 的桌面开发
- CMake ≥ 3.8(随 VS 安装)
### 编译
```powershell
cd "3D opticsfem-master"
# 若 cmake 不在 PATH 中,追加 VS 2026 自带 CMake
$env:Path += ";C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin"
mkdir build
cd build
cmake .. -G "Visual Studio 18 2026" -A x64
cmake --build . --config Release
```
产物:
- `build/Release/OpticsFEM.exe`
- `build/Release/complex/complexsolver.exe`CMake 自动编译)
### 运行 sbc3d 算例
```powershell
# 复制输入文件到 exe 同目录
Copy-Item ..\sbc3d.json, ..\SBCmesh.dat -Destination Release\
cd Release
.\OpticsFEM.exe
```
结果输出到 `Release/OutFile/``Ex`、`Ey`、`Ez`、`normE`。
### 输入文件
| 文件 | 说明 |
|------|------|
| `sbc3d.json` | 算例配置,`FemType` 必须为 **4** |
| `SBCmesh.dat` | 三维四面体网格(顶点、四面体、边、三角边界等) |
## 详细文档
- [OpticsFEM_完整使用说明与代码介绍.md](./OpticsFEM_完整使用说明与代码介绍.md) — 模块说明、JSON 字段、FemType=4 专章
- [compare/README.md](./compare/README.md) — 与 COMSOL 的 normE 切面对比
## 仓库说明
- 只需上传**源码**`build/` 由 CMake 本地生成,不必提交。
- 散射算例FemType=4`complexsolver.exe` 可由 CMake 从 `complex/complexsolver.cpp` 编译,无需单独 PETSc 版求解器。