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

Implement Runge-Kutta time integration #86

Merged
merged 36 commits into from
Nov 11, 2023

Commits on Nov 6, 2023

  1. Add RK2 loop in time integration module

    Add RK2 loop in time integration module. This is the bare bones of
    RK2 time stepping. Compiles but likely will not run.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    4ec4101 View commit details
    Browse the repository at this point in the history
  2. Pass rkTend to advection routine

    Pass rkTend to advection routine to accumulate tendencies
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    bf947b6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c703988 View commit details
    Browse the repository at this point in the history
  4. Correct dimensions of rkTend

    Correct dimensions of rkTend, which was inadvertently 2D instead
    of 3D.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    bf88eb8 View commit details
    Browse the repository at this point in the history
  5. Update halos for rkTend in each step of RK loop

    Update halos for rkTend in each step of RK loop
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    220e2a4 View commit details
    Browse the repository at this point in the history
  6. Ensure damage >= damageNye after RK integration

    Ensure damage >= damageNye after RK integration. Previously,
    li_finalize_damage_after_advection did not impose the damageNye minumum.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    9ccdde6 View commit details
    Browse the repository at this point in the history
  7. Generalize RK time integration

    Generalize RK time integration to use order defined in namelist.
    Currently supports config_rk_order = 1, 2, 4. Third order to be
    added soon.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    5d1e573 View commit details
    Browse the repository at this point in the history
  8. Fix forward Euler time integration

    The previous Runge-Kutta commits left forward Euler time integration
    non-functioning. This makes FE time integration function again.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    278a5d7 View commit details
    Browse the repository at this point in the history
  9. Rename files, modules, and routines to include Runge-Kutta

    Rename files, modules, and routines to include Runge-Kutta
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    af21705 View commit details
    Browse the repository at this point in the history
  10. Add SSP-RK3 time integration

    Add support for config_rk_order = 3, using the Strong Stability-
    Preserving RK3 method. This follows a slightly different algorithm
    from the classic RK2 and RK4 methods, and so requires significantl
    increasing the complexity of the RK loop. See eq 2.48 (pg 56) in
    Durran (2010): Numerical Methods for Fluid Dynamics for the description
    of this method.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    63a169b View commit details
    Browse the repository at this point in the history
  11. Update RK2 and RK4 substeps using 0th step solution

    Previous commits inadvertently updated sub-step solutions incrementally
    (i.e., using y(k-1) to solve for y(k), where k is the substep), when they
    should have been using y0. This commit fixes that, although tests show
    that this treatment is not complete and solutions are unstable.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    b920b33 View commit details
    Browse the repository at this point in the history
  12. Only use SSP RK2 and RK3 methods

    Only use SSP RK2 and RK3 methods, and remove support for classical
    RK2 and RK4.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    dc33a67 View commit details
    Browse the repository at this point in the history
  13. Some cleanup

    Rename some local variables, update comments, update log write
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    74c014f View commit details
    Browse the repository at this point in the history
  14. Add option for 4-stage SSPRK3

    Add option for 4-stage SSPRK3, which involves four velocities solves
    instead of three, but also allows for a CFL fraction of 2. To use
    the 4-stage formulation, set 'config_rk_order = 3' and
    'config_rk3_stages = 4'.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    e938e92 View commit details
    Browse the repository at this point in the history
  15. Include SMB and BMB within RK loop

    Include SMB and BMB within RK loop by calculating a weighted average
    based on each specific RK formulation.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    f0c9a1f View commit details
    Browse the repository at this point in the history
  16. Fix SMB and BMB budget for forward euler

    Fix SMB and BMB budget for forward euler, as previous commit caused
    these fields to be written out as all zeroes.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    79b4635 View commit details
    Browse the repository at this point in the history
  17. Some more cleanup

    Correct a description in Registry, update comments and log writes.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    413f304 View commit details
    Browse the repository at this point in the history
  18. Fix bug in groundedSfcMassBalApplied after Runge-Kutta loop

    Fix bug in groundedSfcMassBalApplied after Runge-Kutta loop. It was
    inadvertently being assigned the enitre applied SMB field instead
    of just the grounded portion.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    954ecce View commit details
    Browse the repository at this point in the history
  19. Calculate groundedToFloatingThickness and grounding line flux after RK

    Calculate the total groundedToFloatingThickness and fluxAcrossGroundingLine
    at the end of the RK loop. Budgets do not yet close, but are reasonably close.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    606cbb0 View commit details
    Browse the repository at this point in the history
  20. Reset layerThickness when using config_restore_thickness_after_advection

    Reset layerThickness when using config_restore_thickness_after_advection.
    Restoring thickness alone is not sufficient when using Runge-Kutta
    time integration because the advected layerThickness gets propagated through
    all stages of the Runge-Kutta loop, which leads to advection and surface/basal
    mass balances causing thickness change.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    35fe8fa View commit details
    Browse the repository at this point in the history
  21. Update stresses and strain rates after calving

    Update stresses and strain rates after calving. This allows
    restart test with damage to pass validation, but may not be the
    most rigorous fix.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    07fdc99 View commit details
    Browse the repository at this point in the history
  22. Update thickness and tracer halos before velocity solve

    Update thickness and tracer halos before velocity solve. This allows
    eismint2 decomposition test to pass validation.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    f875198 View commit details
    Browse the repository at this point in the history
  23. Update temperature and waterFrac in RK loop, but not enthalpy

    Update temperature and waterFrac in RK loop, but not enthalpy. Updating
    enthalpy resulted in negative temperatures, which caused an error in li_thermal.
    Updating temperature and waterFrac instead after enthalpy is advected allows
    enthalpy tests in full_integration suite to pass execution and validation.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    20fdec7 View commit details
    Browse the repository at this point in the history
  24. Simple clean-up after code review

    Simple clean-up after code review, including moving call to mask
    calculation, initializing waterFracPrev to zeroes, adding return
    statements after error messages. Also add a halo update on cellMask
    and edgeMask before calculating groundedToFloatingThickness and
    fluxAcrossGroundingLineOnCells.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    fbb6d6d View commit details
    Browse the repository at this point in the history
  25. Initialize RK weights to large negative values

    Initialize the various RK weights (rkSSPweights, rkTendWeights,
    rkSubstepWeights) to large negative values which are overwritten
    for each case. This will make it obvious if a weight is being used
    when it should not be.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    d7eac5c View commit details
    Browse the repository at this point in the history
  26. Restore calving front within RK loop

    Restore calving front within RK loop to prevent velocity solutions
    on extended ice geometry.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    3bcd1d9 View commit details
    Browse the repository at this point in the history
  27. Remove support for config_rk_order = 1

    Remove support for config_rk_order = 1 to avoid unnecessary redundancy
    with config_time_integration = forward_euler while maintaining
    backward compatibility.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    13f0908 View commit details
    Browse the repository at this point in the history
  28. Include calving in Runge-Kutta loop

    Include calving in Runge-Kutta loop, rather than implementing it
    afterwards.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    e7e1f30 View commit details
    Browse the repository at this point in the history
  29. Calculate layerThickness after calving in RK loop

    Calculate layerThickness after calving in RK loop, which is necessary
    when calculating weighted averages for RK integration.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    add0633 View commit details
    Browse the repository at this point in the history
  30. Revert "Calculate layerThickness after calving in RK loop"

    This reverts commit 5e23b98.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    7073b89 View commit details
    Browse the repository at this point in the history
  31. Revert "Include calving in Runge-Kutta loop"

    This reverts commit 813ee05. After
    testing and discussion, it is apparent that including calving within
    the Runge-Kutta loop is not desirable because it changes the domain
    between stages of the Runge-Kutta integration.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    fb0315f View commit details
    Browse the repository at this point in the history
  32. Average fluxAcrossGroundingLineOnCells in time integration module

    Calculate fluxAcrossGroundingLineOnCells in advection module for each
    RK stage and then take weighted average after RK integration instead
    of calcuating fluxAcrossGroundingLineOnCells on final state. This is
    more consistent with how fluxAcrossGroundingLine (on edges) is treated.
    trhille committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    51802e1 View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2023

  1. Add logic to control whether velocity is solved before and/or after c…

    …alving
    
    Add logic to control whether velocity is solved before and/or after calving.
    This allows both for backward compatibility and for the abilility to
    use self-consistent velocty, stress, and strain-rate fields when calculating calving.
    trhille committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    ca28f5b View commit details
    Browse the repository at this point in the history
  2. Make config_update_velocity_before_calving = .false. the default

    Make config_update_velocity_before_calving = .false. the default. This
    is not necessarily the desired behavior for production runs, but it
    is necessary for baseline comparison when using forward Euler time
    integration.
    trhille committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    4cda648 View commit details
    Browse the repository at this point in the history
  3. Always update velocity after calving if it was not updated before cal…

    …ving.
    
    Always update velocity after calving if it was not updated before calving.
    trhille committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    9ac9af2 View commit details
    Browse the repository at this point in the history
  4. Move subglacial hydro and bed topography updates back to their former…

    … positions
    
    Move subglacial hydro and bed topography updates back to their original positions.
    These were initially moved due to the complexity of interaction with
    RK integration, but I think subsequent changes have made that move
    unnecessary.
    trhille committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    e2a2f0b View commit details
    Browse the repository at this point in the history