Skip to content

Commit

Permalink
Merge pull request mom-ocean#17 from gustavo-marques/fix_ssh_slopes
Browse files Browse the repository at this point in the history
Fix ssh slope calculation
  • Loading branch information
alperaltuntas authored Jul 28, 2017
2 parents 17d4586 + c04f081 commit 76565cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions config_src/mct_driver/coupler_indices.F90
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,12 @@ subroutine ocn_export(ind, ocn_public, grid, o2x)
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
n = n+1
! This is a simple second-order difference
! o2x(ind%o2x_So_dhdx, n) = 0.5 * (ssh(i+1,j) + ssh(i-1,j)) * grid%IdxT(i,j) * grid%mask2dT(i,j)
! o2x(ind%o2x_So_dhdx, n) = 0.5 * (ssh(i+1,j) + ssh(i-1,j)) * grid%IdxT(i,j) * grid%mask2dT(i,j)
! This is a PLM slope which might be less prone to the A-grid null mode
slp_L = ssh(i,j) - ssh(i-1,j)
slp_R = ssh(i+1,j) - ssh(i,j)
slp_L = (ssh(i,j) - ssh(i-1,j)) * grid%mask2dCu(I-1,j)
!if (grid%mask2dCu(I-1,j)==0.) slp_L = 0.
slp_R = (ssh(i+1,j) - ssh(i,j)) * grid%mask2dCu(I,j)
!if (grid%mask2dCu(I,j)==0.) slp_R = 0.
slp_C = 0.5 * (slp_L + slp_R)
if ( (slp_L * slp_R) > 0.0 ) then
! This limits the slope so that the edge values are bounded by the
Expand All @@ -270,6 +272,8 @@ subroutine ocn_export(ind, ocn_public, grid, o2x)
! This is a PLM slope which might be less prone to the A-grid null mode
slp_L = ssh(i,j) - ssh(i,j-1)
slp_R = ssh(i,j+1) - ssh(i,j)
slp_L=0.
slp_R=0.
slp_C = 0.5 * (slp_L + slp_R)
if ( (slp_L * slp_R) > 0.0 ) then
! This limits the slope so that the edge values are bounded by the
Expand Down

0 comments on commit 76565cb

Please sign in to comment.