Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into modify_opt_arg
Browse files Browse the repository at this point in the history
  • Loading branch information
adcroft authored Jun 30, 2021
2 parents 5da1b8f + 52fe576 commit 3c59a07
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
12 changes: 9 additions & 3 deletions src/initialization/MOM_grid_initialize.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module MOM_grid_initialize
use MOM_domains, only : To_North, To_South, To_East, To_West
use MOM_domains, only : MOM_domain_type, clone_MOM_domain, deallocate_MOM_domain
use MOM_dyn_horgrid, only : dyn_horgrid_type, set_derived_dyn_horgrid
use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, is_root_pe
use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING, is_root_pe
use MOM_error_handler, only : callTree_enter, callTree_leave
use MOM_file_parser, only : get_param, log_param, log_version, param_file_type
use MOM_io, only : MOM_read_data, slasher, file_exists, stdout
Expand Down Expand Up @@ -1217,11 +1217,17 @@ subroutine initialize_masks(G, PF, US)
units="m", default=0.0, scale=m_to_Z_scale)
call get_param(PF, mdl, "MASKING_DEPTH", mask_depth, &
"The depth below which to mask points as land points, for which all "//&
"fluxes are zeroed out. MASKING_DEPTH is ignored if negative.", &
"fluxes are zeroed out. MASKING_DEPTH needs to be smaller than MINIMUM_DEPTH", &
units="m", default=-9999.0, scale=m_to_Z_scale)

if (mask_depth > min_depth) then
mask_depth = -9999.0*m_to_Z_scale
call MOM_error(WARNING, "MOM_grid_init: initialize_masks "//&
'MASKING_DEPTH is larger than MINIMUM_DEPTH and therefore ignored.')
endif

Dmin = min_depth
if (mask_depth>=0.) Dmin = mask_depth
if (mask_depth /= -9999.*m_to_Z_scale) Dmin = mask_depth

G%mask2dCu(:,:) = 0.0 ; G%mask2dCv(:,:) = 0.0 ; G%mask2dBu(:,:) = 0.0

Expand Down
26 changes: 18 additions & 8 deletions src/initialization/MOM_shared_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -413,17 +413,27 @@ subroutine limit_topography(D, G, param_file, max_depth, US)
"The depth below which to mask the ocean as land.", &
units="m", default=-9999.0, scale=m_to_Z, do_not_log=.true.)

! Make sure that min_depth < D(x,y) < max_depth
if (mask_depth < -9990.*m_to_Z) then
do j=G%jsd,G%jed ; do i=G%isd,G%ied
D(i,j) = min( max( D(i,j), 0.5*min_depth ), max_depth )
enddo ; enddo
if (mask_depth > min_depth) then
mask_depth = -9999.0*m_to_Z
call MOM_error(WARNING, "MOM_shared_initialization: limit_topography "//&
'MASKING_DEPTH is larger than MINIMUM_DEPTH and therefore ignored.')
endif

! Make sure that min_depth < D(x,y) < max_depth for ocean points
if (mask_depth == -9999.*m_to_Z) then
if (min_depth > 0.0) then ! This is retained to avoid answer changes (over the land points) in the test cases.
do j=G%jsd,G%jed ; do i=G%isd,G%ied
D(i,j) = min( max( D(i,j), 0.5*min_depth ), max_depth )
enddo ; enddo
else
do j=G%jsd,G%jed ; do i=G%isd,G%ied
D(i,j) = min( max( D(i,j), min_depth ), max_depth )
enddo ; enddo
endif
else
do j=G%jsd,G%jed ; do i=G%isd,G%ied
if (D(i,j)>0.) then
if (D(i,j) > mask_depth) then
D(i,j) = min( max( D(i,j), min_depth ), max_depth )
else
D(i,j) = 0.
endif
enddo ; enddo
endif
Expand Down

0 comments on commit 3c59a07

Please sign in to comment.