API 概要
eMachineSim の公開 API は Python module eMachineSim を中心に構成されています。基本方針は JSON-first です。
主な使い方
| 目的 | API |
|---|---|
| JSON file を 1 回実行 | eMachineSim.run_file() |
| thermal sample を実行 | eMachineSim.thermal.run_file() |
| BDF thermal sample を実行 | eMachineSim.thermal.run_bdf() |
| structural static sample を実行 | eMachineSim.structural.run_file() |
| modal / NVH sample を実行 | eMachineSim.modal.run_file() |
| 条件変更しながら連続実行 | eMachineSim.Session |
JSON-first design
解析条件は JSON input control file に記述します。Python API は、その JSON を渡して solver を実行し、結果ファイルを生成します。
import eMachineSim
result = eMachineSim.run_file("input.json", r"case_directory")
Session workflow
同じ mesh / model を使って条件を変える場合は Session を使います。
session = eMachineSim.Session()
session.initialize(input_json, run_directory)
session.update_input({"thermal_network": {}})
result = session.solve()
session.finalize()
Scope
公開 API は、ユーザーが解析を実行し、結果ファイルを確認するための API です。内部 FEM assembly step を細かく分解して公開することは、現在の主目的ではありません。