program test_input_shell_section 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_get_input_warning_count use sph_database, only: section_count, particle_phase, particle_status, & material_id, section_type, section_thickness, section_integration_points, & section_shear_correction, SPH_PHASE_SHELL, SPH_PHASE_SOLID, & SPH_STATUS_ACTIVE use sph_shell, only: shell_material_count, shell_material_ids, & shell_elastic_defined, shell_johnson_cook_defined, & shell_failure_defined, shell_control_defined, shell_elastic_e, & shell_elastic_nu, shell_jc_a, shell_jc_epsdot0, shell_failure_d, & shell_softening_width implicit none integer :: ierr integer :: warnings call check_minimal_shell_input() call check_section_points() call check_johnson_cook_shell_input() call check_unbound_warning() call check_existing_solid_phase_path() contains subroutine check_minimal_shell_input() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for minimal Shell input') call sph_read_inp('tests/data/shell_minimal_060.inp', ierr) call assert_ok(ierr, 'read failed for minimal Shell input') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for minimal Shell input') if (shell_material_count /= 1) call fail('Shell material count mismatch') if (section_count /= 1) call fail('Shell section count mismatch') if (.not. shell_elastic_defined(1)) call fail('Shell elastic data missing') if (abs(shell_elastic_e(1) - 210.0e9_rk) > 1.0e3_rk) call fail('Shell elastic E mismatch') if (abs(shell_elastic_nu(1) - 0.30_rk) > 1.0e-12_rk) call fail('Shell Poisson mismatch') if (any(particle_phase(1:4) /= SPH_PHASE_SHELL)) call fail('Shell phase mismatch') if (any(particle_status(1:4) /= SPH_STATUS_ACTIVE)) call fail('Shell status changed') if (material_id(1) /= shell_material_ids(1)) call fail('Shell material mapping mismatch') if (trim(section_type(1)) /= 'SHELL') call fail('Shell section type mismatch') if (abs(section_thickness(1) - 0.010_rk) > 1.0e-12_rk) call fail('Shell thickness mismatch') if (section_integration_points(1) /= 3) call fail('Shell section points mismatch') if (abs(section_shear_correction(1) - 5.0_rk / 6.0_rk) > 1.0e-10_rk) & call fail('Shell shear correction mismatch') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for minimal Shell input') end subroutine check_minimal_shell_input subroutine check_section_points() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for Shell 5 point input') call sph_read_inp('tests/data/shell_section_5pt_060.inp', ierr) call assert_ok(ierr, 'read failed for Shell 5 point input') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for Shell 5 point input') if (section_integration_points(1) /= 5) call fail('Shell 5 point section not stored') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for Shell 5 point input') end subroutine check_section_points subroutine check_johnson_cook_shell_input() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for Shell Johnson-Cook input') call sph_read_inp('tests/data/shell_johnson_cook_failure_060.inp', ierr) call assert_ok(ierr, 'read failed for Shell Johnson-Cook input') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for Shell Johnson-Cook input') if (.not. shell_johnson_cook_defined(1)) call fail('Shell Johnson-Cook flow missing') if (.not. shell_failure_defined(1)) call fail('Shell Johnson-Cook failure missing') if (.not. shell_control_defined(1)) call fail('Shell control missing') if (shell_jc_a(1) <= 0.0_rk) call fail('Shell Johnson-Cook A mismatch') if (shell_jc_epsdot0(1) <= 0.0_rk) call fail('Shell Johnson-Cook epsdot0 mismatch') if (abs(shell_failure_d(1,1) - 0.05_rk) > 1.0e-12_rk) call fail('Shell failure D1 mismatch') if (abs(shell_softening_width(1) - 0.25_rk) > 1.0e-12_rk) call fail('Shell softening mismatch') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for Shell Johnson-Cook input') end subroutine check_johnson_cook_shell_input subroutine check_unbound_warning() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for unbound Shell input') call sph_read_inp('tests/data/shell_unbound_material_warning_060.inp', ierr) call assert_ok(ierr, 'read failed for unbound Shell input') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for unbound Shell input') call sph_get_input_warning_count(warnings, ierr) call assert_ok(ierr, 'warning count failed for unbound Shell input') if (warnings <= 0) call fail('unbound Shell material warning missing') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for unbound Shell input') end subroutine check_unbound_warning subroutine check_existing_solid_phase_path() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for Solid phase regression') call sph_read_inp('tests/data/solid_elastic_minimal_050.inp', ierr) call assert_ok(ierr, 'read failed for Solid phase regression') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for Solid phase regression') if (any(particle_phase(1:4) /= SPH_PHASE_SOLID)) call fail('Solid phase path changed') if (any(particle_status(1:4) /= SPH_STATUS_ACTIVE)) call fail('Solid status path changed') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for Solid phase regression') end subroutine check_existing_solid_phase_path 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_input_shell_section