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

Add MALI mesh convergence tests #690

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

matthewhoffman
Copy link
Member

@matthewhoffman matthewhoffman commented Sep 1, 2023

This PR introduces 3 mesh resolution convergence tests for MALI, copying from the planar_convergence test group in the ocean.

Checklist

  • User's Guide has been updated
  • Developer's Guide has been updated
  • API documentation in the Developer's Guide (api.rst) has any new or modified class, method and/or functions listed
  • Documentation has been built locally and changes look as expected
  • The MALI-Dev submodule has been updated with relevant MALI changes
  • Document (in a comment titled Testing in this PR) any testing that was used to verify the changes
  • New tests have been added to a test suite

@matthewhoffman matthewhoffman added land ice in progress This PR is not ready for review or merging labels Sep 1, 2023
matthewhoffman added a commit to MALI-Dev/E3SM that referenced this pull request Sep 6, 2023
This merge adds a flux-correct transport (FCT) scheme to MALI for thickness and
tracer advection, ported over with MALI-relevant modification from MPAS-Ocean's
routines, which are based on Skamarock and Gassmann (2011)
(https://doi.org/10.1175/MWR-D-10-05056.1). This uses a blend of 3rd and 4th
order fluxes to achieve monotonicity. The FCT routine is only used for tracers
in MPAS-Ocean, whereas here it is modified for use with both thickness and
tracers. The user can specify 2nd, 3rd, or 4th order advection with the
config_horiz_tracer_adv_order option, but only config_horiz_tracer_adv_order = 3
with 0 < config_advection_coef_3rd_order < 1 is truly FCT. The
config_advection_coef_3rd_order option specifies the blend between 3rd and 4th
order fluxes used in the flux correction. config_advection_coef_3rd_order = 1.0
is purely 3rd order, while config_advection_coef_3rd_order = 0.0 is purely 4th
order. The default value of 0.25 is taken from the MPAS-Ocean default and may
not be appropriate for all situations. Note that all higher-order advection must
reduce to 1st order at the boundaries.

This also adds a new variable passiveTracer2d, that can be used to verify
advection schemes.

Currently supported combinations of thickness and tracer advection with fct
include:

1. config_thickness_advection = 'fo'; config_tracer_advection = 'fct'
2. config_thickness_advection = 'fct'; config_tracer_advection = 'fct'
3. config_thickness_advection = 'fct'; config_tracer_advection = 'none'

FCT tracer advection with no thickness advection and FCT thickness advection
with FO tracer advection could be added, but we do not currently anticipate
using them.  Therefore, we have left them out of this PR as they would add
unnecessary complexity to the code.  When used with forward Euler time
integration, FCT requires a severely reduced time step relative to first order
advection. Testing shows that CFL fraction on the order of 0.1 is likely
sufficiently small, but this is probably case-dependent. Once Runge-Kutta time
integration is operational, it is recommended to use that instead of forward
Euler.

At the time of merging, there is a very slight conservation error (<0.1% in the
grounded slab test shown below) for tracers when using FCT for both thickness
and tracer advection, while mass is fully conserved. Tracers are conserved when
using FO thickness advection with FCT tracer advection. The convergence order
has not yet been verified, but testing is under way using a new mesh convergence
COMPASS test: MPAS-Dev/compass#690.

* trhille/add_higher_order_advection: (46 commits)
  Enable fct thickness advection without tracer advection
  Change passiveTracer to passiveTracer2d
  Only pass layer thickness tracer for first call to fct
  Fix the case of fo thickness, none tracer advection
  Fix bug with activeTracerHorizontalAdvectionEdgeFlux
  Make activeTracerHorizontalAdvectionEdgeFlux optional
  Throw error forr fct thickness with fo tracer
  Simple cleanup after code review
  Make conserve tracer volume
  Fix first order flux at ice edge
  Make fct conserve mass
  Call li_tracer_advection_fct_tend for thickness and tracers separately
  Clean up 2nd order mask
  Make 2nd order and 3rd-4th order masks mutually exclusive
  Try new mask for 2nd order terms
  Change normalThicknessFlux, layerThickness, and tracer definitions
  Pass layerThickness as tracer instead of array of 1s
  Increase max number of tracers to accomodate passiveTracer
  Add passiveTracer to help verify advection schemes
  Fix bug in marking boundaryCell
  ...
@matthewhoffman matthewhoffman force-pushed the landice/mesh_convergence_test branch from 0be65fe to 95e99e1 Compare September 7, 2023 16:28
@trhille trhille force-pushed the landice/mesh_convergence_test branch from a6b1a99 to 3f0b4a5 Compare November 8, 2023 00:04
matthewhoffman and others added 14 commits August 19, 2024 08:51
This is copied from the ocean's planar_convergence test case with minor
adjustments to work for the landice core.
Also modify the mesh_convergence test-group-level architecture to be
flexible enough to support these two different test cases.
Adding both a test group stream and a test case stream will result in
the union of their contents, so I've moved test-case-specific variables
to the test-case streams file.
This commit changes a lot of details about the convergence tests to get
them both working at the same time after the halfar one broke the
horizontal_advection one.  Changes include:
* replacing dt_1km cfg option with target_velocity that is then used to
  figure out an appropriate timestep that can be scaled for all
  resolutions.  Note this change may not be desirable in the end,
  because there are a number of reasons one might want to directly control
  the dt.  e.g. Halfar has a diffusive CFL constraint, which the current
  logic to set the dt from the target velocity is unable to deal with, and
  for FCT, one may want to take substantially smaller dt.
* change horizontal_advection to use glacier-like velocities and times
* change the duration cfg option to use years
* minor cfg and plotting updates
All advection will reduce to first order at margin, so the dome center
error provides a metric of error "away" from the margin.
* drop 16 km and add 1 km to ensemble.  16 km appears too coarse to be
  very useful, especially for halfar, where it makes a dome of only 7 grid cells
* adjust halfar target_velocity accordingly (accounting for diffusive cfl)
* move start time of year 1 to the test group level so it applies to both tests
This is identical to the horizontal_advection test of a passive tracer, but Gaussian
bump is applied to thickness field and tracer advection is not considered.  This
isolates the analysis to a single advection call; if there are issues with the
thickness advection, we presumably cannot expect tracer advection to converge properly.

It might have been possible to create an argument to toggle between
versions, but it was easier (and arguably less confusing) to just make a
copy.

This uses a Gaussian bump of 1000 m sitting on top of a 1000 m base
layer in a doubly periodic mesh.  This ensures a margin-less domain,
which would avoid the issue of advection degrading to 1st order at
margins.
    have compass expect seperate files for the dome and rmse convergence.
Change restart output interval from 30 days to 30 years.
Update passiveTracer to passiveTracer2d in analysis.py for horizontal_advection.
@trhille trhille force-pushed the landice/mesh_convergence_test branch from 080d1f0 to 754a540 Compare August 19, 2024 20:53
Change clobber mode from truncate to overwrite because we
want to be able to use restarts without losing the initial
time level in the output file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress This PR is not ready for review or merging land ice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants