Release FemLite 0.5.2 V5 closeout
FemLite CI / build-test (push) Has been cancelled

This commit is contained in:
shenw
2026-07-01 14:51:40 +08:00
parent 5e90d58d0e
commit 75d4e735b1
82 changed files with 9972 additions and 2613 deletions
+185 -102
View File
@@ -19,7 +19,8 @@ program test_implicit_inp
section_thickness, section_layer_start, &
section_layer_count, section_layer_thickness, &
section_layer_material_name, section_layer_material, &
elem_mat, fint
elem_mat, fint, nmpc, nmpc_term, mpc_start, &
mpc_count, mpc_node, mpc_dof, mpc_coeff, mpc_penalty
use fem_database_surface, only: db_contact_facet_match, &
db_contact_facet_normal_sign, &
db_contact_facet_has_side
@@ -43,9 +44,13 @@ program test_implicit_inp
call check_s4_comp_section_inp()
call check_static_nonlinear_elastic()
call check_static_nonlinear_j2_disp()
call check_buckling_step_inp()
call check_buckling_preload_inp()
call check_buck_solid_preload()
call check_cyclic_solid_inp()
call check_cyclic_symmetry_inp()
call check_nlc_inp()
call check_arc_disp_continuation_api()
call check_s4_curved_nonlinear_path()
call check_sph_zero_int()
call check_implicit_newmark_inp()
call check_contact_pair_inp()
@@ -139,6 +144,88 @@ contains
end subroutine check_implicit_linear_compat
subroutine check_cyclic_solid_inp()
integer :: ierr
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(2200)
call fem_read_inp('tests/data/c3d4_cyclic_symmetry.inp', ierr)
if (ierr .ne. 0) call fail(2201)
if (cyclic_num_sectors .ne. 4) call fail(2202)
if (cyclic_dof_count .ne. 3) call fail(2203)
if (cyclic_pair_count .ne. 1) call fail(2204)
if (nmpc .ne. 3) call fail(2205)
if (nmpc_term .ne. 6) call fail(2206)
call check_cyclic_equation(1, 2, 1, ONE, 1, 2, ONE, 2210)
call check_cyclic_equation(2, 2, 2, ONE, 1, 1, -ONE, 2220)
call check_cyclic_equation(3, 2, 3, ONE, 1, 3, -ONE, 2230)
end subroutine check_cyclic_solid_inp
subroutine check_buck_solid_preload()
integer :: ierr
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(2250)
call fem_read_inp('tests/data/c3d4_buckling_solid_preload.inp', ierr)
if (ierr .ne. 0) call fail(2251)
if (analysis_type .ne. ANALYSIS_BUCKLING) call fail(2252)
if (.not. buckling_static_preload_req) call fail(2253)
if (buckling_num_modes .ne. 1) call fail(2254)
if (buckling_geom_line_count .ne. 0) call fail(2255)
end subroutine check_buck_solid_preload
subroutine check_cyclic_symmetry_inp()
integer :: ierr
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(2300)
call fem_read_inp('tests/data/s4_cyclic_symmetry.inp', ierr)
if (ierr .ne. 0) call fail(2301)
if (cyclic_num_sectors .ne. 4) call fail(2302)
if (cyclic_wave_number .ne. 0) call fail(2303)
if (cyclic_dof_count .ne. 6) call fail(2304)
if (cyclic_pair_count .ne. 1) call fail(2305)
if (nmpc .ne. 6) call fail(2306)
if (nmpc_term .ne. 12) call fail(2307)
if (abs(mpc_penalty(1) - 1.0e9_rk) .gt. ONE) call fail(2308)
call check_cyclic_equation(1, 2, 1, ONE, 1, 2, ONE, 2310)
call check_cyclic_equation(2, 2, 2, ONE, 1, 1, -ONE, 2320)
call check_cyclic_equation(3, 2, 3, ONE, 1, 3, -ONE, 2330)
call check_cyclic_equation(4, 2, 4, ONE, 1, 5, ONE, 2340)
call check_cyclic_equation(5, 2, 5, ONE, 1, 4, -ONE, 2350)
call check_cyclic_equation(6, 2, 6, ONE, 1, 6, -ONE, 2360)
end subroutine check_cyclic_symmetry_inp
subroutine check_cyclic_equation(eqn, slave_node, slave_dof, slave_coeff, &
master_node, master_dof, master_coeff, code)
integer, intent(in) :: eqn
integer, intent(in) :: slave_node
integer, intent(in) :: slave_dof
integer, intent(in) :: master_node
integer, intent(in) :: master_dof
integer, intent(in) :: code
real(rk), intent(in) :: slave_coeff
real(rk), intent(in) :: master_coeff
integer :: start_pos
if (mpc_count(eqn) .ne. 2) call fail(code)
start_pos = mpc_start(eqn)
if (mpc_node(start_pos) .ne. slave_node) call fail(code + 1)
if (mpc_dof(start_pos) .ne. slave_dof) call fail(code + 2)
call check_close(mpc_coeff(start_pos), slave_coeff, code + 3)
if (mpc_node(start_pos + 1) .ne. master_node) call fail(code + 4)
if (mpc_dof(start_pos + 1) .ne. master_dof) call fail(code + 5)
call check_close(mpc_coeff(start_pos + 1), master_coeff, code + 6)
end subroutine check_cyclic_equation
subroutine check_static_linear_inp()
integer :: ierr
integer :: iter
@@ -223,6 +310,45 @@ contains
if (ierr .ne. 0) call fail(54)
end subroutine check_static_linear_inp
subroutine check_buckling_step_inp()
integer :: ierr
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(1230)
call fem_read_inp('tests/data/c3d4_buckling_step.inp', ierr)
if (ierr .ne. 0) call fail(1231)
if (analysis_type .ne. ANALYSIS_BUCKLING) call fail(1232)
if (buckling_static_preload_req) call fail(1265)
if (buckling_num_modes .ne. 1) call fail(1260)
if (buckling_geom_line_count .ne. 1) call fail(1261)
if (buckling_geom_line_node1(1) .ne. 1) call fail(1262)
if (buckling_geom_line_node2(1) .ne. 2) call fail(1263)
call check_close(buckling_geom_line_force(1), ONE, 1264)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(1233)
end subroutine check_buckling_step_inp
subroutine check_buckling_preload_inp()
integer :: ierr
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(1270)
call fem_read_inp('tests/data/c3d4_buckling_static_preload.inp', ierr)
if (ierr .ne. 0) call fail(1271)
if (analysis_type .ne. ANALYSIS_BUCKLING) call fail(1272)
if (.not. buckling_static_preload_req) call fail(1273)
if (buckling_num_modes .ne. 1) call fail(1274)
if (buckling_geom_line_count .ne. 1) call fail(1275)
if (buck_geom_line_kind(1) .ne. BUCK_GEOM_PRELOAD) call fail(1277)
call check_close(buck_geom_line_area(1), ONE, 1278)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(1276)
end subroutine check_buckling_preload_inp
subroutine check_s4_comp_section_inp()
integer :: ierr
@@ -573,28 +699,54 @@ contains
call control_set_defaults()
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=ARC_LENGTH_OR_DISPLACEMENT_CONTROL,'// &
' ARC_LENGTH=0.35, ARC_LOAD_SCALE=2.5, SHELL_GEOMETRIC=YES', ierr)
' ARC_LENGTH=0.35, ARC_LOAD_SCALE=2.5, SHELL_GEOMETRIC=FINITE_STRAIN,'// &
' DISP_ADAPTIVE=YES', ierr)
if (ierr .ne. 0) call fail(1260)
if (nonlinear_continuation_method .ne. NLC_ARC_DISP) call fail(1261)
if (.not. shell_geometric_nonlinear) call fail(1262)
if (.not. shell_finite_strain_requested) call fail(1262)
if (.not. use_disp_path_adaptive) call fail(1271)
call check_close(nlc_arc_length_radius, 0.35_rk, 1267)
call check_close(nlc_arc_load_scale, 2.5_rk, 1268)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=ARC_LENGTH_OR_DISPLACEMENT_CONTROL,'// &
' COROTATIONAL_SHELL=NO', ierr)
' TRUST_RADIUS=0.12, TRUST_MIN_RADIUS=0.01, TRUST_MAX_RADIUS=0.2', &
ierr)
if (ierr .ne. 0) call fail(1277)
if (nonlinear_continuation_method .ne. NLC_ARC_DISP) call fail(1278)
call check_close(nlc_trust_radius, 0.12_rk, 1279)
call check_close(nlc_trust_min_radius, 0.01_rk, 1280)
call check_close(nlc_trust_max_radius, 0.2_rk, 1281)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=ARC_LENGTH_OR_DISPLACEMENT_CONTROL,'// &
' SHELL_GEOMETRIC=LINEAR, DISP_ADAPTIVE=NO', ierr)
if (ierr .ne. 0) call fail(1263)
if (shell_geometric_nonlinear) call fail(1264)
if (shell_finite_strain_requested) call fail(1264)
if (use_disp_path_adaptive) call fail(1272)
end subroutine check_nlc_valid_options
subroutine check_nlc_error_rollbacks()
integer :: ierr
shell_geometric_nonlinear = .true.
shell_finite_strain_requested = .true.
use_disp_path_adaptive = .true.
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, SHELL_GEOMETRIC=MAYBE', ierr)
if (ierr .eq. 0) call fail(1265)
if (.not. shell_geometric_nonlinear) call fail(1266)
if (.not. shell_finite_strain_requested) call fail(1266)
if (.not. use_disp_path_adaptive) call fail(1273)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, COROTATIONAL_SHELL=NO', ierr)
if (ierr .eq. 0) call fail(1269)
if (.not. shell_finite_strain_requested) call fail(1270)
if (.not. use_disp_path_adaptive) call fail(1274)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, DISP_ADAPTIVE=MAYBE', ierr)
if (ierr .eq. 0) call fail(1275)
if (.not. use_disp_path_adaptive) call fail(1276)
call control_set_defaults()
nonlinear_continuation_method = NLC_ADAPT_NEWTON
@@ -763,98 +915,6 @@ contains
if (ierr .ne. 0) call fail(1255)
end subroutine check_arc_disp_continuation_api
subroutine check_s4_curved_nonlinear_path()
integer :: ierr
integer :: iter
integer :: path_count
integer :: row
integer :: row_step
integer :: control_dof_count
integer :: row_iteration
integer :: status_code
integer :: failure_code
real(rk) :: res_norm
real(rk) :: rel_norm
real(rk) :: contact_gap
real(rk) :: combined_norm
real(rk) :: row_time
real(rk) :: control_parameter
real(rk) :: prescribed_l2
real(rk) :: prescribed_max
real(rk) :: actual_l2
real(rk) :: actual_max
real(rk) :: residual_linf
real(rk) :: residual_l2
real(rk) :: reaction_sum
real(rk) :: reaction_generalized
real(rk) :: work
real(rk) :: residual_norm
real(rk) :: relative_residual
real(rk) :: correction_norm
real(rk) :: first_secant
real(rk) :: last_secant
real(rk) :: max_secant
real(rk) :: secant
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(2400)
call fem_read_inp('tests/data/s4_curved_nonlinear_patch.inp', ierr)
if (ierr .ne. 0) call fail(2401)
if (nonlinear_continuation_method .ne. NLC_ARC_DISP) call fail(2402)
if (.not. shell_geometric_nonlinear) call fail(2403)
call fem_build_model(ierr)
if (ierr .ne. 0) call fail(2404)
call fem_solve_static_nonlinear(20, 120, 1.0e-8_rk, iter, res_norm, ierr)
if (ierr .ne. 0) call fail(2405)
if (iter .le. 20) call fail(2406)
call fem_get_convergence_metrics(rel_norm, contact_gap, combined_norm, ierr)
if (ierr .ne. 0) call fail(2407)
if (rel_norm .gt. 1.0e-8_rk) call fail(2424)
call fem_get_continuation_path_count(path_count, ierr)
if (ierr .ne. 0) call fail(2408)
if (path_count .ne. 20) call fail(2409)
first_secant = ZERO
last_secant = ZERO
max_secant = ZERO
do row = 1, path_count
call fem_get_continuation_path_row(row, row_step, row_time, &
control_parameter, control_dof_count, prescribed_l2, prescribed_max, &
actual_l2, actual_max, residual_linf, residual_l2, reaction_sum, &
reaction_generalized, work, row_iteration, residual_norm, &
relative_residual, correction_norm, status_code, failure_code, ierr)
if (ierr .ne. 0) call fail(2410)
if (row_step .ne. row) call fail(2411)
if (control_dof_count .ne. 1) call fail(2412)
if (residual_linf .gt. 1.0e-10_rk) call fail(2413)
if (residual_l2 .gt. 1.0e-10_rk) call fail(2414)
if (reaction_sum .ge. ZERO) call fail(2415)
if (row_iteration .le. 0) call fail(2416)
if (status_code .ne. CONVERGENCE_STATUS_CONVERGED) call fail(2417)
if (failure_code .ne. CONV_FAIL_NONE) call fail(2418)
if (relative_residual .gt. 1.0e-8_rk) call fail(2425)
if (abs(actual_l2 - prescribed_l2) .gt. &
1.0e-10_rk * max(ONE, prescribed_l2)) call fail(2419)
if (prescribed_l2 .gt. TOL) then
secant = abs(reaction_generalized) / prescribed_l2
if (row .eq. 1) first_secant = secant
last_secant = secant
max_secant = max(max_secant, secant)
end if
end do
call check_close(prescribed_l2, 1.5_rk, 2420)
if (last_secant .le. 1.05_rk * first_secant) call fail(2421)
if (max_secant .lt. last_secant) call fail(2422)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(2423)
end subroutine check_s4_curved_nonlinear_path
subroutine check_sph_zero_int()
integer :: ierr
real(rk) :: max_force
@@ -864,19 +924,40 @@ contains
call fem_read_inp('examples/spherical_cap_with_central_point_load/'// &
'spherical_cap_displacement_control_shell4.inp', ierr)
if (ierr .ne. 0) call fail(1401)
if (.not. shell_finite_strain_requested) call fail(1406)
call fem_build_model(ierr)
if (ierr .ne. 0) call fail(1402)
call element_compute_internal_force(ierr)
if (ierr .ne. FEM_SUCCESS) call fail(1403)
max_force = maxval(abs(fint))
if (max_force .gt. 1.0e-7_rk) then
write(*,'(A,ES16.8)') 'spherical zero internal max force=', max_force
if (max_force .gt. 1.0e-5_rk) then
write(*,'(A,ES16.8)') 'spherical finite S4 zero internal max force=', max_force
call fail(1404)
end if
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(1405)
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(1407)
call fem_read_inp('examples/spherical_cap_with_central_point_load/'// &
'spherical_cap_displacement_control.inp', ierr)
if (ierr .ne. 0) call fail(1408)
if (shell_finite_strain_requested) call fail(1409)
call fem_build_model(ierr)
if (ierr .ne. 0) call fail(1410)
call element_compute_internal_force(ierr)
if (ierr .ne. FEM_SUCCESS) call fail(1411)
max_force = maxval(abs(fint))
if (max_force .gt. 1.0e-7_rk) then
write(*,'(A,ES16.8)') 'spherical zero internal max force=', max_force
call fail(1412)
end if
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(1413)
end subroutine check_sph_zero_int
subroutine check_contact_pair_inp()
@@ -1076,6 +1157,8 @@ contains
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)
call check_contact_pair_build_error( &
'tests/data/s4_node_surface_element_master.inp', 552)
end subroutine check_contact_pair_input_errors
subroutine check_node_surface_inp()