1811 lines
63 KiB
Fortran
1811 lines
63 KiB
Fortran
program test_solver_implicit
|
|
use fem_precision
|
|
use fem_error
|
|
use fem_control
|
|
use fem_database
|
|
use fem_boundary
|
|
use fem_element_mass
|
|
use fem_solver_implicit
|
|
use fem_output_csv
|
|
use fem_linear_solver_cg, only: linear_solver_configure, &
|
|
linear_solver_get_diagnostics, linear_solver_get_settings, &
|
|
linear_solver_get_stats, linear_solver_get_fail_info
|
|
use fem_nonlinear_lifecycle
|
|
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_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()
|
|
call check_newmark_mass_damping()
|
|
call check_newmark_nonlinear_elastic()
|
|
call check_newmark_nonlinear_robin()
|
|
call check_newmark_nonlinear_mpc()
|
|
call check_newmark_nonlinear_contact()
|
|
call check_newmark_trial_rollback()
|
|
call check_static_cutback_rollback()
|
|
call check_newmark_nonconv_reason()
|
|
call check_static_adapt_newton()
|
|
call check_static_trust_damped()
|
|
call check_static_arc_load_riks()
|
|
call check_static_arc_no_control()
|
|
call check_static_arc_disp_path()
|
|
call check_static_arc_amp_path()
|
|
call check_static_arc_disp_adaptive()
|
|
call check_static_arc_disp_trust()
|
|
call check_path_storage_reset()
|
|
call check_nonlinear_cg_fallback()
|
|
call check_nl_linear_failure_reason()
|
|
|
|
contains
|
|
|
|
subroutine check_single_dof_pull()
|
|
integer :: ierr
|
|
integer :: iter
|
|
real(rk) :: res_norm
|
|
real(rk) :: expected
|
|
integer :: dof
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(1)
|
|
|
|
call implicit_solve_linear_static(ZERO, 50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(2)
|
|
if (iter .le. 0 .or. iter .gt. 5) call fail(3)
|
|
if (res_norm .gt. TOL) call fail(4)
|
|
call check_solver_diag(4000)
|
|
|
|
dof = dof_id(1,2)
|
|
expected = 5.0_rk / 6.0_rk
|
|
call check_close(u(dof), expected, 5)
|
|
call check_close(u(dof_id(2,2)), ZERO, 6)
|
|
call check_close(u(dof_id(3,2)), ZERO, 7)
|
|
call check_close(maxval(abs(v)), ZERO, 8)
|
|
call check_close(maxval(abs(a)), ZERO, 9)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(10)
|
|
end subroutine check_single_dof_pull
|
|
|
|
subroutine check_prescribed_value()
|
|
integer :: ierr
|
|
integer :: iter
|
|
real(rk) :: res_norm
|
|
integer :: dof
|
|
|
|
call setup_prescribed_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(20)
|
|
|
|
call implicit_solve_linear_static(ZERO, 50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(21)
|
|
if (res_norm .gt. TOL) call fail(22)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 0.25_rk, 23)
|
|
call check_close(maxval(abs(v)), ZERO, 24)
|
|
call check_close(maxval(abs(a)), ZERO, 25)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(26)
|
|
end subroutine check_prescribed_value
|
|
|
|
subroutine check_robin_explicit_force()
|
|
integer :: ierr
|
|
integer :: dof
|
|
|
|
call setup_base_tet(0, 0, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(30)
|
|
call database_allocate_robin(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(31)
|
|
|
|
robin_target(1) = '2'
|
|
robin_dof(1) = 1
|
|
robin_stiffness(1) = 10.0_rk
|
|
robin_damping(1) = 2.0_rk
|
|
robin_reference(1) = 0.25_rk
|
|
robin_amp(1) = 0
|
|
|
|
dof = dof_id(1,2)
|
|
u(dof) = 0.5_rk
|
|
v(dof) = -0.1_rk
|
|
fext = ZERO
|
|
|
|
call boundary_apply_robin_forces(ZERO, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(32)
|
|
call check_close(fext(dof), -2.3_rk, 33)
|
|
|
|
call database_finalize(ierr)
|
|
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
|
|
real(rk) :: res_norm
|
|
integer :: dof
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(40)
|
|
call database_allocate_robin(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(41)
|
|
|
|
robin_target(1) = '2'
|
|
robin_dof(1) = 1
|
|
robin_stiffness(1) = 6.0_rk
|
|
robin_damping(1) = ZERO
|
|
robin_reference(1) = 0.25_rk
|
|
robin_amp(1) = 0
|
|
|
|
call implicit_solve_linear_static(ZERO, 50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(42)
|
|
if (res_norm .gt. TOL) call fail(43)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 13.0_rk / 24.0_rk, 44)
|
|
call check_close(u(dof_id(2,2)), ZERO, 45)
|
|
call check_close(u(dof_id(3,2)), ZERO, 46)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(47)
|
|
end subroutine check_robin_implicit_spring
|
|
|
|
subroutine check_mpc_explicit_force()
|
|
integer :: ierr
|
|
integer :: dof2
|
|
integer :: dof3
|
|
|
|
call setup_base_tet(0, 0, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(50)
|
|
call database_allocate_mpc(1, 2, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(51)
|
|
|
|
mpc_start(1) = 1
|
|
mpc_count(1) = 2
|
|
mpc_rhs(1) = 0.05_rk
|
|
mpc_penalty(1) = 10.0_rk
|
|
mpc_node(1) = 2
|
|
mpc_dof(1) = 1
|
|
mpc_coeff(1) = ONE
|
|
mpc_node(2) = 3
|
|
mpc_dof(2) = 1
|
|
mpc_coeff(2) = -2.0_rk
|
|
|
|
dof2 = dof_id(1,2)
|
|
dof3 = dof_id(1,3)
|
|
u(dof2) = 0.4_rk
|
|
u(dof3) = 0.1_rk
|
|
fext = ZERO
|
|
|
|
call boundary_apply_mpc_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(52)
|
|
call check_close(fext(dof2), -1.5_rk, 53)
|
|
call check_close(fext(dof3), 3.0_rk, 54)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(55)
|
|
end subroutine check_mpc_explicit_force
|
|
|
|
subroutine check_mpc_implicit_penalty()
|
|
integer :: ierr
|
|
integer :: iter
|
|
real(rk) :: res_norm
|
|
integer :: dof
|
|
|
|
call setup_single_free_dof_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(60)
|
|
call database_allocate_mpc(1, 1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(61)
|
|
|
|
mpc_start(1) = 1
|
|
mpc_count(1) = 1
|
|
mpc_rhs(1) = 0.25_rk
|
|
mpc_penalty(1) = 6.0_rk
|
|
mpc_node(1) = 2
|
|
mpc_dof(1) = 1
|
|
mpc_coeff(1) = ONE
|
|
|
|
call implicit_solve_linear_static(ZERO, 50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(62)
|
|
if (res_norm .gt. TOL) call fail(63)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 0.125_rk, 64)
|
|
call check_close(u(dof_id(2,2)), ZERO, 65)
|
|
call check_close(u(dof_id(3,2)), ZERO, 66)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(67)
|
|
end subroutine check_mpc_implicit_penalty
|
|
|
|
subroutine check_newmark_mass_damping()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: dof
|
|
real(rk) :: res_norm
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(70)
|
|
call element_compute_lumped_mass(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(71)
|
|
|
|
current_time = ZERO
|
|
rayleigh_alpha_mass = 2.0_rk
|
|
rayleigh_beta_stiffness = ZERO
|
|
|
|
call implicit_advance_newmark_linear(0.1_rk, 0.25_rk, 0.5_rk, &
|
|
50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(72)
|
|
if (iter .le. 0 .or. iter .gt. 5) call fail(73)
|
|
if (res_norm .gt. TOL) call fail(74)
|
|
call check_solver_diag(4100)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 15.0_rk / 73.0_rk, 75)
|
|
call check_close(v(dof), 300.0_rk / 73.0_rk, 76)
|
|
call check_close(a(dof), 6000.0_rk / 73.0_rk, 77)
|
|
call check_close(u(dof_id(2,2)), ZERO, 78)
|
|
call check_close(u(dof_id(3,2)), ZERO, 79)
|
|
|
|
rayleigh_alpha_mass = ZERO
|
|
rayleigh_beta_stiffness = ZERO
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(80)
|
|
end subroutine check_newmark_mass_damping
|
|
|
|
subroutine check_newmark_nonlinear_elastic()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: dof
|
|
real(rk) :: res_norm
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(90)
|
|
call element_compute_lumped_mass(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(91)
|
|
|
|
current_time = ZERO
|
|
rayleigh_alpha_mass = ZERO
|
|
rayleigh_beta_stiffness = ZERO
|
|
call nl_lifecycle_reset()
|
|
|
|
call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, &
|
|
50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(92)
|
|
if (iter .le. 0 .or. iter .gt. 5) call fail(93)
|
|
if (res_norm .gt. TOL) call fail(94)
|
|
if (convergence_correction_norm .le. ZERO) call fail(101)
|
|
call check_close(convergence_total_resid_norm, res_norm, 5500)
|
|
call check_close(convergence_force_resid_norm, res_norm, 5501)
|
|
call check_close(convergence_contact_resid_norm, ZERO, 5502)
|
|
call check_close(convergence_cons_resid_norm, ZERO, 5503)
|
|
call check_close(convergence_arc_resid_norm, ZERO, 5504)
|
|
if (convergence_material_fail_count .ne. 0) call fail(5505)
|
|
call check_lifecycle_event(1, NLC_EVENT_INCREMENT_BEGIN, NFAIL_NONE, 5610)
|
|
call check_lifecycle_event(2, NLC_EVENT_TRIAL_BEGIN, NFAIL_NONE, 5611)
|
|
call check_lifecycle_event(3, NLC_EVENT_ITERATION_BEGIN, NFAIL_NONE, 5612)
|
|
if (lifecycle_count_event(NLC_EVENT_ITERATION_RESULT) .le. 0) &
|
|
call fail(5613)
|
|
call check_lifecycle_last(NLC_EVENT_ACCEPT, NFAIL_NONE, 5614)
|
|
call check_lifecycle_summary(NLC_EVENT_ACCEPT, NFAIL_NONE, 1, 0, 0, &
|
|
5660)
|
|
call check_lifecycle_report_row( &
|
|
'build-codex-gcc/test_solver_lifecycle_report_accept', &
|
|
'accept', 'none', 5690)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 15.0_rk / 68.0_rk, 95)
|
|
call check_close(v(dof), 75.0_rk / 17.0_rk, 96)
|
|
call check_close(a(dof), 1500.0_rk / 17.0_rk, 97)
|
|
call check_close(u(dof_id(2,2)), ZERO, 98)
|
|
call check_close(u(dof_id(3,2)), ZERO, 99)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(100)
|
|
end subroutine check_newmark_nonlinear_elastic
|
|
|
|
subroutine check_newmark_nonlinear_robin()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: dof
|
|
real(rk) :: res_norm
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(110)
|
|
call database_allocate_robin(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(111)
|
|
call element_compute_lumped_mass(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(112)
|
|
|
|
robin_target(1) = '2'
|
|
robin_dof(1) = 1
|
|
robin_stiffness(1) = 6.0_rk
|
|
robin_damping(1) = ZERO
|
|
robin_reference(1) = 0.25_rk
|
|
robin_amp(1) = 0
|
|
|
|
current_time = ZERO
|
|
call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, &
|
|
50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(113)
|
|
if (iter .le. 0 .or. iter .gt. 5) call fail(114)
|
|
if (res_norm .gt. TOL) call fail(115)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 39.0_rk / 172.0_rk, 116)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(117)
|
|
end subroutine check_newmark_nonlinear_robin
|
|
|
|
subroutine check_newmark_nonlinear_mpc()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: dof
|
|
real(rk) :: res_norm
|
|
|
|
call setup_single_free_dof_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(120)
|
|
call database_allocate_mpc(1, 1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(121)
|
|
call element_compute_lumped_mass(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(122)
|
|
|
|
mpc_start(1) = 1
|
|
mpc_count(1) = 1
|
|
mpc_rhs(1) = 0.25_rk
|
|
mpc_penalty(1) = 6.0_rk
|
|
mpc_node(1) = 2
|
|
mpc_dof(1) = 1
|
|
mpc_coeff(1) = ONE
|
|
|
|
current_time = ZERO
|
|
call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, &
|
|
50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(123)
|
|
if (iter .le. 0 .or. iter .gt. 5) call fail(124)
|
|
if (res_norm .gt. TOL) call fail(125)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 9.0_rk / 172.0_rk, 126)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(127)
|
|
end subroutine check_newmark_nonlinear_mpc
|
|
|
|
subroutine check_newmark_nonlinear_contact()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: dof
|
|
real(rk) :: res_norm
|
|
|
|
call setup_single_free_dof_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(130)
|
|
call database_allocate_contact(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(131)
|
|
call element_compute_lumped_mass(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(132)
|
|
|
|
contact_target(1) = '2'
|
|
contact_normal(:,1) = (/ ONE, ZERO, ZERO /)
|
|
contact_offset(1) = 1.1_rk
|
|
contact_penalty(1) = 10.0_rk
|
|
contact_damping(1) = ZERO
|
|
|
|
current_time = ZERO
|
|
call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, &
|
|
50, 1.0e-12_rk, iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(133)
|
|
if (iter .le. 0 .or. iter .gt. 5) call fail(134)
|
|
if (res_norm .gt. TOL) call fail(135)
|
|
call check_solver_diag(4200)
|
|
|
|
dof = dof_id(1,2)
|
|
call check_close(u(dof), 3.0_rk / 98.0_rk, 136)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(137)
|
|
end subroutine check_newmark_nonlinear_contact
|
|
|
|
subroutine check_newmark_trial_rollback()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: dof
|
|
real(rk) :: res_norm
|
|
|
|
call setup_single_free_dof_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(140)
|
|
call element_compute_lumped_mass(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(141)
|
|
|
|
dof = dof_id(1,2)
|
|
u(dof) = 0.2_rk
|
|
current_time = ZERO
|
|
call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, &
|
|
1, 1.0e-30_rk, iter, res_norm, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(142)
|
|
if (.not. allocated(stress)) call fail(143)
|
|
if (maxval(abs(stress)) .gt. TOL) call fail(144)
|
|
if (maxval(abs(strain)) .gt. TOL) call fail(145)
|
|
if (maxval(abs(statev)) .gt. TOL) call fail(146)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(147)
|
|
end subroutine check_newmark_trial_rollback
|
|
|
|
subroutine check_static_cutback_rollback()
|
|
integer :: ierr
|
|
integer :: iter
|
|
real(rk) :: res_norm
|
|
logical :: old_cutback
|
|
integer :: old_max_cutback
|
|
real(rk) :: old_min_increment
|
|
real(rk) :: old_cutback_factor
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(150)
|
|
|
|
old_cutback = allow_step_cutback
|
|
old_max_cutback = max_cutback
|
|
old_min_increment = static_min_increment
|
|
old_cutback_factor = cutback_factor
|
|
|
|
allow_step_cutback = .true.
|
|
max_cutback = 2
|
|
static_min_increment = 0.2_rk
|
|
cutback_factor = 0.5_rk
|
|
current_time = ZERO
|
|
call nl_lifecycle_reset()
|
|
|
|
call implicit_solve_nonlinear_static(ONE, 1, 1, 1.0e-30_rk, &
|
|
iter, res_norm, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(151)
|
|
if (abs(current_time) .gt. TOL) call fail(152)
|
|
if (maxval(abs(u)) .gt. TOL) call fail(153)
|
|
if (allocated(stress)) then
|
|
if (maxval(abs(stress)) .gt. TOL) call fail(154)
|
|
end if
|
|
if (allocated(strain)) then
|
|
if (maxval(abs(strain)) .gt. TOL) call fail(155)
|
|
end if
|
|
if (allocated(statev)) then
|
|
if (maxval(abs(statev)) .gt. TOL) call fail(156)
|
|
end if
|
|
if (convergence_cutback_count .ne. 2) call fail(158)
|
|
if (convergence_status_code .ne. CONVERGENCE_STATUS_FAILED) call fail(159)
|
|
if (convergence_converged) call fail(160)
|
|
call check_close(convergence_last_dt, 0.25_rk, 161)
|
|
if (convergence_failure_code .ne. CONV_FAIL_CUTBACK_LIMIT) &
|
|
call fail(162)
|
|
if (convergence_failure_reason_id .ne. NFAIL_MIN_STEP) call fail(5164)
|
|
call check_reason_name(NFAIL_MIN_STEP, 'minimum-step-exhausted', 5165)
|
|
call check_cutback_reason_name(CUTBACK_REASON_MIN_STEP, &
|
|
'minimum-step-exhausted', 5680)
|
|
if (conv_last_cutback_reason_id .ne. &
|
|
CUTBACK_REASON_NONCONVERGENCE) call fail(5681)
|
|
call check_cutback_reason_name(conv_last_cutback_reason_id, &
|
|
'nonlinear-nonconvergence', 5682)
|
|
call check_close(convergence_last_accepted_time, ZERO, 163)
|
|
if (lifecycle_count_event(NLC_EVENT_CUTBACK) .ne. 2) call fail(5605)
|
|
if (lifecycle_count_event_reason(NLC_EVENT_CUTBACK, &
|
|
CUTBACK_REASON_NONCONVERGENCE) .ne. 2) call fail(5625)
|
|
call check_lifecycle_last(NLC_EVENT_REJECT, NFAIL_MIN_STEP, 5606)
|
|
call check_lifecycle_audit_min(1, 1, 1, 0, 0, 5630)
|
|
call check_lifecycle_summary(NLC_EVENT_REJECT, NFAIL_MIN_STEP, 0, 1, &
|
|
2, 5670)
|
|
call check_lifecycle_report_row( &
|
|
'build-codex-gcc/test_solver_lifecycle_report_reject', &
|
|
'reject', 'minimum-step-exhausted', 5700)
|
|
|
|
allow_step_cutback = old_cutback
|
|
max_cutback = old_max_cutback
|
|
static_min_increment = old_min_increment
|
|
cutback_factor = old_cutback_factor
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(157)
|
|
end subroutine check_static_cutback_rollback
|
|
|
|
subroutine check_newmark_nonconv_reason()
|
|
integer :: ierr
|
|
integer :: iter
|
|
real(rk) :: res_norm
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5166)
|
|
call element_compute_lumped_mass(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5167)
|
|
|
|
current_time = ZERO
|
|
call nl_lifecycle_reset()
|
|
|
|
call implicit_newmark_nonlinear_step(0.1_rk, 0.25_rk, 0.5_rk, &
|
|
1, 1.0e-30_rk, iter, res_norm, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(5168)
|
|
if (convergence_status_code .ne. CONVERGENCE_STATUS_FAILED) &
|
|
call fail(5169)
|
|
if (convergence_failure_code .ne. CONV_FAIL_NONCONVERGENCE) &
|
|
call fail(5170)
|
|
if (convergence_failure_reason_id .ne. NFAIL_NONCONVERGENCE) &
|
|
call fail(5171)
|
|
call check_reason_name(NFAIL_NONCONVERGENCE, &
|
|
'nonlinear-nonconvergence', 5172)
|
|
call check_lifecycle_last(NLC_EVENT_REJECT, NFAIL_NONCONVERGENCE, 5615)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5173)
|
|
end subroutine check_newmark_nonconv_reason
|
|
|
|
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 nl_lifecycle_reset()
|
|
|
|
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)
|
|
call check_close(convergence_total_resid_norm, res_norm, 5510)
|
|
call check_close(convergence_force_resid_norm, res_norm, 5511)
|
|
call check_close(convergence_contact_resid_norm, ZERO, 5512)
|
|
call check_close(convergence_cons_resid_norm, ZERO, 5513)
|
|
call check_close(convergence_arc_resid_norm, ZERO, 5514)
|
|
if (convergence_material_fail_count .ne. 0) call fail(5515)
|
|
call check_lifecycle_event(1, NLC_EVENT_INCREMENT_BEGIN, NFAIL_NONE, 5600)
|
|
call check_lifecycle_event(2, NLC_EVENT_TRIAL_BEGIN, NFAIL_NONE, 5601)
|
|
call check_lifecycle_event(3, NLC_EVENT_ITERATION_BEGIN, NFAIL_NONE, 5602)
|
|
if (lifecycle_count_event(NLC_EVENT_ITERATION_RESULT) .le. 0) &
|
|
call fail(5603)
|
|
call check_lifecycle_last(NLC_EVENT_ACCEPT, NFAIL_NONE, 5604)
|
|
call check_lifecycle_audit_min(1, 0, 0, 0, 1, 5631)
|
|
|
|
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_load_riks()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: old_method
|
|
real(rk) :: res_norm
|
|
real(rk) :: old_arc_radius
|
|
real(rk) :: old_arc_scale
|
|
real(rk) :: old_load_factor
|
|
logical :: old_ramp_load
|
|
|
|
call setup_pull_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(270)
|
|
|
|
old_method = nonlinear_continuation_method
|
|
old_arc_radius = nlc_arc_length_radius
|
|
old_arc_scale = nlc_arc_load_scale
|
|
old_load_factor = load_factor
|
|
old_ramp_load = static_ramp_load
|
|
|
|
nonlinear_continuation_method = NLC_ARC_DISP
|
|
nlc_arc_load_scale = ONE
|
|
nlc_arc_length_radius = sqrt((5.0_rk / 6.0_rk) ** 2 + ONE)
|
|
static_ramp_load = .true.
|
|
load_factor = ONE
|
|
current_time = ZERO
|
|
current_step = 0
|
|
call nl_lifecycle_reset()
|
|
call implicit_solve_nonlinear_static(ONE, 1, 50, 1.0e-12_rk, &
|
|
iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(271)
|
|
call check_close(current_time, ONE, 272)
|
|
call check_close(load_factor, ONE, 273)
|
|
call check_close(u(dof_id(1,2)), 5.0_rk / 6.0_rk, 274)
|
|
if (res_norm .gt. TOL) call fail(275)
|
|
if (nlc_path_count .ne. 1) call fail(276)
|
|
if (nlc_path_int(NLC_PATH_I_CONTROL_DOF_COUNT, 1) .le. 0) call fail(277)
|
|
call check_close(nlc_path_real(NLC_PATH_R_PARAMETER, 1), ONE, 278)
|
|
call check_close(nlc_path_real(NLC_PATH_R_ACTUAL_L2, 1), &
|
|
5.0_rk / 6.0_rk, 279)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_MODE, 1) .ne. NLC_ARC_MODE_LOAD) &
|
|
call fail(5624)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_PRED_OK, 1) .ne. 1) &
|
|
call fail(5625)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_LOAD_REVERSAL, 1) .ne. 0) call fail(5626)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_TURNING_POINT, 1) .ne. 0) call fail(5627)
|
|
if (nlc_path_real(NLC_PATH_R_ARC_LENGTH, 1) .le. ZERO) call fail(5628)
|
|
call check_close(nlc_path_real(NLC_PATH_R_ARC_LOAD_DELTA, 1), ZERO, 5629)
|
|
if (abs(nlc_last_arc_constraint) .gt. 1.0e-8_rk) call fail(280)
|
|
if (nlc_path_int(NLC_PATH_I_STATUS_CODE, 1) .ne. &
|
|
CONVERGENCE_STATUS_CONVERGED) call fail(281)
|
|
if (nlc_path_int(NLC_PATH_I_FAILURE_CODE, 1) .ne. CONV_FAIL_NONE) &
|
|
call fail(282)
|
|
call check_lifecycle_last(NLC_EVENT_ACCEPT, NFAIL_NONE, 5620)
|
|
call check_lifecycle_arc(ONE, 1.0e-8_rk, .true., 5621)
|
|
|
|
nonlinear_continuation_method = old_method
|
|
nlc_arc_length_radius = old_arc_radius
|
|
nlc_arc_load_scale = old_arc_scale
|
|
load_factor = old_load_factor
|
|
static_ramp_load = old_ramp_load
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(283)
|
|
end subroutine check_static_arc_load_riks
|
|
|
|
subroutine check_static_arc_no_control()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: old_method
|
|
real(rk) :: res_norm
|
|
|
|
call setup_single_free_dof_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(284)
|
|
|
|
old_method = nonlinear_continuation_method
|
|
nonlinear_continuation_method = NLC_ARC_DISP
|
|
current_time = ZERO
|
|
current_step = 0
|
|
call implicit_solve_nonlinear_static(ONE, 1, 10, 1.0e-12_rk, &
|
|
iter, res_norm, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(285)
|
|
if (nlc_path_count .ne. 0) call fail(286)
|
|
if (convergence_status_code .ne. CONVERGENCE_STATUS_FAILED) &
|
|
call fail(287)
|
|
if (convergence_failure_code .ne. CONV_FAIL_STOPPED) call fail(288)
|
|
if (convergence_failure_reason_id .ne. NFAIL_ARC_CONSTRAINT) &
|
|
call fail(5290)
|
|
call check_reason_name(NFAIL_ARC_CONSTRAINT, &
|
|
'arc-constraint-failure', 5291)
|
|
|
|
nonlinear_continuation_method = old_method
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(289)
|
|
end subroutine check_static_arc_no_control
|
|
|
|
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)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_MODE, 1) .ne. NLC_ARC_MODE_DISP) &
|
|
call fail(5631)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_MODE, 2) .ne. NLC_ARC_MODE_DISP) &
|
|
call fail(5632)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_PRED_OK, 2) .ne. 1) &
|
|
call fail(5633)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_LOAD_REVERSAL, 2) .ne. 0) call fail(5634)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_TURNING_POINT, 2) .ne. 0) call fail(5635)
|
|
call check_close(nlc_path_real(NLC_PATH_R_ARC_LOAD_DELTA, 2), 0.5_rk, &
|
|
5636)
|
|
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_TARGET_DT, 1), 0.5_rk, 249)
|
|
call check_close(nlc_path_real(NLC_PATH_R_ACTUAL_DT, 2), 0.5_rk, 250)
|
|
call check_close(nlc_path_real(NLC_PATH_R_NEXT_DT, 2), ZERO, 251)
|
|
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)
|
|
if (nlc_path_real(NLC_PATH_R_TOTAL_RESIDUAL, 2) .gt. TOL) call fail(5520)
|
|
if (nlc_path_real(NLC_PATH_R_FORCE_RESIDUAL, 2) .gt. TOL) call fail(5521)
|
|
call check_close(nlc_path_real(NLC_PATH_R_CONTACT_RESIDUAL, 2), ZERO, &
|
|
5522)
|
|
call check_close(nlc_path_real(NLC_PATH_R_CONS_RESIDUAL, 2), ZERO, 5523)
|
|
if (nlc_path_int(NLC_PATH_I_MATERIAL_FAIL_COUNT, 2) .ne. 0) &
|
|
call fail(5524)
|
|
call check_path_breakdown_header(5530)
|
|
|
|
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_static_arc_amp_path()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: old_method
|
|
real(rk) :: res_norm
|
|
|
|
call setup_prescribed_amp_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(290)
|
|
|
|
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(291)
|
|
if (nlc_path_count .ne. 2) call fail(292)
|
|
call check_close(nlc_path_real(NLC_PATH_R_TIME, 1), 0.5_rk, 293)
|
|
call check_close(nlc_path_real(NLC_PATH_R_PRESCRIBED_L2, 1), &
|
|
0.125_rk, 294)
|
|
call check_close(nlc_path_real(NLC_PATH_R_ACTUAL_L2, 2), 0.25_rk, &
|
|
295)
|
|
if (nlc_path_real(NLC_PATH_R_RESIDUAL_LINF, 2) .gt. TOL) call fail(296)
|
|
|
|
nonlinear_continuation_method = old_method
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(297)
|
|
end subroutine check_static_arc_amp_path
|
|
|
|
subroutine check_static_arc_disp_adaptive()
|
|
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
|
|
logical :: old_disp_adaptive
|
|
|
|
call setup_prescribed_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(298)
|
|
|
|
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
|
|
old_disp_adaptive = use_disp_path_adaptive
|
|
|
|
nonlinear_continuation_method = NLC_ARC_DISP
|
|
use_disp_path_adaptive = .true.
|
|
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
|
|
current_step = 0
|
|
call implicit_solve_nonlinear_static(ONE, 4, 50, 1.0e-12_rk, &
|
|
iter, res_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(299)
|
|
call check_close(current_time, ONE, 300)
|
|
if (nlc_path_count .lt. 2 .or. nlc_path_count .gt. 16) call fail(301)
|
|
call check_close(nlc_path_real(NLC_PATH_R_TIME, 1), 0.25_rk, 302)
|
|
call check_close(nlc_path_real(NLC_PATH_R_TIME, nlc_path_count), ONE, 303)
|
|
call check_close(nlc_path_real(NLC_PATH_R_TARGET_DT, 1), 0.25_rk, 307)
|
|
call check_close(nlc_path_real(NLC_PATH_R_ACTUAL_DT, 1), 0.25_rk, 308)
|
|
if (nlc_path_real(NLC_PATH_R_NEXT_DT, 1) .le. ZERO) call fail(309)
|
|
if (nlc_path_int(NLC_PATH_I_ADAPT_ADJUST, 1) .lt. NLC_ADJ_FAILED .or. &
|
|
nlc_path_int(NLC_PATH_I_ADAPT_ADJUST, 1) .gt. NLC_ADJ_CUTBACK) &
|
|
call fail(310)
|
|
if (nlc_path_int(NLC_PATH_I_CUTBACK_COUNT, 1) .ne. 0) call fail(311)
|
|
if (nlc_path_int(NLC_PATH_I_CONTROL_DOF_COUNT, nlc_path_count) .ne. 1) &
|
|
call fail(304)
|
|
if (nlc_path_int(NLC_PATH_I_STATUS_CODE, nlc_path_count) .ne. &
|
|
CONVERGENCE_STATUS_CONVERGED) call fail(305)
|
|
|
|
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
|
|
use_disp_path_adaptive = old_disp_adaptive
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(306)
|
|
end subroutine check_static_arc_disp_adaptive
|
|
|
|
subroutine check_static_arc_disp_trust()
|
|
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
|
|
|
|
call setup_prescribed_model(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(312)
|
|
|
|
old_method = nonlinear_continuation_method
|
|
old_radius = nlc_trust_radius
|
|
old_min_radius = nlc_trust_min_radius
|
|
old_max_radius = nlc_trust_max_radius
|
|
|
|
nonlinear_continuation_method = NLC_ARC_DISP
|
|
nlc_trust_radius = 0.05_rk
|
|
nlc_trust_min_radius = 0.01_rk
|
|
nlc_trust_max_radius = 0.10_rk
|
|
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(313)
|
|
if (nlc_path_count .ne. 2) call fail(314)
|
|
call check_close(nlc_path_real(NLC_PATH_R_TIME, 2), ONE, 315)
|
|
if (nlc_trust_radius .le. ZERO) call fail(316)
|
|
if (nlc_last_damping .le. ZERO .or. &
|
|
nlc_last_damping .gt. ONE + TOL) call fail(318)
|
|
if (nlc_path_int(NLC_PATH_I_STATUS_CODE, 2) .ne. &
|
|
CONVERGENCE_STATUS_CONVERGED) call fail(319)
|
|
|
|
nonlinear_continuation_method = old_method
|
|
nlc_trust_radius = old_radius
|
|
nlc_trust_min_radius = old_min_radius
|
|
nlc_trust_max_radius = old_max_radius
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(320)
|
|
end subroutine check_static_arc_disp_trust
|
|
|
|
subroutine check_path_storage_reset()
|
|
integer :: i
|
|
|
|
call nlc_path_release()
|
|
call append_storage_row(1, 1.0_rk, 1.0_rk, 5700)
|
|
call append_storage_row(2, 2.0_rk, 2.0_rk, 5701)
|
|
call append_storage_row(3, 1.5_rk, 1.5_rk, 5702)
|
|
if (nlc_path_count .ne. 3) call fail(5703)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_LOAD_REVERSAL, 3) .ne. 1) &
|
|
call fail(5704)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_TURNING_POINT, 3) .ne. 1) &
|
|
call fail(5705)
|
|
|
|
call nlc_path_reset()
|
|
if (nlc_path_count .ne. 0) call fail(5706)
|
|
call append_storage_row(4, 10.0_rk, 10.0_rk, 5707)
|
|
if (nlc_path_count .ne. 1) call fail(5708)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_LOAD_REVERSAL, 1) .ne. 0) &
|
|
call fail(5709)
|
|
if (nlc_path_int(NLC_PATH_I_ARC_TURNING_POINT, 1) .ne. 0) &
|
|
call fail(5710)
|
|
call check_close(nlc_path_real(NLC_PATH_R_ARC_LOAD_DELTA, 1), ZERO, 5711)
|
|
call check_close(nlc_path_real(NLC_PATH_R_WORK, 1), ZERO, 5712)
|
|
|
|
call nlc_path_release()
|
|
if (nlc_path_count .ne. 0) call fail(5713)
|
|
if (nlc_path_capacity .ne. 0) call fail(5714)
|
|
do i = 1, 10
|
|
call append_storage_row(i, real(i, rk), real(i, rk), 5720 + i)
|
|
end do
|
|
if (nlc_path_count .ne. 10) call fail(5731)
|
|
if (nlc_path_capacity .lt. 10) call fail(5732)
|
|
if (nlc_path_int(NLC_PATH_I_STEP, 1) .ne. 1) call fail(5733)
|
|
if (nlc_path_int(NLC_PATH_I_STEP, 10) .ne. 10) call fail(5734)
|
|
call check_close(nlc_path_real(NLC_PATH_R_PARAMETER, 10), 10.0_rk, 5735)
|
|
call nlc_path_release()
|
|
end subroutine check_path_storage_reset
|
|
|
|
subroutine append_storage_row(step, parameter, reaction, code_base)
|
|
integer, intent(in) :: step
|
|
integer, intent(in) :: code_base
|
|
real(rk), intent(in) :: parameter
|
|
real(rk), intent(in) :: reaction
|
|
integer :: ierr
|
|
|
|
call nlc_path_append(step, real(step, rk), parameter, 1, &
|
|
0.1_rk * parameter, 0.1_rk * parameter, 0.1_rk * parameter, &
|
|
0.1_rk * parameter, ZERO, ZERO, reaction, reaction, step, &
|
|
ZERO, ZERO, ZERO, CONVERGENCE_STATUS_CONVERGED, CONV_FAIL_NONE, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(code_base)
|
|
end subroutine append_storage_row
|
|
|
|
subroutine check_nonlinear_cg_fallback()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: dof
|
|
integer :: method
|
|
integer :: preconditioner
|
|
integer :: last_method
|
|
integer :: last_preconditioner
|
|
integer :: status_code
|
|
integer :: failure_class
|
|
real(rk) :: res_norm
|
|
real(rk) :: last_residual
|
|
character(len=64) :: failure_reason
|
|
|
|
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 linear_solver_get_fail_info(failure_class, failure_reason, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5263)
|
|
if (failure_class .ne. LS_FAIL_NONE) call fail(5264)
|
|
if (index(trim(failure_reason), 'gmres-selected') .le. 0) &
|
|
call fail(5265)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(262)
|
|
end subroutine check_nonlinear_cg_fallback
|
|
|
|
subroutine check_nl_linear_failure_reason()
|
|
integer :: ierr
|
|
integer :: iter
|
|
integer :: old_method
|
|
integer :: old_preconditioner
|
|
integer :: old_linear_limit
|
|
integer :: method
|
|
integer :: preconditioner
|
|
integer :: failure_class
|
|
integer :: status_code
|
|
real(rk) :: res_norm
|
|
real(rk) :: final_residual
|
|
real(rk) :: relative_residual
|
|
real(rk) :: initial_residual
|
|
character(len=64) :: failure_reason
|
|
|
|
call setup_unconstrained_load(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5400)
|
|
|
|
call linear_solver_get_settings(old_method, old_preconditioner, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5401)
|
|
old_linear_limit = nonlinear_linear_iter_limit
|
|
|
|
call linear_solver_configure(LSOLVER_DENSE, LPRECOND_NONE, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5402)
|
|
nonlinear_linear_iter_limit = 1
|
|
current_time = ZERO
|
|
current_step = 0
|
|
|
|
call implicit_solve_nonlinear_static(ONE, 1, 20, 1.0e-12_rk, &
|
|
iter, res_norm, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(5403)
|
|
if (convergence_status_code .ne. CONVERGENCE_STATUS_FAILED) &
|
|
call fail(5404)
|
|
if (convergence_failure_reason_id .ne. NFAIL_LINEAR_SOLVE) call fail(5405)
|
|
|
|
call linear_solver_get_diagnostics(failure_class, initial_residual, &
|
|
final_residual, relative_residual, status_code, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5406)
|
|
if (status_code .ne. LS_STATUS_FAILED) call fail(5407)
|
|
if (initial_residual .le. ZERO) call fail(5408)
|
|
if (relative_residual .le. ZERO) call fail(5409)
|
|
|
|
call linear_solver_get_fail_info(failure_class, failure_reason, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5410)
|
|
if (failure_class .ne. LS_FAIL_DENSE_FALLBACK) call fail(5411)
|
|
if (index(trim(failure_reason), 'dense-fallback-failure') .le. 0) &
|
|
call fail(5412)
|
|
call linear_solver_get_settings(method, preconditioner, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5415)
|
|
if (method .ne. LSOLVER_DENSE) call fail(5416)
|
|
if (preconditioner .ne. LPRECOND_NONE) call fail(5417)
|
|
|
|
nonlinear_linear_iter_limit = old_linear_limit
|
|
call linear_solver_configure(old_method, old_preconditioner, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5413)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(5414)
|
|
end subroutine check_nl_linear_failure_reason
|
|
|
|
subroutine setup_pull_model(ierr)
|
|
integer, intent(out) :: ierr
|
|
|
|
call setup_base_tet(4, 1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
bc_target(1) = '1'
|
|
bc_dof_start(1) = 1
|
|
bc_dof_end(1) = 3
|
|
bc_value(1) = ZERO
|
|
|
|
bc_target(2) = '2'
|
|
bc_dof_start(2) = 2
|
|
bc_dof_end(2) = 3
|
|
bc_value(2) = ZERO
|
|
|
|
bc_target(3) = '3'
|
|
bc_dof_start(3) = 1
|
|
bc_dof_end(3) = 3
|
|
bc_value(3) = ZERO
|
|
|
|
bc_target(4) = '4'
|
|
bc_dof_start(4) = 1
|
|
bc_dof_end(4) = 3
|
|
bc_value(4) = ZERO
|
|
|
|
cload_target(1) = '2'
|
|
cload_dof(1) = 1
|
|
cload_value(1) = 5.0_rk
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_pull_model
|
|
|
|
subroutine setup_single_free_dof_model(ierr)
|
|
integer, intent(out) :: ierr
|
|
|
|
call setup_base_tet(4, 0, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
bc_target(1) = '1'
|
|
bc_dof_start(1) = 1
|
|
bc_dof_end(1) = 3
|
|
bc_value(1) = ZERO
|
|
|
|
bc_target(2) = '2'
|
|
bc_dof_start(2) = 2
|
|
bc_dof_end(2) = 3
|
|
bc_value(2) = ZERO
|
|
|
|
bc_target(3) = '3'
|
|
bc_dof_start(3) = 1
|
|
bc_dof_end(3) = 3
|
|
bc_value(3) = ZERO
|
|
|
|
bc_target(4) = '4'
|
|
bc_dof_start(4) = 1
|
|
bc_dof_end(4) = 3
|
|
bc_value(4) = ZERO
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_single_free_dof_model
|
|
|
|
subroutine setup_unconstrained_load(ierr)
|
|
integer, intent(out) :: ierr
|
|
|
|
call setup_base_tet(0, 1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
cload_target(1) = '2'
|
|
cload_dof(1) = 1
|
|
cload_value(1) = 5.0_rk
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_unconstrained_load
|
|
|
|
subroutine setup_prescribed_model(ierr)
|
|
integer, intent(out) :: ierr
|
|
|
|
call setup_base_tet(5, 0, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
bc_target(1) = '1'
|
|
bc_dof_start(1) = 1
|
|
bc_dof_end(1) = 3
|
|
bc_value(1) = ZERO
|
|
|
|
bc_target(2) = '2'
|
|
bc_dof_start(2) = 1
|
|
bc_dof_end(2) = 1
|
|
bc_value(2) = 0.25_rk
|
|
|
|
bc_target(3) = '2'
|
|
bc_dof_start(3) = 2
|
|
bc_dof_end(3) = 3
|
|
bc_value(3) = ZERO
|
|
|
|
bc_target(4) = '3'
|
|
bc_dof_start(4) = 1
|
|
bc_dof_end(4) = 3
|
|
bc_value(4) = ZERO
|
|
|
|
bc_target(5) = '4'
|
|
bc_dof_start(5) = 1
|
|
bc_dof_end(5) = 3
|
|
bc_value(5) = ZERO
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_prescribed_model
|
|
|
|
subroutine setup_prescribed_amp_model(ierr)
|
|
integer, intent(out) :: ierr
|
|
|
|
call setup_base_tet(5, 0, ierr, num_amp=1, num_amp_items=2)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
bc_target(1) = '1'
|
|
bc_dof_start(1) = 1
|
|
bc_dof_end(1) = 3
|
|
bc_value(1) = ZERO
|
|
|
|
bc_target(2) = '2'
|
|
bc_dof_start(2) = 1
|
|
bc_dof_end(2) = 1
|
|
bc_value(2) = 0.25_rk
|
|
bc_amp(2) = 1
|
|
|
|
bc_target(3) = '2'
|
|
bc_dof_start(3) = 2
|
|
bc_dof_end(3) = 3
|
|
bc_value(3) = ZERO
|
|
|
|
bc_target(4) = '3'
|
|
bc_dof_start(4) = 1
|
|
bc_dof_end(4) = 3
|
|
bc_value(4) = ZERO
|
|
|
|
bc_target(5) = '4'
|
|
bc_dof_start(5) = 1
|
|
bc_dof_end(5) = 3
|
|
bc_value(5) = ZERO
|
|
|
|
amp_name(1) = 'RAMP'
|
|
amp_start(1) = 1
|
|
amp_count(1) = 2
|
|
amp_time(1) = ZERO
|
|
amp_value(1) = ZERO
|
|
amp_time(2) = ONE
|
|
amp_value(2) = ONE
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_prescribed_amp_model
|
|
|
|
subroutine setup_base_tet(num_bc, num_cload, ierr, num_dload, num_amp, &
|
|
num_amp_items)
|
|
integer, intent(in) :: num_bc
|
|
integer, intent(in) :: num_cload
|
|
integer, intent(out) :: ierr
|
|
integer, intent(in), optional :: num_dload
|
|
integer, intent(in), optional :: num_amp
|
|
integer, intent(in), optional :: num_amp_items
|
|
integer :: i
|
|
integer :: ndload_local
|
|
integer :: namp_local
|
|
integer :: namp_item_local
|
|
|
|
ndload_local = 0
|
|
if (present(num_dload)) ndload_local = num_dload
|
|
namp_local = 0
|
|
if (present(num_amp)) namp_local = num_amp
|
|
namp_item_local = 0
|
|
if (present(num_amp_items)) namp_item_local = num_amp_items
|
|
|
|
call database_allocate_model(4, 1, 0, 0, 0, 0, 1, 0, 1, &
|
|
namp_local, namp_item_local, num_bc, &
|
|
num_cload, ndload_local, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
do i = 1, 4
|
|
node_id_ext(i) = i
|
|
coord0(:,i) = ZERO
|
|
coord(:,i) = ZERO
|
|
end do
|
|
coord0(:,2) = (/ ONE, ZERO, ZERO /)
|
|
coord0(:,3) = (/ ZERO, ONE, ZERO /)
|
|
coord0(:,4) = (/ ZERO, ZERO, ONE /)
|
|
|
|
elem_id_ext(1) = 1
|
|
elem_type(1) = 'C3D4'
|
|
elem_nnode(1) = 4
|
|
elem_conn(:,1) = 0
|
|
elem_conn(1:4,1) = (/ 1, 2, 3, 4 /)
|
|
elem_mat(1) = 1
|
|
elem_sec(1) = 1
|
|
|
|
section_type(1) = 'SOLID'
|
|
section_elset_name(1) = 'EALL'
|
|
section_material_name(1) = 'MAT'
|
|
|
|
mat_name(1) = 'MAT'
|
|
mat_density(1) = ONE
|
|
mat_e(1) = 30.0_rk
|
|
mat_nu(1) = 0.25_rk
|
|
|
|
call database_assign_dofs(ierr)
|
|
end subroutine setup_base_tet
|
|
|
|
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 check_reason_name(reason_id, expected, code)
|
|
integer, intent(in) :: reason_id
|
|
character(len=*), intent(in) :: expected
|
|
integer, intent(in) :: code
|
|
character(len=64) :: actual
|
|
|
|
call convergence_failure_reason_name(reason_id, actual)
|
|
if (trim(actual) .ne. trim(expected)) call fail(code)
|
|
end subroutine check_reason_name
|
|
|
|
subroutine check_cutback_reason_name(reason_id, expected, code)
|
|
integer, intent(in) :: reason_id
|
|
character(len=*), intent(in) :: expected
|
|
integer, intent(in) :: code
|
|
character(len=64) :: actual
|
|
|
|
call cutback_reason_name(reason_id, actual)
|
|
if (trim(actual) .ne. trim(expected)) call fail(code)
|
|
end subroutine check_cutback_reason_name
|
|
|
|
subroutine check_lifecycle_event(index, expected_event, expected_reason, &
|
|
code)
|
|
integer, intent(in) :: index
|
|
integer, intent(in) :: expected_event
|
|
integer, intent(in) :: expected_reason
|
|
integer, intent(in) :: code
|
|
integer :: step
|
|
integer :: increment
|
|
integer :: iteration
|
|
integer :: event_id
|
|
integer :: reason_id
|
|
character(len=64) :: event_name
|
|
character(len=64) :: reason_name
|
|
|
|
call nl_lifecycle_get_event(index, step, increment, iteration, event_id, &
|
|
event_name, reason_id, reason_name)
|
|
if (event_id .ne. expected_event) call fail(code)
|
|
if (reason_id .ne. expected_reason) call fail(code + 100)
|
|
end subroutine check_lifecycle_event
|
|
|
|
subroutine check_lifecycle_last(expected_event, expected_reason, code)
|
|
integer, intent(in) :: expected_event
|
|
integer, intent(in) :: expected_reason
|
|
integer, intent(in) :: code
|
|
integer :: count
|
|
|
|
count = nl_lifecycle_get_event_count()
|
|
if (count .le. 0) call fail(code)
|
|
call check_lifecycle_event(count, expected_event, expected_reason, code)
|
|
end subroutine check_lifecycle_last
|
|
|
|
subroutine check_lifecycle_arc(expected_load, max_arc_residual, &
|
|
expected_appended, code)
|
|
real(rk), intent(in) :: expected_load
|
|
real(rk), intent(in) :: max_arc_residual
|
|
logical, intent(in) :: expected_appended
|
|
integer, intent(in) :: code
|
|
real(rk) :: load_snapshot
|
|
real(rk) :: arc_residual
|
|
logical :: path_appended
|
|
|
|
call nl_lifecycle_get_arc_state(load_snapshot, arc_residual, &
|
|
path_appended)
|
|
call check_close(load_snapshot, expected_load, code)
|
|
if (abs(arc_residual) .gt. max_arc_residual) call fail(code + 1)
|
|
if (path_appended .neqv. expected_appended) call fail(code + 2)
|
|
end subroutine check_lifecycle_arc
|
|
|
|
subroutine check_lifecycle_audit_min(min_begin, min_rollback_requested, &
|
|
min_rollback_ok, max_rollback_failed, &
|
|
min_commit_ok, code)
|
|
integer, intent(in) :: min_begin
|
|
integer, intent(in) :: min_rollback_requested
|
|
integer, intent(in) :: min_rollback_ok
|
|
integer, intent(in) :: max_rollback_failed
|
|
integer, intent(in) :: min_commit_ok
|
|
integer, intent(in) :: code
|
|
integer :: status_id
|
|
integer :: begin_trial_count
|
|
integer :: rollback_requested_count
|
|
integer :: rollback_ok_count
|
|
integer :: rollback_failed_count
|
|
integer :: commit_ok_count
|
|
character(len=64) :: status_name
|
|
|
|
call nl_lifecycle_get_audit(status_id, status_name, begin_trial_count, &
|
|
rollback_requested_count, rollback_ok_count, rollback_failed_count, &
|
|
commit_ok_count)
|
|
if (begin_trial_count .lt. min_begin) call fail(code)
|
|
if (rollback_requested_count .lt. min_rollback_requested) &
|
|
call fail(code + 1)
|
|
if (rollback_ok_count .lt. min_rollback_ok) call fail(code + 2)
|
|
if (rollback_failed_count .gt. max_rollback_failed) call fail(code + 3)
|
|
if (commit_ok_count .lt. min_commit_ok) call fail(code + 4)
|
|
end subroutine check_lifecycle_audit_min
|
|
|
|
subroutine check_lifecycle_summary(expected_event, expected_reason, &
|
|
min_accept, min_reject, min_cutback, &
|
|
code)
|
|
integer, intent(in) :: expected_event
|
|
integer, intent(in) :: expected_reason
|
|
integer, intent(in) :: min_accept
|
|
integer, intent(in) :: min_reject
|
|
integer, intent(in) :: min_cutback
|
|
integer, intent(in) :: code
|
|
integer :: step
|
|
integer :: increment
|
|
integer :: iteration
|
|
integer :: event_id
|
|
integer :: reason_id
|
|
integer :: audit_status
|
|
integer :: begin_trial_count
|
|
integer :: rollback_requested_count
|
|
integer :: rollback_ok_count
|
|
integer :: rollback_failed_count
|
|
integer :: commit_ok_count
|
|
integer :: accept_count
|
|
integer :: reject_count
|
|
integer :: cutback_count
|
|
character(len=64) :: event_name
|
|
character(len=64) :: reason_name
|
|
character(len=64) :: audit_name
|
|
|
|
call nl_lifecycle_get_summary(step, increment, iteration, event_id, &
|
|
event_name, reason_id, reason_name, audit_status, audit_name, &
|
|
begin_trial_count, rollback_requested_count, rollback_ok_count, &
|
|
rollback_failed_count, commit_ok_count, accept_count, reject_count, &
|
|
cutback_count)
|
|
if (event_id .ne. expected_event) call fail(code)
|
|
if (reason_id .ne. expected_reason) call fail(code + 1)
|
|
if (trim(event_name) .eq. 'unknown') call fail(code + 2)
|
|
if (trim(reason_name) .eq. 'unknown') call fail(code + 3)
|
|
if (accept_count .lt. min_accept) call fail(code + 4)
|
|
if (reject_count .lt. min_reject) call fail(code + 5)
|
|
if (cutback_count .lt. min_cutback) call fail(code + 6)
|
|
if (audit_status .lt. NLC_AUDIT_NONE) call fail(code + 7)
|
|
if (begin_trial_count .lt. 0) call fail(code + 8)
|
|
if (rollback_requested_count .lt. 0) call fail(code + 9)
|
|
if (rollback_ok_count .lt. 0) call fail(code + 10)
|
|
if (rollback_failed_count .lt. 0) call fail(code + 11)
|
|
if (commit_ok_count .lt. 0) call fail(code + 12)
|
|
end subroutine check_lifecycle_summary
|
|
|
|
integer function lifecycle_count_event(expected_event)
|
|
integer, intent(in) :: expected_event
|
|
integer :: i
|
|
integer :: step
|
|
integer :: increment
|
|
integer :: iteration
|
|
integer :: event_id
|
|
integer :: reason_id
|
|
character(len=64) :: event_name
|
|
character(len=64) :: reason_name
|
|
|
|
lifecycle_count_event = 0
|
|
do i = 1, nl_lifecycle_get_event_count()
|
|
call nl_lifecycle_get_event(i, step, increment, iteration, event_id, &
|
|
event_name, reason_id, reason_name)
|
|
if (event_id .eq. expected_event) then
|
|
lifecycle_count_event = lifecycle_count_event + 1
|
|
end if
|
|
end do
|
|
end function lifecycle_count_event
|
|
|
|
integer function lifecycle_count_event_reason(expected_event, &
|
|
expected_reason)
|
|
integer, intent(in) :: expected_event
|
|
integer, intent(in) :: expected_reason
|
|
integer :: i
|
|
integer :: step
|
|
integer :: increment
|
|
integer :: iteration
|
|
integer :: event_id
|
|
integer :: reason_id
|
|
character(len=64) :: event_name
|
|
character(len=64) :: reason_name
|
|
|
|
lifecycle_count_event_reason = 0
|
|
do i = 1, nl_lifecycle_get_event_count()
|
|
call nl_lifecycle_get_event(i, step, increment, iteration, event_id, &
|
|
event_name, reason_id, reason_name)
|
|
if (event_id .eq. expected_event .and. &
|
|
reason_id .eq. expected_reason) then
|
|
lifecycle_count_event_reason = lifecycle_count_event_reason + 1
|
|
end if
|
|
end do
|
|
end function lifecycle_count_event_reason
|
|
|
|
subroutine check_path_breakdown_header(code_base)
|
|
integer, intent(in) :: code_base
|
|
character(len=2048) :: header
|
|
character(len=2048) :: row_line
|
|
integer :: ierr
|
|
integer :: ios
|
|
integer :: unit_id
|
|
integer :: header_fields
|
|
integer :: row_fields
|
|
|
|
call output_csv_set_directory('build-codex-gcc/test_solver_implicit_path', &
|
|
ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(code_base)
|
|
call output_csv_write_path(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(code_base + 1)
|
|
|
|
unit_id = 94
|
|
open(unit=unit_id, &
|
|
file='build-codex-gcc/test_solver_implicit_path/continuation_path.csv', &
|
|
status='old', action='read', iostat=ios)
|
|
if (ios .ne. 0) call fail(code_base + 2)
|
|
read(unit_id,'(A)',iostat=ios) header
|
|
if (ios .ne. 0) call fail(code_base + 3)
|
|
read(unit_id,'(A)',iostat=ios) row_line
|
|
close(unit_id)
|
|
if (ios .ne. 0) call fail(code_base + 4)
|
|
if (index(header, 'residual_total') .le. 0) call fail(code_base + 5)
|
|
if (index(header, 'residual_force') .le. 0) call fail(code_base + 6)
|
|
if (index(header, 'residual_contact') .le. 0) call fail(code_base + 7)
|
|
if (index(header, 'residual_constraint') .le. 0) call fail(code_base + 8)
|
|
if (index(header, 'residual_arc') .le. 0) call fail(code_base + 9)
|
|
if (index(header, 'material_failure_count') .le. 0) &
|
|
call fail(code_base + 10)
|
|
if (index(header, 'linear_method,linear_precond') .le. 0) &
|
|
call fail(code_base + 23)
|
|
if (index(header, 'linear_iterations,linear_status') .le. 0) &
|
|
call fail(code_base + 24)
|
|
if (index(header, 'linear_initial_residual') .le. 0) &
|
|
call fail(code_base + 25)
|
|
if (index(header, 'linear_final_residual') .le. 0) &
|
|
call fail(code_base + 26)
|
|
if (index(header, 'linear_relative_residual') .le. 0) &
|
|
call fail(code_base + 27)
|
|
if (index(header, 'lifecycle_event_id') .le. 0) &
|
|
call fail(code_base + 11)
|
|
if (index(header, 'lifecycle_event_name') .le. 0) &
|
|
call fail(code_base + 12)
|
|
if (index(header, 'lifecycle_audit_status') .le. 0) &
|
|
call fail(code_base + 13)
|
|
if (index(header, 'lifecycle_audit_name') .le. 0) &
|
|
call fail(code_base + 14)
|
|
if (index(header, 'lifecycle_increment') .le. 0) &
|
|
call fail(code_base + 15)
|
|
if (index(header, 'lifecycle_iteration') .le. 0) &
|
|
call fail(code_base + 16)
|
|
if (index(header, 'lifecycle_accept_count') .le. 0) &
|
|
call fail(code_base + 17)
|
|
if (index(header, 'lifecycle_reject_count') .le. 0) &
|
|
call fail(code_base + 18)
|
|
if (index(header, 'arc_mode,arc_predictor_consistent') .le. 0) &
|
|
call fail(code_base + 19)
|
|
if (index(header, 'arc_load_reversal,arc_turning_point') .le. 0) &
|
|
call fail(code_base + 20)
|
|
if (index(header, 'arc_length,arc_load_delta,arc_predictor_dot') .le. 0) &
|
|
call fail(code_base + 21)
|
|
header_fields = csv_test_fields(header)
|
|
row_fields = csv_test_fields(row_line)
|
|
if (header_fields .ne. 60) call fail(code_base + 28)
|
|
if (row_fields .ne. header_fields) call fail(code_base + 29)
|
|
if (index(row_line, ',accept,') .le. 0) call fail(code_base + 22)
|
|
end subroutine check_path_breakdown_header
|
|
|
|
integer function csv_test_fields(line)
|
|
character(len=*), intent(in) :: line
|
|
integer :: i
|
|
integer :: n
|
|
|
|
n = len_trim(line)
|
|
if (n .le. 0) then
|
|
csv_test_fields = 0
|
|
return
|
|
end if
|
|
csv_test_fields = 1
|
|
do i = 1, n
|
|
if (line(i:i) .eq. ',') csv_test_fields = csv_test_fields + 1
|
|
end do
|
|
end function csv_test_fields
|
|
|
|
subroutine check_lifecycle_report_row(output_dir, expected_event, &
|
|
expected_reason, code_base)
|
|
character(len=*), intent(in) :: output_dir
|
|
character(len=*), intent(in) :: expected_event
|
|
character(len=*), intent(in) :: expected_reason
|
|
integer, intent(in) :: code_base
|
|
character(len=2048) :: header
|
|
character(len=2048) :: row_line
|
|
character(len=512) :: filename
|
|
integer :: ierr
|
|
integer :: ios
|
|
integer :: unit_id
|
|
integer :: header_fields
|
|
integer :: row_fields
|
|
|
|
call output_csv_set_directory(output_dir, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(code_base)
|
|
call output_csv_write_nl_lifecycle(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(code_base + 1)
|
|
|
|
filename = trim(output_dir)//'/nonlinear_lifecycle.csv'
|
|
unit_id = 95
|
|
open(unit=unit_id, file=trim(filename), status='old', action='read', &
|
|
iostat=ios)
|
|
if (ios .ne. 0) call fail(code_base + 2)
|
|
read(unit_id,'(A)',iostat=ios) header
|
|
if (ios .ne. 0) call fail(code_base + 3)
|
|
read(unit_id,'(A)',iostat=ios) row_line
|
|
close(unit_id)
|
|
if (ios .ne. 0) call fail(code_base + 4)
|
|
if (index(header, 'convergence_status') .le. 0) call fail(code_base + 5)
|
|
if (index(header, 'cutback_reason_id') .le. 0) call fail(code_base + 6)
|
|
if (index(header, 'residual_total') .le. 0) call fail(code_base + 7)
|
|
if (index(header, 'linear_status') .le. 0) call fail(code_base + 8)
|
|
if (index(header, 'audit_status') .le. 0) call fail(code_base + 9)
|
|
if (index(header, 'linear_method,linear_precond') .le. 0) &
|
|
call fail(code_base + 12)
|
|
if (index(header, 'linear_iterations') .le. 0) call fail(code_base + 13)
|
|
if (index(header, 'linear_initial_residual') .le. 0) &
|
|
call fail(code_base + 14)
|
|
if (index(header, 'linear_final_residual') .le. 0) &
|
|
call fail(code_base + 15)
|
|
if (index(header, 'linear_relative_residual') .le. 0) &
|
|
call fail(code_base + 16)
|
|
if (index(header, 'linear_fail_class') .le. 0) call fail(code_base + 17)
|
|
header_fields = csv_test_fields(header)
|
|
row_fields = csv_test_fields(row_line)
|
|
if (header_fields .ne. 38) call fail(code_base + 18)
|
|
if (row_fields .ne. header_fields) call fail(code_base + 19)
|
|
if (index(row_line, ','//trim(expected_event)//',') .le. 0) &
|
|
call fail(code_base + 10)
|
|
if (index(row_line, ','//trim(expected_reason)//',') .le. 0) &
|
|
call fail(code_base + 11)
|
|
end subroutine check_lifecycle_report_row
|
|
|
|
subroutine check_solver_diag(code_base)
|
|
integer, intent(in) :: code_base
|
|
integer :: ierr
|
|
integer :: matrix_class
|
|
integer :: status_code
|
|
real(rk) :: initial_residual
|
|
real(rk) :: final_residual
|
|
real(rk) :: relative_residual
|
|
|
|
call linear_solver_get_diagnostics(matrix_class, initial_residual, &
|
|
final_residual, relative_residual, status_code, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(code_base)
|
|
if (matrix_class .lt. CSR_CLASS_GENERAL .or. &
|
|
matrix_class .gt. CSR_CLASS_SPD_CAND) call fail(code_base + 1)
|
|
if (status_code .ne. LS_STATUS_CONVERGED) call fail(code_base + 2)
|
|
if (initial_residual .le. final_residual) call fail(code_base + 3)
|
|
if (final_residual .gt. 1.0e-8_rk) call fail(code_base + 4)
|
|
if (relative_residual .gt. 1.0e-8_rk) call fail(code_base + 5)
|
|
end subroutine check_solver_diag
|
|
|
|
subroutine fail(code)
|
|
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
|
|
|
|
end program test_solver_implicit
|