Add Explosive interfaces and restart

This commit is contained in:
Codex
2026-07-03 12:32:14 +08:00
parent 5853ac2644
commit 187af844d1
17 changed files with 629 additions and 32 deletions
+26
View File
@@ -31,6 +31,10 @@ def main() -> int:
raise AssertionError("Python wrapper is missing Gas C ABI diagnostics")
if not hasattr(solver.lib, "sphlite_get_gas_extended_summary"):
raise AssertionError("Python wrapper is missing Gas extended C ABI diagnostics")
if not hasattr(solver.lib, "sphlite_get_explosive_summary"):
raise AssertionError("Python wrapper is missing Explosive C ABI diagnostics")
if not hasattr(solver.lib, "sphlite_set_ignition_point"):
raise AssertionError("Python wrapper is missing Explosive ignition C ABI")
if solver.version() != (0, 4, 0):
raise AssertionError("Python version mismatch")
@@ -53,6 +57,8 @@ def main() -> int:
raise AssertionError("inspect helper did not include Gas diagnostics")
if "gas_source_mass" not in solid_summary or "gas_density_range" not in solid_summary:
raise AssertionError("inspect helper did not include Gas extended diagnostics")
if "explosive_particles" not in solid_summary or "explosive_lambda_range" not in solid_summary:
raise AssertionError("inspect helper did not include Explosive diagnostics")
solver.set_output_directory(root / "build-codex-unix")
solver.write_output(0, 0.0)
restart = root / "build-codex-unix" / "python_restart.tmp"
@@ -112,6 +118,26 @@ def main() -> int:
finally:
gas.finalize()
explosive = SPHLite(args.library)
explosive.initialize()
try:
explosive_input = root / "tests" / "data" / "explosive_conversion_phase_040.inp"
explosive.read_inp(explosive_input)
explosive.set_ignition_point(0.0, 0.0, 0.0, 0.0)
explosive.build_model()
explosive.run_explicit()
explosive_summary = explosive.explosive_summary()
if explosive_summary["explosive_particles"] <= 0:
raise AssertionError("explosive summary particle count mismatch")
if explosive_summary["explosive_reacted_particles"] <= 0:
raise AssertionError("explosive summary reacted count mismatch")
if explosive_summary["explosive_lambda_range"][1] <= 0.0:
raise AssertionError("explosive summary lambda mismatch")
if explosive_summary["explosive_released_totals"][1] <= 0.0:
raise AssertionError("explosive summary energy mismatch")
finally:
explosive.finalize()
bad_water = SPHLite(args.library)
bad_water.initialize()
try: