diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index f03d875..d0e7d5b 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -4062,7 +4062,7 @@ SUBROUTINE torsion_after_attachments(est, emt) ! the weights at the twisted state: an attachment the twist moved within its radius of the ! surface carries another share of its buoyancy (once more, with the loads of this state) CALL attachment_static_weight(q_static, att_node, ln%att, opts, f_att_now, surface=.TRUE.) - IF (.NOT. has_drag .AND. ALL(f_att_now == f_att)) RETURN + IF (.NOT. has_drag .AND. ALL(f_att_now <= f_att .AND. f_att_now >= f_att)) RETURN IF (MAXVAL(ABS(q_static - q_prev)) <= FIXED_POINT_TOL) RETURN END DO est = CD_DECKDRV_SOLVEFAIL diff --git a/src/CableDyn_HermiteCableDynamic.f90 b/src/CableDyn_HermiteCableDynamic.f90 index 68473b3..58bda2f 100644 --- a/src/CableDyn_HermiteCableDynamic.f90 +++ b/src/CableDyn_HermiteCableDynamic.f90 @@ -12557,7 +12557,7 @@ SUBROUTINE CD_HermiteCable_Drag_Element(qe, ve, l0, fluid, waterline_z, rho, dia END DO ! the immersed fraction moves with the height of the point (in the surface band only): ! d wf/d qe(b) = dwf H(sp) for the vertical DOFs, dwf = d wf/d z - IF (dwf /= CD_ZERO) THEN + IF (.NOT. (ABS(dwf) <= CD_ZERO)) THEN DO sp = 1, 4 b = 3*sp djq(a, b) = djq(a, b) + gw(g)*speed*H(s)*fpl(c)*dwf*H(sp) @@ -12668,7 +12668,7 @@ SUBROUTINE CD_HermiteCable_VIV_Lift_Element(qe, ve, l0, fluid, waterline_z, k_no djq(a, b) = djq(a, b) + gww*H(s)*dH(sp)*(speed*jtan(c, cp) + fpl(c)*tangent(cp)) END DO END DO - IF (dwf /= CD_ZERO) THEN ! the immersed fraction moves with the height of the point + IF (.NOT. (ABS(dwf) <= CD_ZERO)) THEN ! the immersed fraction moves with the height of the point DO sp = 1, 4 b = 3*sp djq(a, b) = djq(a, b) + gw(g)*speed*H(s)*fpl(c)*dwf*H(sp) @@ -12984,7 +12984,7 @@ SUBROUTINE CD_HermiteCable_FK_Element(qe, l0, waterline_z, rho, diam, can, cat, fjq(a, b) = fjq(a, b) + (gw(g)*wf)*H(s)*dH(sp)*jq3(c, cp) END DO END DO - IF (dwf /= CD_ZERO) THEN ! the immersed fraction moves with the height of the point + IF (.NOT. (ABS(dwf) <= CD_ZERO)) THEN ! the immersed fraction moves with the height of the point DO sp = 1, 4 b = 3*sp fjq(a, b) = fjq(a, b) + gw(g)*speed*H(s)*fpl(c)*dwf*H(sp) diff --git a/src/CableDyn_VIV.f90 b/src/CableDyn_VIV.f90 index af7f719..801bd17 100644 --- a/src/CableDyn_VIV.f90 +++ b/src/CableDyn_VIV.f90 @@ -575,7 +575,7 @@ PURE SUBROUTINE CD_VIV_Amplitude_Update(st, yd, dt) IF (.NOT. (dt > CD_ZERO)) RETURN y_old = st(4) p = y_old - IF (.NOT. (p /= CD_ZERO)) p = st(1) + IF (ABS(p) <= CD_ZERO) p = st(1) IF ((p > CD_ZERO .AND. yd < CD_ZERO) .OR. (p < CD_ZERO .AND. yd > CD_ZERO)) THEN ! theta = 0 when the step starts on the sample at zero that ends the half cycle theta = y_old/(y_old - yd) @@ -619,6 +619,7 @@ PURE SUBROUTINE CD_VIV_Check_Amp_Table(amp, amp_n, cl, msg) INTEGER, INTENT(IN) :: amp_n(:) CHARACTER(*), INTENT(OUT) :: msg INTEGER :: e, n, i + REAL(wp) :: prev REAL(wp), PARAMETER :: big = 1.0e15_wp msg = '' IF (SIZE(amp, 1) /= 3 .OR. SIZE(amp, 2) /= CD_VIV_AMP_MAXP .OR. SIZE(amp, 3) /= SIZE(cl) .OR. & @@ -637,18 +638,19 @@ PURE SUBROUTINE CD_VIV_Check_Amp_Table(amp, amp_n, cl, msg) msg = 'a VIV amplitude table needs the cross-flow lift (cl > 0) on its element' RETURN END IF + ! the previous row's A/D; below every valid first row, which the range check holds at >= 0 + prev = -CD_ONE DO i = 1, n IF (.NOT. (amp(1, i, e) >= CD_ZERO .AND. amp(1, i, e) <= big .AND. amp(2, i, e) >= CD_ZERO .AND. & amp(2, i, e) <= big .AND. amp(3, i, e) > CD_ZERO .AND. amp(3, i, e) <= big)) THEN msg = 'VIV amplitude table rows need finite A/D >= 0, C_v >= 0 and drag factor > 0, each at most 1e15' RETURN END IF - IF (i > 1) THEN - IF (.NOT. (amp(1, i, e) > amp(1, i - 1, e))) THEN - msg = 'the A/D of a VIV amplitude table must increase strictly' - RETURN - END IF + IF (.NOT. (amp(1, i, e) > prev)) THEN + msg = 'the A/D of a VIV amplitude table must increase strictly' + RETURN END IF + prev = amp(1, i, e) END DO END DO END SUBROUTINE CD_VIV_Check_Amp_Table diff --git a/tests/test_model.f90 b/tests/test_model.f90 index d805b8f..c1daee6 100644 --- a/tests/test_model.f90 +++ b/tests/test_model.f90 @@ -1742,7 +1742,8 @@ SUBROUTINE case_substeps_restore_viv_state(inline) REAL(wp) :: q0(3*NN), v0(3*NN), f_ext(3*NN), pq(3*NN), pv(3*NN), pa(3*NN), fluid(3, NN), wl(NN) REAL(wp) :: l0(NE), ea(NE), rho_a(NE), cl(NE), dia(NE), cf(NE), df(NE), phi0(NN), w, t, phx0(NN) REAL(wp) :: tab(3, CD_VIV_AMP_MAXP, NE) - INTEGER :: tab_n(NE), ev0 + INTEGER :: tab_n(NE) + INTEGER(KIND(auto_m%sub_stats%events)) :: ev0 LOGICAL :: conv, stalled, all_conv CHARACTER(200) :: em