program test_implicit_inp use fem_precision use fem_control use fem_api use fem_database, only: ncontact_pair, contact_pair_slave, & contact_pair_master, contact_pair_penalty, & contact_pair_damping, contact_pair_search, & contact_pair_friction, n_surface, surface_name, & surface_start, surface_count, surface_target, & surface_face, surface_owner, surface_type, & surface_plane_normal, surface_plane_offset, & n_contact_property, contact_property_name, & contact_property_penalty, contact_property_damping, & contact_property_search, contact_property_friction, & contact_property_friction_reg, & contact_property_aug_factor, contact_pair_friction_reg, & contact_pair_aug_factor, & contact_pair_property use fem_database_surface, only: db_contact_facet_match, & db_contact_facet_normal_sign, & db_contact_facet_has_side use fem_sparse_csr_diagnostics, only: CSR_CLASS_GENERAL, & CSR_CLASS_SPD_CAND implicit none real(rk), parameter :: TOL = 1.0e-10_rk call check_implicit_linear_compat() call check_static_linear_inp() call check_static_patch_file('tests/data/c3d8_static_patch.inp', 2, 0.01_rk, 60) call check_static_patch_file('tests/data/c3d10_static_patch.inp', 2, 0.01_rk, 80) call check_static_patch_file('tests/data/c3d20_static_patch.inp', 2, 0.01_rk, 100) call check_shell_static_patch('tests/data/s4_static_patch.inp', 2, 130) call check_shell_static_patch('tests/data/s3_static_patch.inp', 2, 160) call check_shell_static_patch('tests/data/s6_static_patch.inp', 2, 190) call check_shell_static_patch('tests/data/s8_static_patch.inp', 2, 220) call check_static_nonlinear_elastic() call check_static_nonlinear_j2_disp() call check_implicit_newmark_inp() call check_contact_pair_inp() contains subroutine check_implicit_linear_compat() integer :: ierr integer :: iter integer :: step integer :: conv_increment integer :: conv_iteration integer :: linsol_method integer :: linsol_preconditioner integer :: linsol_iteration integer :: linsol_status integer :: linsol_matrix_class real(rk) :: res_norm real(rk) :: conv_residual_norm real(rk) :: conv_correction_norm real(rk) :: linsol_initial_residual real(rk) :: linsol_residual real(rk) :: linsol_relative_residual real(rk) :: time real(rk) :: displacement(NDIM) real(rk) :: velocity(NDIM) real(rk) :: acceleration(NDIM) logical :: conv_converged call fem_initialize(ierr) if (ierr .ne. 0) call fail(1) call fem_read_inp('tests/data/c3d4_implicit_pull.inp', ierr) if (ierr .ne. 0) call fail(2) call fem_build_model(ierr) if (ierr .ne. 0) call fail(3) call fem_set_linear_solver(LSOLVER_BICGSTAB, LPRECOND_JACOBI, ierr) if (ierr .ne. 0) call fail(1004) call fem_solve_implicit_linear(50, 1.0e-12_rk, iter, res_norm, ierr) if (ierr .ne. 0) call fail(4) if (iter .le. 0 .or. iter .gt. 5) call fail(5) if (res_norm .gt. TOL) call fail(6) call fem_get_convergence_status(conv_increment, conv_iteration, & conv_residual_norm, conv_correction_norm, conv_converged, ierr) if (ierr .ne. 0) call fail(17) if (.not. conv_converged) call fail(18) if (conv_increment .ne. 1) call fail(19) if (conv_iteration .ne. iter) call fail(1001) call check_close(conv_residual_norm, res_norm, 1002) call check_close(conv_correction_norm, ZERO, 1003) call fem_get_linear_solver_stats(linsol_method, linsol_preconditioner, & linsol_iteration, linsol_residual, linsol_status, ierr) if (ierr .ne. 0) call fail(1005) if (linsol_method .ne. LSOLVER_BICGSTAB) call fail(1006) if (linsol_preconditioner .ne. LPRECOND_JACOBI) call fail(1007) if (linsol_status .ne. LS_STATUS_CONVERGED) call fail(1008) if (linsol_iteration .le. 0) call fail(1009) if (linsol_residual .gt. 1.0e-10_rk) call fail(1010) call fem_get_linsol_diagnostics(linsol_matrix_class, & linsol_initial_residual, linsol_residual, linsol_relative_residual, & linsol_status, ierr) if (ierr .ne. 0) call fail(1012) if (linsol_matrix_class .lt. CSR_CLASS_GENERAL .or. & linsol_matrix_class .gt. CSR_CLASS_SPD_CAND) call fail(1013) if (linsol_initial_residual .le. linsol_residual) call fail(1014) if (linsol_residual .gt. 1.0e-10_rk) call fail(1015) if (linsol_relative_residual .gt. 1.0e-10_rk) call fail(1016) if (linsol_status .ne. LS_STATUS_CONVERGED) call fail(1017) call fem_set_linear_solver(LSOLVER_CG, LPRECOND_JACOBI, ierr) if (ierr .ne. 0) call fail(1011) call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) if (ierr .ne. 0) call fail(7) call check_close(displacement(1), 5.0_rk / 6.0_rk, 8) call check_close(displacement(2), ZERO, 9) call check_close(displacement(3), ZERO, 10) call check_close(maxval(abs(velocity)), ZERO, 11) call check_close(maxval(abs(acceleration)), ZERO, 12) call fem_get_current_time(time, step, ierr) if (ierr .ne. 0) call fail(13) call check_close(time, ZERO, 14) if (step .ne. 1) call fail(15) call fem_finalize(ierr) if (ierr .ne. 0) call fail(16) end subroutine check_implicit_linear_compat subroutine check_static_linear_inp() integer :: ierr integer :: iter integer :: step integer :: max_steps logical :: user_dt real(rk) :: res_norm real(rk) :: time real(rk) :: dt real(rk) :: end_time real(rk) :: displacement(NDIM) real(rk) :: velocity(NDIM) real(rk) :: acceleration(NDIM) integer :: query_nodes(4) real(rk) :: reactions(NDOF_NODE,4) integer :: query_elems(1) real(rk) :: stress_out(NSTRESS,1) real(rk) :: strain_out(NSTRESS,1) real(rk) :: plastic_strain(NSTRESS,1) real(rk) :: eqps(1) real(rk) :: damage(1) call fem_initialize(ierr) if (ierr .ne. 0) call fail(20) call fem_read_inp('tests/data/c3d4_static_pull.inp', ierr) if (ierr .ne. 0) call fail(21) if (analysis_type .ne. ANALYSIS_STATIC_LINEAR) call fail(22) call fem_get_time_control(dt, end_time, max_steps, user_dt, ierr) if (ierr .ne. 0) call fail(23) call check_close(dt, 0.1_rk, 24) call check_close(end_time, ONE, 25) if (.not. user_dt) call fail(26) if (max_steps .ne. 10) call fail(27) if (max_increment .ne. 10) call fail(28) call fem_build_model(ierr) if (ierr .ne. 0) call fail(29) call fem_solve_static_linear(50, 1.0e-12_rk, iter, res_norm, ierr) if (ierr .ne. 0) call fail(30) if (iter .le. 0 .or. iter .gt. 5) call fail(31) if (res_norm .gt. TOL) call fail(32) call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) if (ierr .ne. 0) call fail(33) call check_close(displacement(1), 5.0_rk / 6.0_rk, 34) call check_close(displacement(2), ZERO, 35) call check_close(displacement(3), ZERO, 36) call check_close(maxval(abs(velocity)), ZERO, 37) call check_close(maxval(abs(acceleration)), ZERO, 38) call fem_get_current_time(time, step, ierr) if (ierr .ne. 0) call fail(39) call check_close(time, ONE, 40) if (step .ne. 1) call fail(41) query_nodes(1) = 1 query_nodes(2) = 2 query_nodes(3) = 3 query_nodes(4) = 4 call fem_get_nodal_reactions(4, query_nodes, reactions, ierr) if (ierr .ne. 0) call fail(42) call check_close(sum(reactions(1,:)), -5.0_rk, 43) call check_close(sum(reactions(2,:)), ZERO, 44) call check_close(sum(reactions(3,:)), ZERO, 45) query_elems(1) = 1 call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & plastic_strain, eqps, damage, ierr) if (ierr .ne. 0) call fail(46) call check_close(strain_out(1,1), 5.0_rk / 6.0_rk, 47) call check_close(strain_out(2,1), ZERO, 48) call check_close(strain_out(3,1), ZERO, 49) call check_close(stress_out(1,1), 30.0_rk, 50) call check_close(stress_out(2,1), 10.0_rk, 51) call check_close(stress_out(3,1), 10.0_rk, 52) call check_close(maxval(abs(stress_out(4:6,1))), ZERO, 53) call fem_finalize(ierr) if (ierr .ne. 0) call fail(54) end subroutine check_static_linear_inp subroutine check_static_nonlinear_elastic() integer :: ierr integer :: iter integer :: step integer :: conv_increment integer :: conv_iteration integer :: conv_cutback_count integer :: conv_status_code integer :: conv_failure_code integer :: query_nodes(4) integer :: query_elems(1) real(rk) :: res_norm real(rk) :: conv_residual_norm real(rk) :: conv_correction_norm real(rk) :: conv_last_dt real(rk) :: conv_last_accepted_time real(rk) :: conv_relative_residual real(rk) :: conv_contact_gap real(rk) :: conv_combined_norm real(rk) :: time real(rk) :: displacement(NDIM) real(rk) :: velocity(NDIM) real(rk) :: acceleration(NDIM) real(rk) :: reactions(NDOF_NODE,4) real(rk) :: stress_out(NSTRESS,1) real(rk) :: strain_out(NSTRESS,1) real(rk) :: plastic_strain(NSTRESS,1) real(rk) :: eqps(1) real(rk) :: damage(1) logical :: conv_converged call fem_initialize(ierr) if (ierr .ne. 0) call fail(250) call fem_read_inp('tests/data/c3d4_static_nonlinear_elastic.inp', ierr) if (ierr .ne. 0) call fail(251) if (max_increment .ne. 4) call fail(252) call fem_build_model(ierr) if (ierr .ne. 0) call fail(253) call fem_solve_static_nonlinear(4, 50, 1.0e-12_rk, iter, res_norm, ierr) if (ierr .ne. 0) call fail(254) if (iter .le. 0 .or. iter .gt. 12) call fail(255) if (res_norm .gt. TOL) call fail(256) call fem_get_convergence_status(conv_increment, conv_iteration, & conv_residual_norm, conv_correction_norm, conv_converged, ierr) if (ierr .ne. 0) call fail(277) if (.not. conv_converged) call fail(278) if (conv_increment .ne. 4) call fail(279) if (conv_iteration .le. 0) call fail(280) if (conv_residual_norm .gt. TOL) call fail(281) if (conv_correction_norm .lt. ZERO) call fail(282) call fem_get_convergence_diagnostics(conv_cutback_count, conv_last_dt, & conv_last_accepted_time, conv_status_code, conv_failure_code, ierr) if (ierr .ne. 0) call fail(283) if (conv_cutback_count .ne. 0) call fail(284) call check_close(conv_last_dt, 0.25_rk, 285) if (conv_status_code .ne. CONVERGENCE_STATUS_CONVERGED) call fail(286) call check_close(conv_last_accepted_time, ONE, 287) if (conv_failure_code .ne. CONV_FAIL_NONE) call fail(288) call fem_get_convergence_metrics(conv_relative_residual, & conv_contact_gap, conv_combined_norm, ierr) if (ierr .ne. 0) call fail(289) if (conv_relative_residual .gt. TOL) call fail(290) call check_close(conv_contact_gap, ZERO, 291) if (conv_combined_norm .lt. conv_relative_residual .or. & conv_combined_norm .lt. conv_contact_gap) call fail(292) call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) if (ierr .ne. 0) call fail(257) call check_close(displacement(1), 5.0_rk / 6.0_rk, 258) call check_close(displacement(2), ZERO, 259) call check_close(displacement(3), ZERO, 260) call check_close(maxval(abs(velocity)), ZERO, 261) call check_close(maxval(abs(acceleration)), ZERO, 262) call fem_get_current_time(time, step, ierr) if (ierr .ne. 0) call fail(263) call check_close(time, ONE, 264) if (step .ne. 4) call fail(265) query_nodes(1) = 1 query_nodes(2) = 2 query_nodes(3) = 3 query_nodes(4) = 4 call fem_get_nodal_reactions(4, query_nodes, reactions, ierr) if (ierr .ne. 0) call fail(266) call check_close(sum(reactions(1,:)), -5.0_rk, 267) call check_close(sum(reactions(2,:)), ZERO, 268) call check_close(sum(reactions(3,:)), ZERO, 269) query_elems(1) = 1 call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & plastic_strain, eqps, damage, ierr) if (ierr .ne. 0) call fail(270) call check_close(strain_out(1,1), 5.0_rk / 6.0_rk, 271) call check_close(stress_out(1,1), 30.0_rk, 272) call check_close(stress_out(2,1), 10.0_rk, 273) call check_close(stress_out(3,1), 10.0_rk, 274) call check_close(maxval(abs(stress_out(4:6,1))), ZERO, 275) call fem_finalize(ierr) if (ierr .ne. 0) call fail(276) end subroutine check_static_nonlinear_elastic subroutine check_static_nonlinear_j2_disp() integer :: ierr integer :: iter integer :: step integer :: query_elems(1) real(rk) :: res_norm real(rk) :: time real(rk) :: displacement(NDIM) real(rk) :: velocity(NDIM) real(rk) :: acceleration(NDIM) real(rk) :: stress_out(NSTRESS,1) real(rk) :: strain_out(NSTRESS,1) real(rk) :: plastic_strain(NSTRESS,1) real(rk) :: eqps(1) real(rk) :: damage(1) call fem_initialize(ierr) if (ierr .ne. 0) call fail(300) call fem_read_inp('tests/data/c3d4_static_nonlinear_j2_disp.inp', ierr) if (ierr .ne. 0) call fail(301) if (max_increment .ne. 4) call fail(302) call fem_build_model(ierr) if (ierr .ne. 0) call fail(303) call fem_solve_static_nonlinear(4, 50, 1.0e-12_rk, iter, res_norm, ierr) if (ierr .ne. 0) call fail(304) if (iter .le. 0 .or. iter .gt. 4) call fail(305) if (res_norm .gt. TOL) call fail(306) call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) if (ierr .ne. 0) call fail(307) call check_close(displacement(1), 0.05_rk, 308) call check_close(displacement(2), ZERO, 309) call check_close(displacement(3), ZERO, 310) call fem_get_current_time(time, step, ierr) if (ierr .ne. 0) call fail(311) call check_close(time, ONE, 312) if (step .ne. 4) call fail(313) query_elems(1) = 1 call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & plastic_strain, eqps, damage, ierr) if (ierr .ne. 0) call fail(314) call check_close(strain_out(1,1), 0.05_rk, 315) if (eqps(1) .le. 1.0e-8_rk) call fail(316) if (stress_out(1,1) .ge. 18.0_rk) call fail(317) call fem_finalize(ierr) if (ierr .ne. 0) call fail(318) end subroutine check_static_nonlinear_j2_disp subroutine check_implicit_newmark_inp() integer :: ierr integer :: iter integer :: step integer :: max_steps logical :: user_dt real(rk) :: res_norm real(rk) :: time real(rk) :: dt real(rk) :: end_time real(rk) :: displacement(NDIM) real(rk) :: velocity(NDIM) real(rk) :: acceleration(NDIM) call fem_initialize(ierr) if (ierr .ne. 0) call fail(330) call fem_read_inp('tests/data/c3d4_implicit_newmark_pull.inp', ierr) if (ierr .ne. 0) call fail(331) call fem_get_time_control(dt, end_time, max_steps, user_dt, ierr) if (ierr .ne. 0) call fail(332) call check_close(dt, 0.1_rk, 333) call check_close(end_time, 0.1_rk, 334) if (.not. user_dt) call fail(335) if (max_steps .ne. 1) call fail(336) call fem_set_output_interval(0, ierr) if (ierr .ne. 0) call fail(337) call fem_build_model(ierr) if (ierr .ne. 0) call fail(338) call fem_run_implicit_newmark(50, 1.0e-12_rk, iter, res_norm, ierr) if (ierr .ne. 0) call fail(339) if (iter .le. 0 .or. iter .gt. 5) call fail(340) if (res_norm .gt. TOL) call fail(341) call fem_get_node_kinematics(2, displacement, velocity, acceleration, ierr) if (ierr .ne. 0) call fail(342) call check_close(displacement(1), 15.0_rk / 68.0_rk, 343) call check_close(velocity(1), 75.0_rk / 17.0_rk, 344) call check_close(acceleration(1), 1500.0_rk / 17.0_rk, 345) call check_close(displacement(2), ZERO, 346) call check_close(displacement(3), ZERO, 347) call fem_get_current_time(time, step, ierr) if (ierr .ne. 0) call fail(348) call check_close(time, 0.1_rk, 349) if (step .ne. 1) call fail(350) call fem_finalize(ierr) if (ierr .ne. 0) call fail(351) end subroutine check_implicit_newmark_inp subroutine check_contact_pair_inp() integer :: ierr call fem_initialize(ierr) if (ierr .ne. 0) call fail(370) call fem_read_inp('tests/data/s4_contact_pair.inp', ierr) if (ierr .ne. 0) call fail(371) if (ncontact_pair .ne. 1) call fail(372) if (trim(contact_pair_slave(1)) .ne. 'SLAVE') call fail(373) if (trim(contact_pair_master(1)) .ne. 'MASTER') call fail(374) call check_close(contact_pair_penalty(1), 1000.0_rk, 375) call check_close(contact_pair_damping(1), 2.0_rk, 376) call check_close(contact_pair_search(1), 0.1_rk, 377) call check_close(contact_pair_friction(1), 0.2_rk, 378) call fem_build_model(ierr) if (ierr .ne. 0) call fail(379) call fem_finalize(ierr) if (ierr .ne. 0) call fail(380) call fem_initialize(ierr) if (ierr .ne. 0) call fail(381) call fem_read_inp('tests/data/s4_contact_pair_surface.inp', ierr) if (ierr .ne. 0) call fail(382) if (n_surface .ne. 3) call fail(383) if (trim(surface_name(1)) .ne. 'MASTER_SURF') call fail(384) if (trim(surface_name(2)) .ne. 'SLAVE_SURF') call fail(385) if (trim(surface_target(1)) .ne. 'MASTER') call fail(386) if (trim(surface_face(1)) .ne. 'SPOS') call fail(387) if (trim(surface_target(2)) .ne. 'SLAVE') call fail(388) if (trim(surface_face(2)) .ne. 'SNEG') call fail(389) if (trim(surface_name(3)) .ne. 'MASTER_FACE') call fail(410) if (trim(surface_target(3)) .ne. 'MASTER') call fail(411) if (trim(surface_face(3)) .ne. 'S1') call fail(412) if (db_contact_facet_normal_sign(1, 1, 'MASTER_SURF') .ne. 1) & call fail(450) if (db_contact_facet_normal_sign(2, 1, 'SLAVE_SURF') .ne. -1) & call fail(451) if (.not. db_contact_facet_has_side(2, 1, 'SLAVE_SURF')) & call fail(452) if (db_contact_facet_has_side(1, 1, 'MASTER_FACE')) & call fail(453) if (.not. db_contact_facet_match(1, 1, 'MASTER_FACE')) call fail(413) if (db_contact_facet_match(1, 2, 'MASTER_FACE')) call fail(414) if (ncontact_pair .ne. 1) call fail(390) if (trim(contact_pair_slave(1)) .ne. 'SLAVE_SURF') call fail(391) if (trim(contact_pair_master(1)) .ne. 'MASTER_SURF') call fail(392) call check_close(contact_pair_penalty(1), 1000.0_rk, 393) call check_close(contact_pair_damping(1), 2.0_rk, 394) call check_close(contact_pair_search(1), 0.1_rk, 395) call check_close(contact_pair_friction(1), 0.2_rk, 396) call fem_build_model(ierr) if (ierr .ne. 0) call fail(397) call fem_finalize(ierr) if (ierr .ne. 0) call fail(398) call fem_initialize(ierr) if (ierr .ne. 0) call fail(420) call fem_read_inp('tests/data/s4_contact_pair_surface_mixed.inp', ierr) if (ierr .ne. 0) call fail(421) if (n_surface .ne. 2) call fail(422) if (trim(surface_name(1)) .ne. 'MASTER_ALL') call fail(423) if (trim(surface_name(2)) .ne. 'SLAVE_ALL') call fail(424) if (surface_start(1) .ne. 1) call fail(425) if (surface_count(1) .ne. 2) call fail(426) if (surface_start(2) .ne. 3) call fail(427) if (surface_count(2) .ne. 1) call fail(428) if (trim(surface_target(1)) .ne. 'MASTER') call fail(429) if (len_trim(surface_face(1)) .ne. 0) call fail(430) if (trim(surface_target(2)) .ne. '1') call fail(431) if (trim(surface_face(2)) .ne. 'S1') call fail(432) if (trim(surface_target(3)) .ne. '2') call fail(433) if (len_trim(surface_face(3)) .ne. 0) call fail(434) if (.not. db_contact_facet_match(1, 1, 'MASTER_ALL')) call fail(435) if (.not. db_contact_facet_match(1, 6, 'MASTER_ALL')) call fail(436) if (db_contact_facet_match(2, 1, 'MASTER_ALL')) call fail(437) if (.not. db_contact_facet_match(2, 1, 'SLAVE_ALL')) call fail(438) if (ncontact_pair .ne. 1) call fail(439) if (trim(contact_pair_slave(1)) .ne. 'SLAVE_ALL') call fail(440) if (trim(contact_pair_master(1)) .ne. 'MASTER_ALL') call fail(441) call fem_build_model(ierr) if (ierr .ne. 0) call fail(442) call fem_finalize(ierr) if (ierr .ne. 0) call fail(443) call fem_initialize(ierr) if (ierr .ne. 0) call fail(460) call fem_read_inp('tests/data/s4_contact_pair_surface_ops.inp', ierr) if (ierr .ne. 0) call fail(461) if (n_surface .ne. 2) call fail(462) if (trim(surface_name(1)) .ne. 'MASTER_OP') call fail(463) if (trim(surface_name(2)) .ne. 'SLAVE_OP') call fail(464) if (surface_count(1) .ne. 2) call fail(465) if (surface_count(2) .ne. 1) call fail(466) if (surface_owner(1) .ne. 1) call fail(467) if (surface_owner(2) .ne. 0) call fail(468) if (surface_owner(3) .ne. 1) call fail(469) if (surface_owner(4) .ne. 2) call fail(470) if (.not. db_contact_facet_match(1, 1, 'MASTER_OP')) call fail(471) if (db_contact_facet_normal_sign(2, 1, 'SLAVE_OP') .ne. 1) & call fail(472) if (.not. db_contact_facet_has_side(2, 1, 'SLAVE_OP')) call fail(473) if (ncontact_pair .ne. 1) call fail(474) if (trim(contact_pair_slave(1)) .ne. 'SLAVE_OP') call fail(475) if (trim(contact_pair_master(1)) .ne. 'MASTER_OP') call fail(476) call fem_build_model(ierr) if (ierr .ne. 0) call fail(477) call fem_finalize(ierr) if (ierr .ne. 0) call fail(478) call check_node_surface_inp() call check_contact_property_inp() call check_contact_analytical_inp() call check_contact_pair_input_errors() end subroutine check_contact_pair_inp subroutine check_contact_analytical_inp() integer :: ierr integer :: node_count call fem_initialize(ierr) if (ierr .ne. 0) call fail(560) call fem_read_inp('tests/data/s4_contact_analytical_plane.inp', ierr) if (ierr .ne. 0) call fail(561) if (n_surface .ne. 2) call fail(562) if (trim(surface_type(1)) .ne. 'NODE') call fail(563) if (trim(surface_type(2)) .ne. 'ANALYTICAL') call fail(564) if (trim(surface_target(2)) .ne. 'PLANE') call fail(565) call check_close(surface_plane_normal(1,2), ZERO, 566) call check_close(surface_plane_normal(2,2), ZERO, 567) call check_close(surface_plane_normal(3,2), ONE, 568) call check_close(surface_plane_offset(2), ZERO, 569) if (trim(contact_pair_slave(1)) .ne. 'SLAVE_NODES') call fail(570) if (trim(contact_pair_master(1)) .ne. 'RIGID_PLANE') call fail(571) call fem_get_surface_node_count('SLAVE_NODES', node_count, ierr) if (ierr .ne. 0) call fail(572) if (node_count .ne. 1) call fail(573) call fem_build_model(ierr) if (ierr .ne. 0) call fail(574) call fem_finalize(ierr) if (ierr .ne. 0) call fail(575) end subroutine check_contact_analytical_inp subroutine check_contact_property_inp() integer :: ierr call fem_initialize(ierr) if (ierr .ne. 0) call fail(530) call fem_read_inp('tests/data/s4_contact_property.inp', ierr) if (ierr .ne. 0) call fail(531) if (n_contact_property .ne. 1) call fail(532) if (trim(contact_property_name(1)) .ne. 'PROP1') call fail(533) call check_close(contact_property_penalty(1), 1000.0_rk, 534) call check_close(contact_property_damping(1), 2.0_rk, 535) call check_close(contact_property_search(1), 0.1_rk, 536) call check_close(contact_property_friction(1), 0.2_rk, 537) call check_close(contact_property_aug_factor(1), 0.25_rk, 545) call check_close(contact_property_friction_reg(1), 0.05_rk, 547) if (trim(contact_pair_property(1)) .ne. 'PROP1') call fail(538) call fem_build_model(ierr) if (ierr .ne. 0) call fail(539) call check_close(contact_pair_penalty(1), 1000.0_rk, 540) call check_close(contact_pair_damping(1), 2.0_rk, 541) call check_close(contact_pair_search(1), 0.1_rk, 542) call check_close(contact_pair_friction(1), 0.2_rk, 543) call check_close(contact_pair_aug_factor(1), 0.25_rk, 546) call check_close(contact_pair_friction_reg(1), 0.05_rk, 548) call fem_finalize(ierr) if (ierr .ne. 0) call fail(544) end subroutine check_contact_property_inp subroutine check_contact_pair_input_errors() call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_slave.inp', 401) call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_master.inp', 404) call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_penalty.inp', 407) call check_contact_pair_build_error('tests/data/s4_contact_pair_surface_bad_face.inp', 415) call check_contact_pair_inp_error( & 'tests/data/s4_contact_pair_surface_bad_analytical_line.inp', 445) call check_contact_pair_build_error('tests/data/s4_contact_pair_unknown_property.inp', 548) end subroutine check_contact_pair_input_errors subroutine check_node_surface_inp() integer :: ierr integer :: node_count integer :: node_ids(4) integer :: small_node_ids(2) call fem_initialize(ierr) if (ierr .ne. 0) call fail(480) call fem_read_inp('tests/data/s4_node_surface.inp', ierr) if (ierr .ne. 0) call fail(481) if (n_surface .ne. 1) call fail(482) if (trim(surface_name(1)) .ne. 'NODE_SURF') call fail(483) if (trim(surface_type(1)) .ne. 'NODE') call fail(484) if (surface_start(1) .ne. 1) call fail(485) if (surface_count(1) .ne. 2) call fail(486) if (trim(surface_target(1)) .ne. 'TOP_NODES') call fail(487) if (trim(surface_target(2)) .ne. '1') call fail(488) if (db_contact_facet_match(1, 1, 'NODE_SURF')) call fail(489) call fem_build_model(ierr) if (ierr .ne. 0) call fail(490) call fem_get_surface_node_count('NODE_SURF', node_count, ierr) if (ierr .ne. 0) call fail(492) if (node_count .ne. 3) call fail(493) call fem_get_surface_nodes('NODE_SURF', 4, node_ids, node_count, ierr) if (ierr .ne. 0) call fail(494) if (node_count .ne. 3) call fail(495) if (node_ids(1) .ne. 3 .or. node_ids(2) .ne. 4 .or. & node_ids(3) .ne. 1) call fail(496) call fem_get_surface_nodes('NODE_SURF', 2, small_node_ids, node_count, ierr) if (ierr .eq. 0) call fail(497) call fem_finalize(ierr) if (ierr .ne. 0) call fail(491) end subroutine check_node_surface_inp subroutine check_contact_pair_inp_error(path, code_base) character(len=*), intent(in) :: path integer, intent(in) :: code_base integer :: ierr call fem_initialize(ierr) if (ierr .ne. 0) call fail(code_base) call fem_read_inp(path, ierr) if (ierr .eq. 0) call fail(code_base + 1) call fem_finalize(ierr) if (ierr .ne. 0) call fail(code_base + 2) end subroutine check_contact_pair_inp_error subroutine check_contact_pair_build_error(path, code_base) character(len=*), intent(in) :: path integer, intent(in) :: code_base integer :: ierr call fem_initialize(ierr) if (ierr .ne. 0) call fail(code_base) call fem_read_inp(path, ierr) if (ierr .ne. 0) call fail(code_base + 1) call fem_build_model(ierr) if (ierr .eq. 0) call fail(code_base + 2) call fem_finalize(ierr) if (ierr .ne. 0) call fail(code_base + 3) end subroutine check_contact_pair_build_error subroutine check_static_patch_file(path, probe_node, expected_ux, code_base) character(len=*), intent(in) :: path integer, intent(in) :: probe_node real(rk), intent(in) :: expected_ux integer, intent(in) :: code_base integer :: ierr integer :: iter integer :: step integer :: query_elems(1) real(rk) :: res_norm real(rk) :: time real(rk) :: displacement(NDIM) real(rk) :: velocity(NDIM) real(rk) :: acceleration(NDIM) real(rk) :: stress_out(NSTRESS,1) real(rk) :: strain_out(NSTRESS,1) real(rk) :: plastic_strain(NSTRESS,1) real(rk) :: eqps(1) real(rk) :: damage(1) call fem_initialize(ierr) if (ierr .ne. 0) call fail(code_base + 1) call fem_read_inp(path, ierr) if (ierr .ne. 0) call fail(code_base + 2) if (analysis_type .ne. ANALYSIS_STATIC_LINEAR) call fail(code_base + 3) call fem_build_model(ierr) if (ierr .ne. 0) call fail(code_base + 4) call fem_solve_static_linear(50, 1.0e-12_rk, iter, res_norm, ierr) if (ierr .ne. 0) call fail(code_base + 5) if (iter .le. 0 .or. iter .gt. 5) call fail(code_base + 6) if (res_norm .gt. TOL) call fail(code_base + 7) call fem_get_node_kinematics(probe_node, displacement, velocity, acceleration, ierr) if (ierr .ne. 0) call fail(code_base + 8) call check_close(displacement(1), expected_ux, code_base + 9) call check_close(displacement(2), ZERO, code_base + 10) call check_close(displacement(3), ZERO, code_base + 11) query_elems(1) = 1 call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & plastic_strain, eqps, damage, ierr) if (ierr .ne. 0) call fail(code_base + 12) call check_close(strain_out(1,1), 0.01_rk, code_base + 13) call check_close(strain_out(2,1), ZERO, code_base + 14) call check_close(strain_out(3,1), ZERO, code_base + 15) call check_close(stress_out(1,1), 0.36_rk, code_base + 16) call check_close(stress_out(2,1), 0.12_rk, code_base + 17) call check_close(stress_out(3,1), 0.12_rk, code_base + 18) call check_close(maxval(abs(stress_out(4:6,1))), ZERO, code_base + 19) call fem_get_current_time(time, step, ierr) if (ierr .ne. 0) call fail(code_base + 20) call check_close(time, ONE, code_base + 21) if (step .ne. 1) call fail(code_base + 22) call fem_finalize(ierr) if (ierr .ne. 0) call fail(code_base + 23) end subroutine check_static_patch_file subroutine check_shell_static_patch(path, probe_node, code_base) character(len=*), intent(in) :: path integer, intent(in) :: probe_node integer, intent(in) :: code_base integer :: ierr integer :: iter integer :: step integer :: query_elems(1) real(rk) :: res_norm real(rk) :: time real(rk) :: displacement(NDIM) real(rk) :: velocity(NDIM) real(rk) :: acceleration(NDIM) real(rk) :: stress_out(NSTRESS,1) real(rk) :: strain_out(NSTRESS,1) real(rk) :: plastic_strain(NSTRESS,1) real(rk) :: eqps(1) real(rk) :: damage(1) call fem_initialize(ierr) if (ierr .ne. 0) call fail(code_base) call fem_read_inp(path, ierr) if (ierr .ne. 0) call fail(code_base + 1) if (analysis_type .ne. ANALYSIS_STATIC_LINEAR) call fail(code_base + 2) call fem_build_model(ierr) if (ierr .ne. 0) call fail(code_base + 3) call fem_solve_static_linear(50, 1.0e-12_rk, iter, res_norm, ierr) if (ierr .ne. 0) call fail(code_base + 4) if (iter .le. 0 .or. iter .gt. 5) call fail(code_base + 5) if (res_norm .gt. TOL) call fail(code_base + 6) call fem_get_node_kinematics(probe_node, displacement, velocity, acceleration, ierr) if (ierr .ne. 0) call fail(code_base + 7) call check_close(displacement(1), 0.01_rk, code_base + 8) call check_close(displacement(2), ZERO, code_base + 9) call check_close(displacement(3), ZERO, code_base + 10) query_elems(1) = 1 call fem_get_element_average_state(1, query_elems, stress_out, strain_out, & plastic_strain, eqps, damage, ierr) if (ierr .ne. 0) call fail(code_base + 11) call check_close(strain_out(1,1), 0.01_rk, code_base + 12) call check_close(strain_out(2,1), ZERO, code_base + 13) call check_close(strain_out(3,1), ZERO, code_base + 14) call check_close(stress_out(1,1), 0.32_rk, code_base + 15) call check_close(stress_out(2,1), 0.08_rk, code_base + 16) call check_close(stress_out(3,1), ZERO, code_base + 17) call check_close(maxval(abs(stress_out(4:6,1))), ZERO, code_base + 18) call fem_get_current_time(time, step, ierr) if (ierr .ne. 0) call fail(code_base + 19) call check_close(time, ONE, code_base + 20) if (step .ne. 1) call fail(code_base + 21) call fem_finalize(ierr) if (ierr .ne. 0) call fail(code_base + 22) end subroutine check_shell_static_patch subroutine check_close(actual, expected, code) real(rk), intent(in) :: actual real(rk), intent(in) :: expected integer, intent(in) :: code if (abs(actual - expected) .gt. TOL) call fail(code) end subroutine check_close subroutine fail(code) integer, intent(in) :: code write(*,*) 'test_implicit_inp failed:', code stop 1 end subroutine fail end program test_implicit_inp