Skip to content

Commit

Permalink
Do m_to_H conversion within ALE regridding. ALE_main() now handles
Browse files Browse the repository at this point in the history
arbitrary H units - no need to convert to m before calling it. mom-ocean#189
  • Loading branch information
nichannah committed Jul 22, 2015
1 parent f3ff324 commit 0ea5e71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ subroutine buildGridZstar( CS, G, h, dzInterface )
endif

! Local depth (G%bathyT is positive)
nominalDepth = G%bathyT(i,j)
nominalDepth = G%bathyT(i,j)*G%m_to_H

! Determine water column thickness
totalThickness = 0.0
Expand Down Expand Up @@ -519,7 +519,7 @@ subroutine buildGridSigma( CS, G, h, dzInterface )
end do

! The rest of the model defines grids integrating up from the bottom
nominalDepth = G%bathyT(i,j)
nominalDepth = G%bathyT(i,j)*G%m_to_H
zOld(nz+1) = - nominalDepth
zNew(nz+1) = - nominalDepth
do k = nz,1,-1
Expand Down Expand Up @@ -730,7 +730,7 @@ subroutine buildGridRho( G, h, tv, dzInterface, remapCS, CS )
end do ! end regridding iterations

! Local depth (G%bathyT is positive)
nominalDepth = G%bathyT(i,j)
nominalDepth = G%bathyT(i,j)*G%m_to_H

! The rest of the model defines grids integrating up from the bottom
totalThickness = 0.0
Expand Down Expand Up @@ -828,7 +828,7 @@ subroutine build_grid_arbitrary( G, h, dzInterface, h_new, CS )
do i = G%isc-1,G%iec+1

! Local depth
local_depth = G%bathyT(i,j)
local_depth = G%bathyT(i,j)*G%m_to_H

! Determine water column height
total_height = 0.0
Expand Down
13 changes: 0 additions & 13 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -958,10 +958,7 @@ subroutine step_MOM(fluxes, state, Time_start, time_interval, CS)
call check_redundant("Pre-ALE 1 ", u, v, G)
endif
call cpu_clock_begin(id_clock_ALE)
! Switch thickness units from H to m for remapping
h(:,:,:) = h(:,:,:)*G%H_to_m
call ALE_main(G, h, u, v, CS%tv, CS%ALE_CSp)
h(:,:,:) = h(:,:,:)*G%m_to_H
call cpu_clock_end(id_clock_ALE)
if (CS%debug) then
call MOM_state_chksum("Post-ALE 1 ", u, v, h, CS%uh, CS%vh, G)
Expand Down Expand Up @@ -1260,10 +1257,7 @@ subroutine step_MOM(fluxes, state, Time_start, time_interval, CS)
call check_redundant("Pre-ALE ", u, v, G)
endif
call cpu_clock_begin(id_clock_ALE)
! Switch thickness units from H to m for remapping
h(:,:,:) = h(:,:,:)*G%H_to_m
call ALE_main(G, h, u, v, CS%tv, CS%ALE_CSp)
h(:,:,:) = h(:,:,:)*G%m_to_H
call cpu_clock_end(id_clock_ALE)
if (CS%debug) then
call MOM_state_chksum("Post-ALE ", u, v, h, CS%uh, CS%vh, G)
Expand Down Expand Up @@ -1996,18 +1990,11 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in)
call vchksum(CS%v,"Pre initialize_ALE v", G, haloshift=1)
call hchksum(CS%h*G%H_to_m,"Pre initialize_ALE h", G, haloshift=1)
endif
! Switch thickness units from H to m for regridding
CS%h(:,:,:) = CS%h(:,:,:)*G%H_to_m

if (.not. query_initialized(CS%h,"h",CS%restart_CSp)) then
! This is a not a restart so we do the following...
call adjustGridForIntegrity(CS%ALE_CSp, G, CS%h )
call ALE_main( G, CS%h, CS%u, CS%v, CS%tv, CS%ALE_CSp )
endif

! Switch thickness units back to H
CS%h(:,:,:) = CS%h(:,:,:)*G%m_to_H

call ALE_updateVerticalGridType( CS%ALE_CSp, G%GV )
if (CS%debug) then
call uchksum(CS%u,"Post initialize_ALE u", G, haloshift=1)
Expand Down

0 comments on commit 0ea5e71

Please sign in to comment.