diff --git a/CMakeLists.txt b/CMakeLists.txt index c82f8df..4962aa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,6 +216,30 @@ set_target_properties(test_blast_load_conservation PROPERTIES Fortran_MODULE_DIR add_test(NAME blast_load_conservation COMMAND test_blast_load_conservation) set_tests_properties(blast_load_conservation PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") +add_executable(test_blast_solver_order tests/module/test_blast_solver_order.f90) +target_link_libraries(test_blast_solver_order PRIVATE sphlite_core) +set_target_properties(test_blast_solver_order PROPERTIES Fortran_MODULE_DIRECTORY "${SPHLITE_MODULE_DIR}") +add_test(NAME blast_solver_order COMMAND test_blast_solver_order) +set_tests_properties(blast_solver_order PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + +add_executable(test_blast_solid_response tests/module/test_blast_solid_response.f90) +target_link_libraries(test_blast_solid_response PRIVATE sphlite_core) +set_target_properties(test_blast_solid_response PROPERTIES Fortran_MODULE_DIRECTORY "${SPHLITE_MODULE_DIR}") +add_test(NAME blast_solid_response COMMAND test_blast_solid_response) +set_tests_properties(blast_solid_response PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + +add_executable(test_blast_shell_response tests/module/test_blast_shell_response.f90) +target_link_libraries(test_blast_shell_response PRIVATE sphlite_core) +set_target_properties(test_blast_shell_response PROPERTIES Fortran_MODULE_DIRECTORY "${SPHLITE_MODULE_DIR}") +add_test(NAME blast_shell_response COMMAND test_blast_shell_response) +set_tests_properties(blast_shell_response PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + +add_executable(test_blast_noop_regression tests/module/test_blast_noop_regression.f90) +target_link_libraries(test_blast_noop_regression PRIVATE sphlite_core) +set_target_properties(test_blast_noop_regression PROPERTIES Fortran_MODULE_DIRECTORY "${SPHLITE_MODULE_DIR}") +add_test(NAME blast_noop_regression COMMAND test_blast_noop_regression) +set_tests_properties(blast_noop_regression PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + add_executable(test_input_solid_material tests/module/test_input_solid_material.f90) target_link_libraries(test_input_solid_material PRIVATE sphlite_core) set_target_properties(test_input_solid_material PROPERTIES Fortran_MODULE_DIRECTORY "${SPHLITE_MODULE_DIR}") diff --git a/src/blast/sph_blast_load.f90 b/src/blast/sph_blast_load.f90 index 5847da6..3afcb8a 100644 --- a/src/blast/sph_blast_load.f90 +++ b/src/blast/sph_blast_load.f90 @@ -1,8 +1,8 @@ module sph_blast_load use sph_precision, only: rk, SPH_NDIM use sph_error, only: SPH_SUCCESS, SPH_ERROR_DATABASE, sph_error_set - use sph_database, only: SPH_MAX_REGIONS, npart, particle_phase, x, v, & - volume, SPH_PHASE_SOLID, SPH_PHASE_SHELL + use sph_database, only: SPH_MAX_REGIONS, npart, particle_phase, x, v, a, & + mass, volume, SPH_PHASE_SOLID, SPH_PHASE_SHELL use sph_blast, only: blast_region_count, blast_region_enabled, & blast_center, blast_load_scale, blast_time_window, & blast_source_count, blast_target_count, blast_candidate_pair_count, & @@ -28,6 +28,8 @@ module sph_blast_load real(rk) :: blast_load_work(SPH_MAX_REGIONS) = 0.0_rk real(rk) :: blast_load_energy_input(SPH_MAX_REGIONS) = 0.0_rk real(rk) :: blast_load_max_particle_force(SPH_MAX_REGIONS) = 0.0_rk + real(rk) :: blast_load_max_acceleration(SPH_MAX_REGIONS) = 0.0_rk + logical :: blast_load_enabled = .true. contains @@ -36,10 +38,17 @@ contains end subroutine sph_blast_load_initialize subroutine sph_blast_load_reset() + blast_load_enabled = .true. call sph_blast_load_deallocate() call sph_blast_load_clear_diagnostics() end subroutine sph_blast_load_reset + subroutine sph_blast_load_set_enabled(enabled) + logical, intent(in) :: enabled + + blast_load_enabled = enabled + end subroutine sph_blast_load_set_enabled + subroutine sph_blast_load_deallocate() if (allocated(blast_solid_external_force)) deallocate(blast_solid_external_force) if (allocated(blast_shell_external_force)) deallocate(blast_shell_external_force) @@ -70,6 +79,7 @@ contains blast_load_work = 0.0_rk blast_load_energy_input = 0.0_rk blast_load_max_particle_force = 0.0_rk + blast_load_max_acceleration = 0.0_rk end subroutine sph_blast_load_clear_diagnostics subroutine sph_blast_load_prepare_storage(ierr) @@ -97,17 +107,48 @@ contains subroutine sph_blast_load_compute(ierr) integer, intent(out) :: ierr + + call sph_blast_load_compute_at(0.0_rk, ierr) + end subroutine sph_blast_load_compute + + subroutine sph_blast_load_compute_at(time_value, ierr) + real(rk), intent(in) :: time_value + integer, intent(out) :: ierr integer :: region call sph_blast_refresh_snapshot(ierr) if (ierr /= SPH_SUCCESS) return call sph_blast_load_clear(ierr) if (ierr /= SPH_SUCCESS) return + if (.not. blast_load_enabled) return do region = 1, blast_region_count if (.not. blast_region_enabled(region)) cycle + if (.not. sph_blast_load_in_time_window(region, time_value)) cycle call sph_blast_load_project_region(region) end do - end subroutine sph_blast_load_compute + end subroutine sph_blast_load_compute_at + + subroutine sph_blast_load_apply_to_acceleration(ierr) + integer, intent(out) :: ierr + integer :: i + real(rk) :: contribution(SPH_NDIM) + + ierr = SPH_SUCCESS + if (.not. blast_load_enabled) return + if (.not. allocated(blast_solid_external_force)) return + do i = 1, npart + if (mass(i) <= 0.0_rk) cycle + contribution = 0.0_rk + if (particle_phase(i) == SPH_PHASE_SOLID) then + contribution = blast_solid_external_force(:,i) / mass(i) + else if (particle_phase(i) == SPH_PHASE_SHELL) then + contribution = blast_shell_external_force(:,i) / mass(i) + end if + if (.not. sph_blast_load_vector_is_finite(contribution)) cycle + a(:,i) = a(:,i) + contribution + call sph_blast_load_track_acceleration(i, contribution) + end do + end subroutine sph_blast_load_apply_to_acceleration subroutine sph_blast_load_project_region(region) integer, intent(in) :: region @@ -198,6 +239,7 @@ contains integer, intent(in) :: region integer, intent(in) :: target real(rk), intent(in) :: force(SPH_NDIM) + real(rk) :: accel_norm if (particle_phase(target) == SPH_PHASE_SOLID) then blast_solid_external_force(:,target) = & @@ -217,8 +259,39 @@ contains blast_load_momentum_input(:,region) = blast_load_impulse(:,region) blast_load_work(region) = blast_load_work(region) + & sum(force * v(:,target)) * blast_time_window(region) + if (mass(target) > 0.0_rk) then + accel_norm = sqrt(sum((force / mass(target)) * (force / mass(target)))) + if (accel_norm > blast_load_max_acceleration(region)) then + blast_load_max_acceleration(region) = accel_norm + end if + end if end subroutine sph_blast_load_store_force + subroutine sph_blast_load_track_acceleration(index, contribution) + integer, intent(in) :: index + real(rk), intent(in) :: contribution(SPH_NDIM) + integer :: region + real(rk) :: accel_norm + + if (maxval(abs(contribution)) <= 0.0_rk) return + accel_norm = sqrt(sum(contribution * contribution)) + do region = 1, blast_region_count + if (.not. sph_blast_target_accepts(region, index)) cycle + if (accel_norm > blast_load_max_acceleration(region)) then + blast_load_max_acceleration(region) = accel_norm + end if + end do + end subroutine sph_blast_load_track_acceleration + + logical function sph_blast_load_in_time_window(region, time_value) + integer, intent(in) :: region + real(rk), intent(in) :: time_value + + sph_blast_load_in_time_window = .true. + if (blast_time_window(region) <= 0.0_rk) return + if (time_value > blast_time_window(region)) sph_blast_load_in_time_window = .false. + end function sph_blast_load_in_time_window + subroutine sph_blast_load_direction(region, target, direction) integer, intent(in) :: region integer, intent(in) :: target diff --git a/src/solver/sph_solver_explicit.f90 b/src/solver/sph_solver_explicit.f90 index b3e322a..0967d08 100644 --- a/src/solver/sph_solver_explicit.f90 +++ b/src/solver/sph_solver_explicit.f90 @@ -12,7 +12,8 @@ module sph_solver_explicit sph_gas_compute_acceleration, sph_gas_update_diagnostics, & sph_gas_estimate_dt_limits, sph_gas_apply_sources_explicit use sph_explosive, only: sph_explosive_advance, sph_explosive_estimate_dt_limit - use sph_blast_load, only: sph_blast_load_clear, sph_blast_load_compute + use sph_blast_load, only: sph_blast_load_clear, sph_blast_load_compute_at, & + sph_blast_load_apply_to_acceleration use sph_solid_dynamics, only: sph_solid_compute_acceleration, & sph_solid_advance_material, sph_solid_update_diagnostics, & sph_solid_estimate_dt_limits @@ -55,7 +56,7 @@ contains if (ierr /= SPH_SUCCESS) return call sph_gas_update_pressure(ierr) if (ierr /= SPH_SUCCESS) return - call sph_blast_load_compute(ierr) + call sph_blast_load_compute_at(current_time, ierr) if (ierr /= SPH_SUCCESS) return call sph_water_compute_density_rate(ierr) if (ierr /= SPH_SUCCESS) return @@ -67,6 +68,8 @@ contains if (ierr /= SPH_SUCCESS) return call sph_solid_compute_acceleration(ierr) if (ierr /= SPH_SUCCESS) return + call sph_blast_load_apply_to_acceleration(ierr) + if (ierr /= SPH_SUCCESS) return do i = 1, npart vhalf(:,i) = v(:,i) + 0.5_rk * dt * a(:,i) x(:,i) = x(:,i) + dt * vhalf(:,i) @@ -75,10 +78,10 @@ contains end do call sph_explosive_advance(dt, current_time + dt, ierr) if (ierr /= SPH_SUCCESS) return - call sph_blast_load_compute(ierr) - if (ierr /= SPH_SUCCESS) return call sph_gas_apply_sources_explicit(dt, ierr) if (ierr /= SPH_SUCCESS) return + call sph_blast_load_compute_at(current_time + dt, ierr) + if (ierr /= SPH_SUCCESS) return call sph_solid_advance_material(dt, ierr) if (ierr /= SPH_SUCCESS) return call sph_water_update_diagnostics(ierr) diff --git a/tests/module/test_blast_noop_regression.f90 b/tests/module/test_blast_noop_regression.f90 new file mode 100644 index 0000000..938f092 --- /dev/null +++ b/tests/module/test_blast_noop_regression.f90 @@ -0,0 +1,114 @@ +program test_blast_noop_regression + use sph_precision, only: rk + use sph_error, only: SPH_SUCCESS + use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, & + sph_build_model, sph_advance_explicit + use sph_database, only: particle_status, v, SPH_STATUS_FAILED + use sph_blast_load, only: blast_solid_external_force, & + blast_shell_external_force, blast_load_target_count, & + blast_load_total_force, sph_blast_load_compute_at, & + sph_blast_load_set_enabled + implicit none + + integer :: ierr + + call check_disabled_path() + call check_time_window_clear() + call check_failed_solid_target() + call check_failed_shell_target() + +contains + + subroutine check_disabled_path() + call sph_initialize(ierr) + call assert_ok(ierr, 'initialize failed for disabled Blast load') + call sph_read_inp('tests/data/blast_water_gas_explosive_solid_070.inp', ierr) + call assert_ok(ierr, 'read failed for disabled Blast load') + call sph_build_model(ierr) + call assert_ok(ierr, 'build failed for disabled Blast load') + call sph_blast_load_set_enabled(.false.) + call sph_advance_explicit(1.0e-8_rk, ierr) + call assert_ok(ierr, 'advance failed for disabled Blast load') + if (blast_load_target_count(1) /= 0) call fail('disabled Blast load applied') + if (maxval(abs(blast_load_total_force(:,1))) > 0.0_rk) then + call fail('disabled Blast load force not cleared') + end if + if (abs(v(1,5)) > 1.0e-18_rk) call fail('disabled Blast moved Solid target') + call sph_finalize(ierr) + call assert_ok(ierr, 'finalize failed for disabled Blast load') + end subroutine check_disabled_path + + subroutine check_time_window_clear() + call sph_initialize(ierr) + call assert_ok(ierr, 'initialize failed for Blast time window') + call sph_read_inp('tests/data/blast_water_gas_explosive_solid_070.inp', ierr) + call assert_ok(ierr, 'read failed for Blast time window') + call sph_build_model(ierr) + call assert_ok(ierr, 'build failed for Blast time window') + call sph_blast_load_compute_at(3.0e-7_rk, ierr) + call assert_ok(ierr, 'Blast time-window recompute failed') + if (blast_load_target_count(1) /= 0) call fail('Blast time window did not clear') + if (maxval(abs(blast_solid_external_force)) > 0.0_rk) then + call fail('Blast time-window force cache not cleared') + end if + call sph_finalize(ierr) + call assert_ok(ierr, 'finalize failed for Blast time window') + end subroutine check_time_window_clear + + subroutine check_failed_solid_target() + call sph_initialize(ierr) + call assert_ok(ierr, 'initialize failed for failed Solid target') + call sph_read_inp('tests/data/blast_water_gas_explosive_solid_070.inp', ierr) + call assert_ok(ierr, 'read failed for failed Solid target') + call sph_build_model(ierr) + call assert_ok(ierr, 'build failed for failed Solid target') + particle_status(5) = SPH_STATUS_FAILED + call sph_blast_load_compute_at(0.0_rk, ierr) + call assert_ok(ierr, 'failed Solid target recompute failed') + if (blast_load_target_count(1) /= 1) call fail('failed Solid target not skipped') + if (maxval(abs(blast_solid_external_force(:,5))) > 0.0_rk) then + call fail('failed Solid target received load') + end if + if (blast_solid_external_force(1,6) <= 0.0_rk) then + call fail('active Solid target lost load') + end if + call sph_finalize(ierr) + call assert_ok(ierr, 'finalize failed for failed Solid target') + end subroutine check_failed_solid_target + + subroutine check_failed_shell_target() + call sph_initialize(ierr) + call assert_ok(ierr, 'initialize failed for failed Shell target') + call sph_read_inp('tests/data/blast_water_gas_explosive_shell_070.inp', ierr) + call assert_ok(ierr, 'read failed for failed Shell target') + call sph_build_model(ierr) + call assert_ok(ierr, 'build failed for failed Shell target') + particle_status(5) = SPH_STATUS_FAILED + call sph_blast_load_compute_at(0.0_rk, ierr) + call assert_ok(ierr, 'failed Shell target recompute failed') + if (blast_load_target_count(1) /= 1) call fail('failed Shell target not skipped') + if (maxval(abs(blast_shell_external_force(:,5))) > 0.0_rk) then + call fail('failed Shell target received load') + end if + if (blast_shell_external_force(1,6) <= 0.0_rk) then + call fail('active Shell target lost load') + end if + call sph_finalize(ierr) + call assert_ok(ierr, 'finalize failed for failed Shell target') + end subroutine check_failed_shell_target + + subroutine assert_ok(ierr_value, message) + integer, intent(in) :: ierr_value + character(len=*), intent(in) :: message + + if (ierr_value /= SPH_SUCCESS) call fail(message) + end subroutine assert_ok + + subroutine fail(message) + character(len=*), intent(in) :: message + + write(*, '(A)') trim(message) + stop 1 + end subroutine fail + +end program test_blast_noop_regression diff --git a/tests/module/test_blast_shell_response.f90 b/tests/module/test_blast_shell_response.f90 new file mode 100644 index 0000000..b6c68f2 --- /dev/null +++ b/tests/module/test_blast_shell_response.f90 @@ -0,0 +1,73 @@ +program test_blast_shell_response + use sph_precision, only: rk + use sph_error, only: SPH_SUCCESS + use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, & + sph_build_model, sph_advance_explicit + use sph_database, only: a, v + use sph_shell, only: shell_director + use sph_blast_load, only: blast_shell_external_force, & + blast_shell_external_moment, blast_load_max_acceleration, & + blast_load_nonfinite_count + implicit none + + integer :: ierr + real(rk) :: director_before(3) + + call sph_initialize(ierr) + call assert_ok(ierr, 'initialize failed for Blast Shell response') + call sph_read_inp('tests/data/blast_water_gas_explosive_shell_070.inp', ierr) + call assert_ok(ierr, 'read failed for Blast Shell response') + call sph_build_model(ierr) + call assert_ok(ierr, 'build failed for Blast Shell response') + director_before = shell_director(:,5) + if (blast_shell_external_force(1,5) <= 0.0_rk) then + call fail('Shell Blast preload direction mismatch') + end if + if (maxval(abs(blast_shell_external_moment)) > 0.0_rk) then + call fail('Shell Blast moment placeholder changed') + end if + + call sph_advance_explicit(1.0e-8_rk, ierr) + call assert_ok(ierr, 'advance failed for Blast Shell response') + if (a(1,5) <= 0.0_rk) call fail('Shell Blast acceleration missing') + if (v(1,5) <= 0.0_rk) call fail('Shell Blast velocity missing') + call assert_transverse_small(5, 'Shell transverse acceleration mismatch') + if (maxval(abs(shell_director(:,5) - director_before)) > 1.0e-12_rk) then + call fail('Shell director changed through Blast load path') + end if + if (maxval(abs(blast_shell_external_moment)) > 0.0_rk) then + call fail('Shell Blast moment placeholder changed after advance') + end if + if (blast_load_max_acceleration(1) <= 0.0_rk) then + call fail('Shell Blast acceleration diagnostic missing') + end if + if (blast_load_nonfinite_count(1) /= 0) call fail('Shell Blast nonfinite load') + + call sph_finalize(ierr) + call assert_ok(ierr, 'finalize failed for Blast Shell response') + +contains + + subroutine assert_transverse_small(index, message) + integer, intent(in) :: index + character(len=*), intent(in) :: message + + if (abs(a(2,index)) > abs(a(1,index)) * 1.0e-8_rk) call fail(message) + if (abs(a(3,index)) > abs(a(1,index)) * 1.0e-8_rk) call fail(message) + end subroutine assert_transverse_small + + subroutine assert_ok(ierr_value, message) + integer, intent(in) :: ierr_value + character(len=*), intent(in) :: message + + if (ierr_value /= SPH_SUCCESS) call fail(message) + end subroutine assert_ok + + subroutine fail(message) + character(len=*), intent(in) :: message + + write(*, '(A)') trim(message) + stop 1 + end subroutine fail + +end program test_blast_shell_response diff --git a/tests/module/test_blast_solid_response.f90 b/tests/module/test_blast_solid_response.f90 new file mode 100644 index 0000000..2e8f788 --- /dev/null +++ b/tests/module/test_blast_solid_response.f90 @@ -0,0 +1,80 @@ +program test_blast_solid_response + use sph_precision, only: rk + use sph_error, only: SPH_SUCCESS + use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, & + sph_build_model, sph_advance_explicit + use sph_database, only: a, v + use sph_blast_load, only: blast_solid_external_force, & + blast_load_max_acceleration, blast_load_nonfinite_count + implicit none + + integer :: ierr + + call sph_initialize(ierr) + call assert_ok(ierr, 'initialize failed for Blast Solid response') + call sph_read_inp('tests/data/blast_water_gas_explosive_solid_070.inp', ierr) + call assert_ok(ierr, 'read failed for Blast Solid response') + call sph_build_model(ierr) + call assert_ok(ierr, 'build failed for Blast Solid response') + if (blast_solid_external_force(1,5) <= 0.0_rk) then + call fail('Solid Blast preload direction mismatch') + end if + + call sph_advance_explicit(1.0e-8_rk, ierr) + call assert_ok(ierr, 'first advance failed for Blast Solid response') + call assert_positive_x_response('first Solid response missing') + call assert_transverse_small(5, 'first Solid transverse acceleration mismatch') + if (blast_load_max_acceleration(1) <= 0.0_rk) then + call fail('Solid Blast acceleration diagnostic missing') + end if + if (blast_load_nonfinite_count(1) /= 0) call fail('Solid Blast nonfinite load') + + call check_second_step_accumulates() + + call sph_finalize(ierr) + call assert_ok(ierr, 'finalize failed for Blast Solid response') + +contains + + subroutine check_second_step_accumulates() + real(rk) :: previous_velocity + + previous_velocity = v(1,5) + call sph_advance_explicit(1.0e-8_rk, ierr) + call assert_ok(ierr, 'second advance failed for Blast Solid response') + if (v(1,5) <= previous_velocity) then + call fail('Solid Blast velocity did not accumulate') + end if + call assert_positive_x_response('second Solid response missing') + end subroutine check_second_step_accumulates + + subroutine assert_positive_x_response(message) + character(len=*), intent(in) :: message + + if (a(1,5) <= 0.0_rk) call fail(message) + if (v(1,5) <= 0.0_rk) call fail(message) + end subroutine assert_positive_x_response + + subroutine assert_transverse_small(index, message) + integer, intent(in) :: index + character(len=*), intent(in) :: message + + if (abs(a(2,index)) > abs(a(1,index)) * 1.0e-8_rk) call fail(message) + if (abs(a(3,index)) > abs(a(1,index)) * 1.0e-8_rk) call fail(message) + end subroutine assert_transverse_small + + subroutine assert_ok(ierr_value, message) + integer, intent(in) :: ierr_value + character(len=*), intent(in) :: message + + if (ierr_value /= SPH_SUCCESS) call fail(message) + end subroutine assert_ok + + subroutine fail(message) + character(len=*), intent(in) :: message + + write(*, '(A)') trim(message) + stop 1 + end subroutine fail + +end program test_blast_solid_response diff --git a/tests/module/test_blast_solver_order.f90 b/tests/module/test_blast_solver_order.f90 new file mode 100644 index 0000000..985552d --- /dev/null +++ b/tests/module/test_blast_solver_order.f90 @@ -0,0 +1,54 @@ +program test_blast_solver_order + use sph_precision, only: rk + use sph_error, only: SPH_SUCCESS + use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, & + sph_build_model, sph_advance_explicit + use sph_blast, only: blast_candidate_pair_count, & + blast_explosive_progress_mean + use sph_blast_load, only: blast_load_target_count, blast_load_pair_count, & + blast_load_energy_input, blast_load_nonfinite_count + implicit none + + integer :: ierr + + call sph_initialize(ierr) + call assert_ok(ierr, 'initialize failed for Blast solver order') + call sph_read_inp('tests/data/blast_water_gas_explosive_solid_shell_070.inp', ierr) + call assert_ok(ierr, 'read failed for Blast solver order') + call sph_build_model(ierr) + call assert_ok(ierr, 'build failed for Blast solver order') + if (blast_load_target_count(1) /= 4) call fail('initial Blast target mismatch') + + call sph_advance_explicit(1.0e-7_rk, ierr) + call assert_ok(ierr, 'advance failed for Blast solver order') + if (blast_explosive_progress_mean(1) < 0.99_rk) then + call fail('Blast snapshot did not refresh after Explosive update') + end if + if (blast_load_pair_count(1) /= blast_candidate_pair_count(1)) then + call fail('Blast post-step pair count mismatch') + end if + if (blast_load_energy_input(1) <= 0.0_rk) then + call fail('Blast energy diagnostic missing after Gas source update') + end if + if (blast_load_nonfinite_count(1) /= 0) call fail('Blast post-step nonfinite load') + + call sph_finalize(ierr) + call assert_ok(ierr, 'finalize failed for Blast solver order') + +contains + + subroutine assert_ok(ierr_value, message) + integer, intent(in) :: ierr_value + character(len=*), intent(in) :: message + + if (ierr_value /= SPH_SUCCESS) call fail(message) + end subroutine assert_ok + + subroutine fail(message) + character(len=*), intent(in) :: message + + write(*, '(A)') trim(message) + stop 1 + end subroutine fail + +end program test_blast_solver_order diff --git a/todo.md b/todo.md index d2f921f..3114e6d 100644 --- a/todo.md +++ b/todo.md @@ -140,36 +140,36 @@ ## 阶段 E:显式推进接入、Solid/Shell 响应和隔离规则 -- [ ] 设计局部爆炸载荷在 Velocity-Verlet 中的调用顺序。 -- [ ] 确认 Explosive 更新早于爆炸载荷投影。 -- [ ] 确认 Gas 源项应用早于结构载荷诊断。 -- [ ] 确认 Water/Gas 压力更新早于结构载荷投影。 -- [ ] 将 Solid 外载荷并入 Solid 加速度或外力入口。 -- [ ] 将 Shell 外载荷并入 Shell 受控外力入口。 -- [ ] 对尚未完成的 Shell 内力路径保持受控 no-op 或诊断占位。 -- [ ] 确认 Shell 外载荷不宣称完整 Shell 动力学闭环。 -- [ ] 确认 Solid 外载荷不改变既有 Solid-only gate 结果。 -- [ ] 确认 Shell 外载荷不改变既有 Shell 运动学 gate 结果。 -- [ ] 确认 Water-only 显式步结果保持稳定。 -- [ ] 确认 Gas-only 显式步结果保持稳定。 -- [ ] 确认 Explosive-Gas 显式步结果保持稳定。 -- [ ] 确认 Solid-only 显式步结果保持稳定。 -- [ ] 确认无载荷控制时完整显式步行为不变。 -- [ ] 添加局部爆炸载荷启用开关。 -- [ ] 添加局部爆炸载荷禁用路径测试。 -- [ ] 添加单步载荷施加测试。 -- [ ] 添加多步载荷累积测试。 -- [ ] 添加载荷时间窗口结束后清零测试。 -- [ ] 添加结构加速度方向检查测试。 -- [ ] 添加 Shell director 不被外载荷路径非法修改的测试。 -- [ ] 添加 failed Solid 目标处理测试。 -- [ ] 添加 failed Shell 目标处理测试。 -- [ ] 新增 `blast_solver_order` 测试。 -- [ ] 新增 `blast_solid_response` 测试。 -- [ ] 新增 `blast_shell_response` 测试。 -- [ ] 新增 `blast_noop_regression` 测试。 -- [ ] 将显式推进接入测试接入 CTest。 -- [ ] 准备阶段 E 本地提交说明。 +- [x] 设计局部爆炸载荷在 Velocity-Verlet 中的调用顺序。 +- [x] 确认 Explosive 更新早于爆炸载荷投影。 +- [x] 确认 Gas 源项应用早于结构载荷诊断。 +- [x] 确认 Water/Gas 压力更新早于结构载荷投影。 +- [x] 将 Solid 外载荷并入 Solid 加速度或外力入口。 +- [x] 将 Shell 外载荷并入 Shell 受控外力入口。 +- [x] 对尚未完成的 Shell 内力路径保持受控 no-op 或诊断占位。 +- [x] 确认 Shell 外载荷不宣称完整 Shell 动力学闭环。 +- [x] 确认 Solid 外载荷不改变既有 Solid-only gate 结果。 +- [x] 确认 Shell 外载荷不改变既有 Shell 运动学 gate 结果。 +- [x] 确认 Water-only 显式步结果保持稳定。 +- [x] 确认 Gas-only 显式步结果保持稳定。 +- [x] 确认 Explosive-Gas 显式步结果保持稳定。 +- [x] 确认 Solid-only 显式步结果保持稳定。 +- [x] 确认无载荷控制时完整显式步行为不变。 +- [x] 添加局部爆炸载荷启用开关。 +- [x] 添加局部爆炸载荷禁用路径测试。 +- [x] 添加单步载荷施加测试。 +- [x] 添加多步载荷累积测试。 +- [x] 添加载荷时间窗口结束后清零测试。 +- [x] 添加结构加速度方向检查测试。 +- [x] 添加 Shell director 不被外载荷路径非法修改的测试。 +- [x] 添加 failed Solid 目标处理测试。 +- [x] 添加 failed Shell 目标处理测试。 +- [x] 新增 `blast_solver_order` 测试。 +- [x] 新增 `blast_solid_response` 测试。 +- [x] 新增 `blast_shell_response` 测试。 +- [x] 新增 `blast_noop_regression` 测试。 +- [x] 将显式推进接入测试接入 CTest。 +- [x] 准备阶段 E 本地提交说明。 ## 阶段 F:诊断、输出、restart 占位和公开接口边界