Expose water diagnostics through public APIs

This commit is contained in:
Codex
2026-07-02 21:20:51 +08:00
parent 61b81e9d50
commit 03c05d6931
10 changed files with 280 additions and 24 deletions
+28
View File
@@ -535,6 +535,34 @@ subroutine sphft_get_particle_state(max_particles, particle_id_ext, phase, &
internal_energy, temperature, h, count, ierr)
end subroutine sphft_get_particle_state
subroutine sphft_get_water_summary(mass, momentum, max_pressure, &
min_density, max_density, ierr)
use sph_api, only: sph_get_water_summary
use sph_precision, only: rk
implicit none
real(rk), intent(out) :: mass
real(rk), intent(out) :: momentum(3)
real(rk), intent(out) :: max_pressure
real(rk), intent(out) :: min_density
real(rk), intent(out) :: max_density
integer, intent(out) :: ierr
call sph_get_water_summary(mass, momentum, max_pressure, min_density, &
max_density, ierr)
end subroutine sphft_get_water_summary
subroutine sphft_get_water_dt_limits(dt_cfl, dt_accel, dt_viscous, ierr)
use sph_api, only: sph_get_water_dt_limits
use sph_precision, only: rk
implicit none
real(rk), intent(out) :: dt_cfl
real(rk), intent(out) :: dt_accel
real(rk), intent(out) :: dt_viscous
integer, intent(out) :: ierr
call sph_get_water_dt_limits(dt_cfl, dt_accel, dt_viscous, ierr)
end subroutine sphft_get_water_dt_limits
subroutine sphft_set_output_directory_chars(chars, count, ierr)
use sph_api, only: sph_set_output_directory
implicit none
+37
View File
@@ -53,6 +53,15 @@ extern void SPHLITE_FC_sphft_write_restart_chars(
const int *chars, const int *count, int *ierr);
extern void SPHLITE_FC_sphft_read_restart_chars(
const int *chars, const int *count, int *ierr);
extern void SPHLITE_FC_sphft_get_water_summary(
double *mass,
double *momentum,
double *max_pressure,
double *min_density,
double *max_density,
int *ierr);
extern void SPHLITE_FC_sphft_get_water_dt_limits(
double *dt_cfl, double *dt_accel, double *dt_viscous, int *ierr);
static int sphlite_call_path(
const char *path,
@@ -273,3 +282,31 @@ int sphlite_read_restart(const char *filename)
return sphlite_call_path(
filename, SPHLITE_FC_sphft_read_restart_chars);
}
int sphlite_get_water_summary(double *mass,
double *momentum,
double *max_pressure,
double *min_density,
double *max_density)
{
int ierr = 0;
if (mass == NULL || momentum == NULL || max_pressure == NULL ||
min_density == NULL || max_density == NULL) {
return -1;
}
SPHLITE_FC_sphft_get_water_summary(mass, momentum, max_pressure,
min_density, max_density, &ierr);
return ierr;
}
int sphlite_get_water_dt_limits(double *dt_cfl,
double *dt_accel,
double *dt_viscous)
{
int ierr = 0;
if (dt_cfl == NULL || dt_accel == NULL || dt_viscous == NULL) {
return -1;
}
SPHLITE_FC_sphft_get_water_dt_limits(dt_cfl, dt_accel, dt_viscous, &ierr);
return ierr;
}