Skip to main content

Python API

Import

import eMachineSim

Install eMachineSim from the wheel before importing:

python -m pip install emachinesim-0.1.1-cp313-cp313-win_amd64.whl

Run an Existing JSON File

result = eMachineSim.run_file(
r"Examples\thermal\bdf\input_sample_bdf_min_hexa_qvol.json",
r"Examples\thermal\bdf",
)

Run from a Python Dictionary

import json

with open(r"Examples\thermal\bdf\input_sample_bdf_min_hexa_qvol.json") as f:
data = json.load(f)

result = eMachineSim.run(data, r"Examples\thermal\bdf")

Read Common Results

balance = eMachineSim.get_global_heat_balance(r"Examples\thermal\bdf")
summary = eMachineSim.get_bdf_import_summary(r"Examples\thermal\bdf")

Result accessors read generated CSV files from the run directory and return Python dictionaries or lists of dictionaries.

Version

print(eMachineSim.version())

Built-in Self Tests

eMachineSim.run_self_test("thermal-femh")
eMachineSim.run_self_test("thermal-network")
eMachineSim.run_self_test("solver")
eMachineSim.run_self_test("all")

Namespaces

The namespace functions call the same JSON-first engine while making scripts more readable:

eMachineSim.thermal.run(input_json, run_directory)
eMachineSim.thermal.run_file(input_json_path, run_directory)
eMachineSim.thermal.run_bdf(input_json, run_directory)

eMachineSim.structural.run_static(input_json, run_directory)
eMachineSim.structural.run_file(input_json_path, run_directory)

eMachineSim.modal.run(input_json, run_directory)
eMachineSim.modal.run_file(input_json_path, run_directory)

Result Accessors

Current result accessors parse CSV files from a completed run:

eMachineSim.get_csv_rows(csv_path)
eMachineSim.get_global_heat_balance(run_directory)
eMachineSim.get_bdf_import_summary(run_directory)
eMachineSim.get_component_heat_balance(run_directory)
eMachineSim.get_cooling_path_summary(run_directory)
eMachineSim.get_gap_coupling_summary(run_directory)

Values are returned as strings to avoid guessing units or numeric intent.