Add Gas restart and C ABI diagnostics
This commit is contained in:
@@ -41,8 +41,16 @@ int main(void)
|
||||
double dt_cfl = 0.0;
|
||||
double dt_accel = 0.0;
|
||||
double dt_viscous = 0.0;
|
||||
double gas_volume = 0.0;
|
||||
double gas_center[3] = {0.0, 0.0, 0.0};
|
||||
double gas_mean_pressure = 0.0;
|
||||
double gas_max_pressure = 0.0;
|
||||
double gas_radius = 0.0;
|
||||
double gas_radius_rate = 0.0;
|
||||
double gas_dtcrit = 0.0;
|
||||
|
||||
if (SPHLITE_PHASE_SOLID != 4 || SPHLITE_STATUS_ACTIVE != 0) {
|
||||
if (SPHLITE_PHASE_SOLID != 4 || SPHLITE_PHASE_GAS != 2 ||
|
||||
SPHLITE_STATUS_ACTIVE != 0) {
|
||||
return fail("C constants are not locked");
|
||||
}
|
||||
if (sphlite_get_particle_count(NULL) != -1) {
|
||||
@@ -68,6 +76,27 @@ int main(void)
|
||||
if (sphlite_get_water_dt_limits(&dt_cfl, &dt_accel, NULL) != -1) {
|
||||
return fail("null water dt viscous pointer did not return -1");
|
||||
}
|
||||
if (sphlite_get_gas_summary(NULL, gas_center, &gas_mean_pressure,
|
||||
&gas_max_pressure) != -1) {
|
||||
return fail("null gas summary volume pointer did not return -1");
|
||||
}
|
||||
if (sphlite_get_gas_summary(&gas_volume, NULL, &gas_mean_pressure,
|
||||
&gas_max_pressure) != -1) {
|
||||
return fail("null gas summary center pointer did not return -1");
|
||||
}
|
||||
if (sphlite_get_gas_bubble_metrics(NULL, &gas_radius_rate, gas_center) != -1) {
|
||||
return fail("null gas radius pointer did not return -1");
|
||||
}
|
||||
if (sphlite_get_gas_bubble_metrics(&gas_radius, &gas_radius_rate, NULL) != -1) {
|
||||
return fail("null gas bubble center pointer did not return -1");
|
||||
}
|
||||
if (sphlite_get_gas_dt_limits(NULL, &dt_accel, &gas_dtcrit) != -1) {
|
||||
return fail("null gas dt cfl 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");
|
||||
}
|
||||
|
||||
ierr = sphlite_initialize();
|
||||
if (ierr != 0) return fail("initialize failed");
|
||||
@@ -75,6 +104,11 @@ int main(void)
|
||||
ierr = sphlite_get_water_summary(&water_mass, water_momentum, &max_pressure,
|
||||
&min_density, &max_density);
|
||||
if (ierr != 2) return fail("unbuilt water summary did not return Fortran state error");
|
||||
ierr = sphlite_get_gas_summary(&gas_volume, gas_center, &gas_mean_pressure,
|
||||
&gas_max_pressure);
|
||||
if (ierr != 2) return fail("unbuilt gas summary did not return Fortran state error");
|
||||
ierr = sphlite_get_gas_dt_limits(&dt_cfl, &dt_accel, &gas_dtcrit);
|
||||
if (ierr != 2) return fail("unbuilt gas dt did not return Fortran state error");
|
||||
|
||||
ierr = sphlite_get_version(&major, &minor, &patch);
|
||||
if (ierr != 0) return fail("get_version failed");
|
||||
@@ -159,5 +193,27 @@ int main(void)
|
||||
|
||||
ierr = sphlite_finalize();
|
||||
if (ierr != 0) return fail("finalize water failed");
|
||||
|
||||
ierr = sphlite_initialize();
|
||||
if (ierr != 0) return fail("initialize gas failed");
|
||||
snprintf(path, sizeof(path), "%s/gas_ideal_minimal_030.inp", SPHLITE_TEST_DATA_DIR);
|
||||
ierr = sphlite_read_inp(path);
|
||||
if (ierr != 0) return fail("read gas input failed");
|
||||
ierr = sphlite_build_model();
|
||||
if (ierr != 0) return fail("build gas model failed");
|
||||
ierr = sphlite_get_gas_summary(&gas_volume, gas_center, &gas_mean_pressure,
|
||||
&gas_max_pressure);
|
||||
if (ierr != 0) return fail("gas summary query failed");
|
||||
if (gas_volume <= 0.0 || gas_max_pressure <= 0.0) {
|
||||
return fail("gas summary content mismatch");
|
||||
}
|
||||
ierr = sphlite_get_gas_bubble_metrics(&gas_radius, &gas_radius_rate, gas_center);
|
||||
if (ierr != 0) return fail("gas bubble query failed");
|
||||
if (gas_radius <= 0.0) return fail("gas bubble content mismatch");
|
||||
ierr = sphlite_get_gas_dt_limits(&dt_cfl, &dt_accel, &gas_dtcrit);
|
||||
if (ierr != 0) return fail("gas dt query failed");
|
||||
if (dt_cfl <= 0.0 || gas_dtcrit <= 0.0) return fail("gas dt content mismatch");
|
||||
ierr = sphlite_finalize();
|
||||
if (ierr != 0) return fail("finalize gas failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user