Harden CLI paths and coupling export checks

This commit is contained in:
Codex
2026-07-02 23:53:17 +08:00
parent a750dc9e39
commit 7e98da3301
4 changed files with 95 additions and 40 deletions
+11
View File
@@ -94,6 +94,9 @@ contains
if (ext_id /= 1) call fail('water coupling export id mismatch')
if (phase /= SPH_PHASE_WATER) call fail('water coupling phase mismatch')
if (material <= 0) call fail('water coupling material mismatch')
if (.not. is_finite_vector(position)) call fail('water coupling position is not finite')
if (.not. is_finite_vector(velocity)) call fail('water coupling velocity is not finite')
if (.not. is_finite(particle_pressure)) call fail('water coupling pressure is not finite')
force = (/0.0_rk, 0.0_rk, 2.0_rk/)
call sph_coupling_import_particle_force(1, force, ierr)
@@ -104,6 +107,8 @@ contains
position, velocity, particle_pressure, ierr)
call assert_ok(ierr, 'water coupling export after force failed')
if (velocity(3) <= 0.0_rk) call fail('coupling force did not affect explicit step')
if (.not. is_finite_vector(position)) call fail('water coupling position after force is not finite')
if (.not. is_finite_vector(velocity)) call fail('water coupling velocity after force is not finite')
if (.not. is_finite(particle_pressure)) call fail('water coupling pressure is not finite')
call sph_coupling_get_diagnostics(work, energy, momentum)
@@ -135,4 +140,10 @@ contains
is_finite = (value == value .and. abs(value) < huge(1.0_rk))
end function is_finite
logical function is_finite_vector(value)
real(rk), intent(in) :: value(:)
is_finite_vector = all(value == value) .and. maxval(abs(value)) < huge(value(1))
end function is_finite_vector
end program test_coupling_interface