program test_shell_section_integration 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 use sph_shell, only: shell_ip_count, shell_ip_coord, shell_ip_weight, & shell_ip_stress, shell_ip_strain, shell_ip_plastic_strain, & shell_ip_temperature, shell_ip_damage, shell_ip_softening implicit none integer :: ierr call check_three_point_rule() call check_five_point_rule() contains subroutine check_three_point_rule() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for Shell 3 point rule') call sph_read_inp('tests/data/shell_section_3pt_060.inp', ierr) call assert_ok(ierr, 'read failed for Shell 3 point rule') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for Shell 3 point rule') if (shell_ip_count(1) /= 3) call fail('Shell 3 point count mismatch') if (abs(sum(shell_ip_weight(1:3,1)) - 1.0_rk) > 1.0e-12_rk) & call fail('Shell 3 point weight sum mismatch') if (abs(shell_ip_coord(1,1) + shell_ip_coord(3,1)) > 1.0e-12_rk) & call fail('Shell 3 point coordinate symmetry mismatch') if (shell_ip_coord(2,1) /= 0.0_rk) call fail('Shell 3 point center coordinate mismatch') if (any(abs(shell_ip_weight(4:5,1)) > 1.0e-12_rk)) call fail('Shell unused 3 point weights not zero') if (any(abs(shell_ip_temperature(1:3,1) - 293.15_rk) > 1.0e-12_rk)) & call fail('Shell 3 point temperature mismatch') if (any(abs(shell_ip_softening(1:3,1) - 1.0_rk) > 1.0e-12_rk)) & call fail('Shell 3 point softening mismatch') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for Shell 3 point rule') end subroutine check_three_point_rule subroutine check_five_point_rule() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for Shell 5 point rule') call sph_read_inp('tests/data/shell_section_5pt_060.inp', ierr) call assert_ok(ierr, 'read failed for Shell 5 point rule') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for Shell 5 point rule') if (shell_ip_count(1) /= 5) call fail('Shell 5 point count mismatch') if (abs(sum(shell_ip_weight(1:5,1)) - 1.0_rk) > 1.0e-12_rk) & call fail('Shell 5 point weight sum mismatch') if (abs(shell_ip_coord(1,1) + shell_ip_coord(5,1)) > 1.0e-12_rk) & call fail('Shell 5 point outer coordinate symmetry mismatch') if (abs(shell_ip_coord(2,1) + shell_ip_coord(4,1)) > 1.0e-12_rk) & call fail('Shell 5 point inner coordinate symmetry mismatch') if (shell_ip_coord(3,1) /= 0.0_rk) call fail('Shell 5 point center coordinate mismatch') if (abs(shell_ip_weight(1,1) - shell_ip_weight(5,1)) > 1.0e-12_rk) & call fail('Shell 5 point outer weight symmetry mismatch') if (abs(shell_ip_weight(2,1) - shell_ip_weight(4,1)) > 1.0e-12_rk) & call fail('Shell 5 point inner weight symmetry mismatch') if (any(abs(shell_ip_stress(:,:,1)) > 1.0e-12_rk)) call fail('Shell integration stress default mismatch') if (any(abs(shell_ip_strain(:,:,1)) > 1.0e-12_rk)) call fail('Shell integration strain default mismatch') if (any(abs(shell_ip_plastic_strain(:,1)) > 1.0e-12_rk)) call fail('Shell integration plastic default mismatch') if (any(abs(shell_ip_damage(:,1)) > 1.0e-12_rk)) call fail('Shell integration damage default mismatch') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for Shell 5 point rule') end subroutine check_five_point_rule 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_shell_section_integration