コンテンツにスキップ

後処理チュートリアル

このページは、最初の実行結果を CLI と Python で確認するための短い手順です。 出力ファイルの意味は 出力の読み方、API の詳細は Python 後処理 API リファレンス を参照してください。

Terminal window
beachx inspect outputs/latest

画像を保存する場合:

Terminal window
beachx inspect outputs/latest \
--save-bar outputs/latest/charges_bar.png \
--save-mesh outputs/latest/charges_mesh.png \
--save-potential-mesh outputs/latest/potential_mesh.png

sim.field_bc_mode="periodic2" の mesh を周期セルに寄せて描く場合:

Terminal window
beachx inspect outputs/latest \
--save-mesh outputs/latest/charges_mesh_periodic.png \
--apply-periodic2-mesh

charge_history.csv がある場合:

Terminal window
beachx animate outputs/latest \
--quantity charge \
--save-gif outputs/latest/charge_history.gif \
--total-frames 200

potential_history.csv を出している場合は --quantity potential も使えます。

from beach import Beach
b = Beach("outputs/latest")
print("absorbed:", b.result.absorbed)
print("escaped:", b.result.escaped)
print("batches:", b.result.batches)
b.plot_bar()
b.plot_mesh()
b.plot_potential()

設定ファイルが出力ディレクトリ近傍にない場合は明示します。

b = Beach("outputs/latest", config_path="beach.toml")

mesh_sources.csvmesh_id を確認してから、対象 mesh を選べます。

from beach import Beach
b = Beach("outputs/latest")
mesh1 = b.get_mesh(1)
charge1 = b.get_mesh_charge(1)
print(mesh1.centers.shape, charge1.shape)

履歴がある場合は、batch index を指定できます。

mesh1_step10 = b.get_mesh(1, step=10)
charge1_step10 = b.get_mesh_charge(1, step=10)

少し進んだ解析では次の CLI を使います。

Terminal window
beachx slices outputs/latest \
--grid-n 200 \
--save outputs/latest/potential_slices.png
beachx coulomb outputs/latest \
--component z \
--save outputs/latest/coulomb_force_z.png
beachx mobility outputs/latest \
--density-kg-m3 2500 \
--mu-static 0.4 \
--save-csv outputs/latest/mobility_summary.csv

これらは近傍の beach.toml から geometry や periodic2 設定を自動解決します。 見つからない場合は、対応する CLI の --config を指定してください。