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

Calculate mass budgets online #38

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from

Commits on Apr 17, 2024

  1. Add specialized masks for mass budget calculations

    Add grounded and floating masks that are used for the mass budget
    calculation and are different from the masks in cellMask. Currently,
    the only difference is that the grounded mask includes floating non-dynamic
    cells adjacent to grounded ice. The grounded masks will eventually
    also include floating ice over subglacial lakes, but that requires
    flood_fill to be moved from li_calving to a shared routine, so that
    will come in a future commit. In preparation for that, add domain
    variable in calls to li_calculate_mask.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    dc058a2 View commit details
    Browse the repository at this point in the history
  2. Add floatingSfcMassBalApplied variable

    Also redefine applied surface and basal mass balance fields based
    on new grounded and floating masks for mass budgets.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    093f93e View commit details
    Browse the repository at this point in the history
  3. Add grounded and floating calvingThickness variables

    Add variables to distinguish between grounded and floating components
    of calving in mass budgets.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    4a130e9 View commit details
    Browse the repository at this point in the history
  4. Add grounded and floating faceMeltingThickness components

    Add grounded and floating faceMeltingThickness components for
    calculating mass budgets. Also fix implementation of parsing grounded
    and floating calvingThickness components, which needs to be done
    after calvingThickness is applied but before the masks are updated.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    915be80 View commit details
    Browse the repository at this point in the history
  5. Update global stats calculations using new masks

    Also account for grounded and floating components of calving and
    face melting. It's still not clear what to do about VAF.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    11f4e1e View commit details
    Browse the repository at this point in the history
  6. Zero out grounded and floating mass budget masks at start of call

    Zero out grounded and floating mass budget masks each time li_calculate_mask
    is called, to avoid inheritting values from previous steps. Also fix
    the calculation of total grounded and floating face-melting fluxes
    in global stats.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    37727a4 View commit details
    Browse the repository at this point in the history
  7. Account for multiple updates of calvingThickness within a timestep

    Add a very short subroutine update_calving_budget that is called to
    recalculate groundedCalvingThickness and floatingCalvingThickness
    after calvingThickness is applied and before masks are updated. Also
    treat grounded and floating calving specially within the remove_icebergs
    and remove_small_islands routines to deal with the face that
    calvingThickness is updated multiple times per timestep. Thus, it
    is okay for a cell to have both nonzero groundedCalvingThickness
    and floatingCalvingThickness.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    82dc266 View commit details
    Browse the repository at this point in the history
  8. Use grounded and floating mass budget masks for groundedToFloatingThi…

    …ckness
    
    Instead of cellMask before and after advection, use groundedMaskForMassBudget
    and floatingMaskForMassBudget before and after advection to calculate
    groundedToFloatingThickness. This prevents the switch between floating
    non-dynamic cells and grounded cells being registered as ice grounding,
    which was causing groundedLineMigration to be the wrong sign in testing
    on the Humboldt domain.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    2f48a21 View commit details
    Browse the repository at this point in the history
  9. Calculate grounding line flux before advection, smb, and bmb

    Calculating grounding line flux after advection led to double (or triple?)
    counting between GL Flux and GL Migration Flux (and maybe SMB as well).
    Calculate grounding line flux before advection, smb, and bmb instead.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    be7bdf1 View commit details
    Browse the repository at this point in the history
  10. Update groundedToFloatingThickness when masks are updated

    Update groundedToFloatingThickness whenever masks are updated to
    account for cells changing between masks when face-melting and calving
    are applied, and not just when sfcMassBal, basalMassBal, and advection
    are applied, as was the case previously.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    6128249 View commit details
    Browse the repository at this point in the history
  11. Add halo updates after calling li_calculate_mask

    Add halo updates for mass budget masks after calling li_calculate_mask.
    This did not help close the budget, but in case it is correct I don't want to lose
    the work. Committing and then reverting.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    4f566f0 View commit details
    Browse the repository at this point in the history
  12. Revert "Add halo updates after calling li_calculate_mask"

    This reverts commit ff97c4e.
    The changes in that commit did not help close budgets, but they may
    be helpful at some point.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    93309ab View commit details
    Browse the repository at this point in the history
  13. Correct use of 'cycle' when when calculating masks

    The cycle statement used to exit a loop over neighbors
    when calculating the grounding line and adding non-dynamic floating
    fringe to the grounded mask was inadvertently outside the relevant
    if-statement.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    5976ab0 View commit details
    Browse the repository at this point in the history
  14. Do not apply float-kill to non-dynamic fringe

    Use floatingMaskForMassBudget to define which cells are calving
    when using config_calving = 'floating'. This is because floating
    non-dynamic cells adjacent to grounded cells should not really
    be considered part of the ice shelf.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    02ee6a8 View commit details
    Browse the repository at this point in the history
  15. Use mass budget masks for basal mass balance

    Use floatingMaskForMassBudget and groundedMaskForMassBudget to partition
    basal mass balance between grounded and floating.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    797cf99 View commit details
    Browse the repository at this point in the history
  16. Update calving budget incrementally

    Use a local variable dCalvingThickness to update the calving budget
    each time calving is applied. The variable calvingThickness is now
    not used directly to modify thickness, but calculated by summing
    dCalvingThickness throughout a time step. This might lead to issues
    with halo updates because dCalvingThickness is always an allocatable
    array. If so, it will need to either be made a Registry variable or
    an MPAS allocatable scratch array.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    a5bee82 View commit details
    Browse the repository at this point in the history
  17. Cleanup after rebase onto MALI-Dev/develop

    Clean up a few items after rebasing, including changing a few
    instances of 'flood_fill' to 'li_flood_fill', an instance of
    'nCellsSolve' to 'nCells', and removing cellMaskTemporaryField
    from li_advection_thickness_tracers.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    b89fb71 View commit details
    Browse the repository at this point in the history
  18. Update grounded and floating calving budgets incrementally

    Update grounded and floating calving budgets incrementally, which is
    required to close budget.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    236074d View commit details
    Browse the repository at this point in the history
  19. Clean-up after rebase

    Fix a few small issues after rebasing onto MALI-Dev/develop
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    e7fe705 View commit details
    Browse the repository at this point in the history
  20. Clean up after rebase

    Clean up after rebase, again
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    884049f View commit details
    Browse the repository at this point in the history
  21. Fix dCalvingThickness dimension in remove_small_islands

    Fix dCalvingThickness dimension in remove_small_islands. Must be nCells
    rather than nCellsSolve in size.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    8e85cd8 View commit details
    Browse the repository at this point in the history
  22. Make treatment of basal mass bal components consistent

    Grounded and floating components of sfcMassBal were using the mass
    balance mask fields, while basalMassBal components used cellMask.
    Make both of them use mass balance masks.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    eb6748f View commit details
    Browse the repository at this point in the history
  23. Fix accidental doubling of faceMeltingFlux

    Fix accidental doubling of faceMeltingFlux when calculating global
    stats.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    6f13e2b View commit details
    Browse the repository at this point in the history
  24. Update layerThickness halos after advection

    Update layerThickness halos after advection. This reduces the error
    in a test with 500 m/yr face-melt, so it seems to be necessary, but
    it does not solve the issue entirely.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    6a2d6af View commit details
    Browse the repository at this point in the history
  25. Make grounding line flux calculation consistent with FCT

    Make grounding line flux calculation consistent with FCT advection.
    Also update edgeMask halos before calculating grounding line flux.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    4b77dba View commit details
    Browse the repository at this point in the history
  26. Move face-melting after last RK velocity solve

    Move face-melting after last velocity solve in RK loop. This is necessary
    to close mass budgets when using face-melting.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    4f75613 View commit details
    Browse the repository at this point in the history
  27. Clean up after rebase following Runge-Kutta merge

    Clean up after rebase following Runge-Kutta merge
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    ad484aa View commit details
    Browse the repository at this point in the history
  28. Add cellMaskTemporary back to Registry

    Add cellMaskTemporary back to Registry for use in calving.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    797b72a View commit details
    Browse the repository at this point in the history
  29. Loop over nEdgeSolve instead of nEdges when calculating GL flux

    Loop over nEdgeSolve instead of nEdges when calculating GL flux. Looping
    over nEdges will give an error resulting from grounding line thickness
    <= 0 when the grounding line is at the domain boundary.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    611a77a View commit details
    Browse the repository at this point in the history
  30. Calculate grounding line flux after advection but before updating thi…

    …ckness
    
    Calculate grounding line flux after advection but before updating thickness,
    which is required to close mass budgets.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    1bdc08b View commit details
    Browse the repository at this point in the history
  31. Clean up after rebase

    Fix a few minor issues that were not caught during the rebase.
    trhille committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    0e6025e View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2024

  1. Remove code that was inadvertently overwriting grounded and floating …

    …calving thickness
    
    Remove block of old code that was inadvertently overwriting grounded
    and floating calving thickness after they were calculated incrementally.
    trhille committed Jul 10, 2024
    Configuration menu
    Copy the full SHA
    0afc6db View commit details
    Browse the repository at this point in the history
  2. Update halos on incrementalCalvingThickness

    Replace the allocatable array dCalvingThickness with a Registry
    variable incrementalCalvingThickness, and update halos after calling
    li_apply_front_ablation_velocity and before subtracting from ice thickness.
    trhille committed Jul 10, 2024
    Configuration menu
    Copy the full SHA
    a54c8cb View commit details
    Browse the repository at this point in the history