-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add a regional sea-level projection capability to MALI #21
Conversation
@hollyhan , thanks for opening this PR! Can you update the PR title to something more descriptive, and expand the description to be more detailed? For a major new functionality like this PR, we want the PR description to first give a summary of the overall capability, then describe the implementation, which subroutine were modified or added, and any important algorithmic details (e.g. copying the remapping and gather/scatter code from the ocean SAL PR - you can include a link to that PR). I'll work on a more detailed line by line review starting today, but I thought I would mention that before I got started. |
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.
@hollyhan , overall this PR looks great and represents a lot of work! I made a lot of comments, but they are all little things - many of which I should have instructed you in before you started working. :) A few of the items might require some discussion, but most should be self explanatory. After the initial clean up pass, I'll take a closer look at a few details and might have more changes to request.
The procedure for making changes is to add new commits that fix the various issues. For the formatting and little changes, feel free to put many or all of the changes into a single commit. For more significant changes, keep them in a separate commit. After you've taken care of everything you can, push your updated branch to Github, and the PR will update automatically with your revisions. When you are ready for me to take another look, request another review.
.gitmodules
Outdated
@@ -55,3 +55,6 @@ | |||
[submodule "externals/mct"] | |||
path = externals/mct | |||
url = [email protected]:MCSclimate/MCT.git | |||
[submodule "components/mpas-albany-landice/src/SeaLevelModel"] | |||
path = components/mpas-albany-landice/src/SeaLevelModel | |||
url = [email protected]:hollyhan/SeaLevelModel.git |
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.
We'll need to update this to the project's public fork before we can merge.
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
This commit resolves reveiew comments for PR #21 ('Add a regional sea-level projection capability to MALI') - Set up MPI variables outside of routine 'interpolation_init'. - Move reformatting command of 1D SL array to 2D array inside of routine 'interpolation' - Include #ifdef USE_SEALEVELMODEL inside of the check for config_uplift_method - other small fixes
Thank you for the very insightful comments, @matthewhoffman ! I have resolved most of the comments and updated the PR. |
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.
@hollyhan , thanks for all your hard work on revising this PR last week! It is much easier to read and things look a lot more mature. After a second reading, I've found a smaller number of additional changes. I think with another round or two we will be close to done!
@@ -383,7 +390,6 @@ function li_core_run(domain) result(err) | |||
|
|||
integer :: err, err_tmp, err_tmp2, globalErr | |||
|
|||
|
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.
I'm seeing a number of whitespace deletions in this file that are not related to any code changes. It's best to remove those if possible. I can show you how to see where they are showing up.
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.
I'm still seeing about dozen whitespace changes in this file. You might need to go to https://github.com/MALI-Dev/E3SM/pull/21/files to see what I mean.
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
Thank you so much for the second round of review, @matthewhoffman! |
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.
@hollyhan , this is looking really good! There are just a handful of small things in this round. The one bigger thing is I realized we should add a finalize routine that deallocates all the allocatable arrays. Let me know if you info on the details of how to do that. Otherwise, I think we are very close being done! We'll need to have another discussion about the SLM repo and make sure all the details about that are sorted out before we can merge.
@@ -383,7 +390,6 @@ function li_core_run(domain) result(err) | |||
|
|||
integer :: err, err_tmp, err_tmp2, globalErr | |||
|
|||
|
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.
I'm still seeing about dozen whitespace changes in this file. You might need to go to https://github.com/MALI-Dev/E3SM/pull/21/files to see what I mean.
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
Thanks for the another round of review, @matthewhoffman! Most of the suggestions were easy to address. One thing I would need to discuss in more detail with you is adding the new |
Thanks again for the review, @matthewhoffman! I addressed all of the requested changes and updated the PR. |
aac07fd
to
67d8c62
Compare
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.
@hollyhan , I just have a couple small changes this time around. After that, because this branch has been around for so long, let's rebase it on the current version of MALI-Dev/develop and then also remove commit a2771ad, which won't be needed after the rebase. You can do both operations at once with an interactive rebase. I'm happy to walk you through it if needed.
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
if (trim(config_uplift_method)=='sealevelmodel') then | ||
if (curProc.eq.0) then | ||
deallocate(nCellsPerProc) | ||
deallocate(nCellsDisplacement) |
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.
fix indentation here.
components/mpas-albany-landice/src/mode_forward/mpas_li_bedtopo.F
Outdated
Show resolved
Hide resolved
216c557
to
d1382c8
Compare
At this point this points to a private repo and will need to be moved to a public repo before merging.
This commit modifies the Makefile to support compiling with or without the sea level model. To include it, add "SLM=true" on the make call. If that is included, the build system expects the SLM submodule to have been initialized/updated already. It also activates a cpp directive that includes calls to the sea level code.
This was an oversight in the previous Makefile commit
This commit resolves reveiew comments for PR #21 ('Add a regional sea-level projection capability to MALI') - Set up MPI variables outside of routine 'interpolation_init'. - Move reformatting command of 1D SL array to 2D array inside of routine 'interpolation' - Include #ifdef USE_SEALEVELMODEL inside of the check for config_uplift_method - other small fixes
1fdfa6c
to
9e8bb6b
Compare
@hollyhan, are these panel descriptions correct? |
@trhille , yes they are but in different colour scale. I re-uploaded the plots so they are now all in the same colour scale. |
@hollyhan, can you explain how to set the length of the simulation? I'm using these settings in
and these in
It ran for 55 years and then ended with:
Does the number of |
From my 55-yr runs, I can confirm that the issues with noisy or unstable Runs started in 2007. left: 1 processor; middle 8 processors; right: difference between the two: |
This fix avoids the bound-check error when the code is compiled in DEBUG mode
@trhille, I realize that @matthewhoffman had previously made |
@trhille - thanks for catching this. This particular piece of code was adopted by the group that developed original form of the sea-level model that we are using. Leaving it as is has been no problem so far because the SLM has been compiled without |
…nd SLM settings In MALI, coupled interval is setup in namelist.landice under 'config_slm_coupling_interval'. In SLM, it is defined in namelist.sealevel under the variable 'dtime'. These two variables should have the same value when running coupled simulations. This fix checks the consistency between the two values, and gives an error if the check fails.
Thanks for noting this, @trhille. I've added a check to the code that checks the consistency between coupling interval setup by MALI and SLM. 07b6832 |
because 'topoChange' is not specific enough (e.g., ice sheet surface change is also topography)
How you have defined the length of simulation is "almost" correct - you would also want to set The number of iceload files (e.g., |
! First, check consistency in coupling interval set up in MALI and SLM | ||
err = 0 | ||
call mpas_pool_get_config(liConfigs, 'config_slm_coupling_interval', config_slm_coupling_interval) | ||
read(config_slm_coupling_interval(1:4),*) slm_coupling_interval |
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.
This looks like it is assuming the config_slm_coupling_interval
option has zeros for month, day, hr, min, sec. I think we might want the option to run with coupling intervals of smaller than a year to do sensitivity tests to the coupling interval. We can use the MPAS timekeeping operations to parse the string more carefully.
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.
Given that the SLM just uses decimal years for timekeeping, it would be really tricky to ensure an exact match in the time interval (due to MPAS having the option to track leap years, MPAS keeping track of differing days per month, etc.). I think a match in time interval within 1% would be a reasonable approximation to avoid potentially complicated accounting here.
The most consistent way to do the calculation would be to use mpas_set_timeInterval
and mpas_get_timeInterval
in components/mpas-framework/src/framework/mpas_timekeeping.F
to return the MPAS time interval in seconds (the dt
output argument), and compare that to the SLM time interval. Then throw an error if they differ by, say, >1%. One complication there is that for time intervals that require months and/or years, mpas_get_timeInterval
needs to know the start time, because the result will depend on the start time for many time intervals (e.g., 1 month). For the purposes of this calculation, the start time is not important, but you'd have to provide something. It might be best to hard code a time, like 2001-01-01_00:00:00
(I picked an arbitrary start of a year that isn't a leap year.). That is probably better than using something like the model start time, which would result in possibly slightly different results depending on start year.
This ends up being rather complex for a simple comparison, but I don't see a good way around it given the two different timekeeping systems in the two models.
@hollyhan , when I compile and run in debug mode, I get the following error:
If disable debug mode, the error goes away. Have you seen this? |
@matthewhoffman , Yes - that's the error message from the module code |
I've tested the COMPASS
I also confirmed:
I will proceed to testing runs that actually use the SLM with the Thwaites configuration Holly set up. |
@hollyhan That fix was when using |
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.
@hollyhan, great work on this! After discussion with @matthewhoffman, I'm approving this PR with the knowledge that a few clean-up items will be addressed in another PR.
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.
@hollyhan, I finished testing with the Thwaites mesh and see the same results as you and @trhille. I agree this looks really good and works as desired. It also nicely avoid affecting model behavior when the sea level model is not in use. Thanks for all your hard work in all the rounds of revisions and unexpected issues that popped up. We discussed the few clean-up items that we can leave for a follow up PR, but this is ready to merge!
…Dev/develop Previously, when the regional sea-level prediction capability was added to MALI (#21), the restart config option for the sea-level model was not added. This led the sea-level model to get initialized to Timestep zero when coupled MALI-SLM simulations are being restarted, forgetting about the ice loading changes and associated viscoelastic solid earth deformation that happened in the timesteps prior to current model time. This PR fixes the problem by allowing the sea-level model to resume where it was left off. Note in parallel to this PR, the version of the SLM needs to incorporate the changes made in the following accompanying PR (MALI-Dev/1DSeaLevelModel_FWTW#9) * hollyhan/add_restart_functionality_slm: Don't call SLM on init of a restart Add addl info on restart about the calculated time since last SLM call Allow restarts at any interval when using SLM Add missing error flag so model actually dies when error occurs Add missing arguments to log write statement Update restart check to also use time interval division Adjust check if adaptive dt is on or not Update checks using interval division Improve error handling, correct other usage of config_uplift_method Improve synchronization of timesteps between MALI and SLM Add restart option when the SLM is coupled to MALI
This PR adds a 1D gravitationally consistent sea-level model (Kendall et al., 2005; Gomez et al., 2010; Han et al., 2022; https://github.com/GomezGroup/1DSeaLevelModel_FWTW) as a submodule within MALI, adding the capability of regional sea-level projection associated with ice sheet changes solved by MALI. In this new addition, the sea-level model computes changes in the height of sea surface equipotential and viscoelastic solid Earth associated with surface (ice and ocean) loading changes, enabling MALI to take into account gravitational, rotational and deformational effects of the loading changes.
The implemented requirements and modified/added codes in the PR are as follow:
Makefile
in MALI's top level directory such thatSLM=True
in make command builds the SLM.mpas_li_bedtopo.F
in which sea-level model sub-modules are called.mpas_li_bedtopo.F
in which sea-level model sub-modules are called.Registry.xml
to include a namelist value of the coupling time, 2) modifiedmpas_li_core.F
to add an alarm to the land ice core clock object for the coupling time interval, and 3) modifiedmpas_li_bedtopo.F
to usempas_timekeeping
and check/reset the alarm for the coupling time interval.mpas_li_bedtopo.F
. MALI data (ice thickness) is gathered on the head node after which the SLM is called.mpas_to_grid.nc
andgrid_to_mpas.nc
for the regional, unstructured MALI mesh and the global Gaussian grid are generated using MPAS-mesh toolfrom_mpas.py
andncremap
, respectively. Subroutinesinterpolate_init
andinterpolate
and MPI scatter/gather functions are copied from the ocean SAL PR#4472 [https://github.com/Add in-line self attraction and loading for global tidal simulation E3SM-Project/E3SM#4472]sl_solver
that calculates and outputs total bedtopography, which is used to update bedrock topography inmpas_li_bedtopo.F