Checkpoint V5.11 shell redesign baseline

This commit is contained in:
shenw
2026-06-28 11:34:52 +08:00
parent db68340aaf
commit 5e90d58d0e
60 changed files with 13859 additions and 8386 deletions
+72 -1305
View File
File diff suppressed because it is too large Load Diff
+486
View File
@@ -0,0 +1,486 @@
module fem_api_coupling
use fem_precision
use fem_error
use fem_database
use fem_coupling
use fem_contact
use fem_contact_state, only: CONTACT_PAIR_ACTIVATED, &
CONTACT_PAIR_MAINTAINED, &
CONTACT_PAIR_RELEASED, &
contact_get_search_stats, &
contact_get_perf_stats, &
contact_get_cache_stats
use fem_contact_history, only: contact_history_stats
use fem_contact_multiplier, only: contact_multiplier_stats
use fem_database_surface, only: db_surface_node_count, db_get_surface_nodes
use fem_api_state, only: api_initialized
implicit none
private
public :: fem_clear_sph_forces
public :: fem_apply_sph_nodal_force
public :: fem_apply_sph_nodal_forces
public :: fem_get_sph_force_summary
public :: fem_get_contact_summary
public :: fem_get_contact_diagnostics
public :: fem_get_contact_friction
public :: fem_get_contact_hist_stats
public :: fem_get_contact_mult_stats
public :: fem_get_contact_search_stats
public :: fem_get_contact_perf_stats
public :: fem_get_contact_cache_stats
public :: fem_get_boundary_facet_count
public :: fem_get_boundary_facets
public :: fem_get_surface_node_count
public :: fem_get_surface_nodes
public :: fem_apply_sph_facet_pressure
public :: fem_apply_sph_facet_tractions
public :: fem_apply_sph_facet_nodal_loads
contains
subroutine fem_clear_sph_forces(ierr)
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_clear_sph_forces called before fem_initialize', ierr)
return
end if
if (.not. allocated(fsph)) then
call error_set(FEM_ERR_INTERNAL, 'SPH force vector is not allocated', ierr)
return
end if
fsph = ZERO
ierr = FEM_SUCCESS
end subroutine fem_clear_sph_forces
subroutine fem_apply_sph_nodal_force(node_id, force, ierr)
integer, intent(in) :: node_id
real(rk), intent(in) :: force(NDIM)
integer, intent(out) :: ierr
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_apply_sph_nodal_force called before fem_initialize', ierr)
return
end if
if (.not. allocated(fsph)) then
call error_set(FEM_ERR_INTERNAL, 'SPH force vector is not allocated', ierr)
return
end if
node = database_find_node(node_id)
if (node .eq. 0) then
call error_set(FEM_ERR_COUPLING, 'SPH nodal force references unknown node', ierr)
return
end if
do idir = 1, NDIM
dof = dof_id(idir,node)
if (dof .gt. 0) fsph(dof) = fsph(dof) + force(idir)
end do
ierr = FEM_SUCCESS
end subroutine fem_apply_sph_nodal_force
subroutine fem_apply_sph_nodal_forces(num_force_nodes, node_ids, force, ierr)
integer, intent(in) :: num_force_nodes
integer, intent(in) :: node_ids(num_force_nodes)
real(rk), intent(in) :: force(NDIM,num_force_nodes)
integer, intent(out) :: ierr
integer :: item
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_apply_sph_nodal_forces called before fem_initialize', ierr)
return
end if
if (.not. allocated(fsph)) then
call error_set(FEM_ERR_INTERNAL, 'SPH force vector is not allocated', ierr)
return
end if
if (num_force_nodes .lt. 0) then
call error_set(FEM_ERR_COUPLING, 'number of SPH force nodes is negative', ierr)
return
end if
do item = 1, num_force_nodes
node = database_find_node(node_ids(item))
if (node .eq. 0) then
call error_set(FEM_ERR_COUPLING, 'SPH nodal force references unknown node', ierr)
return
end if
end do
do item = 1, num_force_nodes
node = database_find_node(node_ids(item))
do idir = 1, NDIM
dof = dof_id(idir,node)
if (dof .gt. 0) fsph(dof) = fsph(dof) + force(idir,item)
end do
end do
ierr = FEM_SUCCESS
end subroutine fem_apply_sph_nodal_forces
subroutine fem_get_sph_force_summary(total_force, ierr)
real(rk), intent(out) :: total_force(NDIM)
integer, intent(out) :: ierr
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_sph_force_summary called before fem_initialize', ierr)
return
end if
if (.not. allocated(fsph)) then
call error_set(FEM_ERR_INTERNAL, 'SPH force vector is not allocated', ierr)
return
end if
total_force = ZERO
do node = 1, nnode
do idir = 1, NDIM
dof = dof_id(idir,node)
if (dof .gt. 0) total_force(idir) = total_force(idir) + fsph(dof)
end do
end do
ierr = FEM_SUCCESS
end subroutine fem_get_sph_force_summary
subroutine fem_get_contact_summary(active_count, work_step, work_total, &
max_penetration, force_norm, ierr)
integer, intent(out) :: active_count
real(rk), intent(out) :: work_step
real(rk), intent(out) :: work_total
real(rk), intent(out) :: max_penetration
real(rk), intent(out) :: force_norm
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_contact_summary called before fem_initialize', ierr)
return
end if
active_count = contact_active_count
work_step = contact_work_step
work_total = contact_work_total
max_penetration = contact_max_penetration
force_norm = contact_force_norm
ierr = FEM_SUCCESS
end subroutine fem_get_contact_summary
subroutine fem_get_contact_diagnostics(active_pair_count, &
activated_pair_count, &
maintained_pair_count, &
released_pair_count, &
max_gap_residual, max_aug_lambda, &
ierr)
integer, intent(out) :: active_pair_count
integer, intent(out) :: activated_pair_count
integer, intent(out) :: maintained_pair_count
integer, intent(out) :: released_pair_count
real(rk), intent(out) :: max_gap_residual
real(rk), intent(out) :: max_aug_lambda
integer, intent(out) :: ierr
integer :: pair
active_pair_count = 0
activated_pair_count = 0
maintained_pair_count = 0
released_pair_count = 0
max_gap_residual = ZERO
max_aug_lambda = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_contact_diagnostics called before fem_initialize', ierr)
return
end if
if (allocated(contact_pair_active)) then
do pair = 1, size(contact_pair_active)
if (contact_pair_active(pair) .gt. 0) active_pair_count = &
active_pair_count + 1
end do
end if
if (allocated(contact_pair_status)) then
do pair = 1, size(contact_pair_status)
select case (contact_pair_status(pair))
case (CONTACT_PAIR_ACTIVATED)
activated_pair_count = activated_pair_count + 1
case (CONTACT_PAIR_MAINTAINED)
maintained_pair_count = maintained_pair_count + 1
case (CONTACT_PAIR_RELEASED)
released_pair_count = released_pair_count + 1
end select
end do
end if
if (allocated(contact_pair_gap_residual)) then
max_gap_residual = maxval(contact_pair_gap_residual)
end if
if (allocated(contact_pair_aug_lambda)) then
max_aug_lambda = maxval(contact_pair_aug_lambda)
end if
ierr = FEM_SUCCESS
end subroutine fem_get_contact_diagnostics
subroutine fem_get_contact_friction(work_step, work_total, &
max_accumulated_slip, ierr)
real(rk), intent(out) :: work_step
real(rk), intent(out) :: work_total
real(rk), intent(out) :: max_accumulated_slip
integer, intent(out) :: ierr
work_step = ZERO
work_total = ZERO
max_accumulated_slip = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_contact_friction called before fem_initialize', ierr)
return
end if
work_step = contact_friction_work_step
work_total = contact_friction_work_total
if (allocated(contact_pair_slip)) then
max_accumulated_slip = maxval(contact_pair_slip)
end if
ierr = FEM_SUCCESS
end subroutine fem_get_contact_friction
subroutine fem_get_contact_hist_stats(slot_count, max_slot_slip, &
max_slot_work, max_tangent_force, &
ierr)
integer, intent(out) :: slot_count
real(rk), intent(out) :: max_slot_slip
real(rk), intent(out) :: max_slot_work
real(rk), intent(out) :: max_tangent_force
integer, intent(out) :: ierr
slot_count = 0
max_slot_slip = ZERO
max_slot_work = ZERO
max_tangent_force = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_contact_hist_stats called before fem_initialize', ierr)
return
end if
call contact_history_stats(slot_count, max_slot_slip, max_slot_work, &
max_tangent_force)
ierr = FEM_SUCCESS
end subroutine fem_get_contact_hist_stats
subroutine fem_get_contact_mult_stats(slot_count, active_count, &
max_lambda, max_gap, ierr)
integer, intent(out) :: slot_count
integer, intent(out) :: active_count
real(rk), intent(out) :: max_lambda
real(rk), intent(out) :: max_gap
integer, intent(out) :: ierr
slot_count = 0
active_count = 0
max_lambda = ZERO
max_gap = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_contact_mult_stats called before fem_initialize', ierr)
return
end if
call contact_multiplier_stats(slot_count, active_count, max_lambda, &
max_gap)
ierr = FEM_SUCCESS
end subroutine fem_get_contact_mult_stats
subroutine fem_get_contact_search_stats(facet_count, master_count, &
broad_count, active_count, &
bvh_node_count, ierr)
integer, intent(out) :: facet_count
integer, intent(out) :: master_count
integer, intent(out) :: broad_count
integer, intent(out) :: active_count
integer, intent(out) :: bvh_node_count
integer, intent(out) :: ierr
facet_count = 0
master_count = 0
broad_count = 0
active_count = 0
bvh_node_count = 0
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_contact_search_stats called before fem_initialize', ierr)
return
end if
call contact_get_search_stats(facet_count, master_count, broad_count, &
active_count, bvh_node_count)
ierr = FEM_SUCCESS
end subroutine fem_get_contact_search_stats
subroutine fem_get_contact_perf_stats(search_time, force_time, &
tangent_time, ierr)
real(rk), intent(out) :: search_time
real(rk), intent(out) :: force_time
real(rk), intent(out) :: tangent_time
integer, intent(out) :: ierr
search_time = ZERO
force_time = ZERO
tangent_time = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_contact_perf_stats called before fem_initialize', ierr)
return
end if
call contact_get_perf_stats(search_time, force_time, tangent_time)
ierr = FEM_SUCCESS
end subroutine fem_get_contact_perf_stats
subroutine fem_get_contact_cache_stats(used_count, overflow_count, ierr)
integer, intent(out) :: used_count
integer, intent(out) :: overflow_count
integer, intent(out) :: ierr
used_count = 0
overflow_count = 0
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_contact_cache_stats called before fem_initialize', ierr)
return
end if
call contact_get_cache_stats(used_count, overflow_count)
ierr = FEM_SUCCESS
end subroutine fem_get_contact_cache_stats
subroutine fem_get_boundary_facet_count(num_facets, max_face_nodes, ierr)
integer, intent(out) :: num_facets
integer, intent(out) :: max_face_nodes
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_boundary_facet_count called before fem_initialize', ierr)
return
end if
call cpl_get_facet_count(num_facets, max_face_nodes, ierr)
end subroutine fem_get_boundary_facet_count
subroutine fem_get_boundary_facets(nfacet_in, max_face_nodes_in, &
facet_id, elem_id, face_id, facet_nnode, &
facet_conn, x, vnod, normal, area, ierr)
integer, intent(in) :: nfacet_in
integer, intent(in) :: max_face_nodes_in
integer, intent(out) :: facet_id(nfacet_in)
integer, intent(out) :: elem_id(nfacet_in)
integer, intent(out) :: face_id(nfacet_in)
integer, intent(out) :: facet_nnode(nfacet_in)
integer, intent(out) :: facet_conn(max_face_nodes_in,nfacet_in)
real(rk), intent(out) :: x(NDIM,max_face_nodes_in,nfacet_in)
real(rk), intent(out) :: vnod(NDIM,max_face_nodes_in,nfacet_in)
real(rk), intent(out) :: normal(NDIM,nfacet_in)
real(rk), intent(out) :: area(nfacet_in)
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_boundary_facets called before fem_initialize', ierr)
return
end if
call cpl_get_facets(nfacet_in, max_face_nodes_in, &
facet_id, elem_id, face_id, facet_nnode, &
facet_conn, x, vnod, normal, area, ierr)
end subroutine fem_get_boundary_facets
subroutine fem_get_surface_node_count(surface, node_count, ierr)
character(len=*), intent(in) :: surface
integer, intent(out) :: node_count
integer, intent(out) :: ierr
node_count = 0
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_surface_node_count called before fem_initialize', ierr)
return
end if
call db_surface_node_count(surface, node_count, ierr)
end subroutine fem_get_surface_node_count
subroutine fem_get_surface_nodes(surface, max_nodes, node_ids, node_count, ierr)
character(len=*), intent(in) :: surface
integer, intent(in) :: max_nodes
integer, intent(out) :: node_ids(max_nodes)
integer, intent(out) :: node_count
integer, intent(out) :: ierr
node_count = 0
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_surface_nodes called before fem_initialize', ierr)
return
end if
call db_get_surface_nodes(surface, max_nodes, node_ids, node_count, ierr)
end subroutine fem_get_surface_nodes
subroutine fem_apply_sph_facet_pressure(nfacet_in, facet_id, pressure, ierr)
integer, intent(in) :: nfacet_in
integer, intent(in) :: facet_id(nfacet_in)
real(rk), intent(in) :: pressure(nfacet_in)
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_apply_sph_facet_pressure called before fem_initialize', ierr)
return
end if
call cpl_apply_facet_pressure(nfacet_in, facet_id, pressure, ierr)
end subroutine fem_apply_sph_facet_pressure
subroutine fem_apply_sph_facet_tractions(nfacet_in, facet_id, pressure, shear, ierr)
integer, intent(in) :: nfacet_in
integer, intent(in) :: facet_id(nfacet_in)
real(rk), intent(in) :: pressure(nfacet_in)
real(rk), intent(in) :: shear(NDIM,nfacet_in)
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_apply_sph_facet_tractions called before fem_initialize', ierr)
return
end if
call cpl_apply_facet_tractions(nfacet_in, facet_id, pressure, shear, ierr)
end subroutine fem_apply_sph_facet_tractions
subroutine fem_apply_sph_facet_nodal_loads(nfacet_in, max_face_nodes_in, &
facet_id, facet_nnode_in, &
node_forces, ierr)
integer, intent(in) :: nfacet_in
integer, intent(in) :: max_face_nodes_in
integer, intent(in) :: facet_id(nfacet_in)
integer, intent(in) :: facet_nnode_in(nfacet_in)
real(rk), intent(in) :: node_forces(NDIM,max_face_nodes_in,nfacet_in)
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_apply_sph_facet_nodal_loads called before fem_initialize', ierr)
return
end if
call cpl_apply_facet_nodal_loads(nfacet_in, max_face_nodes_in, facet_id, &
facet_nnode_in, node_forces, ierr)
end subroutine fem_apply_sph_facet_nodal_loads
end module fem_api_coupling
+396
View File
@@ -0,0 +1,396 @@
module fem_api_diagnostics
use fem_precision
use fem_error
use fem_control
use fem_linear_solver_cg, only: linear_solver_configure, &
linear_solver_get_settings, linear_solver_get_stats, &
linear_solver_get_diagnostics
use fem_api_state, only: api_initialized
implicit none
private
public :: fem_record_convergence
public :: fem_get_convergence_status
public :: fem_get_convergence_metrics
public :: fem_get_convergence_diagnostics
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_set_shell_stabilization
public :: fem_get_shell_stabilization
public :: fem_get_shell_stability_stats
contains
subroutine fem_record_convergence(increment, iteration, residual_norm, &
correction_norm, last_dt, accepted_time, &
converged, relative_residual_norm, &
contact_gap_norm)
integer, intent(in) :: increment
integer, intent(in) :: iteration
real(rk), intent(in) :: residual_norm
real(rk), intent(in) :: correction_norm
real(rk), intent(in) :: last_dt
real(rk), intent(in) :: accepted_time
logical, intent(in) :: converged
real(rk), intent(in), optional :: relative_residual_norm
real(rk), intent(in), optional :: contact_gap_norm
convergence_increment = increment
convergence_iteration = iteration
convergence_residual_norm = residual_norm
convergence_correction_norm = correction_norm
if (present(relative_residual_norm)) then
convergence_rel_resid_norm = relative_residual_norm
else
convergence_rel_resid_norm = residual_norm
end if
if (present(contact_gap_norm)) then
convergence_contact_gap_norm = contact_gap_norm
end if
convergence_combined_norm = max(convergence_rel_resid_norm, &
max(convergence_correction_norm, convergence_contact_gap_norm))
convergence_last_dt = last_dt
convergence_last_accepted_time = accepted_time
convergence_converged = converged
if (converged) then
convergence_status_code = CONVERGENCE_STATUS_CONVERGED
convergence_failure_code = CONV_FAIL_NONE
else
convergence_status_code = CONVERGENCE_STATUS_FAILED
convergence_failure_code = CONV_FAIL_NONCONVERGENCE
end if
end subroutine fem_record_convergence
subroutine fem_get_convergence_status(increment, iteration, residual_norm, &
correction_norm, converged, ierr)
integer, intent(out) :: increment
integer, intent(out) :: iteration
real(rk), intent(out) :: residual_norm
real(rk), intent(out) :: correction_norm
logical, intent(out) :: converged
integer, intent(out) :: ierr
increment = 0
iteration = 0
residual_norm = ZERO
correction_norm = ZERO
converged = .false.
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_convergence_status called before fem_initialize', ierr)
return
end if
increment = convergence_increment
iteration = convergence_iteration
residual_norm = convergence_residual_norm
correction_norm = convergence_correction_norm
converged = convergence_converged
ierr = FEM_SUCCESS
end subroutine fem_get_convergence_status
subroutine fem_get_convergence_metrics(relative_residual_norm, &
contact_gap_norm, combined_norm, ierr)
real(rk), intent(out) :: relative_residual_norm
real(rk), intent(out) :: contact_gap_norm
real(rk), intent(out) :: combined_norm
integer, intent(out) :: ierr
relative_residual_norm = ZERO
contact_gap_norm = ZERO
combined_norm = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_convergence_metrics called before fem_initialize', ierr)
return
end if
relative_residual_norm = convergence_rel_resid_norm
contact_gap_norm = convergence_contact_gap_norm
combined_norm = convergence_combined_norm
ierr = FEM_SUCCESS
end subroutine fem_get_convergence_metrics
subroutine fem_get_convergence_diagnostics(cutback_count, last_dt, &
last_accepted_time, status_code, &
failure_code, ierr)
integer, intent(out) :: cutback_count
real(rk), intent(out) :: last_dt
real(rk), intent(out) :: last_accepted_time
integer, intent(out) :: status_code
integer, intent(out) :: failure_code
integer, intent(out) :: ierr
cutback_count = 0
last_dt = ZERO
last_accepted_time = ZERO
status_code = CONVERGENCE_STATUS_IDLE
failure_code = CONV_FAIL_NONE
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_convergence_diagnostics called before fem_initialize', ierr)
return
end if
cutback_count = convergence_cutback_count
last_dt = convergence_last_dt
last_accepted_time = convergence_last_accepted_time
status_code = convergence_status_code
failure_code = convergence_failure_code
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
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_set_linear_solver called before fem_initialize', ierr)
return
end if
call linear_solver_configure(method, preconditioner, ierr)
end subroutine fem_set_linear_solver
subroutine fem_get_linear_solver_settings(method, preconditioner, ierr)
integer, intent(out) :: method
integer, intent(out) :: preconditioner
integer, intent(out) :: ierr
method = LSOLVER_CG
preconditioner = LPRECOND_JACOBI
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_linear_solver_settings called before fem_initialize', ierr)
return
end if
call linear_solver_get_settings(method, preconditioner, ierr)
end subroutine fem_get_linear_solver_settings
subroutine fem_get_linear_solver_stats(method, preconditioner, iteration, &
residual_norm, status_code, ierr)
integer, intent(out) :: method
integer, intent(out) :: preconditioner
integer, intent(out) :: iteration
real(rk), intent(out) :: residual_norm
integer, intent(out) :: status_code
integer, intent(out) :: ierr
method = LSOLVER_CG
preconditioner = LPRECOND_JACOBI
iteration = 0
residual_norm = ZERO
status_code = LS_STATUS_IDLE
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_linear_solver_stats called before fem_initialize', ierr)
return
end if
call linear_solver_get_stats(method, preconditioner, iteration, &
residual_norm, status_code, ierr)
end subroutine fem_get_linear_solver_stats
subroutine fem_get_linsol_diagnostics(matrix_class, initial_residual, &
final_residual, relative_residual, &
status_code, ierr)
integer, intent(out) :: matrix_class
real(rk), intent(out) :: initial_residual
real(rk), intent(out) :: final_residual
real(rk), intent(out) :: relative_residual
integer, intent(out) :: status_code
integer, intent(out) :: ierr
matrix_class = 1
initial_residual = ZERO
final_residual = ZERO
relative_residual = ZERO
status_code = LS_STATUS_IDLE
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_linsol_diagnostics called before fem_initialize', ierr)
return
end if
call linear_solver_get_diagnostics(matrix_class, initial_residual, &
final_residual, relative_residual, status_code, ierr)
end subroutine fem_get_linsol_diagnostics
subroutine fem_set_shell_stabilization(drilling_factor, s3_shear_factor, &
s3_shear_min_scale, ierr)
real(rk), intent(in) :: drilling_factor
real(rk), intent(in) :: s3_shear_factor
real(rk), intent(in) :: s3_shear_min_scale
integer, intent(out) :: ierr
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_set_shell_stabilization called before fem_initialize', ierr)
return
end if
if (drilling_factor .lt. ZERO .or. drilling_factor .gt. ONE) then
call error_set(FEM_ERR_INPUT, 'shell drilling factor is out of range', ierr)
return
end if
if (s3_shear_factor .lt. ZERO) then
call error_set(FEM_ERR_INPUT, 'S3 shear locking factor is negative', ierr)
return
end if
if (s3_shear_min_scale .le. ZERO .or. s3_shear_min_scale .gt. ONE) then
call error_set(FEM_ERR_INPUT, 'S3 shear minimum scale is out of range', ierr)
return
end if
shell_drilling_stiffness_factor = drilling_factor
shell3_shear_locking_factor = s3_shear_factor
shell3_shear_locking_min_scale = s3_shear_min_scale
ierr = FEM_SUCCESS
end subroutine fem_set_shell_stabilization
subroutine fem_get_shell_stabilization(drilling_factor, s3_shear_factor, &
s3_shear_min_scale, ierr)
real(rk), intent(out) :: drilling_factor
real(rk), intent(out) :: s3_shear_factor
real(rk), intent(out) :: s3_shear_min_scale
integer, intent(out) :: ierr
drilling_factor = 1.0e-4_rk
s3_shear_factor = 0.0625_rk
s3_shear_min_scale = 1.0e-4_rk
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_shell_stabilization called before fem_initialize', ierr)
return
end if
drilling_factor = shell_drilling_stiffness_factor
s3_shear_factor = shell3_shear_locking_factor
s3_shear_min_scale = shell3_shear_locking_min_scale
ierr = FEM_SUCCESS
end subroutine fem_get_shell_stabilization
subroutine fem_get_shell_stability_stats(sample_count, last_element, &
last_drilling_stiffness, &
last_shear_scale, min_shear_scale, &
max_drilling_stiffness, ierr)
integer, intent(out) :: sample_count
integer, intent(out) :: last_element
real(rk), intent(out) :: last_drilling_stiffness
real(rk), intent(out) :: last_shear_scale
real(rk), intent(out) :: min_shear_scale
real(rk), intent(out) :: max_drilling_stiffness
integer, intent(out) :: ierr
sample_count = 0
last_element = 0
last_drilling_stiffness = ZERO
last_shear_scale = ONE
min_shear_scale = ONE
max_drilling_stiffness = ZERO
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, &
'fem_get_shell_stability_stats called before fem_initialize', ierr)
return
end if
sample_count = shell_stability_sample_count
last_element = shell_stability_last_elem
last_drilling_stiffness = shell_stability_last_drilling
last_shear_scale = shell_stab_last_shear_scale
min_shear_scale = shell_stability_min_shear_scale
max_drilling_stiffness = shell_stability_max_drilling
ierr = FEM_SUCCESS
end subroutine fem_get_shell_stability_stats
end module fem_api_diagnostics
+165
View File
@@ -0,0 +1,165 @@
module fem_api_stable_dt
use fem_precision
use fem_error
use fem_control
use fem_database
use fem_element_topology
implicit none
private
public :: api_estimate_stable_dt
contains
subroutine api_estimate_stable_dt(dtcrit, ierr)
real(rk), intent(out) :: dtcrit
integer, intent(out) :: ierr
integer :: elem
integer :: mat
real(rk) :: hchar
real(rk) :: wave_speed
real(rk) :: elem_dt
logical :: has_active
dtcrit = ZERO
if (nelem .le. 0) then
call error_set(FEM_ERR_MESH, &
'stable time step requires at least one element', ierr)
return
end if
elem_dt = huge(ONE)
has_active = .false.
do elem = 1, nelem
if (elem_status(elem) .ne. 0) cycle
has_active = .true.
mat = elem_mat(elem)
call estimate_material_wave_speed(mat, wave_speed, ierr)
if (ierr .ne. FEM_SUCCESS) return
call estimate_element_hchar(elem, hchar, ierr)
if (ierr .ne. FEM_SUCCESS) return
elem_dt = min(elem_dt, hchar / wave_speed)
end do
if (.not. has_active) then
dtcrit = ZERO
else
dtcrit = stable_dt_safety * elem_dt
end if
dt_stable = dtcrit
ierr = FEM_SUCCESS
end subroutine api_estimate_stable_dt
subroutine estimate_material_wave_speed(mat, wave_speed, ierr)
integer, intent(in) :: mat
real(rk), intent(out) :: wave_speed
integer, intent(out) :: ierr
real(rk) :: lambda
real(rk) :: mu
wave_speed = ZERO
if (mat .lt. 1 .or. mat .gt. n_material) then
call error_set(FEM_ERR_MATERIAL, &
'stable time step found invalid material index', ierr)
return
end if
if (mat_density(mat) .le. ZERO) then
call error_set(FEM_ERR_MATERIAL, &
'stable time step requires positive density', ierr)
return
end if
if (mat_e(mat) .le. ZERO) then
call error_set(FEM_ERR_MATERIAL, &
'stable time step requires positive elastic modulus', ierr)
return
end if
if (mat_nu(mat) .le. -ONE .or. mat_nu(mat) .ge. HALF) then
call error_set(FEM_ERR_MATERIAL, &
'stable time step found invalid Poisson ratio', ierr)
return
end if
lambda = mat_e(mat) * mat_nu(mat) / &
((ONE + mat_nu(mat)) * (ONE - 2.0_rk * mat_nu(mat)))
mu = mat_e(mat) / (2.0_rk * (ONE + mat_nu(mat)))
wave_speed = sqrt((lambda + 2.0_rk * mu) / mat_density(mat))
ierr = FEM_SUCCESS
end subroutine estimate_material_wave_speed
subroutine estimate_element_hchar(elem, hchar, ierr)
integer, intent(in) :: elem
real(rk), intent(out) :: hchar
integer, intent(out) :: ierr
integer :: edge
integer :: nedge
integer :: num_edge_nodes
integer :: edge_nodes(MAX_FACE_NODES)
hchar = huge(ONE)
nedge = element_num_edges(elem_type(elem))
if (nedge .le. 0) then
call error_set(FEM_ERR_MESH, &
'unsupported element type for stable time step', ierr)
return
end if
do edge = 1, nedge
call element_edge_nodes(elem_type(elem), edge, num_edge_nodes, &
edge_nodes, ierr)
if (ierr .ne. FEM_SUCCESS) return
if (num_edge_nodes .lt. 2) then
call error_set(FEM_ERR_MESH, &
'element edge has fewer than two nodes', ierr)
return
end if
call update_min_edge(elem, edge_nodes(1), edge_nodes(2), hchar)
end do
if (hchar .le. ZERO .or. hchar .gt. 0.5_rk * huge(ONE)) then
call error_set(FEM_ERR_MESH, &
'element has non-positive characteristic length', ierr)
return
end if
ierr = FEM_SUCCESS
end subroutine estimate_element_hchar
subroutine update_min_edge(elem, local_a, local_b, hchar)
integer, intent(in) :: elem
integer, intent(in) :: local_a
integer, intent(in) :: local_b
real(rk), intent(inout) :: hchar
real(rk) :: xa(NDIM)
real(rk) :: xb(NDIM)
real(rk) :: edge_length
integer :: node_a
integer :: node_b
node_a = elem_conn(local_a, elem)
node_b = elem_conn(local_b, elem)
call current_node_position(node_a, xa)
call current_node_position(node_b, xb)
edge_length = sqrt(sum((xb - xa) * (xb - xa)))
hchar = min(hchar, edge_length)
end subroutine update_min_edge
subroutine current_node_position(node, xyz)
integer, intent(in) :: node
real(rk), intent(out) :: xyz(NDIM)
integer :: idir
integer :: dof
xyz = coord0(:,node)
if (.not. allocated(u)) return
do idir = 1, NDIM
dof = dof_id(idir,node)
if (dof .gt. 0) xyz(idir) = xyz(idir) + u(dof)
end do
end subroutine current_node_position
end module fem_api_stable_dt
+6
View File
@@ -0,0 +1,6 @@
module fem_api_state
implicit none
private
public :: api_initialized
logical :: api_initialized = .false.
end module fem_api_state
+276
View File
@@ -0,0 +1,276 @@
module fem_api_state_access
use fem_precision
use fem_error
use fem_database
use fem_element_state
use fem_api_state, only: api_initialized
implicit none
private
public :: fem_get_node_kinematics
public :: fem_set_node_displacement
public :: fem_get_node_internal_force
public :: fem_get_node_reaction
public :: fem_get_nodal_reactions
public :: fem_get_element_average_state
public :: fem_get_element_status
contains
subroutine fem_get_node_kinematics(node_id, displacement, velocity, acceleration, ierr)
integer, intent(in) :: node_id
real(rk), intent(out) :: displacement(NDIM)
real(rk), intent(out) :: velocity(NDIM)
real(rk), intent(out) :: acceleration(NDIM)
integer, intent(out) :: ierr
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_node_kinematics called before fem_initialize', ierr)
return
end if
node = database_find_node(node_id)
if (node .eq. 0) then
call error_set(FEM_ERR_INPUT, 'node kinematics query references unknown node', ierr)
return
end if
displacement = ZERO
velocity = ZERO
acceleration = ZERO
do idir = 1, NDIM
dof = dof_id(idir,node)
if (dof .gt. 0) then
displacement(idir) = u(dof)
velocity(idir) = v(dof)
acceleration(idir) = a(dof)
end if
end do
ierr = FEM_SUCCESS
end subroutine fem_get_node_kinematics
subroutine fem_set_node_displacement(node_id, displacement, ierr)
integer, intent(in) :: node_id
real(rk), intent(in) :: displacement(NDIM)
integer, intent(out) :: ierr
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_set_node_displacement called before fem_initialize', ierr)
return
end if
node = database_find_node(node_id)
if (node .eq. 0) then
call error_set(FEM_ERR_INPUT, 'node displacement setter references unknown node', ierr)
return
end if
do idir = 1, NDIM
dof = dof_id(idir,node)
if (dof .gt. 0) u(dof) = displacement(idir)
end do
ierr = FEM_SUCCESS
end subroutine fem_set_node_displacement
subroutine fem_get_node_internal_force(node_id, force, ierr)
integer, intent(in) :: node_id
real(rk), intent(out) :: force(NDIM)
integer, intent(out) :: ierr
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_node_internal_force called before fem_initialize', ierr)
return
end if
if (.not. allocated(fint)) then
call error_set(FEM_ERR_INTERNAL, 'internal force vector is not allocated', ierr)
return
end if
node = database_find_node(node_id)
if (node .eq. 0) then
call error_set(FEM_ERR_INPUT, 'internal force query references unknown node', ierr)
return
end if
force = ZERO
do idir = 1, NDIM
dof = dof_id(idir,node)
if (dof .gt. 0) force(idir) = fint(dof)
end do
ierr = FEM_SUCCESS
end subroutine fem_get_node_internal_force
subroutine fem_get_node_reaction(node_id, reaction, ierr)
integer, intent(in) :: node_id
real(rk), intent(out) :: reaction(NDOF_NODE)
integer, intent(out) :: ierr
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_node_reaction called before fem_initialize', ierr)
return
end if
if (.not. allocated(freaction)) then
call error_set(FEM_ERR_INTERNAL, 'reaction vector is not allocated', ierr)
return
end if
node = database_find_node(node_id)
if (node .eq. 0) then
call error_set(FEM_ERR_INPUT, 'reaction query references unknown node', ierr)
return
end if
reaction = ZERO
do idir = 1, NDOF_NODE
dof = dof_id(idir,node)
if (dof .gt. 0) reaction(idir) = freaction(dof)
end do
ierr = FEM_SUCCESS
end subroutine fem_get_node_reaction
subroutine fem_get_nodal_reactions(nnode_in, node_id, reaction, ierr)
integer, intent(in) :: nnode_in
integer, intent(in) :: node_id(nnode_in)
real(rk), intent(out) :: reaction(NDOF_NODE,nnode_in)
integer, intent(out) :: ierr
integer :: item
integer :: node
integer :: idir
integer :: dof
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_nodal_reactions called before fem_initialize', ierr)
return
end if
if (.not. allocated(freaction)) then
call error_set(FEM_ERR_INTERNAL, 'reaction vector is not allocated', ierr)
return
end if
if (nnode_in .lt. 0) then
call error_set(FEM_ERR_INPUT, 'number of reaction query nodes is negative', ierr)
return
end if
reaction = ZERO
do item = 1, nnode_in
node = database_find_node(node_id(item))
if (node .eq. 0) then
call error_set(FEM_ERR_INPUT, 'reaction query references unknown node', ierr)
return
end if
do idir = 1, NDOF_NODE
dof = dof_id(idir,node)
if (dof .gt. 0) reaction(idir,item) = freaction(dof)
end do
end do
ierr = FEM_SUCCESS
end subroutine fem_get_nodal_reactions
subroutine fem_get_element_average_state(nelem_in, elem_id, stress_out, &
strain_out, plastic_strain, eqps, &
damage, ierr)
integer, intent(in) :: nelem_in
integer, intent(in) :: elem_id(nelem_in)
real(rk), intent(out) :: stress_out(NSTRESS,nelem_in)
real(rk), intent(out) :: strain_out(NSTRESS,nelem_in)
real(rk), intent(out) :: plastic_strain(NSTRESS,nelem_in)
real(rk), intent(out) :: eqps(nelem_in)
real(rk), intent(out) :: damage(nelem_in)
integer, intent(out) :: ierr
integer :: item
integer :: elem
integer :: gp
integer :: gp_start
integer :: gp_count
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_element_average_state called before fem_initialize', ierr)
return
end if
if (.not. element_state_is_available()) then
call error_set(FEM_ERR_INTERNAL, 'element state is not available', ierr)
return
end if
stress_out = ZERO
strain_out = ZERO
plastic_strain = ZERO
eqps = ZERO
damage = ZERO
do item = 1, nelem_in
elem = database_find_elem(elem_id(item))
if (elem .eq. 0) then
call error_set(FEM_ERR_INPUT, 'element average state references unknown element', ierr)
return
end if
gp_start = elem_gp_start(elem)
gp_count = elem_ngp(elem)
if (gp_start .le. 0 .or. gp_count .le. 0) then
call error_set(FEM_ERR_OUTPUT, 'element state is not available for requested element', ierr)
return
end if
do gp = gp_start, gp_start + gp_count - 1
stress_out(:,item) = stress_out(:,item) + stress(:,gp)
strain_out(:,item) = strain_out(:,item) + strain(:,gp)
plastic_strain(:,item) = plastic_strain(:,item) + statev(5:10,gp)
eqps(item) = eqps(item) + statev(1,gp)
damage(item) = damage(item) + statev(2,gp)
end do
stress_out(:,item) = stress_out(:,item) / real(gp_count, rk)
strain_out(:,item) = strain_out(:,item) / real(gp_count, rk)
plastic_strain(:,item) = plastic_strain(:,item) / real(gp_count, rk)
eqps(item) = eqps(item) / real(gp_count, rk)
damage(item) = damage(item) / real(gp_count, rk)
end do
ierr = FEM_SUCCESS
end subroutine fem_get_element_average_state
subroutine fem_get_element_status(nelem_in, elem_id, status, ierr)
integer, intent(in) :: nelem_in
integer, intent(in) :: elem_id(nelem_in)
integer, intent(out) :: status(nelem_in)
integer, intent(out) :: ierr
integer :: item
integer :: elem
if (.not. api_initialized) then
call error_set(FEM_ERR_INTERNAL, 'fem_get_element_status called before fem_initialize', ierr)
return
end if
if (.not. allocated(elem_status)) then
call error_set(FEM_ERR_INTERNAL, 'element status array is not allocated', ierr)
return
end if
status = 0
do item = 1, nelem_in
elem = database_find_elem(elem_id(item))
if (elem .eq. 0) then
call error_set(FEM_ERR_INPUT, 'element status query references unknown element', ierr)
return
end if
status(item) = elem_status(elem)
end do
ierr = FEM_SUCCESS
end subroutine fem_get_element_status
end module fem_api_state_access
+27 -1
View File
@@ -80,6 +80,8 @@ module fem_control
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_arc_length_radius = ZERO
real(rk) :: nlc_arc_load_scale = ONE
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
@@ -88,6 +90,9 @@ module fem_control
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_arc_constraint = ZERO
real(rk) :: nlc_last_arc_lambda = ONE
real(rk) :: nlc_last_arc_length = ZERO
real(rk) :: nlc_last_damping = ONE
real(rk) :: nlc_last_merit_ratio = ZERO
real(rk) :: load_factor = ONE
@@ -167,6 +172,13 @@ module fem_control
contains
subroutine control_set_defaults()
call control_reset_time_nlc()
call control_reset_solver_ctl()
call control_reset_diag()
call control_reset_flags()
end subroutine control_set_defaults
subroutine control_reset_time_nlc()
time_start = ZERO
time_end = ZERO
current_time = ZERO
@@ -186,6 +198,8 @@ contains
nlc_trust_shrink_factor = 0.5_rk
nlc_trust_accept_ratio = 0.0_rk
nlc_trust_good_ratio = 0.75_rk
nlc_arc_length_radius = ZERO
nlc_arc_load_scale = ONE
nlc_mc_target_strain = 2.5e-3_rk
nlc_mc_yield_tolerance = 1.0e-7_rk
nlc_mc_plastic_limit = 5.0e-2_rk
@@ -194,6 +208,9 @@ contains
nlc_next_target_dt = ZERO
nlc_last_trust_radius = ZERO
nlc_next_trust_radius = ZERO
nlc_last_arc_constraint = ZERO
nlc_last_arc_lambda = ONE
nlc_last_arc_length = ZERO
nlc_last_damping = ONE
nlc_last_merit_ratio = ZERO
load_factor = ONE
@@ -210,6 +227,9 @@ contains
shell_drilling_stiffness_factor = 1.0e-4_rk
shell3_shear_locking_factor = 0.0625_rk
shell3_shear_locking_min_scale = 1.0e-4_rk
end subroutine control_reset_time_nlc
subroutine control_reset_solver_ctl()
current_step = 0
nstep_max = 0
analysis_type = ANALYSIS_EXPLICIT_DYNAMIC
@@ -234,6 +254,9 @@ contains
nlc_last_trust_adjust = NLC_ADJ_NONE
nlc_last_rejections = 0
call nlc_path_release()
end subroutine control_reset_solver_ctl
subroutine control_reset_diag()
shell_stability_sample_count = 0
shell_stability_last_elem = 0
convergence_increment = 0
@@ -257,6 +280,9 @@ contains
convergence_last_accepted_time = ZERO
nonlinear_trace_file = ' '
convergence_converged = .false.
end subroutine control_reset_diag
subroutine control_reset_flags()
use_sph_coupling = .false.
use_user_dt = .false.
large_deformation = .true.
@@ -265,7 +291,7 @@ contains
use_static_predictor = .false.
static_ramp_load = .true.
shell_geometric_nonlinear = .false.
end subroutine control_set_defaults
end subroutine control_reset_flags
subroutine nlc_path_reset()
nlc_path_count = 0