Advance V5 nonlinear benchmarks and shell solver

This commit is contained in:
shenw
2026-06-27 16:43:00 +08:00
parent a2a11179d9
commit db68340aaf
84 changed files with 38720 additions and 971 deletions
+101
View File
@@ -612,6 +612,107 @@ contains
ierr = FEM_SUCCESS
end subroutine fem_get_convergence_diagnostics
subroutine fem_get_continuation_path_count(count, ierr)
integer, intent(out) :: count
integer, intent(out) :: ierr
count = 0
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_continuation_path_count called before fem_initialize', ierr)
return
end if
count = nlc_path_count
ierr = FEM_SUCCESS
end subroutine fem_get_continuation_path_count
subroutine fem_get_continuation_path_row(index, step, time, &
control_parameter, &
control_dof_count, prescribed_l2, &
prescribed_max, actual_l2, &
actual_max, residual_linf, &
residual_l2, reaction_sum, &
reaction_generalized, work, &
iteration, residual_norm, &
relative_residual, correction_norm, &
status_code, failure_code, ierr)
integer, intent(in) :: index
integer, intent(out) :: step
integer, intent(out) :: control_dof_count
integer, intent(out) :: iteration
integer, intent(out) :: status_code
integer, intent(out) :: failure_code
real(rk), intent(out) :: time
real(rk), intent(out) :: control_parameter
real(rk), intent(out) :: prescribed_l2
real(rk), intent(out) :: prescribed_max
real(rk), intent(out) :: actual_l2
real(rk), intent(out) :: actual_max
real(rk), intent(out) :: residual_linf
real(rk), intent(out) :: residual_l2
real(rk), intent(out) :: reaction_sum
real(rk), intent(out) :: reaction_generalized
real(rk), intent(out) :: work
real(rk), intent(out) :: residual_norm
real(rk), intent(out) :: relative_residual
real(rk), intent(out) :: correction_norm
integer, intent(out) :: ierr
step = 0
control_dof_count = 0
iteration = 0
status_code = CONVERGENCE_STATUS_IDLE
failure_code = CONV_FAIL_NONE
time = ZERO
control_parameter = ZERO
prescribed_l2 = ZERO
prescribed_max = ZERO
actual_l2 = ZERO
actual_max = ZERO
residual_linf = ZERO
residual_l2 = ZERO
reaction_sum = ZERO
reaction_generalized = ZERO
work = ZERO
residual_norm = ZERO
relative_residual = ZERO
correction_norm = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_continuation_path_row called before fem_initialize', ierr)
return
end if
if (index .lt. 1 .or. index .gt. nlc_path_count) then
call error_set(FEM_ERR_INPUT, &
'continuation path row index is outside available range', ierr)
return
end if
step = nlc_path_int(NLC_PATH_I_STEP, index)
control_dof_count = nlc_path_int(NLC_PATH_I_CONTROL_DOF_COUNT, index)
iteration = nlc_path_int(NLC_PATH_I_ITERATION, index)
status_code = nlc_path_int(NLC_PATH_I_STATUS_CODE, index)
failure_code = nlc_path_int(NLC_PATH_I_FAILURE_CODE, index)
time = nlc_path_real(NLC_PATH_R_TIME, index)
control_parameter = nlc_path_real(NLC_PATH_R_PARAMETER, index)
prescribed_l2 = nlc_path_real(NLC_PATH_R_PRESCRIBED_L2, index)
prescribed_max = nlc_path_real(NLC_PATH_R_PRESCRIBED_MAX, index)
actual_l2 = nlc_path_real(NLC_PATH_R_ACTUAL_L2, index)
actual_max = nlc_path_real(NLC_PATH_R_ACTUAL_MAX, index)
residual_linf = nlc_path_real(NLC_PATH_R_RESIDUAL_LINF, index)
residual_l2 = nlc_path_real(NLC_PATH_R_RESIDUAL_L2, index)
reaction_sum = nlc_path_real(NLC_PATH_R_REACTION_SUM, index)
reaction_generalized = nlc_path_real(NLC_PATH_R_REACTION_GENERALIZED, &
index)
work = nlc_path_real(NLC_PATH_R_WORK, index)
residual_norm = nlc_path_real(NLC_PATH_R_RESIDUAL_NORM, index)
relative_residual = nlc_path_real(NLC_PATH_R_RELATIVE_RESIDUAL, index)
correction_norm = nlc_path_real(NLC_PATH_R_CORRECTION_NORM, index)
ierr = FEM_SUCCESS
end subroutine fem_get_continuation_path_row
subroutine fem_set_linear_solver(method, preconditioner, ierr)
integer, intent(in) :: method
integer, intent(in) :: preconditioner
+248
View File
@@ -1,5 +1,6 @@
module fem_control
use fem_precision
use fem_error, only: FEM_SUCCESS, FEM_ERR_INTERNAL, error_set
implicit none
integer, parameter :: ANALYSIS_EXPLICIT_DYNAMIC = 1
@@ -18,11 +19,47 @@ module fem_control
integer, parameter :: LSOLVER_CG = 1
integer, parameter :: LSOLVER_BICGSTAB = 2
integer, parameter :: LSOLVER_GMRES = 3
integer, parameter :: LSOLVER_DENSE = 4
integer, parameter :: LPRECOND_NONE = 0
integer, parameter :: LPRECOND_JACOBI = 1
integer, parameter :: LPRECOND_GAUSS_SEIDEL = 2
integer, parameter :: LPRECOND_ILU0 = 3
integer, parameter :: LS_STATUS_IDLE = 0
integer, parameter :: LS_STATUS_CONVERGED = 1
integer, parameter :: LS_STATUS_FAILED = -1
integer, parameter :: NLC_TWO_STAGE = 1
integer, parameter :: NLC_ADAPT_NEWTON = 2
integer, parameter :: NLC_TRUST_DAMPED = 3
integer, parameter :: NLC_ARC_DISP = 4
integer, parameter :: NLC_MC_SUBSTEP = 5
integer, parameter :: NLC_DEFAULT = NLC_TWO_STAGE
integer, parameter :: NLC_ADJ_NONE = 0
integer, parameter :: NLC_ADJ_GROW = 1
integer, parameter :: NLC_ADJ_KEEP = 2
integer, parameter :: NLC_ADJ_SHRINK = 3
integer, parameter :: NLC_ADJ_CUTBACK = 4
integer, parameter :: NLC_ADJ_FAILED = -1
integer, parameter :: NLC_PATH_R_TIME = 1
integer, parameter :: NLC_PATH_R_PARAMETER = 2
integer, parameter :: NLC_PATH_R_PRESCRIBED_L2 = 3
integer, parameter :: NLC_PATH_R_PRESCRIBED_MAX = 4
integer, parameter :: NLC_PATH_R_ACTUAL_L2 = 5
integer, parameter :: NLC_PATH_R_ACTUAL_MAX = 6
integer, parameter :: NLC_PATH_R_RESIDUAL_LINF = 7
integer, parameter :: NLC_PATH_R_RESIDUAL_L2 = 8
integer, parameter :: NLC_PATH_R_REACTION_SUM = 9
integer, parameter :: NLC_PATH_R_REACTION_GENERALIZED = 10
integer, parameter :: NLC_PATH_R_WORK = 11
integer, parameter :: NLC_PATH_R_RESIDUAL_NORM = 12
integer, parameter :: NLC_PATH_R_RELATIVE_RESIDUAL = 13
integer, parameter :: NLC_PATH_R_CORRECTION_NORM = 14
integer, parameter :: NLC_PATH_REAL_COUNT = 14
integer, parameter :: NLC_PATH_I_STEP = 1
integer, parameter :: NLC_PATH_I_CONTROL_DOF_COUNT = 2
integer, parameter :: NLC_PATH_I_ITERATION = 3
integer, parameter :: NLC_PATH_I_STATUS_CODE = 4
integer, parameter :: NLC_PATH_I_FAILURE_CODE = 5
integer, parameter :: NLC_PATH_INT_COUNT = 5
real(rk) :: time_start = ZERO
real(rk) :: time_end = ZERO
@@ -33,6 +70,26 @@ module fem_control
real(rk) :: static_initial_increment = ONE
real(rk) :: static_min_increment = ZERO
real(rk) :: static_max_increment = ONE
real(rk) :: static_predictor_max_scale = 2.0_rk
real(rk) :: nlc_growth_factor = 1.5_rk
real(rk) :: nlc_shrink_factor = 0.5_rk
real(rk) :: nlc_trust_radius = ZERO
real(rk) :: nlc_trust_min_radius = 1.0e-12_rk
real(rk) :: nlc_trust_max_radius = ZERO
real(rk) :: nlc_trust_growth_factor = 1.5_rk
real(rk) :: nlc_trust_shrink_factor = 0.5_rk
real(rk) :: nlc_trust_accept_ratio = 0.0_rk
real(rk) :: nlc_trust_good_ratio = 0.75_rk
real(rk) :: nlc_mc_target_strain = 2.5e-3_rk
real(rk) :: nlc_mc_yield_tolerance = 1.0e-7_rk
real(rk) :: nlc_mc_plastic_limit = 5.0e-2_rk
real(rk) :: nlc_last_target_dt = ZERO
real(rk) :: nlc_last_actual_dt = ZERO
real(rk) :: nlc_next_target_dt = ZERO
real(rk) :: nlc_last_trust_radius = ZERO
real(rk) :: nlc_next_trust_radius = ZERO
real(rk) :: nlc_last_damping = ONE
real(rk) :: nlc_last_merit_ratio = ZERO
real(rk) :: load_factor = ONE
real(rk) :: newton_tol_force = 1.0e-8_rk
real(rk) :: newton_tol_disp = 1.0e-8_rk
@@ -61,6 +118,17 @@ 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 :: nonlinear_linear_iter_limit = 0
integer :: nonlinear_continuation_method = NLC_DEFAULT
integer :: nlc_target_newton = 6
integer :: nlc_mc_min_substeps = 1
integer :: nlc_mc_max_substeps = 64
integer :: nlc_last_iter = 0
integer :: nlc_last_adjust = NLC_ADJ_NONE
integer :: nlc_last_trust_adjust = NLC_ADJ_NONE
integer :: nlc_last_rejections = 0
integer :: nlc_path_count = 0
integer :: nlc_path_capacity = 0
integer :: shell_stability_sample_count = 0
integer :: shell_stability_last_elem = 0
integer :: convergence_increment = 0
@@ -82,12 +150,19 @@ module fem_control
real(rk) :: shell_stability_max_drilling = ZERO
real(rk) :: convergence_last_dt = ZERO
real(rk) :: convergence_last_accepted_time = ZERO
real(rk) :: nlc_path_accumulated_work = ZERO
real(rk), allocatable :: nlc_path_real(:,:)
integer, allocatable :: nlc_path_int(:,:)
character(len=256) :: nonlinear_trace_file = ' '
logical :: convergence_converged = .false.
logical :: use_sph_coupling = .false.
logical :: use_user_dt = .false.
logical :: large_deformation = .true.
logical :: use_line_search = .true.
logical :: allow_step_cutback = .false.
logical :: use_static_predictor = .false.
logical :: static_ramp_load = .true.
logical :: shell_geometric_nonlinear = .false.
contains
@@ -101,6 +176,26 @@ contains
static_initial_increment = ONE
static_min_increment = ZERO
static_max_increment = ONE
static_predictor_max_scale = 2.0_rk
nlc_growth_factor = 1.5_rk
nlc_shrink_factor = 0.5_rk
nlc_trust_radius = ZERO
nlc_trust_min_radius = 1.0e-12_rk
nlc_trust_max_radius = ZERO
nlc_trust_growth_factor = 1.5_rk
nlc_trust_shrink_factor = 0.5_rk
nlc_trust_accept_ratio = 0.0_rk
nlc_trust_good_ratio = 0.75_rk
nlc_mc_target_strain = 2.5e-3_rk
nlc_mc_yield_tolerance = 1.0e-7_rk
nlc_mc_plastic_limit = 5.0e-2_rk
nlc_last_target_dt = ZERO
nlc_last_actual_dt = ZERO
nlc_next_target_dt = ZERO
nlc_last_trust_radius = ZERO
nlc_next_trust_radius = ZERO
nlc_last_damping = ONE
nlc_last_merit_ratio = ZERO
load_factor = ONE
newton_tol_force = 1.0e-8_rk
newton_tol_disp = 1.0e-8_rk
@@ -129,6 +224,16 @@ contains
linear_solver_last_iter = 0
linear_solver_last_status = LS_STATUS_IDLE
linear_solver_last_matrix_class = 1
nonlinear_linear_iter_limit = 0
nonlinear_continuation_method = NLC_DEFAULT
nlc_target_newton = 6
nlc_mc_min_substeps = 1
nlc_mc_max_substeps = 64
nlc_last_iter = 0
nlc_last_adjust = NLC_ADJ_NONE
nlc_last_trust_adjust = NLC_ADJ_NONE
nlc_last_rejections = 0
call nlc_path_release()
shell_stability_sample_count = 0
shell_stability_last_elem = 0
convergence_increment = 0
@@ -150,12 +255,155 @@ contains
shell_stability_max_drilling = ZERO
convergence_last_dt = ZERO
convergence_last_accepted_time = ZERO
nonlinear_trace_file = ' '
convergence_converged = .false.
use_sph_coupling = .false.
use_user_dt = .false.
large_deformation = .true.
use_line_search = .true.
allow_step_cutback = .false.
use_static_predictor = .false.
static_ramp_load = .true.
shell_geometric_nonlinear = .false.
end subroutine control_set_defaults
subroutine nlc_path_reset()
nlc_path_count = 0
nlc_path_accumulated_work = ZERO
end subroutine nlc_path_reset
subroutine nlc_path_release()
if (allocated(nlc_path_real)) deallocate(nlc_path_real)
if (allocated(nlc_path_int)) deallocate(nlc_path_int)
nlc_path_count = 0
nlc_path_capacity = 0
nlc_path_accumulated_work = ZERO
end subroutine nlc_path_release
subroutine nlc_path_append(step, time, parameter, control_dof_count, &
prescribed_l2, prescribed_max, actual_l2, &
actual_max, residual_linf, residual_l2, &
reaction_sum, reaction_generalized, iteration, &
residual_norm, relative_residual, &
correction_norm, status_code, failure_code, ierr)
integer, intent(in) :: step
integer, intent(in) :: control_dof_count
integer, intent(in) :: iteration
integer, intent(in) :: status_code
integer, intent(in) :: failure_code
real(rk), intent(in) :: time
real(rk), intent(in) :: parameter
real(rk), intent(in) :: prescribed_l2
real(rk), intent(in) :: prescribed_max
real(rk), intent(in) :: actual_l2
real(rk), intent(in) :: actual_max
real(rk), intent(in) :: residual_linf
real(rk), intent(in) :: residual_l2
real(rk), intent(in) :: reaction_sum
real(rk), intent(in) :: reaction_generalized
real(rk), intent(in) :: residual_norm
real(rk), intent(in) :: relative_residual
real(rk), intent(in) :: correction_norm
integer, intent(out) :: ierr
integer :: row
real(rk) :: prev_disp
real(rk) :: prev_force
call nlc_path_ensure_capacity(nlc_path_count + 1, ierr)
if (ierr .ne. FEM_SUCCESS) return
if (nlc_path_count .gt. 0) then
prev_disp = nlc_path_real(NLC_PATH_R_PRESCRIBED_L2, nlc_path_count)
prev_force = nlc_path_real(NLC_PATH_R_REACTION_GENERALIZED, &
nlc_path_count)
nlc_path_accumulated_work = nlc_path_accumulated_work + &
0.5_rk * (prev_force + reaction_generalized) * &
(prescribed_l2 - prev_disp)
end if
row = nlc_path_count + 1
nlc_path_real(:, row) = ZERO
nlc_path_int(:, row) = 0
nlc_path_real(NLC_PATH_R_TIME, row) = time
nlc_path_real(NLC_PATH_R_PARAMETER, row) = parameter
nlc_path_real(NLC_PATH_R_PRESCRIBED_L2, row) = prescribed_l2
nlc_path_real(NLC_PATH_R_PRESCRIBED_MAX, row) = prescribed_max
nlc_path_real(NLC_PATH_R_ACTUAL_L2, row) = actual_l2
nlc_path_real(NLC_PATH_R_ACTUAL_MAX, row) = actual_max
nlc_path_real(NLC_PATH_R_RESIDUAL_LINF, row) = residual_linf
nlc_path_real(NLC_PATH_R_RESIDUAL_L2, row) = residual_l2
nlc_path_real(NLC_PATH_R_REACTION_SUM, row) = reaction_sum
nlc_path_real(NLC_PATH_R_REACTION_GENERALIZED, row) = &
reaction_generalized
nlc_path_real(NLC_PATH_R_WORK, row) = nlc_path_accumulated_work
nlc_path_real(NLC_PATH_R_RESIDUAL_NORM, row) = residual_norm
nlc_path_real(NLC_PATH_R_RELATIVE_RESIDUAL, row) = relative_residual
nlc_path_real(NLC_PATH_R_CORRECTION_NORM, row) = correction_norm
nlc_path_int(NLC_PATH_I_STEP, row) = step
nlc_path_int(NLC_PATH_I_CONTROL_DOF_COUNT, row) = control_dof_count
nlc_path_int(NLC_PATH_I_ITERATION, row) = iteration
nlc_path_int(NLC_PATH_I_STATUS_CODE, row) = status_code
nlc_path_int(NLC_PATH_I_FAILURE_CODE, row) = failure_code
nlc_path_count = row
ierr = FEM_SUCCESS
end subroutine nlc_path_append
subroutine nlc_path_ensure_capacity(required, ierr)
integer, intent(in) :: required
integer, intent(out) :: ierr
integer :: new_capacity
integer :: stat
real(rk), allocatable :: new_real(:,:)
integer, allocatable :: new_int(:,:)
if (required .le. nlc_path_capacity) then
ierr = FEM_SUCCESS
return
end if
new_capacity = max(8, nlc_path_capacity)
do while (new_capacity .lt. required)
new_capacity = 2 * new_capacity
end do
allocate(new_real(NLC_PATH_REAL_COUNT, new_capacity), &
new_int(NLC_PATH_INT_COUNT, new_capacity), stat=stat)
if (stat .ne. 0) then
call error_set(FEM_ERR_INTERNAL, &
'failed to allocate nonlinear continuation path storage', ierr)
return
end if
new_real = ZERO
new_int = 0
if (nlc_path_count .gt. 0) then
new_real(:,1:nlc_path_count) = nlc_path_real(:,1:nlc_path_count)
new_int(:,1:nlc_path_count) = nlc_path_int(:,1:nlc_path_count)
end if
if (allocated(nlc_path_real)) deallocate(nlc_path_real)
if (allocated(nlc_path_int)) deallocate(nlc_path_int)
allocate(nlc_path_real(NLC_PATH_REAL_COUNT, new_capacity), &
nlc_path_int(NLC_PATH_INT_COUNT, new_capacity), stat=stat)
if (stat .ne. 0) then
call error_set(FEM_ERR_INTERNAL, &
'failed to resize nonlinear continuation path storage', ierr)
deallocate(new_real)
deallocate(new_int)
nlc_path_count = 0
nlc_path_capacity = 0
return
end if
nlc_path_real = new_real
nlc_path_int = new_int
nlc_path_capacity = new_capacity
deallocate(new_real)
deallocate(new_int)
ierr = FEM_SUCCESS
end subroutine nlc_path_ensure_capacity
end module fem_control