Skip to content

Commit

Permalink
FMA rotation symmetric form of legacy FrictWork_bh
Browse files Browse the repository at this point in the history
This patch updates the expression for FrictWork_bh (biharmonic
frictional work) when the FrictWork_bug flag is enabled.  The new form
is symmetric to rotations when FMA instructions are enabled.
  • Loading branch information
marshallward committed Jan 3, 2025
1 parent 910aa38 commit c346c73
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/parameterizations/lateral/MOM_hor_visc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2011,20 +2011,20 @@ subroutine horizontal_viscosity(u, v, h, uh, vh, diffu, diffv, MEKE, VarMix, G,
! This is the old formulation that includes energy diffusion !cyc
do j=js,je ; do i=is,ie
FrictWork_bh(i,j,k) = GV%H_to_RZ * ( &
(bhstr_xx(i,j) * (u(I,j,k)-u(I-1,j,k))*G%IdxT(i,j) &
- bhstr_xx(i,j) * (v(i,J,k)-v(i,J-1,k))*G%IdyT(i,j)) &
+ 0.25*((bhstr_xy(I,J) * &
((u(I,j+1,k)-u(I,j,k))*G%IdyBu(I,J) &
+ (v(i+1,J,k)-v(i,J,k))*G%IdxBu(I,J)) &
+ bhstr_xy(I-1,J-1) * &
((u(I-1,j,k)-u(I-1,j-1,k))*G%IdyBu(I-1,J-1) &
+ (v(i,J-1,k)-v(i-1,J-1,k))*G%IdxBu(I-1,J-1)) ) &
+ (bhstr_xy(I-1,J) * &
((u(I-1,j+1,k)-u(I-1,j,k))*G%IdyBu(I-1,J) &
+ (v(i,J,k)-v(i-1,J,k))*G%IdxBu(I-1,J)) &
+ bhstr_xy(I,J-1) * &
((u(I,j,k)-u(I,j-1,k))*G%IdyBu(I,J-1) &
+ (v(i+1,J-1,k)-v(i,J-1,k))*G%IdxBu(I,J-1)) ) ) )
((bhstr_xx(i,j) * (u(I,j,k)-u(I-1,j,k))*G%IdxT(i,j)) &
- (bhstr_xx(i,j) * (v(i,J,k)-v(i,J-1,k))*G%IdyT(i,j))) &
+ 0.25*(( (bhstr_xy(I,J) * &
(((u(I,j+1,k)-u(I,j,k))*G%IdyBu(I,J)) &
+ ((v(i+1,J,k)-v(i,J,k))*G%IdxBu(I,J)))) &
+ (bhstr_xy(I-1,J-1) * &
(((u(I-1,j,k)-u(I-1,j-1,k))*G%IdyBu(I-1,J-1)) &
+ ((v(i,J-1,k)-v(i-1,J-1,k))*G%IdxBu(I-1,J-1)))) ) &
+ ( (bhstr_xy(I-1,J) * &
(((u(I-1,j+1,k)-u(I-1,j,k))*G%IdyBu(I-1,J)) &
+ ((v(i,J,k)-v(i-1,J,k))*G%IdxBu(I-1,J)))) &
+ (bhstr_xy(I,J-1) * &
(((u(I,j,k)-u(I,j-1,k))*G%IdyBu(I,J-1)) &
+ ((v(i+1,J-1,k)-v(i,J-1,k))*G%IdxBu(I,J-1)))) ) ) )
enddo ; enddo
else
do j=js,je ; do i=is,ie
Expand Down

0 comments on commit c346c73

Please sign in to comment.