-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix: a couple of mask_depth related issues #1457
Changes from all commits
34b18df
1ce6fe1
1acc70e
20d91da
a77817d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,8 +195,8 @@ subroutine apply_topography_edits_from_file(D, G, param_file, US) | |
character(len=200) :: topo_edits_file, inputdir ! Strings for file/path | ||
character(len=40) :: mdl = "apply_topography_edits_from_file" ! This subroutine's name. | ||
integer :: i, j, n, ncid, n_edits, i_file, j_file, ndims, sizes(8) | ||
logical :: found | ||
logical :: topo_edits_change_mask | ||
real :: min_depth, mask_depth | ||
|
||
call callTree_enter(trim(mdl)//"(), MOM_shared_initialization.F90") | ||
|
||
|
@@ -210,6 +210,17 @@ subroutine apply_topography_edits_from_file(D, G, param_file, US) | |
call get_param(param_file, mdl, "ALLOW_LANDMASK_CHANGES", topo_edits_change_mask, & | ||
"If true, allow topography overrides to change land mask.", & | ||
default=.false.) | ||
call get_param(param_file, mdl, "MINIMUM_DEPTH", min_depth, & | ||
"If MASKING_DEPTH is unspecified, then anything shallower than "//& | ||
"MINIMUM_DEPTH is assumed to be land and all fluxes are masked out. "//& | ||
"If MASKING_DEPTH is specified, then all depths shallower than "//& | ||
"MINIMUM_DEPTH but deeper than MASKING_DEPTH are rounded to MINIMUM_DEPTH.", & | ||
units="m", default=0.0, scale=m_to_Z) | ||
call get_param(param_file, mdl, "MASKING_DEPTH", mask_depth, & | ||
"The depth below which to mask points as land points, for which all "//& | ||
"fluxes are zeroed out. MASKING_DEPTH needs to be smaller than MINIMUM_DEPTH", & | ||
units="m", default=-9999.0, scale=m_to_Z) | ||
if (mask_depth == -9999.*m_to_Z) mask_depth = min_depth | ||
|
||
if (len_trim(topo_edits_file)==0) return | ||
|
||
|
@@ -249,7 +260,7 @@ subroutine apply_topography_edits_from_file(D, G, param_file, US) | |
i = ig(n) - G%isd_global + 2 ! +1 for python indexing and +1 for ig-isd_global+1 | ||
j = jg(n) - G%jsd_global + 2 | ||
if (i>=G%isc .and. i<=G%iec .and. j>=G%jsc .and. j<=G%jec) then | ||
if (new_depth(n)/=0.) then | ||
if (new_depth(n)*m_to_Z /= mask_depth) then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this isn't affecting my current test, I'm wondering if this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just realized that this comment (along with a few others) was not submitted successfully yesterday. I guess we can gain more flexibility with (new_depth(n)*m_to_Z > mask_depth)? So that if one does decide to modify masks with topo_edit_file, they can use any large negative values, which makes the file universal across runs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It turns out there are zeroes in one of our edit files, which is why there's the ALLOW_LANDMASK_CHANGES parameter. I'll look it that later. |
||
write(stdout,'(a,3i5,f8.2,a,f8.2,2i4)') & | ||
'Ocean topography edit: ', n, ig(n), jg(n), D(i,j)/m_to_Z, '->', abs(new_depth(n)), i, j | ||
D(i,j) = abs(m_to_Z*new_depth(n)) ! Allows for height-file edits (i.e. converts negatives) | ||
|
@@ -434,6 +445,10 @@ subroutine limit_topography(D, G, param_file, max_depth, US) | |
do j=G%jsd,G%jed ; do i=G%isd,G%ied | ||
if (D(i,j) > mask_depth) then | ||
D(i,j) = min( max( D(i,j), min_depth ), max_depth ) | ||
else | ||
! This statement is required for cases with masked-out PEs over the land, | ||
! to remove the large initialized values (-9e30) from the halos. | ||
D(i,j) = mask_depth | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @herrwang0 This seems to be the remaining source of answer changes. If MASKING_DEPTH is non-zero, this changes answers (determined by commenting it out). |
||
endif | ||
enddo ; enddo | ||
endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops - this documentation string is different from elsewhere.