Finalize 0.3.0 Gas interfaces and gate
This commit is contained in:
@@ -83,6 +83,28 @@ class SPHLite:
|
||||
]
|
||||
self.lib.sphlite_get_water_dt_limits.restype = ctypes.c_int
|
||||
|
||||
self.lib.sphlite_get_gas_summary.argtypes = [
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
]
|
||||
self.lib.sphlite_get_gas_summary.restype = ctypes.c_int
|
||||
|
||||
self.lib.sphlite_get_gas_bubble_metrics.argtypes = [
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
]
|
||||
self.lib.sphlite_get_gas_bubble_metrics.restype = ctypes.c_int
|
||||
|
||||
self.lib.sphlite_get_gas_dt_limits.argtypes = [
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
ctypes.POINTER(ctypes.c_double),
|
||||
]
|
||||
self.lib.sphlite_get_gas_dt_limits.restype = ctypes.c_int
|
||||
|
||||
self.lib.sphlite_get_particle_state.argtypes = [
|
||||
ctypes.c_int,
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
@@ -260,6 +282,56 @@ class SPHLite:
|
||||
"dt_viscous": float(dt_viscous.value),
|
||||
}
|
||||
|
||||
def gas_summary(self) -> dict[str, float | list[float]]:
|
||||
volume = ctypes.c_double(0.0)
|
||||
center_type = ctypes.c_double * 3
|
||||
center = center_type()
|
||||
mean_pressure = ctypes.c_double(0.0)
|
||||
max_pressure = ctypes.c_double(0.0)
|
||||
self._check(self.lib.sphlite_get_gas_summary(
|
||||
ctypes.byref(volume),
|
||||
center,
|
||||
ctypes.byref(mean_pressure),
|
||||
ctypes.byref(max_pressure),
|
||||
))
|
||||
return {
|
||||
"gas_volume": float(volume.value),
|
||||
"gas_center": list(center),
|
||||
"gas_mean_pressure": float(mean_pressure.value),
|
||||
"gas_max_pressure": float(max_pressure.value),
|
||||
}
|
||||
|
||||
def gas_bubble_metrics(self) -> dict[str, float | list[float]]:
|
||||
equivalent_radius = ctypes.c_double(0.0)
|
||||
radius_rate = ctypes.c_double(0.0)
|
||||
center_type = ctypes.c_double * 3
|
||||
center = center_type()
|
||||
self._check(self.lib.sphlite_get_gas_bubble_metrics(
|
||||
ctypes.byref(equivalent_radius),
|
||||
ctypes.byref(radius_rate),
|
||||
center,
|
||||
))
|
||||
return {
|
||||
"gas_equivalent_radius": float(equivalent_radius.value),
|
||||
"gas_radius_rate": float(radius_rate.value),
|
||||
"gas_bubble_center": list(center),
|
||||
}
|
||||
|
||||
def gas_dt_limits(self) -> dict[str, float]:
|
||||
dt_cfl = ctypes.c_double(0.0)
|
||||
dt_accel = ctypes.c_double(0.0)
|
||||
dtcrit = ctypes.c_double(0.0)
|
||||
self._check(self.lib.sphlite_get_gas_dt_limits(
|
||||
ctypes.byref(dt_cfl),
|
||||
ctypes.byref(dt_accel),
|
||||
ctypes.byref(dtcrit),
|
||||
))
|
||||
return {
|
||||
"gas_dt_cfl": float(dt_cfl.value),
|
||||
"gas_dt_accel": float(dt_accel.value),
|
||||
"gas_dtcrit": float(dtcrit.value),
|
||||
}
|
||||
|
||||
def inspect(self, filename: str | Path) -> dict[str, int | float | list[float]]:
|
||||
self.read_inp(filename)
|
||||
self.build_model()
|
||||
@@ -269,6 +341,9 @@ class SPHLite:
|
||||
}
|
||||
summary.update(self.water_summary())
|
||||
summary.update(self.water_dt_limits())
|
||||
summary.update(self.gas_summary())
|
||||
summary.update(self.gas_bubble_metrics())
|
||||
summary.update(self.gas_dt_limits())
|
||||
return summary
|
||||
|
||||
def run(self, filename: str | Path) -> dict[str, int | float | list[float]]:
|
||||
@@ -277,4 +352,7 @@ class SPHLite:
|
||||
summary["particles"] = self.particle_count()
|
||||
summary.update(self.water_summary())
|
||||
summary.update(self.water_dt_limits())
|
||||
summary.update(self.gas_summary())
|
||||
summary.update(self.gas_bubble_metrics())
|
||||
summary.update(self.gas_dt_limits())
|
||||
return summary
|
||||
|
||||
Reference in New Issue
Block a user