Advance V5 nonlinear benchmarks and shell solver
This commit is contained in:
@@ -6,7 +6,9 @@ program test_solver_implicit
|
||||
use fem_boundary
|
||||
use fem_element_mass
|
||||
use fem_solver_implicit
|
||||
use fem_linear_solver_cg, only: linear_solver_get_diagnostics
|
||||
use fem_linear_solver_cg, only: linear_solver_configure, &
|
||||
linear_solver_get_diagnostics, linear_solver_get_settings, &
|
||||
linear_solver_get_stats
|
||||
use fem_sparse_csr_diagnostics, only: CSR_CLASS_GENERAL, &
|
||||
CSR_CLASS_SPD_CAND
|
||||
implicit none
|
||||
@@ -16,6 +18,9 @@ program test_solver_implicit
|
||||
call check_single_dof_pull()
|
||||
call check_prescribed_value()
|
||||
call check_robin_explicit_force()
|
||||
call check_cload_load_factor()
|
||||
call check_dload_gravity_body_force()
|
||||
call check_dload_gravity_load_factor()
|
||||
call check_robin_implicit_spring()
|
||||
call check_mpc_explicit_force()
|
||||
call check_mpc_implicit_penalty()
|
||||
@@ -26,6 +31,10 @@ program test_solver_implicit
|
||||
call check_newmark_nonlinear_contact()
|
||||
call check_newmark_trial_rollback()
|
||||
call check_static_cutback_rollback()
|
||||
call check_static_adapt_newton()
|
||||
call check_static_trust_damped()
|
||||
call check_static_arc_disp_path()
|
||||
call check_nonlinear_cg_fallback()
|
||||
|
||||
contains
|
||||
|
||||
@@ -108,6 +117,88 @@ contains
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(34)
|
||||
end subroutine check_robin_explicit_force
|
||||
|
||||
subroutine check_cload_load_factor()
|
||||
integer :: ierr
|
||||
integer :: dof
|
||||
|
||||
call setup_base_tet(0, 1, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(182)
|
||||
|
||||
cload_target(1) = '2'
|
||||
cload_dof(1) = 1
|
||||
cload_value(1) = 8.0_rk
|
||||
cload_amp(1) = 0
|
||||
|
||||
load_factor = 0.25_rk
|
||||
call boundary_apply_prescribed_loads(0.5_rk, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(183)
|
||||
|
||||
dof = dof_id(1, 2)
|
||||
call check_close(fext(dof), 2.0_rk, 184)
|
||||
call check_close(fext(dof_id(2, 2)), ZERO, 185)
|
||||
call check_close(fext(dof_id(3, 2)), ZERO, 186)
|
||||
load_factor = ONE
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(187)
|
||||
end subroutine check_cload_load_factor
|
||||
|
||||
subroutine check_dload_gravity_body_force()
|
||||
integer :: ierr
|
||||
integer :: node
|
||||
integer :: dof
|
||||
|
||||
call setup_base_tet(0, 0, ierr, 1)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(170)
|
||||
|
||||
dload_target(1) = '1'
|
||||
dload_label(1) = 'GRAV'
|
||||
dload_value(1) = 6.0_rk
|
||||
dload_direction(:,1) = (/ ZERO, ZERO, -ONE /)
|
||||
dload_amp(1) = 0
|
||||
|
||||
call boundary_apply_prescribed_loads(ZERO, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(171)
|
||||
do node = 1, 4
|
||||
dof = dof_id(3, node)
|
||||
call check_close(fext(dof), -0.25_rk, 172)
|
||||
call check_close(fext(dof_id(1, node)), ZERO, 173)
|
||||
call check_close(fext(dof_id(2, node)), ZERO, 174)
|
||||
end do
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(175)
|
||||
end subroutine check_dload_gravity_body_force
|
||||
|
||||
subroutine check_dload_gravity_load_factor()
|
||||
integer :: ierr
|
||||
integer :: node
|
||||
integer :: dof
|
||||
|
||||
call setup_base_tet(0, 0, ierr, 1)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(176)
|
||||
|
||||
dload_target(1) = '1'
|
||||
dload_label(1) = 'GRAV'
|
||||
dload_value(1) = 6.0_rk
|
||||
dload_direction(:,1) = (/ ZERO, ZERO, -ONE /)
|
||||
dload_amp(1) = 0
|
||||
|
||||
load_factor = 0.4_rk
|
||||
call boundary_apply_prescribed_loads(0.25_rk, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(177)
|
||||
do node = 1, 4
|
||||
dof = dof_id(3, node)
|
||||
call check_close(fext(dof), -0.1_rk, 178)
|
||||
call check_close(fext(dof_id(1, node)), ZERO, 179)
|
||||
call check_close(fext(dof_id(2, node)), ZERO, 180)
|
||||
end do
|
||||
load_factor = ONE
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(181)
|
||||
end subroutine check_dload_gravity_load_factor
|
||||
|
||||
subroutine check_robin_implicit_spring()
|
||||
integer :: ierr
|
||||
integer :: iter
|
||||
@@ -458,6 +549,228 @@ contains
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(157)
|
||||
end subroutine check_static_cutback_rollback
|
||||
|
||||
subroutine check_static_adapt_newton()
|
||||
integer :: ierr
|
||||
integer :: iter
|
||||
integer :: old_method
|
||||
integer :: old_target
|
||||
real(rk) :: res_norm
|
||||
real(rk) :: old_growth
|
||||
real(rk) :: old_shrink
|
||||
real(rk) :: old_initial
|
||||
real(rk) :: old_min
|
||||
real(rk) :: old_max
|
||||
|
||||
call setup_pull_model(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(190)
|
||||
|
||||
old_method = nonlinear_continuation_method
|
||||
old_target = nlc_target_newton
|
||||
old_growth = nlc_growth_factor
|
||||
old_shrink = nlc_shrink_factor
|
||||
old_initial = static_initial_increment
|
||||
old_min = static_min_increment
|
||||
old_max = static_max_increment
|
||||
|
||||
nonlinear_continuation_method = NLC_ADAPT_NEWTON
|
||||
nlc_target_newton = 4
|
||||
nlc_growth_factor = 2.0_rk
|
||||
nlc_shrink_factor = 0.5_rk
|
||||
static_initial_increment = 0.25_rk
|
||||
static_min_increment = 0.01_rk
|
||||
static_max_increment = 0.5_rk
|
||||
current_time = ZERO
|
||||
|
||||
call implicit_solve_nonlinear_static(ONE, 4, 50, 1.0e-12_rk, &
|
||||
iter, res_norm, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(191)
|
||||
call check_close(current_time, ONE, 192)
|
||||
if (current_step .ge. 4) call fail(193)
|
||||
if (nlc_last_iter .le. 0) call fail(194)
|
||||
if (nlc_last_target_dt .le. ZERO) call fail(195)
|
||||
if (nlc_last_actual_dt .le. ZERO) call fail(196)
|
||||
if (nlc_last_actual_dt .gt. static_max_increment + TOL) call fail(197)
|
||||
if (abs(nlc_next_target_dt) .gt. TOL) call fail(198)
|
||||
if (nlc_last_adjust .ne. NLC_ADJ_KEEP) call fail(199)
|
||||
if (convergence_status_code .ne. CONVERGENCE_STATUS_CONVERGED) &
|
||||
call fail(200)
|
||||
if (.not. convergence_converged) call fail(201)
|
||||
|
||||
nonlinear_continuation_method = old_method
|
||||
nlc_target_newton = old_target
|
||||
nlc_growth_factor = old_growth
|
||||
nlc_shrink_factor = old_shrink
|
||||
static_initial_increment = old_initial
|
||||
static_min_increment = old_min
|
||||
static_max_increment = old_max
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(202)
|
||||
end subroutine check_static_adapt_newton
|
||||
|
||||
subroutine check_static_trust_damped()
|
||||
integer :: ierr
|
||||
integer :: iter
|
||||
integer :: old_method
|
||||
real(rk) :: res_norm
|
||||
real(rk) :: old_radius
|
||||
real(rk) :: old_min_radius
|
||||
real(rk) :: old_max_radius
|
||||
real(rk) :: old_growth
|
||||
real(rk) :: old_shrink
|
||||
real(rk) :: old_accept
|
||||
real(rk) :: old_good
|
||||
logical :: old_line_search
|
||||
|
||||
call setup_pull_model(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(210)
|
||||
|
||||
old_method = nonlinear_continuation_method
|
||||
old_radius = nlc_trust_radius
|
||||
old_min_radius = nlc_trust_min_radius
|
||||
old_max_radius = nlc_trust_max_radius
|
||||
old_growth = nlc_trust_growth_factor
|
||||
old_shrink = nlc_trust_shrink_factor
|
||||
old_accept = nlc_trust_accept_ratio
|
||||
old_good = nlc_trust_good_ratio
|
||||
old_line_search = use_line_search
|
||||
|
||||
nonlinear_continuation_method = NLC_TRUST_DAMPED
|
||||
nlc_trust_radius = 0.10_rk
|
||||
nlc_trust_min_radius = 0.05_rk
|
||||
nlc_trust_max_radius = 0.10_rk
|
||||
nlc_trust_growth_factor = 2.0_rk
|
||||
nlc_trust_shrink_factor = 0.5_rk
|
||||
nlc_trust_accept_ratio = ZERO
|
||||
nlc_trust_good_ratio = 0.75_rk
|
||||
use_line_search = .true.
|
||||
current_time = ZERO
|
||||
|
||||
call implicit_solve_nonlinear_static(ONE, 1, 80, 1.0e-12_rk, &
|
||||
iter, res_norm, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(211)
|
||||
call check_close(current_time, ONE, 212)
|
||||
if (iter .le. 5) call fail(213)
|
||||
if (res_norm .gt. TOL) call fail(214)
|
||||
if (convergence_correction_norm .gt. 0.10_rk + TOL) call fail(215)
|
||||
if (nlc_last_trust_radius .le. ZERO) call fail(216)
|
||||
if (nlc_next_trust_radius .le. ZERO) call fail(217)
|
||||
if (nlc_next_trust_radius .gt. 0.10_rk + TOL) call fail(218)
|
||||
if (nlc_last_damping .le. ZERO .or. &
|
||||
nlc_last_damping .gt. ONE + TOL) call fail(219)
|
||||
if (nlc_last_merit_ratio .lt. -TOL) call fail(220)
|
||||
if (nlc_last_rejections .lt. 0) call fail(221)
|
||||
if (nlc_last_trust_adjust .lt. NLC_ADJ_FAILED .or. &
|
||||
nlc_last_trust_adjust .gt. NLC_ADJ_CUTBACK) call fail(222)
|
||||
call check_close(u(dof_id(1,2)), 5.0_rk / 6.0_rk, 223)
|
||||
|
||||
nonlinear_continuation_method = old_method
|
||||
nlc_trust_radius = old_radius
|
||||
nlc_trust_min_radius = old_min_radius
|
||||
nlc_trust_max_radius = old_max_radius
|
||||
nlc_trust_growth_factor = old_growth
|
||||
nlc_trust_shrink_factor = old_shrink
|
||||
nlc_trust_accept_ratio = old_accept
|
||||
nlc_trust_good_ratio = old_good
|
||||
use_line_search = old_line_search
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(224)
|
||||
end subroutine check_static_trust_damped
|
||||
|
||||
subroutine check_static_arc_disp_path()
|
||||
integer :: ierr
|
||||
integer :: iter
|
||||
integer :: old_method
|
||||
real(rk) :: res_norm
|
||||
|
||||
call setup_prescribed_model(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(230)
|
||||
|
||||
old_method = nonlinear_continuation_method
|
||||
nonlinear_continuation_method = NLC_ARC_DISP
|
||||
current_time = ZERO
|
||||
current_step = 0
|
||||
call implicit_solve_nonlinear_static(ONE, 2, 50, 1.0e-12_rk, &
|
||||
iter, res_norm, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(231)
|
||||
if (nlc_path_count .ne. 2) call fail(232)
|
||||
if (.not. allocated(nlc_path_real)) call fail(233)
|
||||
if (.not. allocated(nlc_path_int)) call fail(234)
|
||||
if (nlc_path_int(NLC_PATH_I_STEP, 1) .ne. 1) call fail(235)
|
||||
if (nlc_path_int(NLC_PATH_I_STEP, 2) .ne. 2) call fail(236)
|
||||
if (nlc_path_int(NLC_PATH_I_CONTROL_DOF_COUNT, 1) .ne. 1) call fail(237)
|
||||
if (nlc_path_int(NLC_PATH_I_CONTROL_DOF_COUNT, 2) .ne. 1) call fail(238)
|
||||
call check_close(nlc_path_real(NLC_PATH_R_TIME, 1), 0.5_rk, 239)
|
||||
call check_close(nlc_path_real(NLC_PATH_R_TIME, 2), ONE, 240)
|
||||
call check_close(nlc_path_real(NLC_PATH_R_PRESCRIBED_L2, 1), 0.125_rk, &
|
||||
241)
|
||||
call check_close(nlc_path_real(NLC_PATH_R_ACTUAL_L2, 2), 0.25_rk, 242)
|
||||
if (nlc_path_real(NLC_PATH_R_RESIDUAL_LINF, 2) .gt. TOL) call fail(243)
|
||||
if (nlc_path_real(NLC_PATH_R_RESIDUAL_L2, 2) .gt. TOL) call fail(244)
|
||||
if (abs(nlc_path_real(NLC_PATH_R_REACTION_SUM, 2)) .le. TOL) call fail(245)
|
||||
if (nlc_path_int(NLC_PATH_I_STATUS_CODE, 2) .ne. &
|
||||
CONVERGENCE_STATUS_CONVERGED) call fail(246)
|
||||
if (nlc_path_int(NLC_PATH_I_FAILURE_CODE, 2) .ne. CONV_FAIL_NONE) &
|
||||
call fail(247)
|
||||
|
||||
nonlinear_continuation_method = old_method
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(248)
|
||||
end subroutine check_static_arc_disp_path
|
||||
|
||||
subroutine check_nonlinear_cg_fallback()
|
||||
integer :: ierr
|
||||
integer :: iter
|
||||
integer :: dof
|
||||
integer :: method
|
||||
integer :: preconditioner
|
||||
integer :: last_method
|
||||
integer :: last_preconditioner
|
||||
integer :: status_code
|
||||
real(rk) :: res_norm
|
||||
real(rk) :: last_residual
|
||||
|
||||
call setup_single_free_dof_model(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(249)
|
||||
call database_allocate_robin(1, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(250)
|
||||
|
||||
robin_target(1) = '2'
|
||||
robin_dof(1) = 1
|
||||
robin_stiffness(1) = -8.0_rk
|
||||
robin_damping(1) = ZERO
|
||||
robin_reference(1) = 0.1_rk
|
||||
robin_amp(1) = 0
|
||||
|
||||
call linear_solver_configure(LSOLVER_CG, LPRECOND_JACOBI, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(251)
|
||||
current_time = ZERO
|
||||
current_step = 0
|
||||
call implicit_solve_nonlinear_static(ONE, 1, 20, 1.0e-12_rk, &
|
||||
iter, res_norm, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(252)
|
||||
|
||||
dof = dof_id(1,2)
|
||||
call check_close(u(dof), 0.4_rk, 253)
|
||||
call linear_solver_get_settings(method, preconditioner, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(254)
|
||||
if (method .ne. LSOLVER_CG) call fail(255)
|
||||
if (preconditioner .ne. LPRECOND_JACOBI) call fail(256)
|
||||
|
||||
call linear_solver_get_stats(last_method, last_preconditioner, iter, &
|
||||
last_residual, status_code, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(257)
|
||||
if (last_method .ne. LSOLVER_GMRES) call fail(258)
|
||||
if (last_preconditioner .ne. LPRECOND_JACOBI) call fail(259)
|
||||
if (status_code .ne. LS_STATUS_CONVERGED) call fail(260)
|
||||
if (last_residual .gt. TOL) call fail(261)
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(262)
|
||||
end subroutine check_nonlinear_cg_fallback
|
||||
|
||||
subroutine setup_pull_model(ierr)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
@@ -551,14 +864,19 @@ contains
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine setup_prescribed_model
|
||||
|
||||
subroutine setup_base_tet(num_bc, num_cload, ierr)
|
||||
subroutine setup_base_tet(num_bc, num_cload, ierr, num_dload)
|
||||
integer, intent(in) :: num_bc
|
||||
integer, intent(in) :: num_cload
|
||||
integer, intent(out) :: ierr
|
||||
integer, intent(in), optional :: num_dload
|
||||
integer :: i
|
||||
integer :: ndload_local
|
||||
|
||||
ndload_local = 0
|
||||
if (present(num_dload)) ndload_local = num_dload
|
||||
|
||||
call database_allocate_model(4, 1, 0, 0, 0, 0, 1, 0, 1, &
|
||||
0, 0, num_bc, num_cload, 0, ierr)
|
||||
0, 0, num_bc, num_cload, ndload_local, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
do i = 1, 4
|
||||
@@ -622,6 +940,7 @@ contains
|
||||
integer, intent(in) :: code
|
||||
|
||||
write(*,*) 'test_solver_implicit failed:', code
|
||||
write(*,*) 'last error:', last_error_code, trim(last_error_message)
|
||||
stop 1
|
||||
end subroutine fail
|
||||
|
||||
|
||||
Reference in New Issue
Block a user