Skip to content

Commit

Permalink
Merge branch 'NOAA-GFDL:dev/gfdl' into dev/cefi
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengt900 authored Dec 31, 2024
2 parents efd1e5c + 9564493 commit 9f3b445
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
10 changes: 7 additions & 3 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,11 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
do j=js,je ; do i=is,ie
CS%ssh_rint(i,j) = CS%ssh_rint(i,j) + dt*ssh(i,j)
enddo ; enddo
if (CS%IDs%id_ssh_inst > 0) call post_data(CS%IDs%id_ssh_inst, ssh, CS%diag)
if (CS%IDs%id_ssh_inst > 0) then
call enable_averages(dt, Time_local, CS%diag)
call post_data(CS%IDs%id_ssh_inst, ssh, CS%diag)
call disable_averaging(CS%diag)
endif
call cpu_clock_end(id_clock_dynamics)
endif

Expand Down Expand Up @@ -4014,7 +4018,7 @@ subroutine extract_surface_state(CS, sfc_state_in)
numberOfErrors=0 ! count number of errors
do j=js,je ; do i=is,ie
if (G%mask2dT(i,j)>0.) then
localError = sfc_state%sea_lev(i,j) <= -G%bathyT(i,j) - G%Z_ref &
localError = sfc_state%sea_lev(i,j) < -G%bathyT(i,j) - G%Z_ref &
.or. sfc_state%sea_lev(i,j) >= CS%bad_val_ssh_max &
.or. sfc_state%sea_lev(i,j) <= -CS%bad_val_ssh_max &
.or. sfc_state%sea_lev(i,j) + G%bathyT(i,j) + G%Z_ref < CS%bad_val_col_thick
Expand All @@ -4041,7 +4045,7 @@ subroutine extract_surface_state(CS, sfc_state_in)
write(msg(1:240),'(2(a,i4,1x),4(a,f8.3,1x),6(a,es11.4))') &
'Extreme surface sfc_state detected: i=',ig,'j=',jg, &
'lon=',G%geoLonT(i,j), 'lat=',G%geoLatT(i,j), &
'x=',G%gridLonT(i), 'y=',G%gridLatT(j), &
'x=',G%gridLonT(ig), 'y=',G%gridLatT(jg), &
'D=',US%Z_to_m*(G%bathyT(i,j)+G%Z_ref), 'SSH=',US%Z_to_m*sfc_state%sea_lev(i,j), &
'U-=',US%L_T_to_m_s*sfc_state%u(I-1,j), 'U+=',US%L_T_to_m_s*sfc_state%u(I,j), &
'V-=',US%L_T_to_m_s*sfc_state%v(i,J-1), 'V+=',US%L_T_to_m_s*sfc_state%v(i,J)
Expand Down
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 9f3b445

Please sign in to comment.