Skip to content
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

Smooth topography before interp to MPAS #489

Closed

Conversation

xylar
Copy link
Collaborator

@xylar xylar commented Mar 24, 2020

This merge adds a python script for iteratively smoothing topograpthy (from for now, the dataset combining BedMachine and GEBCO) proportional to the resolution of the MPAS mesh, as determined in the base_mesh step.

Local weights for the iterative smoothing are determined based on the resolution of the lon/lat grid, the MPAS mesh resolution, the number of iterations of smoothing and a constant multiplicative factor smoothing that can be increased or decreased to provide more or less smoothing overall. The default value, smoothing = 1.0, smooths the topography by one MPAS cell width.

Increasing the number of iterations will typically not increase the amount of smoothing, since less smoothing is performed at each iteration. The exception is that the maximum amount of smoothing is an unweighted nearest-neighbor averaging at each iteration. If a region (commonly the poles) is so stretched on the lon/lat grid that an MPAS cell covers more grid cells than the number of smoothing iterations, it is not possible to smooth over the full width of an MPAS grid cell. In practice, this is not likely to be an important issue.

The cost of this approach is significant, taking several minutes even for coarse MPAS meshes (it is performed on the topographic grid, so is largely agnostic to the MPAS resolution). We may
need to make the QU240wISC test case a special case where we either skip this process or simplify it in some way to reduce runtime of regression testing.

Currently, the approach is only being used for test cases with ice-shelf cavities (the same ones using BedMachine/GEBCO bathymetry). It could be expanded to other test cases if it proves useful.

This merge adds a python script for iteratively smoothing
topograpthy (from for now, the dataset combining BedMachine and GEBCO)
proportional to the resolution of the MPAS mesh, as determined in
the base_mesh step.

Local weights for the iterative smoothing are determined based on
the resolution of the lon/lat grid, the MPAS mesh resolution, the
number of iterations of smoothing and a constant multiplicative
factor `smoothing` that can be increased or decreased to provide
more or less smoothing overall.  The default value,
`smoothing = 1.0`, smooths the topography by one MPAS cell width.

Increasing the number of iterations will typically not increase
the amount of smoothing, since less smoothing is performed at each
iteration.  The exception is that the maximum amount of smoothing
is an unweighted nearest-neighbor averaging at each iteration.  If
a region (commonly the poles) is so stretched on the lon/lat grid
that an MPAS cell covers more grid cells than the number of
smoothing iterations, it is not possible to smooth over the full
width of an MPAS grid cell.  In practice, this is not likely to
be an important issue.

The cost of this approach is significant, taking several minutes
even for coarse MPAS meshes (it is performed on the topographic
grid, so is largely agnostic to the MPAS resolution).  We may
need to make the QU240wISC test case a special case where we
either skip this process or simplify it in some way to reduce
runtime of regression testing.

Currently, the approach is only being used for test cases with
ice-shelf cavities (the same ones using BedMachine/GEBCO
bathymetry).  It could be expanded to other test cases if it
proves useful.
@xylar
Copy link
Collaborator Author

xylar commented Mar 24, 2020

@mark-petersen, this is the work I mentioned today where I would smooth bathymetry before resampling to the MPAS mesh rather than after. It seems to be working well so far.

I'm putting this here as a placeholder for now, not because it's ready to review or merge.

@jonbob, I might get your help doing another round of E3SM testing with a new EC60to30wISC mesh once we're a little further along (e.g. we have 64 layers as an option).

@xylar
Copy link
Collaborator Author

xylar commented Mar 24, 2020

To determine the relationship between nearest-neighbor weights, number of iterations and the width (in grid cells on a regular, logically rectangular grid) of the resulting smoothing, I used this script:
https://gist.github.com/xylar/ffe3317daa4203b7fe58397381969770
The finding was that interpolation weights can be determined from the width over which to smooth and the number of iterations by

A = 2.65
p_iter = 0.5
p_width = 2.25
weight = (width/(A*iterations**p_iter))**p_width

This formula is used in the script smooth_topo.py in COMPASS.

<step executable="./smooth_topo.py">
<argument flag="--iter">100</argument>
<argument flag="--smoothing">1.0</argument>
<argument flag="--mpi_tasks">4</argument>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's annoying that the number of MPI tasks is repeatedly hard coded and not part of the config file or some kind of machine config file. We need to think if there's a better way to do this. This is just one example of where the problem arises.

@xylar
Copy link
Collaborator Author

xylar commented Mar 25, 2020

@prajvala01123, take a look at this when you get a chance. It's probably not the easiest entry point for learning about setting up a new test case for MPAS-Ocean in E3SM, but it will eventually be helpful if you are interested in playing with bathymetric smoothing.

@xylar
Copy link
Collaborator Author

xylar commented Apr 10, 2020

Needs to be rebased once the next set of COMPASS merges have happened.

@xylar
Copy link
Collaborator Author

xylar commented Nov 6, 2020

This branch has been moved here: https://github.com/xylar/compass/tree/add_better_topo_smoothing

A PR will be made to https://github.com/MPAS-Dev/compass when the time is right.

@xylar xylar closed this Nov 6, 2020
@xylar xylar deleted the add_compass_better_topo_smoothing branch November 6, 2020 12:26
@xylar xylar restored the add_compass_better_topo_smoothing branch February 8, 2021 18:37
@xylar xylar deleted the add_compass_better_topo_smoothing branch February 8, 2021 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants