Skip to content

Commit da282e0

Browse files
committed
actually fix frontier
1 parent 013d41d commit da282e0

File tree

8 files changed

+262
-288
lines changed

8 files changed

+262
-288
lines changed

src/simulation/m_hypoelastic.fpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ contains
394394

395395
real(wp) :: tau_p ! principal stress
396396
real(wp) :: tau_xx, tau_xy, tau_yy, tau_zz, tau_yz, tau_xz
397-
real(wp) :: I1, I2, I3, argument, phi, sqrt_term
397+
real(wp) :: I1, I2, I3, argument, phi, sqrt_term_1, sqrt_term_2, temp
398398
integer :: q, l, k
399399

400400
if (n == 0) then
@@ -412,8 +412,8 @@ contains
412412
tau_p = 0.5_wp*(q_cons_vf(stress_idx%beg)%sf(k, l, q) + &
413413
q_cons_vf(stress_idx%beg + 2)%sf(k, l, q)) + &
414414
sqrt((q_cons_vf(stress_idx%beg)%sf(k, l, q) - &
415-
q_cons_vf(stress_idx%beg + 2)%sf(k, l, q))**2 + &
416-
4._wp*q_cons_vf(stress_idx%beg + 1)%sf(k, l, q)**2)/2._wp
415+
q_cons_vf(stress_idx%beg + 2)%sf(k, l, q))**2.0_wp + &
416+
4._wp*q_cons_vf(stress_idx%beg + 1)%sf(k, l, q)**2.0_wp)/2._wp
417417

418418
rhs_vf(damage_idx)%sf(k, l, q) = (alpha_bar*max(tau_p - tau_star, 0._wp))**cont_damage_s
419419
end do
@@ -433,18 +433,24 @@ contains
433433
! Invariants of the stress tensor
434434
I1 = tau_xx + tau_yy + tau_zz
435435
I2 = tau_xx*tau_yy + tau_xx*tau_zz + tau_yy*tau_zz - &
436-
(tau_xy**2 + tau_xz**2 + tau_yz**2)
436+
(tau_xy**2.0_wp + tau_xz**2.0_wp + tau_yz**2.0_wp)
437437
I3 = tau_xx*tau_yy*tau_zz + 2.0_wp*tau_xy*tau_xz*tau_yz - &
438-
tau_xx*tau_yz**2 - tau_yy*tau_xz**2 - tau_zz*tau_xy**2
438+
tau_xx*tau_yz**2.0_wp - tau_yy*tau_xz**2.0_wp - tau_zz*tau_xy**2.0_wp
439439

440440
! Maximum principal stress
441-
argument = (2.0_wp*I1**3 - 9.0_wp*I1*I2 + 27.0_wp*I3)/ &
442-
(2.0_wp*sqrt(max((I1**2 - 3.0_wp*I2)**3, 0.0_wp)))
443-
if (argument > 1.0_wp) argument = 1.0_wp
444-
if (argument < -1.0_wp) argument = -1.0_wp
445-
phi = acos(argument)
446-
sqrt_term = sqrt(max(I1**2 - 3.0_wp*I2, 0.0_wp))
447-
tau_p = I1/3.0_wp + 2.0_wp/sqrt(3.0_wp)*sqrt_term*cos(phi/3.0_wp)
441+
temp = I1**2.0_wp - 3.0_wp*I2
442+
sqrt_term_1 = sqrt(max(temp, 0.0_wp))
443+
if (sqrt_term_1 > verysmall) then ! Avoid 0/0
444+
argument = (2.0_wp*I1*I1*I1 - 9.0_wp*I1*I2 + 27.0_wp*I3)/ &
445+
(2.0_wp*sqrt_term_1*sqrt_term_1*sqrt_term_1)
446+
if (argument > 1.0_wp) argument = 1.0_wp
447+
if (argument < -1.0_wp) argument = -1.0_wp
448+
phi = acos(argument)
449+
sqrt_term_2 = sqrt(max(I1**2.0_wp - 3.0_wp*I2, 0.0_wp))
450+
tau_p = I1/3.0_wp + 2.0_wp/sqrt(3.0_wp)*sqrt_term_2*cos(phi/3.0_wp)
451+
else
452+
tau_p = I1/3.0_wp
453+
end if
448454

449455
rhs_vf(damage_idx)%sf(k, l, q) = (alpha_bar*max(tau_p - tau_star, 0._wp))**cont_damage_s
450456
end do

tests/32A3A936/golden-metadata.txt

Lines changed: 74 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)