Eloisa's block-averaged topography and some minor fixes#25
Merged
domingom merged 6 commits intodomingom:feature/icbcs_fe2fefrom Apr 15, 2026
Merged
Eloisa's block-averaged topography and some minor fixes#25domingom merged 6 commits intodomingom:feature/icbcs_fe2fefrom
domingom merged 6 commits intodomingom:feature/icbcs_fe2fefrom
Conversation
domingom
reviewed
Apr 15, 2026
| if (topo_average_opt==0): | ||
| data_topo0 = topo[y_s:y_e:npy_inc,x_s:x_e:npx_inc] | ||
| else: | ||
| data_topo0 = block_reduce(topo[y_s:y_e,x_s:x_e], block_size=(int(d_eta/dy_inter),int(d_xi/dx_inter)), func=np.mean) |
Owner
There was a problem hiding this comment.
Change 'func=np.mean' by 'func=np.median'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new option for block-averaged topography and fixes some small issues related to interpolation in SimGrid.py.
Main changes
1. Fix for interpolation domain when interp_flag = 1
The computation of
x_eandy_ehas been corrected for non-integer resolution ratios (d_xi/dx_inter). Previously, the selected source subdomain could be too small when interpolation was used, leading to insufficient spatial coverage and edge artifacts in the interpolated fields.2. Fix in building mask interpolation
When
interp_flag == 1, the interpolator was using an undefined variable (data_bmask). This has been corrected to use the appropriate source field (bdg_heights).3. New option: block-averaged topography
This new option has been added via
simgrid.json("topo_average_opt": 1, with"topo_average_opt": 0by default). When enabled, topography is computed using an area-weighted block average instead of decimation or interpolation. This helps mitigate potential aliasing in terrain data. Forinterp_flag == 0, usesblock_reducewith mean. Forinterp_flag == 1, uses the functionblock_average_topo(introduced in couplingUtils.py) based on cell overlap.Testing
The changes have been tested with the four possible combinations: