555 lines
23 KiB
Fortran
555 lines
23 KiB
Fortran
program test_cohesive_contact
|
|
use fem_precision
|
|
use fem_error
|
|
use fem_cohesive_law
|
|
use fem_cohesive_state
|
|
use fem_cohesive_metrics
|
|
implicit none
|
|
|
|
real(rk), parameter :: TOL = 1.0e-10_rk
|
|
|
|
call check_law_elastic_damage()
|
|
call check_mixed_mode_failure()
|
|
call check_compression_unload()
|
|
call check_acceptance_path()
|
|
call check_state_trial_restart()
|
|
call check_metrics()
|
|
call check_error_paths()
|
|
|
|
contains
|
|
|
|
subroutine check_law_elastic_damage()
|
|
type(cohesive_law_params) :: params
|
|
real(rk) :: traction_n
|
|
real(rk) :: traction_t(3)
|
|
real(rk) :: tangent_n
|
|
real(rk) :: tangent_t
|
|
real(rk) :: damage
|
|
real(rk) :: max_eff
|
|
real(rk) :: dissipated
|
|
real(rk) :: index_value
|
|
real(rk) :: onset_sep
|
|
real(rk) :: failure_sep
|
|
real(rk) :: peak
|
|
integer :: status
|
|
integer :: ierr
|
|
|
|
call cohesive_params_init(1000.0_rk, 500.0_rk, 10.0_rk, 5.0_rk, &
|
|
0.20_rk, 0.30_rk, ONE, 2.0_rk, params, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(10)
|
|
|
|
call cohesive_trial_update(params, 0.005_rk, (/ ZERO, ZERO, ZERO /), &
|
|
ZERO, ZERO, &
|
|
traction_n, traction_t, tangent_n, tangent_t, &
|
|
damage, max_eff, dissipated, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(11)
|
|
call check_close(traction_n, 5.0_rk, 12)
|
|
call check_close(tangent_n, 1000.0_rk, 13)
|
|
call check_close(tangent_t, 500.0_rk, 14)
|
|
call check_close(damage, ZERO, 15)
|
|
call check_close(max_eff, 0.005_rk, 16)
|
|
call check_close(dissipated, ZERO, 17)
|
|
if (status .ne. COH_STATUS_BONDED) call fail(18)
|
|
|
|
call cohesive_initiation_index(params, 0.006_rk, (/ 0.006_rk, ZERO, ZERO /), &
|
|
index_value, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(19)
|
|
call check_close(index_value, sqrt(0.36_rk + 0.36_rk), 20)
|
|
|
|
call cohesive_failure_sep(params, ZERO, onset_sep, failure_sep, peak, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(21)
|
|
call check_close(onset_sep, 0.01_rk, 22)
|
|
call check_close(failure_sep, 0.04_rk, 23)
|
|
call check_close(peak, 10.0_rk, 24)
|
|
|
|
call cohesive_trial_update(params, 0.025_rk, (/ ZERO, ZERO, ZERO /), &
|
|
ZERO, 0.005_rk, &
|
|
traction_n, traction_t, tangent_n, tangent_t, &
|
|
damage, max_eff, dissipated, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(25)
|
|
if (damage .le. ZERO .or. damage .ge. ONE) call fail(26)
|
|
if (traction_n .le. ZERO .or. traction_n .ge. 25.0_rk) call fail(27)
|
|
if (dissipated .le. ZERO) call fail(28)
|
|
if (status .ne. COH_STATUS_DAMAGING) call fail(29)
|
|
end subroutine check_law_elastic_damage
|
|
|
|
subroutine check_mixed_mode_failure()
|
|
type(cohesive_law_params) :: params
|
|
real(rk) :: traction_n
|
|
real(rk) :: traction_t(3)
|
|
real(rk) :: tangent_n
|
|
real(rk) :: tangent_t
|
|
real(rk) :: damage
|
|
real(rk) :: max_eff
|
|
real(rk) :: dissipated
|
|
real(rk) :: effective
|
|
real(rk) :: mixity
|
|
real(rk) :: mixed_energy
|
|
integer :: status
|
|
integer :: ierr
|
|
|
|
call cohesive_params_init(1000.0_rk, 500.0_rk, 10.0_rk, 5.0_rk, &
|
|
0.20_rk, 0.40_rk, 2.0_rk, ONE, params, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(40)
|
|
|
|
call cohesive_effective_sep(0.03_rk, (/ 0.04_rk, ZERO, ZERO /), &
|
|
effective, mixity, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(41)
|
|
call check_close(effective, 0.05_rk, 42)
|
|
call check_close(mixity, 0.64_rk, 43)
|
|
call cohesive_mixed_energy(params, mixity, mixed_energy, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(44)
|
|
call check_close(mixed_energy, 0.20_rk + 0.20_rk * 0.64_rk * 0.64_rk, 45)
|
|
|
|
call cohesive_trial_update(params, 0.30_rk, (/ 0.30_rk, ZERO, ZERO /), &
|
|
ZERO, ZERO, traction_n, traction_t, tangent_n, &
|
|
tangent_t, damage, max_eff, dissipated, status, &
|
|
ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(46)
|
|
call check_close(damage, ONE, 47)
|
|
call check_close(traction_n, ZERO, 48)
|
|
call check_vec(traction_t, (/ ZERO, ZERO, ZERO /), 49)
|
|
call check_close(tangent_n, ZERO, 50)
|
|
call check_close(tangent_t, ZERO, 51)
|
|
if (status .ne. COH_STATUS_FAILED) call fail(52)
|
|
end subroutine check_mixed_mode_failure
|
|
|
|
subroutine check_compression_unload()
|
|
type(cohesive_law_params) :: params
|
|
real(rk) :: traction_n
|
|
real(rk) :: traction_t(3)
|
|
real(rk) :: tangent_n
|
|
real(rk) :: tangent_t
|
|
integer :: status
|
|
integer :: ierr
|
|
|
|
call cohesive_params_init(1000.0_rk, 500.0_rk, 10.0_rk, 5.0_rk, &
|
|
0.20_rk, 0.30_rk, ONE, 3.0_rk, params, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(70)
|
|
call cohesive_fixed_damage(params, -0.002_rk, (/ 0.004_rk, ZERO, ZERO /), &
|
|
0.25_rk, traction_n, traction_t, tangent_n, &
|
|
tangent_t, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(71)
|
|
call check_close(traction_n, -6.0_rk, 72)
|
|
call check_vec(traction_t, (/ 1.5_rk, ZERO, ZERO /), 73)
|
|
call check_close(tangent_n, 3000.0_rk, 74)
|
|
call check_close(tangent_t, 375.0_rk, 75)
|
|
if (status .ne. COH_STATUS_COMPRESS) call fail(76)
|
|
end subroutine check_compression_unload
|
|
|
|
subroutine check_acceptance_path()
|
|
type(cohesive_law_params) :: params
|
|
type(cohesive_metrics_state) :: metrics
|
|
real(rk) :: traction_n
|
|
real(rk) :: traction_t(3)
|
|
real(rk) :: tangent_n
|
|
real(rk) :: tangent_t
|
|
real(rk) :: damage
|
|
real(rk) :: old_damage
|
|
real(rk) :: max_eff
|
|
real(rk) :: old_max_eff
|
|
real(rk) :: max_opening
|
|
real(rk) :: dissipated
|
|
real(rk) :: energy_total
|
|
integer :: status
|
|
integer :: ierr
|
|
|
|
call cohesive_params_init(1000.0_rk, 500.0_rk, 10.0_rk, 5.0_rk, &
|
|
0.20_rk, 0.40_rk, ONE, 2.0_rk, params, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(120)
|
|
call cohesive_state_reset()
|
|
call cohesive_metrics_reset(metrics)
|
|
old_damage = ZERO
|
|
old_max_eff = ZERO
|
|
max_opening = ZERO
|
|
energy_total = ZERO
|
|
|
|
call cohesive_trial_update(params, 0.005_rk, (/ ZERO, ZERO, ZERO /), &
|
|
old_damage, old_max_eff, traction_n, &
|
|
traction_t, tangent_n, tangent_t, damage, &
|
|
max_eff, dissipated, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(121)
|
|
if (status .ne. COH_STATUS_BONDED) call fail(122)
|
|
call check_close(damage, ZERO, 123)
|
|
call check_close(dissipated, ZERO, 124)
|
|
call record_acceptance(status, damage, 0.005_rk, max_eff, dissipated, &
|
|
metrics, max_opening, energy_total, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(125)
|
|
old_damage = damage
|
|
old_max_eff = max_eff
|
|
|
|
call cohesive_trial_update(params, 0.020_rk, &
|
|
(/ 0.015_rk, ZERO, ZERO /), old_damage, &
|
|
old_max_eff, traction_n, traction_t, &
|
|
tangent_n, tangent_t, damage, max_eff, &
|
|
dissipated, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(126)
|
|
if (status .ne. COH_STATUS_DAMAGING) call fail(127)
|
|
if (damage .le. old_damage .or. damage .ge. ONE) call fail(128)
|
|
if (max_eff .le. old_max_eff) call fail(129)
|
|
if (dissipated .le. ZERO) call fail(130)
|
|
call record_acceptance(status, damage, 0.020_rk, max_eff, dissipated, &
|
|
metrics, max_opening, energy_total, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(131)
|
|
old_damage = damage
|
|
old_max_eff = max_eff
|
|
|
|
call cohesive_trial_update(params, 0.008_rk, &
|
|
(/ 0.006_rk, ZERO, ZERO /), old_damage, &
|
|
old_max_eff, traction_n, traction_t, &
|
|
tangent_n, tangent_t, damage, max_eff, &
|
|
dissipated, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(132)
|
|
if (status .ne. COH_STATUS_DAMAGING) call fail(133)
|
|
if (damage .lt. old_damage - TOL) call fail(134)
|
|
if (max_eff .lt. old_max_eff - TOL) call fail(135)
|
|
if (dissipated .lt. -TOL) call fail(136)
|
|
call record_acceptance(status, damage, 0.008_rk, max_eff, dissipated, &
|
|
metrics, max_opening, energy_total, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(137)
|
|
old_damage = damage
|
|
old_max_eff = max_eff
|
|
|
|
call cohesive_trial_update(params, 0.030_rk, &
|
|
(/ 0.0225_rk, ZERO, ZERO /), old_damage, &
|
|
old_max_eff, traction_n, traction_t, &
|
|
tangent_n, tangent_t, damage, max_eff, &
|
|
dissipated, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(157)
|
|
if (damage .le. old_damage .or. damage .ge. ONE) call fail(158)
|
|
if (status .ne. COH_STATUS_DAMAGING) call fail(159)
|
|
if (dissipated .le. ZERO) call fail(160)
|
|
call record_acceptance(status, damage, 0.030_rk, max_eff, dissipated, &
|
|
metrics, max_opening, energy_total, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(161)
|
|
old_damage = damage
|
|
old_max_eff = max_eff
|
|
|
|
call cohesive_trial_update(params, 0.080_rk, &
|
|
(/ 0.060_rk, ZERO, ZERO /), old_damage, &
|
|
old_max_eff, traction_n, traction_t, &
|
|
tangent_n, tangent_t, damage, max_eff, &
|
|
dissipated, status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(162)
|
|
call check_close(damage, ONE, 163)
|
|
if (status .ne. COH_STATUS_FAILED) call fail(164)
|
|
call check_vec(traction_t, (/ ZERO, ZERO, ZERO /), 165)
|
|
call check_close(traction_n, ZERO, 166)
|
|
if (dissipated .le. ZERO) call fail(167)
|
|
call record_acceptance(status, damage, 0.080_rk, max_eff, dissipated, &
|
|
metrics, max_opening, energy_total, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(168)
|
|
|
|
call check_acceptance_restart(max_opening, max_eff, energy_total, metrics)
|
|
call cohesive_state_reset()
|
|
end subroutine check_acceptance_path
|
|
|
|
subroutine check_acceptance_restart(max_opening, max_eff, energy_total, &
|
|
metrics)
|
|
character(len=*), parameter :: TMP_FILE = 'test_cohesive_accept_tmp.dat'
|
|
real(rk), intent(in) :: max_opening
|
|
real(rk), intent(in) :: max_eff
|
|
real(rk), intent(in) :: energy_total
|
|
type(cohesive_metrics_state), intent(in) :: metrics
|
|
|
|
real(rk) :: restart_damage
|
|
real(rk) :: restart_opening
|
|
real(rk) :: restart_effective
|
|
real(rk) :: restart_energy
|
|
real(rk) :: max_damage
|
|
real(rk) :: max_energy
|
|
real(rk) :: failed_area
|
|
real(rk) :: failed_fraction
|
|
real(rk) :: total_energy
|
|
integer :: status
|
|
integer :: slots
|
|
integer :: damaging
|
|
integer :: failed
|
|
integer :: sample_count
|
|
integer :: failed_count
|
|
integer :: ierr
|
|
integer :: ios
|
|
integer :: unit_id
|
|
integer :: count_in
|
|
character(len=64) :: header
|
|
|
|
call cohesive_state_stats(slots, damaging, failed, max_damage, &
|
|
restart_opening, max_energy)
|
|
if (slots .ne. 1 .or. damaging .ne. 0 .or. failed .ne. 1) call fail(169)
|
|
call check_close(max_damage, ONE, 170)
|
|
call check_close(restart_opening, max_opening, 171)
|
|
call check_close(max_energy, energy_total, 172)
|
|
|
|
unit_id = 92
|
|
open(unit=unit_id, file=TMP_FILE, status='replace', action='write', &
|
|
iostat=ios)
|
|
if (ios .ne. 0) call fail(173)
|
|
call cohesive_state_write(unit_id, ios)
|
|
if (ios .ne. 0) call fail(174)
|
|
close(unit_id)
|
|
|
|
call cohesive_state_reset()
|
|
open(unit=unit_id, file=TMP_FILE, status='old', action='read', iostat=ios)
|
|
if (ios .ne. 0) call fail(175)
|
|
read(unit_id,*,iostat=ios) header, count_in
|
|
if (ios .ne. 0) call fail(176)
|
|
if (trim(header) .ne. 'COHESIVE_STATE') call fail(177)
|
|
call cohesive_state_read(unit_id, count_in, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(178)
|
|
close(unit_id, status='delete')
|
|
|
|
call cohesive_state_old(2, 100, 1, 200, 1, 1, restart_damage, &
|
|
restart_opening, restart_effective, &
|
|
restart_energy, status)
|
|
call check_close(restart_damage, ONE, 190)
|
|
call check_close(restart_opening, max_opening, 191)
|
|
call check_close(restart_effective, max_eff, 192)
|
|
call check_close(restart_energy, energy_total, 193)
|
|
if (status .ne. COH_STATUS_FAILED) call fail(194)
|
|
|
|
call cohesive_metrics_summary(metrics, sample_count, failed_count, &
|
|
max_damage, restart_opening, failed_area, &
|
|
failed_fraction, total_energy, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(195)
|
|
if (sample_count .ne. 5 .or. failed_count .ne. 1) call fail(196)
|
|
call check_close(max_damage, ONE, 197)
|
|
call check_close(restart_opening, max_opening, 198)
|
|
call check_close(failed_area, ONE, 199)
|
|
call check_close(failed_fraction, 0.2_rk, 200)
|
|
call check_close(total_energy, energy_total, 201)
|
|
end subroutine check_acceptance_restart
|
|
|
|
subroutine record_acceptance(status, damage, opening, effective, &
|
|
dissipated, metrics, max_opening, &
|
|
energy_total, ierr)
|
|
integer, intent(in) :: status
|
|
real(rk), intent(in) :: damage
|
|
real(rk), intent(in) :: opening
|
|
real(rk), intent(in) :: effective
|
|
real(rk), intent(in) :: dissipated
|
|
type(cohesive_metrics_state), intent(inout) :: metrics
|
|
real(rk), intent(inout) :: max_opening
|
|
real(rk), intent(inout) :: energy_total
|
|
integer, intent(out) :: ierr
|
|
|
|
max_opening = max(max_opening, max(ZERO, opening))
|
|
energy_total = energy_total + max(ZERO, dissipated)
|
|
call cohesive_state_begin_trial()
|
|
call cohesive_state_store_trial(2, 100, 1, 200, 1, 1, damage, &
|
|
max_opening, effective, dissipated, &
|
|
status, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
call cohesive_state_commit()
|
|
call cohesive_metrics_add(metrics, status, damage, max_opening, &
|
|
effective, ONE, dissipated, ZERO, ierr)
|
|
end subroutine record_acceptance
|
|
|
|
subroutine check_state_trial_restart()
|
|
character(len=*), parameter :: TMP_FILE = 'test_cohesive_state_tmp.dat'
|
|
real(rk) :: damage
|
|
real(rk) :: opening
|
|
real(rk) :: effective
|
|
real(rk) :: energy
|
|
real(rk) :: max_damage
|
|
real(rk) :: max_opening
|
|
real(rk) :: max_energy
|
|
integer :: status
|
|
integer :: slots
|
|
integer :: damaging
|
|
integer :: failed
|
|
integer :: ierr
|
|
integer :: ios
|
|
integer :: unit_id
|
|
character(len=64) :: header
|
|
integer :: count_in
|
|
|
|
call cohesive_state_reset()
|
|
call cohesive_state_begin_trial()
|
|
call cohesive_state_store_trial(1, 10, 2, 20, 3, 4, 0.2_rk, &
|
|
0.01_rk, 0.02_rk, 0.03_rk, &
|
|
COH_STATUS_DAMAGING, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(90)
|
|
if (cohesive_state_count() .ne. 1) call fail(91)
|
|
call cohesive_state_old(1, 10, 2, 20, 3, 4, damage, opening, effective, &
|
|
energy, status)
|
|
call check_close(damage, ZERO, 92)
|
|
call cohesive_state_commit()
|
|
call cohesive_state_old(1, 10, 2, 20, 3, 4, damage, opening, effective, &
|
|
energy, status)
|
|
call check_close(damage, 0.2_rk, 93)
|
|
call check_close(opening, 0.01_rk, 94)
|
|
call check_close(effective, 0.02_rk, 95)
|
|
call check_close(energy, 0.03_rk, 96)
|
|
if (status .ne. COH_STATUS_DAMAGING) call fail(97)
|
|
|
|
call cohesive_state_begin_trial()
|
|
call cohesive_state_store_trial(1, 10, 2, 20, 3, 4, 0.9_rk, &
|
|
0.04_rk, 0.05_rk, 0.07_rk, &
|
|
COH_STATUS_DAMAGING, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(98)
|
|
call cohesive_state_rollback()
|
|
call cohesive_state_commit()
|
|
call cohesive_state_old(1, 10, 2, 20, 3, 4, damage, opening, effective, &
|
|
energy, status)
|
|
call check_close(damage, 0.2_rk, 99)
|
|
call check_close(energy, 0.03_rk, 100)
|
|
|
|
call cohesive_state_store_trial(1, 10, 2, 20, 3, 5, ONE, &
|
|
0.10_rk, 0.20_rk, 0.50_rk, &
|
|
COH_STATUS_DAMAGING, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(101)
|
|
call cohesive_state_commit()
|
|
call cohesive_state_stats(slots, damaging, failed, max_damage, &
|
|
max_opening, max_energy)
|
|
if (slots .ne. 2) call fail(102)
|
|
if (damaging .ne. 1) call fail(103)
|
|
if (failed .ne. 1) call fail(104)
|
|
call check_close(max_damage, ONE, 105)
|
|
call check_close(max_opening, 0.10_rk, 106)
|
|
call check_close(max_energy, 0.50_rk, 107)
|
|
|
|
unit_id = 91
|
|
open(unit=unit_id, file=TMP_FILE, status='replace', action='write', &
|
|
iostat=ios)
|
|
if (ios .ne. 0) call fail(108)
|
|
call cohesive_state_write(unit_id, ios)
|
|
if (ios .ne. 0) call fail(109)
|
|
close(unit_id)
|
|
|
|
call cohesive_state_reset()
|
|
open(unit=unit_id, file=TMP_FILE, status='old', action='read', iostat=ios)
|
|
if (ios .ne. 0) call fail(110)
|
|
read(unit_id,*,iostat=ios) header, count_in
|
|
if (ios .ne. 0) call fail(111)
|
|
if (trim(header) .ne. 'COHESIVE_STATE') call fail(112)
|
|
call cohesive_state_read(unit_id, count_in, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(113)
|
|
close(unit_id, status='delete')
|
|
|
|
call cohesive_state_old(1, 10, 2, 20, 3, 5, damage, opening, effective, &
|
|
energy, status)
|
|
call check_close(damage, ONE, 114)
|
|
call check_close(opening, 0.10_rk, 115)
|
|
call check_close(effective, 0.20_rk, 116)
|
|
call check_close(energy, 0.50_rk, 117)
|
|
if (status .ne. COH_STATUS_FAILED) call fail(118)
|
|
call cohesive_state_reset()
|
|
end subroutine check_state_trial_restart
|
|
|
|
subroutine check_metrics()
|
|
type(cohesive_metrics_state) :: state
|
|
type(cohesive_metrics_state) :: other
|
|
type(cohesive_metrics_state) :: merged
|
|
integer :: sample_count
|
|
integer :: failed_count
|
|
real(rk) :: damage_max
|
|
real(rk) :: opening_max
|
|
real(rk) :: failed_area
|
|
real(rk) :: failed_fraction
|
|
real(rk) :: total_energy
|
|
integer :: ierr
|
|
|
|
call cohesive_metrics_reset(state)
|
|
call cohesive_metrics_add(state, COH_STATUS_BONDED, ZERO, 0.01_rk, &
|
|
0.01_rk, 2.0_rk, ZERO, 0.5_rk, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(140)
|
|
call cohesive_metrics_add(state, COH_STATUS_DAMAGING, 0.5_rk, 0.03_rk, &
|
|
0.04_rk, 3.0_rk, 0.2_rk, 0.6_rk, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(141)
|
|
call cohesive_metrics_add(state, COH_STATUS_FAILED, ONE, 0.10_rk, &
|
|
0.20_rk, 5.0_rk, 1.0_rk, ZERO, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(142)
|
|
|
|
call cohesive_metrics_summary(state, sample_count, failed_count, &
|
|
damage_max, opening_max, failed_area, &
|
|
failed_fraction, total_energy, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(143)
|
|
if (sample_count .ne. 3) call fail(144)
|
|
if (failed_count .ne. 1) call fail(145)
|
|
call check_close(damage_max, ONE, 146)
|
|
call check_close(opening_max, 0.10_rk, 147)
|
|
call check_close(failed_area, 5.0_rk, 148)
|
|
call check_close(failed_fraction, 0.5_rk, 149)
|
|
call check_close(total_energy, 2.3_rk, 150)
|
|
|
|
call cohesive_metrics_reset(other)
|
|
call cohesive_metrics_add(other, COH_STATUS_COMPRESS, ZERO, ZERO, ZERO, &
|
|
2.0_rk, ZERO, 0.1_rk, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(151)
|
|
call cohesive_metrics_merge(state, other, merged, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(152)
|
|
call cohesive_metrics_summary(merged, sample_count, failed_count, &
|
|
damage_max, opening_max, failed_area, &
|
|
failed_fraction, total_energy, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(153)
|
|
if (sample_count .ne. 4) call fail(154)
|
|
call check_close(failed_fraction, 5.0_rk / 12.0_rk, 155)
|
|
call check_close(total_energy, 2.4_rk, 156)
|
|
end subroutine check_metrics
|
|
|
|
subroutine check_error_paths()
|
|
type(cohesive_law_params) :: params
|
|
type(cohesive_metrics_state) :: metrics
|
|
real(rk) :: traction_n
|
|
real(rk) :: traction_t(3)
|
|
real(rk) :: tangent_n
|
|
real(rk) :: tangent_t
|
|
real(rk) :: damage
|
|
real(rk) :: max_eff
|
|
real(rk) :: dissipated
|
|
integer :: status
|
|
integer :: ierr
|
|
|
|
call cohesive_params_init(ZERO, 500.0_rk, 10.0_rk, 5.0_rk, 0.2_rk, &
|
|
0.3_rk, ONE, ONE, params, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(180)
|
|
call cohesive_params_init(1000.0_rk, 500.0_rk, 10.0_rk, 5.0_rk, 0.2_rk, &
|
|
0.3_rk, ONE, ONE, params, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(181)
|
|
call cohesive_trial_update(params, 0.01_rk, (/ ZERO, ZERO, ZERO /), &
|
|
-0.1_rk, ZERO, &
|
|
traction_n, traction_t, tangent_n, tangent_t, &
|
|
damage, max_eff, dissipated, status, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(182)
|
|
call cohesive_fixed_damage(params, 0.01_rk, (/ ZERO, ZERO, ZERO /), &
|
|
1.2_rk, traction_n, &
|
|
traction_t, tangent_n, tangent_t, status, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(183)
|
|
call cohesive_state_reset()
|
|
call cohesive_state_store_trial(1, 1, 1, 1, 1, 1, -0.1_rk, ZERO, ZERO, &
|
|
ZERO, COH_STATUS_OPEN, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(184)
|
|
call cohesive_metrics_reset(metrics)
|
|
call cohesive_metrics_add(metrics, 99, ZERO, ZERO, ZERO, ONE, ZERO, ZERO, &
|
|
ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(185)
|
|
call cohesive_metrics_add(metrics, COH_STATUS_FAILED, ONE, ZERO, ZERO, &
|
|
-ONE, ZERO, ZERO, ierr)
|
|
if (ierr .eq. FEM_SUCCESS) call fail(186)
|
|
end subroutine check_error_paths
|
|
|
|
subroutine check_close(actual, expected, code)
|
|
real(rk), intent(in) :: actual
|
|
real(rk), intent(in) :: expected
|
|
integer, intent(in) :: code
|
|
|
|
if (abs(actual - expected) .gt. TOL * max(ONE, abs(expected))) call fail(code)
|
|
end subroutine check_close
|
|
|
|
subroutine check_vec(actual, expected, code)
|
|
real(rk), intent(in) :: actual(3)
|
|
real(rk), intent(in) :: expected(3)
|
|
integer, intent(in) :: code
|
|
|
|
if (maxval(abs(actual - expected)) .gt. TOL) call fail(code)
|
|
end subroutine check_vec
|
|
|
|
subroutine fail(code)
|
|
integer, intent(in) :: code
|
|
|
|
write(*,*) 'test_cohesive_contact failed:', code
|
|
stop 1
|
|
end subroutine fail
|
|
|
|
end program test_cohesive_contact
|