diff --git a/src/ALE/MOM_regridding.F90 b/src/ALE/MOM_regridding.F90 index 77a2b4ea8b..5b19a7549c 100644 --- a/src/ALE/MOM_regridding.F90 +++ b/src/ALE/MOM_regridding.F90 @@ -880,21 +880,20 @@ subroutine check_remapping_grid( G, GV, h, dzInterface, msg ) !$OMP parallel do default(shared) do j = G%jsc-1,G%jec+1 ; do i = G%isc-1,G%iec+1 - if (G%mask2dT(i,j)>0.) call check_grid_column( GV%ke, GV%Z_to_H*G%bathyT(i,j), h(i,j,:), dzInterface(i,j,:), msg ) + if (G%mask2dT(i,j)>0.) call check_grid_column( GV%ke, h(i,j,:), dzInterface(i,j,:), msg ) enddo ; enddo end subroutine check_remapping_grid !> Check that the total thickness of new and old grids are consistent -subroutine check_grid_column( nk, depth, h, dzInterface, msg ) +subroutine check_grid_column( nk, h, dzInterface, msg ) integer, intent(in) :: nk !< Number of cells - real, intent(in) :: depth !< Depth of bottom [Z ~> m] or arbitrary units real, dimension(nk), intent(in) :: h !< Cell thicknesses [Z ~> m] or arbitrary units real, dimension(nk+1), intent(in) :: dzInterface !< Change in interface positions (same units as h) character(len=*), intent(in) :: msg !< Message to append to errors ! Local variables integer :: k - real :: eps, total_h_old, total_h_new, h_new, z_old, z_new + real :: eps, total_h_old, total_h_new, h_new eps =1. ; eps = epsilon(eps) @@ -904,13 +903,8 @@ subroutine check_grid_column( nk, depth, h, dzInterface, msg ) total_h_old = total_h_old + h(k) enddo - ! Integrate upwards for the interfaces consistent with the rest of MOM6 - z_old = - depth - if (depth == 0.) z_old = - total_h_old total_h_new = 0. do k = nk,1,-1 - z_old = z_old + h(k) ! Old interface position above layer k - z_new = z_old + dzInterface(k) ! New interface position based on dzInterface h_new = h(k) + ( dzInterface(k) - dzInterface(k+1) ) ! New thickness if (h_new<0.) then write(0,*) 'k,h,hnew=',k,h(k),h_new @@ -1082,7 +1076,7 @@ subroutine filtered_grid_motion( CS, nk, z_old, z_new, dz_g ) end subroutine filtered_grid_motion -!> Builds a z*-ccordinate grid with partial steps (Adcroft and Campin, 2004). +!> Builds a z*-coordinate grid with partial steps (Adcroft and Campin, 2004). !! z* is defined as !! z* = (z-eta)/(H+eta)*H s.t. z*=0 when z=eta and z*=-H when z=-H . subroutine build_zstar_grid( CS, G, GV, h, dzInterface, frac_shelf_h) @@ -1118,7 +1112,7 @@ subroutine build_zstar_grid( CS, G, GV, h, dzInterface, frac_shelf_h) cycle endif - ! Local depth (G%bathyT is positive) + ! Local depth (G%bathyT is positive downward) nominalDepth = G%bathyT(i,j)*GV%Z_to_H ! Determine water column thickness @@ -1319,7 +1313,7 @@ subroutine build_rho_grid( G, GV, US, h, tv, dzInterface, remapCS, CS, frac_shel endif - ! Local depth (G%bathyT is positive) + ! Local depth (G%bathyT is positive downward) nominalDepth = G%bathyT(i,j)*GV%Z_to_H ! Determine total water column thickness @@ -1406,7 +1400,7 @@ end subroutine build_rho_grid !! density interpolated from the column profile and a clipping of depth for !! each interface to a fixed z* or p* grid. This should probably be (optionally?) !! changed to find the nearest location of the target density. -!! \remark { Based on Bleck, 2002: An oceanice general circulation model framed in +!! \remark { Based on Bleck, 2002: An ocean-ice general circulation model framed in !! hybrid isopycnic-Cartesian coordinates, Ocean Modelling 37, 55-88. !! http://dx.doi.org/10.1016/S1463-5003(01)00012-9 } subroutine build_grid_HyCOM1( G, GV, US, h, tv, h_new, dzInterface, CS, frac_shelf_h ) @@ -1575,7 +1569,9 @@ subroutine build_grid_SLight(G, GV, US, h, tv, dzInterface, CS) real, dimension(SZK_(GV)+1) :: z_col_new ! Interface positions relative to the surface [H ~> m or kg m-2] real, dimension(SZK_(GV)+1) :: dz_col ! The realized change in z_col [H ~> m or kg m-2] real, dimension(SZK_(GV)) :: p_col ! Layer center pressure [R L2 T-2 ~> Pa] - real :: depth + + ! Local variables + real :: depth ! Depth of the ocean relative to the mean sea surface height in thickness units [H ~> m or kg m-2] integer :: i, j, k, nz real :: h_neglect, h_neglect_edge @@ -1631,8 +1627,8 @@ end subroutine build_grid_SLight subroutine adjust_interface_motion( CS, nk, h_old, dz_int ) type(regridding_CS), intent(in) :: CS !< Regridding control structure integer, intent(in) :: nk !< Number of layers in h_old - real, dimension(nk), intent(in) :: h_old !< Minium allowed thickness of h [H ~> m or kg m-2] - real, dimension(CS%nk+1), intent(inout) :: dz_int !< Minium allowed thickness of h [H ~> m or kg m-2] + real, dimension(nk), intent(in) :: h_old !< Minimum allowed thickness of h [H ~> m or kg m-2] + real, dimension(CS%nk+1), intent(inout) :: dz_int !< Minimum allowed thickness of h [H ~> m or kg m-2] ! Local variables integer :: k real :: h_new, eps, h_total, h_err @@ -1710,8 +1706,8 @@ subroutine build_grid_arbitrary( G, GV, h, dzInterface, h_new, CS ) real :: total_height real :: delta_h real :: max_depth - real :: eta ! local elevation - real :: local_depth + real :: eta ! local elevation [H ~> m or kg m-2] + real :: local_depth ! The local ocean depth relative to mean sea level in thickness units [H ~> m or kg m-2] real :: x1, y1, x2, y2 real :: x, t @@ -1769,7 +1765,7 @@ subroutine build_grid_arbitrary( G, GV, h, dzInterface, h_new, CS ) endif enddo - ! Chnage in interface position + ! Change in interface position x = 0. ! Left boundary at x=0 dzInterface(i,j,1) = 0. do k = 2,nz @@ -1797,7 +1793,7 @@ subroutine inflate_vanished_layers_old( CS, G, GV, h ) ! objective is to make sure all layers are at least as thick as the minimum ! thickness allowed for regridding purposes (this parameter is set in the ! MOM_input file or defaulted to 1.0e-3). When layers are too thin, they -! are inflated up to the minmum thickness. +! are inflated up to the minimum thickness. !------------------------------------------------------------------------------ ! Arguments @@ -1901,7 +1897,7 @@ function uniformResolution(nk,coordMode,maxDepth,rhoLight,rhoHeavy) ! Arguments integer, intent(in) :: nk !< Number of cells in source grid character(len=*), intent(in) :: coordMode !< A string indicating the coordinate mode. - !! See the documenttion for regrid_consts + !! See the documentation for regrid_consts !! for the recognized values. real, intent(in) :: maxDepth !< The range of the grid values in some modes real, intent(in) :: rhoLight !< The minimum value of the grid in RHO mode