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
+40
View File
@@ -55,6 +55,11 @@ int main(void)
double gas_source_mass = 0.0;
double gas_source_momentum[3] = {0.0, 0.0, 0.0};
double gas_source_energy = 0.0;
int explosive_particle_count = 0;
int explosive_reacted_count = 0;
double explosive_lambda_range[3] = {0.0, 0.0, 0.0};
double explosive_released_totals[5] = {0.0, 0.0, 0.0, 0.0, 0.0};
double explosive_detonation_range[2] = {0.0, 0.0};
if (SPHLITE_PHASE_SOLID != 4 || SPHLITE_PHASE_GAS != 2 ||
SPHLITE_STATUS_ACTIVE != 0) {
@@ -108,6 +113,16 @@ int main(void)
&gas_source_energy) != -1) {
return fail("null gas source momentum pointer did not return -1");
}
if (sphlite_get_explosive_summary(NULL, &explosive_reacted_count,
explosive_lambda_range, explosive_released_totals,
explosive_detonation_range) != -1) {
return fail("null explosive summary particle pointer did not return -1");
}
if (sphlite_get_explosive_summary(&explosive_particle_count,
&explosive_reacted_count, NULL, explosive_released_totals,
explosive_detonation_range) != -1) {
return fail("null explosive summary lambda pointer did not return -1");
}
if (sphlite_get_gas_summary(&gas_volume, gas_center, &gas_mean_pressure,
&gas_max_pressure) != 2) {
return fail("uninitialized gas summary did not return Fortran state error");
@@ -242,5 +257,30 @@ int main(void)
}
ierr = sphlite_finalize();
if (ierr != 0) return fail("finalize gas failed");
ierr = sphlite_initialize();
if (ierr != 0) return fail("initialize explosive failed");
snprintf(path, sizeof(path), "%s/explosive_conversion_phase_040.inp",
SPHLITE_TEST_DATA_DIR);
ierr = sphlite_read_inp(path);
if (ierr != 0) return fail("read explosive input failed");
ierr = sphlite_set_ignition_point(0.0, 0.0, 0.0, 0.0);
if (ierr != 0) return fail("set explosive ignition failed");
ierr = sphlite_build_model();
if (ierr != 0) return fail("build explosive model failed");
ierr = sphlite_run_explicit();
if (ierr != 0) return fail("run explosive model failed");
ierr = sphlite_get_explosive_summary(&explosive_particle_count,
&explosive_reacted_count, explosive_lambda_range,
explosive_released_totals, explosive_detonation_range);
if (ierr != 0) return fail("explosive summary query failed");
if (explosive_particle_count <= 0 || explosive_reacted_count <= 0) {
return fail("explosive summary count mismatch");
}
if (explosive_lambda_range[1] <= 0.0 || explosive_released_totals[1] <= 0.0) {
return fail("explosive summary content mismatch");
}
ierr = sphlite_finalize();
if (ierr != 0) return fail("finalize explosive failed");
return 0;
}