This commit is contained in:
@@ -40,6 +40,18 @@ module fem_contact_mortar_tangent
|
||||
real(rk) :: slip_soft = ZERO
|
||||
end type mortar_tangent_diag
|
||||
|
||||
type, public :: mortar_tangent_audit
|
||||
integer :: ndof = 0
|
||||
integer :: node_count = 0
|
||||
real(rk) :: row_sum_norm = ZERO
|
||||
real(rk) :: col_sum_norm = ZERO
|
||||
real(rk) :: max_asym = ZERO
|
||||
real(rk) :: max_translation_residual = ZERO
|
||||
real(rk) :: energy_probe = ZERO
|
||||
logical :: balance_ok = .false.
|
||||
logical :: translation_ok = .false.
|
||||
end type mortar_tangent_audit
|
||||
|
||||
public :: mortar_tan_params_init
|
||||
public :: mortar_tan_params_valid
|
||||
public :: mortar_tan_matrix
|
||||
@@ -51,6 +63,7 @@ module fem_contact_mortar_tangent
|
||||
public :: mortar_tan_pressure_parts
|
||||
public :: mortar_tan_block_values
|
||||
public :: mortar_tan_row_balance
|
||||
public :: mortar_tan_audit_matrix
|
||||
|
||||
contains
|
||||
|
||||
@@ -297,6 +310,79 @@ contains
|
||||
call error_clear(ierr)
|
||||
end subroutine mortar_tan_row_balance
|
||||
|
||||
subroutine mortar_tan_audit_matrix(ndof, k_local, balance_tol, audit, ierr)
|
||||
integer, intent(in) :: ndof
|
||||
real(rk), intent(in) :: k_local(:,:)
|
||||
real(rk), intent(in) :: balance_tol
|
||||
type(mortar_tangent_audit), intent(out) :: audit
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
real(rk) :: probe(MORTAR_TAN_MAX_DOF)
|
||||
real(rk) :: force(MORTAR_TAN_MAX_DOF)
|
||||
integer :: idir
|
||||
integer :: inode
|
||||
integer :: i
|
||||
integer :: j
|
||||
|
||||
call audit_reset(audit)
|
||||
if (ndof .lt. 1 .or. ndof .gt. MORTAR_TAN_MAX_DOF .or. &
|
||||
mod(ndof, NDIM) .ne. 0) then
|
||||
call error_set(FEM_ERR_INPUT, 'invalid mortar tangent audit dof count', ierr)
|
||||
return
|
||||
end if
|
||||
if (size(k_local, 1) .lt. ndof .or. size(k_local, 2) .lt. ndof) then
|
||||
call error_set(FEM_ERR_INPUT, 'mortar tangent audit matrix too small', ierr)
|
||||
return
|
||||
end if
|
||||
if (balance_tol .lt. ZERO) then
|
||||
call error_set(FEM_ERR_INPUT, 'mortar tangent audit tolerance is negative', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
audit%ndof = ndof
|
||||
audit%node_count = ndof / NDIM
|
||||
call mortar_tan_row_balance(ndof, k_local, audit%row_sum_norm, &
|
||||
audit%col_sum_norm, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
call mortar_tan_check_sym(ndof, k_local, audit%max_asym, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
do idir = 1, NDIM
|
||||
probe = ZERO
|
||||
force = ZERO
|
||||
do inode = 1, audit%node_count
|
||||
probe(NDIM * (inode - 1) + idir) = ONE
|
||||
end do
|
||||
do i = 1, ndof
|
||||
do j = 1, ndof
|
||||
force(i) = force(i) + k_local(i,j) * probe(j)
|
||||
end do
|
||||
end do
|
||||
audit%max_translation_residual = max(audit%max_translation_residual, &
|
||||
maxval(abs(force(1:ndof))))
|
||||
end do
|
||||
|
||||
probe = ZERO
|
||||
force = ZERO
|
||||
do i = 1, ndof
|
||||
if (mod(i, 2) .eq. 0) then
|
||||
probe(i) = -ONE
|
||||
else
|
||||
probe(i) = ONE
|
||||
end if
|
||||
end do
|
||||
do i = 1, ndof
|
||||
do j = 1, ndof
|
||||
force(i) = force(i) + k_local(i,j) * probe(j)
|
||||
end do
|
||||
end do
|
||||
audit%energy_probe = HALF * dot_product(probe(1:ndof), force(1:ndof))
|
||||
audit%balance_ok = audit%row_sum_norm .le. balance_tol .and. &
|
||||
audit%col_sum_norm .le. balance_tol
|
||||
audit%translation_ok = audit%max_translation_residual .le. balance_tol
|
||||
call error_clear(ierr)
|
||||
end subroutine mortar_tan_audit_matrix
|
||||
|
||||
subroutine build_tangent(cons, params, mode, ndof, k_local, diag, ierr)
|
||||
type(mortar_constraint), intent(in) :: cons
|
||||
type(mortar_tangent_params), intent(in) :: params
|
||||
@@ -480,6 +566,20 @@ contains
|
||||
diag%slip_soft = ZERO
|
||||
end subroutine diag_reset
|
||||
|
||||
subroutine audit_reset(audit)
|
||||
type(mortar_tangent_audit), intent(out) :: audit
|
||||
|
||||
audit%ndof = 0
|
||||
audit%node_count = 0
|
||||
audit%row_sum_norm = ZERO
|
||||
audit%col_sum_norm = ZERO
|
||||
audit%max_asym = ZERO
|
||||
audit%max_translation_residual = ZERO
|
||||
audit%energy_probe = ZERO
|
||||
audit%balance_ok = .false.
|
||||
audit%translation_ok = .false.
|
||||
end subroutine audit_reset
|
||||
|
||||
function friction_factor(cons, params, mode) result(scale)
|
||||
type(mortar_constraint), intent(in) :: cons
|
||||
type(mortar_tangent_params), intent(in) :: params
|
||||
|
||||
@@ -20,6 +20,7 @@ module fem_contact_multiplier
|
||||
public :: contact_multiplier_entry
|
||||
public :: contact_multiplier_status_name
|
||||
public :: contact_multiplier_compact
|
||||
public :: contact_multiplier_audit
|
||||
public :: contact_multiplier_write
|
||||
public :: contact_multiplier_read
|
||||
|
||||
@@ -184,6 +185,78 @@ contains
|
||||
call error_clear(ierr)
|
||||
end subroutine contact_multiplier_full_stats
|
||||
|
||||
subroutine contact_multiplier_audit(slot_count, active_count, &
|
||||
released_count, open_count, &
|
||||
duplicate_count, invalid_count, &
|
||||
max_lambda, max_gap, &
|
||||
max_commit_error, ierr)
|
||||
integer, intent(out) :: slot_count
|
||||
integer, intent(out) :: active_count
|
||||
integer, intent(out) :: released_count
|
||||
integer, intent(out) :: open_count
|
||||
integer, intent(out) :: duplicate_count
|
||||
integer, intent(out) :: invalid_count
|
||||
real(rk), intent(out) :: max_lambda
|
||||
real(rk), intent(out) :: max_gap
|
||||
real(rk), intent(out) :: max_commit_error
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
integer :: slot
|
||||
integer :: other
|
||||
|
||||
slot_count = mult_count
|
||||
active_count = 0
|
||||
released_count = 0
|
||||
open_count = 0
|
||||
duplicate_count = 0
|
||||
invalid_count = 0
|
||||
max_lambda = ZERO
|
||||
max_gap = ZERO
|
||||
max_commit_error = ZERO
|
||||
|
||||
if (mult_count .le. 0) then
|
||||
call error_clear(ierr)
|
||||
return
|
||||
end if
|
||||
if (.not. allocated(mult_pair) .or. .not. allocated(mult_lambda)) then
|
||||
invalid_count = mult_count
|
||||
call error_set(FEM_ERR_INTERNAL, 'contact multiplier audit found missing arrays', &
|
||||
ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
do slot = 1, mult_count
|
||||
if (.not. valid_multiplier_status(mult_status(slot))) then
|
||||
invalid_count = invalid_count + 1
|
||||
else if (mult_status(slot) .eq. CONTACT_MULT_ACTIVE) then
|
||||
active_count = active_count + 1
|
||||
else if (mult_status(slot) .eq. CONTACT_MULT_RELEASED) then
|
||||
released_count = released_count + 1
|
||||
else
|
||||
open_count = open_count + 1
|
||||
end if
|
||||
|
||||
max_lambda = max(max_lambda, mult_lambda(slot))
|
||||
max_gap = max(max_gap, mult_trial_gap(slot))
|
||||
max_commit_error = max(max_commit_error, &
|
||||
abs(mult_trial_lambda(slot) - mult_lambda(slot)))
|
||||
|
||||
do other = slot + 1, mult_count
|
||||
if (same_multiplier_key(slot, other)) duplicate_count = duplicate_count + 1
|
||||
end do
|
||||
end do
|
||||
|
||||
if (invalid_count .gt. 0) then
|
||||
call error_set(FEM_ERR_INTERNAL, 'contact multiplier audit found invalid status', &
|
||||
ierr)
|
||||
else if (duplicate_count .gt. 0) then
|
||||
call error_set(FEM_ERR_INTERNAL, 'contact multiplier audit found duplicate key', &
|
||||
ierr)
|
||||
else
|
||||
call error_clear(ierr)
|
||||
end if
|
||||
end subroutine contact_multiplier_audit
|
||||
|
||||
subroutine contact_multiplier_entry(index, pair, selem, sface, melem, &
|
||||
mface, point_id, status, lambda_value, &
|
||||
trial_lambda, gap_value, ierr)
|
||||
@@ -508,6 +581,21 @@ contains
|
||||
mult_trial_lambda(slot) .le. tiny(ONE)
|
||||
end function drop_multiplier_slot
|
||||
|
||||
logical function same_multiplier_key(lhs, rhs)
|
||||
integer, intent(in) :: lhs
|
||||
integer, intent(in) :: rhs
|
||||
|
||||
same_multiplier_key = .false.
|
||||
if (lhs .lt. 1 .or. rhs .lt. 1) return
|
||||
if (lhs .gt. mult_count .or. rhs .gt. mult_count) return
|
||||
same_multiplier_key = mult_pair(lhs) .eq. mult_pair(rhs) .and. &
|
||||
mult_slave_elem(lhs) .eq. mult_slave_elem(rhs) .and. &
|
||||
mult_slave_face(lhs) .eq. mult_slave_face(rhs) .and. &
|
||||
mult_master_elem(lhs) .eq. mult_master_elem(rhs) .and. &
|
||||
mult_master_face(lhs) .eq. mult_master_face(rhs) .and. &
|
||||
mult_point(lhs) .eq. mult_point(rhs)
|
||||
end function same_multiplier_key
|
||||
|
||||
subroutine copy_multiplier_slot(dst, src)
|
||||
integer, intent(in) :: dst
|
||||
integer, intent(in) :: src
|
||||
|
||||
@@ -67,11 +67,14 @@ contains
|
||||
integer :: active
|
||||
integer :: released
|
||||
integer :: open_count
|
||||
integer :: duplicate_count
|
||||
integer :: invalid_count
|
||||
real(rk) :: max_lambda
|
||||
real(rk) :: max_trial
|
||||
real(rk) :: max_gap
|
||||
real(rk) :: max_commit_error
|
||||
|
||||
if (len(line) .lt. 192) then
|
||||
if (len(line) .lt. 256) then
|
||||
call error_set(FEM_ERR_OUTPUT, 'contact multiplier summary too small', &
|
||||
ierr)
|
||||
return
|
||||
@@ -79,10 +82,16 @@ contains
|
||||
call contact_multiplier_full_stats(slots, active, released, open_count, &
|
||||
max_lambda, max_trial, max_gap, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
write(line, '(A,I0,A,I0,A,I0,A,I0,A,ES16.8,A,ES16.8,A,ES16.8)') &
|
||||
call contact_multiplier_audit(slots, active, released, open_count, &
|
||||
duplicate_count, invalid_count, max_lambda, max_gap, max_commit_error, &
|
||||
ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
write(line, '(A,I0,A,I0,A,I0,A,I0,A,ES16.8,A,ES16.8,A,ES16.8,' // &
|
||||
'A,I0,A,I0,A,ES16.8)') &
|
||||
'slots=', slots, ',active=', active, ',released=', released, &
|
||||
',open=', open_count, ',max_lambda=', max_lambda, ',max_trial=', &
|
||||
max_trial, ',max_gap=', max_gap
|
||||
max_trial, ',max_gap=', max_gap, ',duplicates=', duplicate_count, &
|
||||
',invalid=', invalid_count, ',max_commit_error=', max_commit_error
|
||||
call error_clear(ierr)
|
||||
end subroutine contact_mult_report_summary
|
||||
|
||||
@@ -98,9 +107,12 @@ contains
|
||||
integer :: active
|
||||
integer :: released
|
||||
integer :: open_count
|
||||
integer :: duplicate_count
|
||||
integer :: invalid_count
|
||||
real(rk) :: max_lambda
|
||||
real(rk) :: max_trial
|
||||
real(rk) :: max_gap
|
||||
real(rk) :: max_commit_error
|
||||
|
||||
if (len_trim(filename) .le. 0) then
|
||||
call error_set(FEM_ERR_OUTPUT, 'contact multiplier report empty', ierr)
|
||||
@@ -109,6 +121,10 @@ contains
|
||||
call contact_multiplier_full_stats(slots, active, released, open_count, &
|
||||
max_lambda, max_trial, max_gap, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
call contact_multiplier_audit(slots, active, released, open_count, &
|
||||
duplicate_count, invalid_count, max_lambda, max_gap, max_commit_error, &
|
||||
ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
unit = 96
|
||||
open(unit=unit, file=trim(filename), status='replace', action='write', &
|
||||
|
||||
Reference in New Issue
Block a user