Add convergence status diagnostics
FemLite CI / build-test (push) Has been cancelled

This commit is contained in:
shenw
2026-06-25 09:07:54 +08:00
parent 255c7caf4f
commit d2dc7ab689
11 changed files with 207 additions and 4 deletions
+21 -4
View File
@@ -203,8 +203,9 @@ contains
dt_try = sub_target_time - current_time
end if
call nonlinear_static_increment(sub_target_time, dt_try, max_iter, tol, &
iter_inc, res_norm, ierr)
call nonlinear_static_increment(current_step + 1, sub_target_time, &
dt_try, max_iter, tol, iter_inc, &
res_norm, ierr)
if (ierr .eq. FEM_SUCCESS) then
iter_total = iter_total + iter_inc
current_time = sub_target_time
@@ -818,8 +819,10 @@ contains
if (allocated(kcopy)) deallocate(kcopy)
end subroutine evaluate_newmark_trial_residual
subroutine nonlinear_static_increment(target_time, dt_inc, max_iter, tol, &
iter_used, res_norm, ierr)
subroutine nonlinear_static_increment(increment_id, target_time, dt_inc, &
max_iter, tol, iter_used, res_norm, &
ierr)
integer, intent(in) :: increment_id
real(rk), intent(in) :: target_time
real(rk), intent(in) :: dt_inc
integer, intent(in) :: max_iter
@@ -836,6 +839,7 @@ contains
real(rk) :: ref_norm
real(rk) :: trial_res_norm
real(rk) :: trial_ref_norm
real(rk) :: correction_norm
integer :: iter
integer :: stat
integer :: state_ierr
@@ -846,7 +850,13 @@ contains
ref_norm = ONE
trial_res_norm = ZERO
trial_ref_norm = ONE
correction_norm = ZERO
converged = .false.
convergence_increment = increment_id
convergence_iteration = 0
convergence_residual_norm = ZERO
convergence_correction_norm = ZERO
convergence_converged = .false.
allocate(residual(ndof), external(ndof), rhs_corr(ndof), du(ndof), &
u_start(ndof), u_base(ndof), stat=stat)
if (stat .ne. 0) then
@@ -870,8 +880,13 @@ contains
res_norm, ref_norm, ierr)
if (ierr .ne. FEM_SUCCESS) go to 900
iter_used = iter
convergence_iteration = iter
convergence_residual_norm = res_norm
convergence_correction_norm = correction_norm
convergence_converged = .false.
if (res_norm .le. tol .or. res_norm / ref_norm .le. tol) then
converged = .true.
convergence_converged = .true.
if (allocated(freaction)) freaction = fint - external
exit
end if
@@ -880,6 +895,8 @@ contains
call static_solve_correction(target_time, residual, rhs_corr, du, &
max_iter, tol, ierr)
if (ierr .ne. FEM_SUCCESS) go to 900
correction_norm = sqrt(sum(du * du))
convergence_correction_norm = correction_norm
u_base = u
if (use_line_search) then