Skip to content

Commit

Permalink
(*)Add parentheses in end_value_h4 for FMAs
Browse files Browse the repository at this point in the history
  Added parentheses to prevent FMAs in 4 expressions in end_value_h4 that rely
on exact vertical symmetry in order to get the cancellations that are necessary
to pass the vertical remapping unit testing.  Before this change, the MOM6
unit-testing was failing when FMAs are enabled, but with it the unit-testing is
passing even when FMAs are enabled.  All answers are bitwise identical in cases
without FMAs, but answers could change with FMAs.
  • Loading branch information
Hallberg-NOAA committed Aug 2, 2024
1 parent ffa766b commit fd82861
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ALE/regrid_edge_values.F90
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,10 @@ subroutine end_value_h4(dz, u, Csys)
Wt(2,4) = -4.0 * I_h1234 * (I_h23 * (I_h123 + I_h234)) ! Wt*h1^3 > -4* (h1/h23)*(1+h1/h234)
Wt(3,4) = 4.0 * I_denom ! = 4.0*I_h1234 * I_h234 * I_h34 ! Wt*h1^3 < 4 * (h1/h234)*(h1/h34)

Csys(1) = ((u(1) + Wt(1,1) * (u(2)-u(1))) + Wt(2,1) * (u(3)-u(2))) + Wt(3,1) * (u(4)-u(3))
Csys(2) = (Wt(1,2) * (u(2)-u(1)) + Wt(2,2) * (u(3)-u(2))) + Wt(3,2) * (u(4)-u(3))
Csys(3) = (Wt(1,3) * (u(2)-u(1)) + Wt(2,3) * (u(3)-u(2))) + Wt(3,3) * (u(4)-u(3))
Csys(4) = (Wt(1,4) * (u(2)-u(1)) + Wt(2,4) * (u(3)-u(2))) + Wt(3,4) * (u(4)-u(3))
Csys(1) = ((u(1) + (Wt(1,1) * (u(2)-u(1)))) + (Wt(2,1) * (u(3)-u(2)))) + (Wt(3,1) * (u(4)-u(3)))
Csys(2) = ((Wt(1,2) * (u(2)-u(1))) + (Wt(2,2) * (u(3)-u(2)))) + (Wt(3,2) * (u(4)-u(3)))
Csys(3) = ((Wt(1,3) * (u(2)-u(1))) + (Wt(2,3) * (u(3)-u(2)))) + (Wt(3,3) * (u(4)-u(3)))
Csys(4) = ((Wt(1,4) * (u(2)-u(1))) + (Wt(2,4) * (u(3)-u(2)))) + (Wt(3,4) * (u(4)-u(3)))

! endif ! End of non-uniform layer thickness branch.

Expand Down

0 comments on commit fd82861

Please sign in to comment.