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

Create a calving CFL limit and apply to adaptive timestepper #33

Merged
merged 17 commits into from
May 11, 2022

Conversation

matthewhoffman
Copy link

@matthewhoffman matthewhoffman commented Apr 27, 2022

There is reason to think it is incorrect to allow calving to remove more than a whole grid cell in a given timestep - a CFL condition for calving. This merge calculates a calving CFL and adds it to the adaptive timestepper. It's important to note that the calving CFL is calculated from the previous timestep, because determining the calving CFL prior to starting the timestep is prohibitively difficult. That would require doing advection and other operations to generate the geometry that the calvingVelocity will be based on just to calculate the CFL limit, and then going back and actually progressing through the time step for real once the dt has been set. So this addition works under the principle that the calving CFL limit will not change a lot from timestep to timestep, thus a lagged CFL limit is a useful way to adapt the timestep. Testing shows this assumption works very well most, though not all, of the time.

The calving CFL is included in the adaptive timestepper with the new config_adaptive_timestep_include_calving option. The fraction of the calving CFL to use is controlled with the new option config_adaptive_timestep_calvingCFL_fraction.

A number of other related changes are made:

  • The adaptive timestepper logic and log messages are adjusted somewhat. A significant change is that config_adaptive_timestep_CFL_fraction now only applied to the advective CFL. There is no longer a general fraction applied.
  • The new variable processLimitingTimestep outputs a code indicating which process (advective CFL, diffusive CFL, calving) was the limiting factor in determining each timestep length.
  • The new variable calvingCFLdt calculates the dt estimated for by the calving CFL. The variable dtCalvingCFLratio is the ratio of the actual dt used to that dt indicated by the lagged calving CFL calculation. If conditions don't change between timesteps, this should be the value chosen for config_adaptive_timestep_calvingCFL_fraction, but if calving conditions change significantly between timesteps, this variable can be used to assess how bad the choice of dt actually was.
  • The 10% calving error now can be controlled with a namelist option: config_calving_error_threshold
    Note could add a check and a warning if the calving CFL on the actual time step exceeds the timestep in use.
  • There was a longstanding problem in the adaptive timestepper of dying if the force interval required a timestep smaller than the minimum allowable timestep. This has been fixed.
  • Log output has been modified to make the start of each timestep more obvious.

There is reason to think it is incorrect to allow calving to remove more
than a whole grid cell in a given timestep - a CFL condition for
calving.  This commit calculates a calving CFL and adds it to the
adaptive timestepper.  It's important to note that the calving CFL is
calculated from the *previous* timestep, because determining the calving
CFL prior to starting the timestep is prohibitively difficult.  That
would require doing advection and other operations to generate the
geometry that the calvingVelocity will be based on just to calculate the
CFL limit, and then going back and actually progressing through the time
step for real once the dt has been set.  So this addition works under
the principle that the calving CFL limit will not change a lot from
timestep to timestep, thus a lagged CFL limit is a useful way to adapt
the timestep.  In initial tests this appears to work for the simple
MISMIP+ test case.

Note that this additional work is required beyond this commit:
* Right now it is only calculated if using the von Mises calving law
* It is not calculated on the initial time
* Restarts are not handled
* There is not yet an option to disable this
* Adjustments may be desired for how the option for what fraction of the
calving CFL to use interacts with the general CFL dt fraction option
* some general clean up may be desired
@matthewhoffman matthewhoffman force-pushed the matthewhoffman/MALI/calving_CFL branch from ebd678f to 6188da9 Compare May 2, 2022 18:05
This commit adds the calving CFL calculation to all the other calving
laws that use a calvingVelocity: specified_velocity, eigencalving,
ISMIP6-retreat, and damage-rate
This calculation should be low cost, so I've enabled it in these
routines, regardless of if it is being used.  I anticipate its result
will be a useful diagnostic even if it is not being applied in the
timestepper.
@matthewhoffman matthewhoffman force-pushed the matthewhoffman/MALI/calving_CFL branch from 42dab2a to 80f3aa0 Compare May 2, 2022 19:08
The calving CFL application can be now controlled with the option
config_adaptive_timestep_include_calving.  If that option is true, the
calculation is only applied if a calving law that calculates
calvingVelocity is actually enabled, to avoid attempting to apply the
calvingCFLDt variable when it is not being calculated.

This commit also changes config_adaptive_timestep_CFL_fraction so that
it is only applied to the advective CFL.  That is typically how it has
been used.  I did not change the option name to avoid breaking backwards
compatibility of namelist files.  With this change, there is no longer a
master adjustment - there are only adjustments to the individual
candidate CFL conditions.  Note that the diffusive CFL does not have a
fraction, but it is rarely used, so that is fine for now.
This commit fixes a longstanding annoyance where an error would be
triggered if the adaptive timestepper’s force interval calculation
resulted in a timestep less than the limit specified by
config_min_adaptive_timestep
This is needed for the calving CFL to behave correctly on a restart.
This variable is only needed in a restart file if the calving CFL is
actually being applied, but including it always because it is only a
scalar value, and adding logic for that would be complicated.
This is needed to get the calving CFL to work properly on the first
timestep because the calving CFL calculation is made on the timestep
prior to its application.  To ensure there is no actual calving for
rate-based calving laws, the model deltat is temporarily set to 0 before
calling the calving routines.  Note that non-rate-based calving laws
(thickness, damage thresholds, etc.) will now be applied on the
initial time whereas before they were not.  But I think that behavior is
actually preferable.  We don't have any tests or routine configurations
using those calving laws currently, so that change will not disrupt
anything.
Required for von Mises calving to work on initial time
@matthewhoffman matthewhoffman force-pushed the matthewhoffman/MALI/calving_CFL branch from e7fe763 to 7d9b03e Compare May 2, 2022 21:16
* Convert limiting timestep values reported to days
* Add a message saying which process controlled the timestep
* Add a new output variable for which process controlled the timestep so
that behavior could be analyzed more easily in post-processing if
desired.
This assesses if using the calving CFL from the previous timestep is
sufficient.
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 5, 2022
These changes have only small impacts on the behavior of the calving
routine, but add some minor cleanup.
@matthewhoffman matthewhoffman force-pushed the matthewhoffman/MALI/calving_CFL branch from ce930ca to 5122a22 Compare May 5, 2022 20:40
It accidentally got dropped in an earlier commit.
@matthewhoffman
Copy link
Author

Results of full_integration suite:

Test Runtimes:
00:10 PASS landice_dome_2000m_sia_restart_test
00:05 PASS landice_dome_2000m_sia_decomposition_test
00:08 PASS landice_dome_variable_resolution_sia_restart_test
00:04 PASS landice_dome_variable_resolution_sia_decomposition_test
00:31 PASS landice_enthalpy_benchmark_A
00:13 PASS landice_eismint2_decomposition_test
00:13 PASS landice_eismint2_enthalpy_decomposition_test
00:14 PASS landice_eismint2_restart_test
00:14 PASS landice_eismint2_enthalpy_restart_test
00:18 FAIL landice_greenland_sia_restart_test
00:09 FAIL landice_greenland_sia_decomposition_test
00:09 PASS landice_hydro_radial_restart_test
00:06 PASS landice_hydro_radial_decomposition_test
00:17 PASS landice_dome_2000m_fo_decomposition_test
00:14 PASS landice_dome_2000m_fo_restart_test
00:11 PASS landice_dome_variable_resolution_fo_decomposition_test
00:13 PASS landice_dome_variable_resolution_fo_restart_test
00:14 PASS landice_circular_shelf_decomposition_test
00:41 FAIL landice_greenland_fo_decomposition_test
00:41 FAIL landice_greenland_fo_restart_test
00:32 PASS landice_thwaites_decomposition_test
00:44 PASS landice_thwaites_restart_test
00:51 FAIL landice_humboldt_mesh-3km_restart_test_velo-fo_calving-von_mises_stress_damage-threshold_faceMelting
Total runtime 07:14
FAIL: 5 tests failed, see above.

The greenland failures are because this PR applies the calving routine on the initial time, whereas before it was not applied until the first time step. For rate-based calving laws, applying calving on the initial time has no effect because dt=0, but for threshold-based calving laws, this change will apply calving on the initial time. The greenland cases all are currently using thickness-based calving, so applying calving on the initial time removes floating ice from a handful of grid cells in NE Greenland. As I mention in the commit messages, I think we actually prefer to have threshold-based calving applied on the initial time, so this change is desireable.

The landice_humboldt_mesh-3km_restart_test_velo-fo_calving-von_mises_stress_damage-threshold_faceMelting failure is due to a small change (order 1e-6 m/s) to calvingVelocity (but not calvingThickness). This PR includes a lot of minor adjustments to how calving is processed, so that level of change did not concern me.

Therefore, I would consider all these changes as blessed.

To actually test this PR, I would run the calving_dt_convergence suite in the accompanying COMPASS PR: MPAS-Dev/compass#386

@trhille , you may also want to run one of your Humboldt paper runs to ensure there are no major differences.

@matthewhoffman matthewhoffman removed the in progress Still being worked on, don't merge yet! label May 5, 2022
@matthewhoffman matthewhoffman requested a review from trhille May 5, 2022 22:20
@trhille
Copy link

trhille commented May 9, 2022

I see the same 5 tests failing baseline comparison.

Test Runtimes:
00:09 PASS landice_dome_2000m_sia_restart_test
00:05 PASS landice_dome_2000m_sia_decomposition_test
00:08 PASS landice_dome_variable_resolution_sia_restart_test
00:05 PASS landice_dome_variable_resolution_sia_decomposition_test
00:33 PASS landice_enthalpy_benchmark_A
00:12 PASS landice_eismint2_decomposition_test
00:12 PASS landice_eismint2_enthalpy_decomposition_test
00:14 PASS landice_eismint2_restart_test
00:14 PASS landice_eismint2_enthalpy_restart_test
00:18 FAIL landice_greenland_sia_restart_test
00:10 FAIL landice_greenland_sia_decomposition_test
00:09 PASS landice_hydro_radial_restart_test
00:06 PASS landice_hydro_radial_decomposition_test
00:16 PASS landice_dome_2000m_fo_decomposition_test
00:15 PASS landice_dome_2000m_fo_restart_test
00:11 PASS landice_dome_variable_resolution_fo_decomposition_test
00:13 PASS landice_dome_variable_resolution_fo_restart_test
00:14 PASS landice_circular_shelf_decomposition_test
00:41 FAIL landice_greenland_fo_decomposition_test
00:40 FAIL landice_greenland_fo_restart_test
00:32 PASS landice_thwaites_decomposition_test
00:43 PASS landice_thwaites_restart_test
00:51 FAIL landice_humboldt_mesh-3km_restart_test_velo-fo_calving-von_mises_stress_damage-threshold_faceMelting
Total runtime 07:13
FAIL: 5 tests failed, see above.

@trhille
Copy link

trhille commented May 10, 2022

I also tested this on the Humboldt_1to10km_r04_20210615 mesh using the most aggressive mass loss scenario from the perturbed parameter ensemble in my paper (HadGEM2 climate, 170 kPa von Mises threshold stress, q = 1/7). Happily, these changes result in only minor differences from the original simulation, which used an executable compiled using https://github.com/MALI-Dev/E3SM/tree/d0c286778a6a035c600af891a268ed9f843aac52 and https://github.com/sandialabs/Albany/tree/ecbc0182015fda8d6a2bb29eaa3a47c260f40b13.
In the results below, blue is the run from the original ensemble, green is compiled on the current head of MALI-Dev/develop (commit 6c06533, with commit d4f7c0b cherry-picked to enable compiling on Cori), and orange was compiled using this branch (commit 258eadc, also with commit d4f7c0b cherry-picked):
image
image
image

The green curve used config_distribute_unablatedVolumeDynCell = .true., but ran into the >10% ablation error, and I did not bother reducing the timestep and restarting.

The orange curve (this branch) used

config_adaptive_timestep_calvingCFL_fraction = 1.0
config_adaptive_timestep_include_calving = .true.
config_distribute_unablatedVolumeDynCell = .false.

The ratio of timestep taken to CFL calculated at the end of the timestep (i.e., the effect of the one-timestep lag in CFL condition calculation) looks pretty good here:
image

@trhille
Copy link

trhille commented May 10, 2022

I ran the calving_dt_convergence COMPASS test suite (MPAS-Dev/compass#386), and all tests passed successfully:

Test Runtimes:
02:42 ESC[92mPASSESC[0m landice_calving_dt_convergence_mismip+.specified_calving_velocity.none
02:12 ESC[92mPASSESC[0m landice_calving_dt_convergence_mismip+.von_Mises_stress.none
02:01 ESC[92mPASSESC[0m landice_calving_dt_convergence_humboldt.specified_calving_velocity.none
01:48 ESC[92mPASSESC[0m landice_calving_dt_convergence_humboldt.von_Mises_stress.none
03:03 ESC[92mPASSESC[0m landice_calving_dt_convergence_thwaites.specified_calving_velocity.none
03:28 ESC[92mPASSESC[0m landice_calving_dt_convergence_thwaites.von_Mises_stress.none
73:56 ESC[92mPASSESC[0m landice_calving_dt_convergence_mismip+.von_Mises_stress.FO
08:40 ESC[92mPASSESC[0m landice_calving_dt_convergence_humboldt.von_Mises_stress.FO
21:36 ESC[92mPASSESC[0m landice_calving_dt_convergence_thwaites.von_Mises_stress.FO
Total runtime 119:29
PASS: All passed successfully!

See MPAS-Dev/compass#386 for test results.

Copy link

@trhille trhille left a comment

Choose a reason for hiding this comment

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

@matthewhoffman, this is great! I had a few minor suggestions here and there. One concern that could complicate things is that I think we should include face-melting in the CFL condition calculation, although it is unlikely to exceed calving rates.

These aren't always relevant, but there is no harm in including them,
and it is convenient not to have to add them manually when desired.
The change to principalStrainRateRatio is unrelated to this branch, but
I happened to notice the missing Time dimension.
@matthewhoffman
Copy link
Author

@trhille , thanks for the review and the informative testing on this. I updated the PR. Let me know if you think we should add the faceMelting CFL limit or not. I'm inclined to not bother, but I could be convinced.

@trhille
Copy link

trhille commented May 10, 2022

@matthewhoffman, thanks for these changes. I don't think any of them will make a difference, but I'll run full_integration again to be sure.

@trhille , thanks for the review and the informative testing on this. I updated the PR. Let me know if you think we should add the faceMelting CFL limit or not. I'm inclined to not bother, but I could be convinced.

Let's leave it as-is for now. It's probably true that in the vast majority of cases, face melting will not be the dominant velocity, and for our short-term Antarctic use cases that won't matter. We can add that in another PR if we determine it is necessary.

Copy link

@trhille trhille left a comment

Choose a reason for hiding this comment

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

Okay, I'm seeing the same behavior as before when I run full_integration, so this is good to go!

@trhille trhille merged commit 9d3dcd9 into develop May 11, 2022
@trhille trhille deleted the matthewhoffman/MALI/calving_CFL branch May 11, 2022 16:37
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 11, 2022
This brings in the calving CFL PR for MALI that is required to run the
new tests: MALI-Dev/E3SM#33
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 11, 2022
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 11, 2022
This brings in the calving CFL PR for MALI that is required to run the
new tests: MALI-Dev/E3SM#33
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 11, 2022
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 11, 2022
This brings in the calving CFL PR for MALI that is required to run the
new tests: MALI-Dev/E3SM#33
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 11, 2022
matthewhoffman added a commit to matthewhoffman/compass that referenced this pull request May 11, 2022
This brings in the calving CFL PR for MALI that is required to run the
new tests: MALI-Dev/E3SM#33
matthewhoffman added a commit to MPAS-Dev/compass that referenced this pull request May 11, 2022
…gdt_test

MALI calving dt convergence tests

This merge adds a new set of tests for MALI that explore convergence with timestep of the calving physics. This is added in a new test group that runs a configuration multiple times with the adaptive timestepper restricted by different fractions of the calculated calving CFL limit. The results are then analyzed and a summary plot is produced. This test can be applied to a number of different calving laws and meshes and using either data velocity or prognostic velocity. These set of tests are not intended to be run routinely as part of integration, but instead are a tool for evaluating development of calving physics. A test suite is also included that runs a number of these tests that have been evaluated as being useful. There are some known ways this test group could be improved, but given its limited intended usage, they are not worth developing further at this time.

A MISMIP+ smoke test is also added as part of this PR. The calving tests were first developed to use the MISMIP+ configuration, which was not yet in COMPASS. Later, things were reorganized to make the calving tests more general and support multiple meshes. Having a MISMIP+ smoke test is generally useful, so that test was retained in this branch after reorganizing things.

Note that this PR includes an update to the MALI-Dev submodule to include the merged MALI PR here: MALI-Dev/E3SM#33.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants