Advance V5 nonlinear benchmarks and shell solver

This commit is contained in:
shenw
2026-06-27 16:43:00 +08:00
parent a2a11179d9
commit db68340aaf
84 changed files with 38720 additions and 971 deletions
+274
View File
@@ -19,6 +19,7 @@ program test_implicit_inp
use fem_database_surface, only: db_contact_facet_match, &
db_contact_facet_normal_sign, &
db_contact_facet_has_side
use fem_inp_helpers, only: parse_nlc_header
use fem_sparse_csr_diagnostics, only: CSR_CLASS_GENERAL, &
CSR_CLASS_SPD_CAND
implicit none
@@ -36,6 +37,8 @@ program test_implicit_inp
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_nlc_inp()
call check_arc_disp_continuation_api()
call check_implicit_newmark_inp()
call check_contact_pair_inp()
@@ -429,6 +432,277 @@ contains
if (ierr .ne. 0) call fail(351)
end subroutine check_implicit_newmark_inp
subroutine check_nlc_inp()
integer :: ierr
integer :: method
character(len=256) :: header
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(1100)
if (nonlinear_continuation_method .ne. NLC_DEFAULT) call fail(1101)
call fem_read_inp('tests/data/c3d4_static_nonlinear_elastic.inp', ierr)
if (ierr .ne. 0) call fail(1102)
if (nonlinear_continuation_method .ne. NLC_DEFAULT) call fail(1103)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(1104)
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(1110)
call fem_read_inp('tests/data/c3d4_static_nonlinear_continuation.inp', &
ierr)
if (ierr .ne. 0) call fail(1111)
if (nonlinear_continuation_method .ne. &
NLC_ADAPT_NEWTON) call fail(1112)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(1113)
do method = NLC_TWO_STAGE, NLC_MC_SUBSTEP
call control_set_defaults()
write(header,'(A,I0)') '*NONLINEAR CONTINUATION, METHOD=', method
call parse_nlc_header(header, ierr)
if (ierr .ne. 0) call fail(1120 + method)
if (nonlinear_continuation_method .ne. method) call fail(1130 + method)
end do
call check_nlc_symbol('TWO_STAGE_LOAD_STRENGTH', &
NLC_TWO_STAGE, 1140)
call check_nlc_symbol('ADAPTIVE_TARGET_NEWTON', &
NLC_ADAPT_NEWTON, 1150)
call check_nlc_symbol('TRUST_REGION_DAMPED_NEWTON', &
NLC_TRUST_DAMPED, 1160)
call check_nlc_symbol('ARC_LENGTH_OR_DISPLACEMENT_CONTROL', &
NLC_ARC_DISP, 1170)
call check_nlc_symbol('MC_SUBSTEPPING_SEMISMOOTH', &
NLC_MC_SUBSTEP, 1180)
call control_set_defaults()
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=MC_SUBSTEPPING_SEMISMOOTH,'// &
' MC_MIN_SUBSTEPS=3, MC_MAX_SUBSTEPS=24,'// &
' MC_TARGET_STRAIN=2.5E-4, MC_YIELD_TOL=1.0E-9,'// &
' MC_PLASTIC_LIMIT=2.5E-2', ierr)
if (ierr .ne. 0) call fail(1220)
if (nonlinear_continuation_method .ne. NLC_MC_SUBSTEP) call fail(1221)
if (nlc_mc_min_substeps .ne. 3) call fail(1222)
if (nlc_mc_max_substeps .ne. 24) call fail(1223)
call check_close(nlc_mc_target_strain, 2.5e-4_rk, 1224)
call check_close(nlc_mc_yield_tolerance, 1.0e-9_rk, 1225)
call check_close(nlc_mc_plastic_limit, 2.5e-2_rk, 1226)
call control_set_defaults()
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=ADAPTIVE_TARGET_NEWTON,'// &
' TARGET_NEWTON=9, GROWTH=1.75, SHRINK=0.4', ierr)
if (ierr .ne. 0) call fail(1185)
if (nonlinear_continuation_method .ne. NLC_ADAPT_NEWTON) call fail(1186)
if (nlc_target_newton .ne. 9) call fail(1187)
call check_close(nlc_growth_factor, 1.75_rk, 1188)
call check_close(nlc_shrink_factor, 0.4_rk, 1189)
call control_set_defaults()
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=TRUST_REGION_DAMPED_NEWTON,'// &
' TRUST_RADIUS=0.2, TRUST_MIN_RADIUS=0.05,'// &
' TRUST_MAX_RADIUS=0.4, TRUST_GROWTH=1.8,'// &
' TRUST_SHRINK=0.35, TRUST_ACCEPT_RATIO=0.1,'// &
' TRUST_GOOD_RATIO=0.7', ierr)
if (ierr .ne. 0) call fail(1200)
if (nonlinear_continuation_method .ne. NLC_TRUST_DAMPED) call fail(1201)
call check_close(nlc_trust_radius, 0.2_rk, 1202)
call check_close(nlc_trust_min_radius, 0.05_rk, 1203)
call check_close(nlc_trust_max_radius, 0.4_rk, 1204)
call check_close(nlc_trust_growth_factor, 1.8_rk, 1205)
call check_close(nlc_trust_shrink_factor, 0.35_rk, 1206)
call check_close(nlc_trust_accept_ratio, 0.1_rk, 1207)
call check_close(nlc_trust_good_ratio, 0.7_rk, 1208)
call control_set_defaults()
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=ARC_LENGTH_OR_DISPLACEMENT_CONTROL,'// &
' SHELL_GEOMETRIC=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)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=ARC_LENGTH_OR_DISPLACEMENT_CONTROL,'// &
' COROTATIONAL_SHELL=NO', ierr)
if (ierr .ne. 0) call fail(1263)
if (shell_geometric_nonlinear) call fail(1264)
shell_geometric_nonlinear = .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)
call control_set_defaults()
nonlinear_continuation_method = NLC_ADAPT_NEWTON
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=6', ierr)
if (ierr .eq. 0) call fail(1190)
if (nonlinear_continuation_method .ne. &
NLC_ADAPT_NEWTON) call fail(1191)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=NOT_A_METHOD', ierr)
if (ierr .eq. 0) call fail(1192)
if (nonlinear_continuation_method .ne. &
NLC_ADAPT_NEWTON) call fail(1193)
nlc_target_newton = 7
nlc_growth_factor = 1.6_rk
nlc_shrink_factor = 0.3_rk
nlc_trust_radius = 0.2_rk
nlc_trust_min_radius = 0.05_rk
nlc_trust_max_radius = 0.4_rk
nlc_trust_growth_factor = 1.8_rk
nlc_trust_shrink_factor = 0.35_rk
nlc_trust_accept_ratio = 0.1_rk
nlc_trust_good_ratio = 0.7_rk
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=ADAPTIVE_TARGET_NEWTON,'// &
' TARGET_NEWTON=0', ierr)
if (ierr .eq. 0) call fail(1194)
if (nlc_target_newton .ne. 7) call fail(1195)
call check_close(nlc_growth_factor, 1.6_rk, 1196)
call check_close(nlc_shrink_factor, 0.3_rk, 1197)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=TRUST_REGION_DAMPED_NEWTON,'// &
' TRUST_RADIUS=0.01, TRUST_MIN_RADIUS=0.02', ierr)
if (ierr .eq. 0) call fail(1210)
call check_close(nlc_trust_radius, 0.2_rk, 1211)
call check_close(nlc_trust_min_radius, 0.05_rk, 1212)
call check_close(nlc_trust_max_radius, 0.4_rk, 1213)
call check_close(nlc_trust_growth_factor, 1.8_rk, 1214)
call check_close(nlc_trust_shrink_factor, 0.35_rk, 1215)
call check_close(nlc_trust_accept_ratio, 0.1_rk, 1216)
call check_close(nlc_trust_good_ratio, 0.7_rk, 1217)
nlc_mc_min_substeps = 4
nlc_mc_max_substeps = 16
nlc_mc_target_strain = 1.0e-3_rk
nlc_mc_yield_tolerance = 1.0e-8_rk
nlc_mc_plastic_limit = 4.0e-2_rk
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=MC_SUBSTEPPING_SEMISMOOTH,'// &
' MC_MIN_SUBSTEPS=8, MC_MAX_SUBSTEPS=2', ierr)
if (ierr .eq. 0) call fail(1230)
if (nlc_mc_min_substeps .ne. 4) call fail(1231)
if (nlc_mc_max_substeps .ne. 16) call fail(1232)
call check_close(nlc_mc_target_strain, 1.0e-3_rk, 1233)
call check_close(nlc_mc_yield_tolerance, 1.0e-8_rk, 1234)
call check_close(nlc_mc_plastic_limit, 4.0e-2_rk, 1235)
call parse_nlc_header( &
'*NONLINEAR CONTINUATION, METHOD=MC_SUBSTEPPING_SEMISMOOTH,'// &
' MC_TARGET_STRAIN=0.0', ierr)
if (ierr .eq. 0) call fail(1236)
if (nlc_mc_min_substeps .ne. 4) call fail(1237)
if (nlc_mc_max_substeps .ne. 16) call fail(1238)
end subroutine check_nlc_inp
subroutine check_nlc_symbol(symbol, expected, code_base)
character(len=*), intent(in) :: symbol
integer, intent(in) :: expected
integer, intent(in) :: code_base
integer :: ierr
character(len=160) :: header
call control_set_defaults()
header = '*NONLINEAR CONTINUATION, METHOD='//trim(symbol)
call parse_nlc_header(header, ierr)
if (ierr .ne. 0) call fail(code_base)
if (nonlinear_continuation_method .ne. expected) call fail(code_base + 1)
end subroutine check_nlc_symbol
subroutine check_arc_disp_continuation_api()
integer :: ierr
integer :: iter
integer :: path_count
integer :: row_step
integer :: control_dof_count
integer :: row_iteration
integer :: status_code
integer :: failure_code
real(rk) :: res_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
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(1220)
call fem_read_inp('tests/data/c3d4_static_arc_disp_continuation.inp', &
ierr)
if (ierr .ne. 0) call fail(1221)
if (nonlinear_continuation_method .ne. NLC_ARC_DISP) call fail(1222)
call fem_build_model(ierr)
if (ierr .ne. 0) call fail(1223)
call fem_solve_static_nonlinear(2, 50, 1.0e-12_rk, iter, res_norm, ierr)
if (ierr .ne. 0) call fail(1224)
if (iter .le. 0) call fail(1225)
if (res_norm .gt. TOL) call fail(1226)
call fem_get_continuation_path_count(path_count, ierr)
if (ierr .ne. 0) call fail(1227)
if (path_count .ne. 2) call fail(1228)
call fem_get_continuation_path_row(1, 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(1229)
if (row_step .ne. 1) call fail(1230)
call check_close(row_time, 0.5_rk, 1231)
call check_close(control_parameter, 0.5_rk, 1232)
if (control_dof_count .ne. 1) call fail(1233)
call check_close(prescribed_l2, 0.125_rk, 1234)
call check_close(prescribed_max, 0.125_rk, 1235)
call check_close(actual_l2, 0.125_rk, 1236)
if (residual_linf .gt. TOL) call fail(1237)
if (residual_l2 .gt. TOL) call fail(1238)
if (abs(reaction_sum) .le. TOL) call fail(1239)
if (row_iteration .le. 0) call fail(1240)
if (status_code .ne. CONVERGENCE_STATUS_CONVERGED) call fail(1241)
if (failure_code .ne. CONV_FAIL_NONE) call fail(1242)
call fem_get_continuation_path_row(2, 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(1243)
if (row_step .ne. 2) call fail(1244)
call check_close(row_time, ONE, 1245)
call check_close(control_parameter, ONE, 1246)
if (control_dof_count .ne. 1) call fail(1247)
call check_close(prescribed_l2, 0.25_rk, 1248)
call check_close(actual_l2, 0.25_rk, 1249)
if (residual_linf .gt. TOL) call fail(1250)
if (residual_l2 .gt. TOL) call fail(1251)
if (abs(reaction_generalized) .le. TOL) call fail(1252)
if (status_code .ne. CONVERGENCE_STATUS_CONVERGED) call fail(1253)
if (failure_code .ne. CONV_FAIL_NONE) call fail(1254)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(1255)
end subroutine check_arc_disp_continuation_api
subroutine check_contact_pair_inp()
integer :: ierr