This commit is contained in:
@@ -643,6 +643,7 @@ contains
|
||||
total_cutback = 0
|
||||
convergence_cutback_count = 0
|
||||
convergence_failure_code = CONV_FAIL_NONE
|
||||
convergence_failure_reason_id = NFAIL_NONE
|
||||
convergence_last_accepted_time = current_time
|
||||
|
||||
do
|
||||
@@ -665,11 +666,17 @@ contains
|
||||
convergence_last_dt = dt_step
|
||||
convergence_status_code = CONVERGENCE_STATUS_CUTBACK
|
||||
convergence_failure_code = CONV_FAIL_NONE
|
||||
convergence_failure_reason_id = NFAIL_NONE
|
||||
ierr = FEM_SUCCESS
|
||||
else
|
||||
convergence_cutback_count = total_cutback
|
||||
convergence_status_code = CONVERGENCE_STATUS_FAILED
|
||||
convergence_failure_code = CONV_FAIL_CUTBACK_LIMIT
|
||||
if (linear_solver_last_status .eq. LS_STATUS_FAILED) then
|
||||
convergence_failure_reason_id = NFAIL_LINEAR_SOLVE
|
||||
else
|
||||
convergence_failure_reason_id = NFAIL_MIN_STEP
|
||||
end if
|
||||
return
|
||||
end if
|
||||
end do
|
||||
@@ -692,6 +699,7 @@ contains
|
||||
'nonlinear Newmark run stopped before end time', ierr)
|
||||
convergence_status_code = CONVERGENCE_STATUS_FAILED
|
||||
convergence_failure_code = CONV_FAIL_STOPPED
|
||||
convergence_failure_reason_id = NFAIL_STOPPED
|
||||
return
|
||||
end if
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ module fem_api_diagnostics
|
||||
use fem_control
|
||||
use fem_linear_solver_cg, only: linear_solver_configure, &
|
||||
linear_solver_get_settings, linear_solver_get_stats, &
|
||||
linear_solver_get_diagnostics
|
||||
linear_solver_get_diagnostics, linear_solver_get_fail_info
|
||||
use fem_api_state, only: api_initialized
|
||||
implicit none
|
||||
private
|
||||
@@ -12,12 +12,15 @@ module fem_api_diagnostics
|
||||
public :: fem_get_convergence_status
|
||||
public :: fem_get_convergence_metrics
|
||||
public :: fem_get_convergence_diagnostics
|
||||
public :: fem_get_convergence_reason
|
||||
public :: fem_get_residual_breakdown
|
||||
public :: fem_get_continuation_path_count
|
||||
public :: fem_get_continuation_path_row
|
||||
public :: fem_set_linear_solver
|
||||
public :: fem_get_linear_solver_settings
|
||||
public :: fem_get_linear_solver_stats
|
||||
public :: fem_get_linsol_diagnostics
|
||||
public :: fem_get_linsol_failure_info
|
||||
public :: fem_set_shell_stabilization
|
||||
public :: fem_get_shell_stabilization
|
||||
public :: fem_get_shell_stability_stats
|
||||
@@ -48,6 +51,11 @@ contains
|
||||
if (present(contact_gap_norm)) then
|
||||
convergence_contact_gap_norm = contact_gap_norm
|
||||
end if
|
||||
convergence_total_resid_norm = residual_norm
|
||||
convergence_force_resid_norm = residual_norm
|
||||
convergence_contact_resid_norm = convergence_contact_gap_norm
|
||||
convergence_cons_resid_norm = ZERO
|
||||
convergence_arc_resid_norm = ZERO
|
||||
convergence_combined_norm = max(convergence_rel_resid_norm, &
|
||||
max(convergence_correction_norm, convergence_contact_gap_norm))
|
||||
convergence_last_dt = last_dt
|
||||
@@ -56,9 +64,11 @@ contains
|
||||
if (converged) then
|
||||
convergence_status_code = CONVERGENCE_STATUS_CONVERGED
|
||||
convergence_failure_code = CONV_FAIL_NONE
|
||||
convergence_failure_reason_id = NFAIL_NONE
|
||||
else
|
||||
convergence_status_code = CONVERGENCE_STATUS_FAILED
|
||||
convergence_failure_code = CONV_FAIL_NONCONVERGENCE
|
||||
convergence_failure_reason_id = NFAIL_NONCONVERGENCE
|
||||
end if
|
||||
end subroutine fem_record_convergence
|
||||
|
||||
@@ -144,6 +154,59 @@ contains
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine fem_get_convergence_diagnostics
|
||||
|
||||
subroutine fem_get_convergence_reason(reason_id, reason_name, ierr)
|
||||
integer, intent(out) :: reason_id
|
||||
character(len=*), intent(out) :: reason_name
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
reason_id = NFAIL_NONE
|
||||
reason_name = 'none'
|
||||
|
||||
if (.not. api_initialized) then
|
||||
call error_set(FEM_ERR_INTERNAL, &
|
||||
'fem_get_convergence_reason called before fem_initialize', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
reason_id = convergence_failure_reason_id
|
||||
call convergence_failure_reason_name(reason_id, reason_name)
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine fem_get_convergence_reason
|
||||
|
||||
subroutine fem_get_residual_breakdown(total_residual, force_residual, &
|
||||
contact_residual, constraint_residual, &
|
||||
arc_residual, material_fail_count, &
|
||||
ierr)
|
||||
real(rk), intent(out) :: total_residual
|
||||
real(rk), intent(out) :: force_residual
|
||||
real(rk), intent(out) :: contact_residual
|
||||
real(rk), intent(out) :: constraint_residual
|
||||
real(rk), intent(out) :: arc_residual
|
||||
integer, intent(out) :: material_fail_count
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
total_residual = ZERO
|
||||
force_residual = ZERO
|
||||
contact_residual = ZERO
|
||||
constraint_residual = ZERO
|
||||
arc_residual = ZERO
|
||||
material_fail_count = 0
|
||||
|
||||
if (.not. api_initialized) then
|
||||
call error_set(FEM_ERR_INTERNAL, &
|
||||
'fem_get_residual_breakdown called before fem_initialize', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
total_residual = convergence_total_resid_norm
|
||||
force_residual = convergence_force_resid_norm
|
||||
contact_residual = convergence_contact_resid_norm
|
||||
constraint_residual = convergence_cons_resid_norm
|
||||
arc_residual = convergence_arc_resid_norm
|
||||
material_fail_count = convergence_material_fail_count
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine fem_get_residual_breakdown
|
||||
|
||||
subroutine fem_get_continuation_path_count(count, ierr)
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ierr
|
||||
@@ -312,6 +375,20 @@ contains
|
||||
call linear_solver_get_diagnostics(matrix_class, initial_residual, &
|
||||
final_residual, relative_residual, status_code, ierr)
|
||||
end subroutine fem_get_linsol_diagnostics
|
||||
subroutine fem_get_linsol_failure_info(failure_class, reason, ierr)
|
||||
integer, intent(out) :: failure_class
|
||||
character(len=*), intent(out) :: reason
|
||||
integer, intent(out) :: ierr
|
||||
failure_class = LS_FAIL_NONE
|
||||
reason = 'none'
|
||||
if (.not. api_initialized) then
|
||||
call error_set(FEM_ERR_INTERNAL, &
|
||||
'fem_get_linsol_failure_diagnostics called before fem_initialize', &
|
||||
ierr)
|
||||
return
|
||||
end if
|
||||
call linear_solver_get_fail_info(failure_class, reason, ierr)
|
||||
end subroutine fem_get_linsol_failure_info
|
||||
subroutine fem_set_shell_stabilization(drilling_factor, s3_shear_factor, &
|
||||
s3_shear_min_scale, ierr)
|
||||
real(rk), intent(in) :: drilling_factor
|
||||
|
||||
+141
-2
@@ -17,6 +17,22 @@ module fem_control
|
||||
integer, parameter :: CONV_FAIL_NONCONVERGENCE = 1
|
||||
integer, parameter :: CONV_FAIL_CUTBACK_LIMIT = 2
|
||||
integer, parameter :: CONV_FAIL_STOPPED = 3
|
||||
integer, parameter :: NFAIL_NONE = 0
|
||||
integer, parameter :: NFAIL_LINEAR_SOLVE = 10
|
||||
integer, parameter :: NFAIL_RESIDUAL_STAGNATION = 20
|
||||
integer, parameter :: NFAIL_CORRECTION_LIMIT = 30
|
||||
integer, parameter :: NFAIL_LINE_SEARCH = 40
|
||||
integer, parameter :: NFAIL_TRUST_REJECTION = 50
|
||||
integer, parameter :: NFAIL_CONTACT_ACTIVE_SET = 60
|
||||
integer, parameter :: NFAIL_CONTACT_PROJECTION = 61
|
||||
integer, parameter :: NFAIL_CONTACT_PENETRATION = 62
|
||||
integer, parameter :: NFAIL_FRICTION_SWITCH = 70
|
||||
integer, parameter :: NFAIL_MATERIAL_RETURN = 80
|
||||
integer, parameter :: NFAIL_ARC_CONSTRAINT = 90
|
||||
integer, parameter :: NFAIL_CONSTRAINT_RESIDUAL = 100
|
||||
integer, parameter :: NFAIL_MIN_STEP = 110
|
||||
integer, parameter :: NFAIL_NONCONVERGENCE = 120
|
||||
integer, parameter :: NFAIL_STOPPED = 130
|
||||
integer, parameter :: LSOLVER_CG = 1
|
||||
integer, parameter :: LSOLVER_BICGSTAB = 2
|
||||
integer, parameter :: LSOLVER_GMRES = 3
|
||||
@@ -28,6 +44,12 @@ module fem_control
|
||||
integer, parameter :: LS_STATUS_IDLE = 0
|
||||
integer, parameter :: LS_STATUS_CONVERGED = 1
|
||||
integer, parameter :: LS_STATUS_FAILED = -1
|
||||
integer, parameter :: LS_FAIL_NONE = 0
|
||||
integer, parameter :: LS_FAIL_NONCONVERGENCE = 1
|
||||
integer, parameter :: LS_FAIL_INVALID_MATRIX = 2
|
||||
integer, parameter :: LS_FAIL_DENSE_FALLBACK = 3
|
||||
integer, parameter :: LS_FAIL_CONFIGURATION = 4
|
||||
integer, parameter :: LS_FAIL_DIAGNOSTIC = 5
|
||||
integer, parameter :: NLC_TWO_STAGE = 1
|
||||
integer, parameter :: NLC_ADAPT_NEWTON = 2
|
||||
integer, parameter :: NLC_TRUST_DAMPED = 3
|
||||
@@ -64,7 +86,12 @@ module fem_control
|
||||
integer, parameter :: NLC_PATH_R_NEXT_TRUST_RADIUS = 22
|
||||
integer, parameter :: NLC_PATH_R_TRUST_DAMPING = 23
|
||||
integer, parameter :: NLC_PATH_R_TRUST_MERIT_RATIO = 24
|
||||
integer, parameter :: NLC_PATH_REAL_COUNT = 24
|
||||
integer, parameter :: NLC_PATH_R_TOTAL_RESIDUAL = 25
|
||||
integer, parameter :: NLC_PATH_R_FORCE_RESIDUAL = 26
|
||||
integer, parameter :: NLC_PATH_R_CONTACT_RESIDUAL = 27
|
||||
integer, parameter :: NLC_PATH_R_CONS_RESIDUAL = 28
|
||||
integer, parameter :: NLC_PATH_R_ARC_RESIDUAL = 29
|
||||
integer, parameter :: NLC_PATH_REAL_COUNT = 29
|
||||
integer, parameter :: NLC_PATH_I_STEP = 1
|
||||
integer, parameter :: NLC_PATH_I_CONTROL_DOF_COUNT = 2
|
||||
integer, parameter :: NLC_PATH_I_ITERATION = 3
|
||||
@@ -78,7 +105,9 @@ module fem_control
|
||||
integer, parameter :: NLC_PATH_I_CUTBACK_COUNT = 11
|
||||
integer, parameter :: NLC_PATH_I_TRUST_ADJUST = 12
|
||||
integer, parameter :: NLC_PATH_I_TRUST_REJECTIONS = 13
|
||||
integer, parameter :: NLC_PATH_INT_COUNT = 13
|
||||
integer, parameter :: NLC_PATH_I_REASON_ID = 14
|
||||
integer, parameter :: NLC_PATH_I_MATERIAL_FAIL_COUNT = 15
|
||||
integer, parameter :: NLC_PATH_INT_COUNT = 15
|
||||
integer, parameter :: BUCKLING_MAX_GEOM_LINE = 64
|
||||
integer, parameter :: BUCK_GEOM_EXPLICIT = 1
|
||||
integer, parameter :: BUCK_GEOM_PRELOAD = 2
|
||||
@@ -146,6 +175,7 @@ module fem_control
|
||||
integer :: linear_solver_last_iter = 0
|
||||
integer :: linear_solver_last_status = LS_STATUS_IDLE
|
||||
integer :: linear_solver_last_matrix_class = 1
|
||||
integer :: linsol_last_fail_class = LS_FAIL_NONE
|
||||
integer :: nonlinear_linear_iter_limit = 0
|
||||
integer :: nonlinear_continuation_method = NLC_DEFAULT
|
||||
integer :: buckling_num_modes = 1
|
||||
@@ -177,11 +207,18 @@ module fem_control
|
||||
integer :: convergence_cutback_count = 0
|
||||
integer :: convergence_status_code = CONVERGENCE_STATUS_IDLE
|
||||
integer :: convergence_failure_code = CONV_FAIL_NONE
|
||||
integer :: convergence_failure_reason_id = NFAIL_NONE
|
||||
integer :: convergence_material_fail_count = 0
|
||||
real(rk) :: convergence_residual_norm = ZERO
|
||||
real(rk) :: convergence_rel_resid_norm = ZERO
|
||||
real(rk) :: convergence_correction_norm = ZERO
|
||||
real(rk) :: convergence_contact_gap_norm = ZERO
|
||||
real(rk) :: convergence_combined_norm = ZERO
|
||||
real(rk) :: convergence_total_resid_norm = ZERO
|
||||
real(rk) :: convergence_force_resid_norm = ZERO
|
||||
real(rk) :: convergence_contact_resid_norm = ZERO
|
||||
real(rk) :: convergence_cons_resid_norm = ZERO
|
||||
real(rk) :: convergence_arc_resid_norm = ZERO
|
||||
real(rk) :: linear_solver_initial_resid = ZERO
|
||||
real(rk) :: linear_solver_last_resid = ZERO
|
||||
real(rk) :: linear_solver_relative_resid = ZERO
|
||||
@@ -199,6 +236,7 @@ module fem_control
|
||||
real(rk), allocatable :: nlc_path_real(:,:)
|
||||
integer, allocatable :: nlc_path_int(:,:)
|
||||
character(len=256) :: nonlinear_trace_file = ' '
|
||||
character(len=64) :: linear_solver_last_reason = 'idle'
|
||||
logical :: convergence_converged = .false.
|
||||
logical :: use_sph_coupling = .false.
|
||||
logical :: use_user_dt = .false.
|
||||
@@ -288,6 +326,8 @@ contains
|
||||
linear_solver_last_iter = 0
|
||||
linear_solver_last_status = LS_STATUS_IDLE
|
||||
linear_solver_last_matrix_class = 1
|
||||
linsol_last_fail_class = LS_FAIL_NONE
|
||||
linear_solver_last_reason = 'idle'
|
||||
nonlinear_linear_iter_limit = 0
|
||||
nonlinear_continuation_method = NLC_DEFAULT
|
||||
buckling_num_modes = 1
|
||||
@@ -327,11 +367,18 @@ contains
|
||||
convergence_cutback_count = 0
|
||||
convergence_status_code = CONVERGENCE_STATUS_IDLE
|
||||
convergence_failure_code = CONV_FAIL_NONE
|
||||
convergence_failure_reason_id = NFAIL_NONE
|
||||
convergence_material_fail_count = 0
|
||||
convergence_residual_norm = ZERO
|
||||
convergence_rel_resid_norm = ZERO
|
||||
convergence_correction_norm = ZERO
|
||||
convergence_contact_gap_norm = ZERO
|
||||
convergence_combined_norm = ZERO
|
||||
convergence_total_resid_norm = ZERO
|
||||
convergence_force_resid_norm = ZERO
|
||||
convergence_contact_resid_norm = ZERO
|
||||
convergence_cons_resid_norm = ZERO
|
||||
convergence_arc_resid_norm = ZERO
|
||||
linear_solver_initial_resid = ZERO
|
||||
linear_solver_last_resid = ZERO
|
||||
linear_solver_relative_resid = ZERO
|
||||
@@ -445,6 +492,16 @@ contains
|
||||
nlc_path_real(NLC_PATH_R_TRUST_DAMPING, row) = nlc_last_damping
|
||||
nlc_path_real(NLC_PATH_R_TRUST_MERIT_RATIO, row) = &
|
||||
nlc_last_merit_ratio
|
||||
nlc_path_real(NLC_PATH_R_TOTAL_RESIDUAL, row) = &
|
||||
convergence_total_resid_norm
|
||||
nlc_path_real(NLC_PATH_R_FORCE_RESIDUAL, row) = &
|
||||
convergence_force_resid_norm
|
||||
nlc_path_real(NLC_PATH_R_CONTACT_RESIDUAL, row) = &
|
||||
convergence_contact_resid_norm
|
||||
nlc_path_real(NLC_PATH_R_CONS_RESIDUAL, row) = &
|
||||
convergence_cons_resid_norm
|
||||
nlc_path_real(NLC_PATH_R_ARC_RESIDUAL, row) = &
|
||||
convergence_arc_resid_norm
|
||||
|
||||
nlc_path_int(NLC_PATH_I_STEP, row) = step
|
||||
nlc_path_int(NLC_PATH_I_CONTROL_DOF_COUNT, row) = control_dof_count
|
||||
@@ -459,11 +516,93 @@ contains
|
||||
nlc_path_int(NLC_PATH_I_CUTBACK_COUNT, row) = convergence_cutback_count
|
||||
nlc_path_int(NLC_PATH_I_TRUST_ADJUST, row) = nlc_last_trust_adjust
|
||||
nlc_path_int(NLC_PATH_I_TRUST_REJECTIONS, row) = nlc_last_rejections
|
||||
nlc_path_int(NLC_PATH_I_REASON_ID, row) = convergence_failure_reason_id
|
||||
nlc_path_int(NLC_PATH_I_MATERIAL_FAIL_COUNT, row) = &
|
||||
convergence_material_fail_count
|
||||
|
||||
nlc_path_count = row
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine nlc_path_append
|
||||
|
||||
integer function convergence_reason_from_failure(failure_code) result(reason_id)
|
||||
integer, intent(in) :: failure_code
|
||||
|
||||
select case (failure_code)
|
||||
case (CONV_FAIL_NONE)
|
||||
reason_id = NFAIL_NONE
|
||||
case (CONV_FAIL_NONCONVERGENCE)
|
||||
reason_id = NFAIL_NONCONVERGENCE
|
||||
case (CONV_FAIL_CUTBACK_LIMIT)
|
||||
reason_id = NFAIL_MIN_STEP
|
||||
case (CONV_FAIL_STOPPED)
|
||||
reason_id = NFAIL_STOPPED
|
||||
case default
|
||||
reason_id = NFAIL_NONCONVERGENCE
|
||||
end select
|
||||
end function convergence_reason_from_failure
|
||||
|
||||
subroutine convergence_failure_reason_name(reason_id, reason_name)
|
||||
integer, intent(in) :: reason_id
|
||||
character(len=*), intent(out) :: reason_name
|
||||
|
||||
reason_name = 'unknown'
|
||||
select case (reason_id)
|
||||
case (NFAIL_NONE)
|
||||
reason_name = 'none'
|
||||
case (NFAIL_LINEAR_SOLVE)
|
||||
reason_name = 'linear-solve-failure'
|
||||
case (NFAIL_RESIDUAL_STAGNATION)
|
||||
reason_name = 'residual-stagnation'
|
||||
case (NFAIL_CORRECTION_LIMIT)
|
||||
reason_name = 'correction-norm-limit'
|
||||
case (NFAIL_LINE_SEARCH)
|
||||
reason_name = 'line-search-failure'
|
||||
case (NFAIL_TRUST_REJECTION)
|
||||
reason_name = 'trust-rejection'
|
||||
case (NFAIL_CONTACT_ACTIVE_SET)
|
||||
reason_name = 'contact-active-set-oscillation'
|
||||
case (NFAIL_CONTACT_PROJECTION)
|
||||
reason_name = 'contact-projection-failure'
|
||||
case (NFAIL_CONTACT_PENETRATION)
|
||||
reason_name = 'contact-excessive-penetration'
|
||||
case (NFAIL_FRICTION_SWITCH)
|
||||
reason_name = 'friction-stick-slip-switching'
|
||||
case (NFAIL_MATERIAL_RETURN)
|
||||
reason_name = 'material-return-failure'
|
||||
case (NFAIL_ARC_CONSTRAINT)
|
||||
reason_name = 'arc-constraint-failure'
|
||||
case (NFAIL_CONSTRAINT_RESIDUAL)
|
||||
reason_name = 'constraint-residual-failure'
|
||||
case (NFAIL_MIN_STEP)
|
||||
reason_name = 'minimum-step-exhausted'
|
||||
case (NFAIL_NONCONVERGENCE)
|
||||
reason_name = 'nonlinear-nonconvergence'
|
||||
case (NFAIL_STOPPED)
|
||||
reason_name = 'run-stopped'
|
||||
end select
|
||||
end subroutine convergence_failure_reason_name
|
||||
|
||||
subroutine linsol_fail_class_name(failure_class, class_name)
|
||||
integer, intent(in) :: failure_class
|
||||
character(len=*), intent(out) :: class_name
|
||||
|
||||
class_name = 'unknown'
|
||||
select case (failure_class)
|
||||
case (LS_FAIL_NONE)
|
||||
class_name = 'none'
|
||||
case (LS_FAIL_NONCONVERGENCE)
|
||||
class_name = 'linear-nonconvergence'
|
||||
case (LS_FAIL_INVALID_MATRIX)
|
||||
class_name = 'invalid-matrix-class'
|
||||
case (LS_FAIL_DENSE_FALLBACK)
|
||||
class_name = 'dense-fallback-failure'
|
||||
case (LS_FAIL_CONFIGURATION)
|
||||
class_name = 'linear-configuration-failure'
|
||||
case (LS_FAIL_DIAGNOSTIC)
|
||||
class_name = 'linear-diagnostic-failure'
|
||||
end select
|
||||
end subroutine linsol_fail_class_name
|
||||
|
||||
subroutine nlc_path_ensure_capacity(required, ierr)
|
||||
integer, intent(in) :: required
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
@@ -16,7 +16,7 @@ module fem_precision
|
||||
|
||||
integer, parameter :: FEMLITE_VERSION_MAJOR = 0
|
||||
integer, parameter :: FEMLITE_VERSION_MINOR = 5
|
||||
integer, parameter :: FEMLITE_VERSION_PATCH = 2
|
||||
integer, parameter :: FEMLITE_VERSION_PATCH = 3
|
||||
|
||||
real(rk), parameter :: ZERO = 0.0_rk
|
||||
real(rk), parameter :: ONE = 1.0_rk
|
||||
|
||||
Reference in New Issue
Block a user