Integrate water explicit stepping and dt limits

This commit is contained in:
Codex
2026-07-02 20:52:05 +08:00
parent 662129d2bb
commit 4809701068
10 changed files with 226 additions and 33 deletions
+24 -1
View File
@@ -22,7 +22,8 @@ module sph_api
use sph_explosive, only: sph_explosive_initialize, sph_explosive_reset
use sph_solid, only: sph_solid_initialize, sph_solid_reset
use sph_shell, only: sph_shell_initialize, sph_shell_reset
use sph_api_state, only: sph_api_initialized, sph_api_state_set_initialized
use sph_api_state, only: sph_api_initialized, sph_api_model_built, &
sph_api_state_set_initialized, sph_api_state_set_model_built
implicit none
contains
@@ -42,6 +43,7 @@ contains
call sph_solid_initialize()
call sph_shell_initialize()
call sph_api_state_set_initialized(.true.)
call sph_api_state_set_model_built(.false.)
ierr = SPH_SUCCESS
end subroutine sph_initialize
@@ -91,6 +93,7 @@ contains
call sph_api_require_initialized(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_api_state_set_model_built(.false.)
call sph_input_read(filename, ierr)
end subroutine sph_read_inp
@@ -100,6 +103,7 @@ contains
call sph_api_require_initialized(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_build_model(ierr)
if (ierr == SPH_SUCCESS) call sph_api_state_set_model_built(.true.)
end subroutine sph_build_model
subroutine sph_estimate_stable_dt(dtcrit, ierr)
@@ -111,6 +115,11 @@ contains
dtcrit = 0.0_rk
return
end if
call sph_api_require_model_built(ierr)
if (ierr /= SPH_SUCCESS) then
dtcrit = 0.0_rk
return
end if
call sph_solver_estimate_stable_dt(dtcrit, ierr)
end subroutine sph_estimate_stable_dt
@@ -120,6 +129,8 @@ contains
call sph_api_require_initialized(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_api_require_model_built(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_solver_advance_explicit(dt, ierr)
end subroutine sph_advance_explicit
@@ -128,6 +139,8 @@ contains
call sph_api_require_initialized(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_api_require_model_built(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_solver_run_explicit(ierr)
end subroutine sph_run_explicit
@@ -280,6 +293,16 @@ contains
end if
end subroutine sph_api_require_initialized
subroutine sph_api_require_model_built(ierr)
integer, intent(out) :: ierr
ierr = SPH_SUCCESS
if (.not. sph_api_model_built) then
call sph_error_set(SPH_ERROR_STATE, 'SPHLite model is not built')
ierr = SPH_ERROR_STATE
end if
end subroutine sph_api_require_model_built
end module sph_api
subroutine sphft_initialize(ierr)