Skip to content

Commit

Permalink
Update MOM_wave_interface.F90 (#784)
Browse files Browse the repository at this point in the history
* Update MOM_wave_interface.F90

The index at the interface has been changed from I-1 ->i+1 and J-1 -> j+1, which helps fixed model error in 3D simulations while keeping halo_size to 1.

* Update MOM_wave_interface.F90

Corrected the index for thickness which fixed the issue of 3D wave coupled simulations while keeping the halo_size in thickness as 1
  • Loading branch information
Zeracesharon authored Dec 30, 2024
1 parent 9371bb0 commit 9564493
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/user/MOM_wave_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,8 @@ subroutine Update_Stokes_Drift(G, GV, US, CS, dz, ustar, dt, dynamics_step)
MidPoint = 0.0
do k = 1,GV%ke
Top = Bottom
MidPoint = Bottom - 0.25*(dz(I,j,k)+dz(I-1,j,k))
Bottom = Bottom - 0.5*(dz(I,j,k)+dz(I-1,j,k))
MidPoint = Bottom - 0.25*(dz(i,j,k)+dz(i+1,j,k))
Bottom = Bottom - 0.5*(dz(i,j,k)+dz(i+1,j,k))
CS%Us_x(I,j,k) = CS%TP_STKX0*exp(MidPoint*DecayScale)
enddo
enddo
Expand All @@ -810,8 +810,8 @@ subroutine Update_Stokes_Drift(G, GV, US, CS, dz, ustar, dt, dynamics_step)
MidPoint = 0.0
do k = 1,GV%ke
Top = Bottom
MidPoint = Bottom - 0.25*(dz(i,J,k)+dz(i,J-1,k))
Bottom = Bottom - 0.5*(dz(i,J,k)+dz(i,J-1,k))
MidPoint = Bottom - 0.25*(dz(i,j,k)+dz(i,j+1,k))
Bottom = Bottom - 0.5*(dz(i,j,k)+dz(i,j+1,k))
CS%Us_y(i,J,k) = CS%TP_STKY0*exp(MidPoint*DecayScale)
enddo
enddo
Expand All @@ -837,7 +837,7 @@ subroutine Update_Stokes_Drift(G, GV, US, CS, dz, ustar, dt, dynamics_step)
bottom = 0.0
do k = 1,GV%ke
Top = Bottom
level_thick = 0.5*(dz(I,j,k)+dz(I-1,j,k))
level_thick = 0.5*(dz(i,j,k)+dz(i+1,j,k))
MidPoint = Top - 0.5*level_thick
Bottom = Top - level_thick

Expand Down Expand Up @@ -894,7 +894,7 @@ subroutine Update_Stokes_Drift(G, GV, US, CS, dz, ustar, dt, dynamics_step)
bottom = 0.0
do k = 1,GV%ke
Top = Bottom
level_thick = 0.5*(dz(i,J,k)+dz(i,J-1,k))
level_thick = 0.5*(dz(i,j,k)+dz(i,j+1,k))
MidPoint = Top - 0.5*level_thick
Bottom = Top - level_thick

Expand Down Expand Up @@ -947,8 +947,8 @@ subroutine Update_Stokes_Drift(G, GV, US, CS, dz, ustar, dt, dynamics_step)
bottom = 0.0
do k = 1,GV%ke
Top = Bottom
MidPoint = Top - 0.25*(dz(I,j,k)+dz(I-1,j,k))
Bottom = Top - 0.5*(dz(I,j,k)+dz(I-1,j,k))
MidPoint = Top - 0.25*(dz(i,j,k)+dz(i+1,j,k))
Bottom = Top - 0.5*(dz(i,j,k)+dz(i+1,j,k))
!bgr note that this is using a u-point I on h-point ustar
! this code has only been previous used for uniform
! grid cases. This needs fixed if DHH85 is used for non
Expand All @@ -964,8 +964,8 @@ subroutine Update_Stokes_Drift(G, GV, US, CS, dz, ustar, dt, dynamics_step)
Bottom = 0.0
do k = 1,GV%ke
Top = Bottom
MidPoint = Bottom - 0.25*(dz(i,J,k)+dz(i,J-1,k))
Bottom = Bottom - 0.5*(dz(i,J,k)+dz(i,J-1,k))
MidPoint = Bottom - 0.25*(dz(i,j,k)+dz(i,j+1,k))
Bottom = Bottom - 0.5*(dz(i,j,k)+dz(i,j+1,k))
!bgr note that this is using a v-point J on h-point ustar
! this code has only been previous used for uniform
! grid cases. This needs fixed if DHH85 is used for non
Expand Down Expand Up @@ -1688,8 +1688,8 @@ subroutine CoriolisStokes(G, GV, dt, h, u, v, Waves)
do k = 1, GV%ke
do j = G%jsc, G%jec
do I = G%iscB, G%iecB
DVel = 0.25*((Waves%us_y(i,J+1,k)+Waves%us_y(i-1,J+1,k)) * G%CoriolisBu(I,J+1)) + &
0.25*((Waves%us_y(i,J,k)+Waves%us_y(i-1,J,k)) * G%CoriolisBu(I,J))
DVel = 0.25*((Waves%us_y(i,J-1,k)+Waves%us_y(i+1,J-1,k)) * G%CoriolisBu(I,J-1)) + &
0.25*((Waves%us_y(i,J,k)+Waves%us_y(i+1,J,k)) * G%CoriolisBu(I,J))
u(I,j,k) = u(I,j,k) + DVEL*dt
enddo
enddo
Expand All @@ -1698,8 +1698,8 @@ subroutine CoriolisStokes(G, GV, dt, h, u, v, Waves)
do k = 1, GV%ke
do J = G%jscB, G%jecB
do i = G%isc, G%iec
DVel = 0.25*((Waves%us_x(I+1,j,k)+Waves%us_x(I+1,j-1,k)) * G%CoriolisBu(I+1,J)) + &
0.25*((Waves%us_x(I,j,k)+Waves%us_x(I,j-1,k)) * G%CoriolisBu(I,J))
DVel = 0.25*((Waves%us_x(I-1,j,k)+Waves%us_x(I-1,j+1,k)) * G%CoriolisBu(I-1,j)) + &
0.25*((Waves%us_x(I,j,k)+Waves%us_x(I,j+1,k)) * G%CoriolisBu(I,J))
v(i,J,k) = v(i,j,k) - DVEL*dt
enddo
enddo
Expand Down

0 comments on commit 9564493

Please sign in to comment.