Complete V5 acceptance milestone
This commit is contained in:
@@ -11,6 +11,7 @@ program test_cohesive_contact
|
||||
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()
|
||||
@@ -136,6 +137,213 @@ contains
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user