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

Remove "Build Type" option from albany input file. #6286

Closed
wants to merge 49 commits into from

Conversation

mperego
Copy link
Contributor

@mperego mperego commented Mar 8, 2024

Remove "Build Type" option from albany input file.

Epetra solver stack is no longer available through Albany and this change will be needed with newer versions of Albany.
See sandialabs/Albany#1028

This will work with older versions of Albnay if Albany is built with no Epetra support.

hollyhan and others added 30 commits January 14, 2024 21:21
Update MALI-Dev/develop with latest code in E3SM-Project/master after
having recently merged the other way. Needed to keep MALI-Dev/develop
from getting out of date with non-MALI code.

* e3sm/master: (2435 commits)
  Provenance: do not crash if config_src does not exist
  SMP_PRESENT is gone, use BUILD_THREADED
  Disable gpu env-vars in cpu runs; append cuda path to link flags
  CPL: Fix uninitialized variable.
  update fates external for API31 refactor
  refactor elmfates api to avoid calling hlm-side procudures
  Set E3SMinput project paths and 1:1 MPI-to-GPU affinity
  Array initialization
  Re-added FATES specific initialization for fire calculation.
  Update gnugpu, nvidia and nvidiagpu cmake and modules
  Add `-fopenmp` for OpenMP support with cray-cray
  Adjust gnugpu_frontier.cmake macro
  Update paths and modules, add gnu config
  Update paths and queues
  Update Polaris config
  add polaris machine
  persist-credentials: false
  Bump actions/setup-python from 4.7.0 to 5.0.0
  Fix Homme Cmake, EKAT subm update changed the EkatBuildKokkos module
  Fix MOAB compile issues
  ...
After further inspection, I realized that the mass conservation equation
used to evolve sheet thickness is missing a source term from the
production of meltwater within the channel.  This is the 2nd term on the
RHS of Hewitt (2013) Eq. 7, and it is missing from Eq. 54 in the Hoffman
et al. 2018 GMD paper.

Melt production in the channel is generally a small contribution to the
total water balance, which may explain why the model matched GlaDS well for
the SHMIP experiments.  It's possible this correction will help with
channel blowup events, or it could make them worse - it's hard to think
through how this affects those events without better characterizing
what's causing them.  In any case, this is a clear omission and should
be used going forward.
This reverts commit ae98181.

It seems like we would want the channel model to see the elevation head
produced by a lake's water thickness to ensure that channel flow is
consistent with the presence of the lake.  This commit reverts the
commit that dropped the water thickness elevation head from the
hydropotential gradients used by the channel.

In the sheet model, the elevation head is removed from the advection
equation, but it is handled by the diffusion equation, so it's still
represented in the evolution.  As the channel model currently exists,
the elevation head is almost completely absent (other than its effect
on the magnitude of gradMagPhiEdge).  It seems like this could lead to
channels draining *into* lakes even when the full hydropotential
gradient of the lake indicates water flow should be draining the lake.
The water thickness in the ocean is undefined, and if anything we'd have
diffusion from the ocean (thick water layer) to the grounded ice, and we
don't want any flux from the ocean inward.
Previously the call to mpas_calculate_barycentric_weights_for_points to
set up barycentric weights for interpolation from cells to vertices
occurred in the mpas_li_sia.F module.  However, these weights may also
be needed by the subglacial hydro code, which can be called with any (or
none) velocity solver.  This commit moves that initialization to
mpas_li_setup and adds logic to call the weight generation routine if
either the SIA or SGH code requires it.
Without explicitly doing this, the gradients are likely using
neighboring values of 0, which would yield unexpectedly large gradients.
This commit explicitly treats the calculation of hydropotentialBaseSlopeTangent
near mesh boundaries.
For the two vertex based methods, edges with vertices on the boundary
of the mesh will have invalid values.
For the normal slope method, any edges on cells that are at the
edge of the mesh will have contaminated values.
In those cases, set tangent slope to zero rather than leaving the
possibility of garbage values.
Without this change, the CFL condition might be overly restrictive
because values from cells that aren't part of advection get included in
the calculation and they may happen to have values that are more
restrictive than the valid edges.
Simplify calculation disallowing inflow and move it *before* extra logic
limiting outflow gradient.
Channels now use updated version of gradMagPhiEdge, which is dependent
on full hydropotential. This is done to keep channels from filling up
lakes even when lake is full and  hydropotential is in opposite direction.

Distributed system is now dependent on new variable gradMagPhiBaseEdge,
which is dependent only on hydropotentialBase and is equivalent to
gradMagPhiEdge in previous commits.
Creates hydroTerrestrialMarginMask variable, which designates the
terrestrial margins of the active subglacial hydrology model
Edits description of config_SGH_tangent_slope_calculation in
Registry_subglacial_hydro.xml based on detailed testing of
'from_normal_slope' and 'from_vertex_barycentric' options.
Explicitly sets diffusivity to zero at boundary edges, instead of just
waterFluxDiff
Redfines hydroTerrestiralMarineMargin to AT or above sea level, whereas
hydroMarineMarginMask is exclusively below sea level.
Debugs calculations of channelAreaChangeCell and channelMeltInputCell.
Loop where these were being calculated was overwritting cell values each
iteration through nEdgesOnCell. Now each cell is the sum of all of its edges as
intended.
This is necessary to get BFB results on different decompositions.  This
addition was made necessary by c9c13aa.

There may be a way to adjust halo updates to avoid needing to add these
both, as they are both local calculations.  But it is likely complex, so
this solution is adequate in that it works.
As previously ordered, the operations in evolving waterThickness and
pressure variables were out of sync, resulting in the full
hydropotential variable using the old waterThickness in the term
calculating the water layer elevation head.  This was causing restarts
with the channel model to fail and channel hydropotential gradients to be
inaccurate (unknown how significant that was).  This commit moves the
pressure calculation to eliminate this issue.  Code comments explain in
more detail.
This is needed for BFB restarts with the till model.  We never use the
till model, but I identified this issue while debugging channel restarts.
…ev/develop

This PR introduces a number of fixes and improvements to the subglacial hydrology model
to get it to run more stably, mostly related to handling of boundaries of the subglacial
hydrology domain:

* Adds a missing channel melt source term to the mass cons eqn.  This term is typically
  very small but was missing
* Make channels see the elevation head of lake thickness in the hydropotential to avoid
  channels flowing in to lakes
* Disable diffusive water flux at grounding line where water thickness is undefined
* Explicitly handle gradients at boundaries of the mesh where they are undefined
* Move the ordering of the pressure calculation to enable consistency in the time levels
  used for key model variables (affects channel model only)
* Update channel CFL calculation to only consider valid edges
* zero the diffusivity at domain boundaries to prevent those edges from affecting diffusive CFL
* creation of new hydroTerrestrialMarginMask to be used for handling boundaries of the SGH domain
* other minor cleanup/adjustments

* origin/matthewhoffman/mali/hydro_boundary_cleanup:
  Initialize deltatSGH only on a cold start & make it a restart variable
  Move pressure calc so it uses consistent time levels of variables
  Add halo updates on two channel variables
  fix typo
  channelAreaChangeCell/channelMeltInputCell debug
  hydroTerrestrialMarginMask >= sea level
  Zero diffusivity at boundary edges
  Edit SGH_tangent_slope_calculation description
  Create hydroTerrestrialMarginMask
  Channel gradMagPhiEdge dependent on full water hydropotential
  Update gradient calulations at boundaries of hydro domain
  Adjust hydro CFL calculation to ignore invalid edges
  Treat tangent slope calculation near boundary of mesh
  Zero gradients at edges of the mesh
  Move call to mpas_calculate_barycentric_weights_for_points
  Disable diffusive water flux at grounding line
  Revert "Ignore the water thickness head in the channel model"
  Add missing channel melt source term to mass cons eqn
- Add "totalSubglacialWaterVolume"
- Add "totalLakeVolume"
- Add "totalBasalMeltInput"
- Add "totalExternalWaterInput"
- Add "totalChannelMelt"
- Add "totalGLMeltFlux"
- Add "totalTerrestrialMeltFlux"
- Add "totalChannelGLMeltFlux"
- Add "totalChannelTerrestrialMeltFlux"
- Add "totalFlotationFraction"
- Add "avgFlotationFraction"
Adds conditional statements in mpas_li_global_stats.F to prevent
calculating SGH global stats when SGH model is deactivated.
The basalMeltInput term was including non-grounded ice in the
calculation of the totalBasalMeltInput and giving wrong answers. The
mask ensures that only basal melt occurring under grounded ice is considered.
This PR request includes updates to the global stats to include new analysis members for subglacial hydrology.

The new analysis members are:
* totalSubglacialWaterVolume
* totalSubglacialLakeVolume
* totalSubglacialLakeArea
* totalBasalMeltInput
* totalExternalWaterInput
* totalChannelMelt
* totalDistWaterFluxMarineMargin
* totalDistWaterFluxTerrestrialMargin
* totalChnlWaterFluxMarineMargin
* totalChnlWaterFluxTerrestrialMargin
* avgFlotationFraction

* origin/cshafer/hydro_stats:
  Correct flotation fraction globalStat to use ice density
  Update variable names and other code review edits
  Add grounded ice mask to BasalMeltInput term
  Fix hydro globalStats bug - protect global stats calcs if SGH disabled
  Add SGH analysis members to global stats
This PR updates handling of timesteps between MALI and the SLM in a few ways:
* switch config_slm_coupling_interval to be an integer in years because we only allow
  integer year values
* On init, check that config_adaptive_timestep_force_interval divides evenly
  into config_slm_coupling_interval
* On init, check that restart interval is an even multiple of config_slm_coupling_interval
* On a restart, calculate which SLM time level to use based on the elapsed time from
  the start of the original simulation and config_slm_coupling_interval and make sure
  these divide cleanly
Also add missing =>next pointer assignment to keep code from hanging
Trying to cast intervals into dateTimeStrings did not work.
matthewhoffman and others added 19 commits February 21, 2024 13:36
Following the recent addition of subglacial hydro quantities to
the global stats analysis member, we've used those additions as
template to add the quantitites to the regional stats analysis member.
The reduction of `fluxAcrossGroundingLine` was accidently moved within
a `config_SGH` condition, so that `groundingLineFlux` would only be
calculated if `config_SGH` was turned on. Moved the reduction back to
where it was to ensure it's calculated in all situations it's needed.
The grounded ice mask is used in the calculation of the `basalMeltInput`
term but was excluded from `externalWaterInput`, which could cause
problems in closing budgets. The grounded ice mask was not added to
any of the calculations dependent on `waterThickness` b/c SGH model
explicitly sets the `waterThickness` to zero outside of the grounded
ice area.
Masking by `regionCellMasks` in SGH regional stats terms was missing,
which meant all cell centered SGH values would have been uniform across
the regions and match the global stats value.

Still not determined how the edge centered SGH value should be mask by
region (e.g. using upwind cells region or by the `regionEdgeMasks`), but
once that is decided the matching region masking needs to be done for
the SGH edge quantities.
Was missing the deallocation of `regionalSumFlotationFraction`,
which is a local variable needed for calculating the numerator
of `regionalAvgFlotationFraction`.
This commit changes how restarts are handled when the SLM is active to
allow MALI to be restarted at any arbitrary restart interval and have
the SLM restart correctly.

This is done by changing the SLM coupling alarm to be based off of the
original simulationStartTime (instead of the start time of the current
execution).  This required moving the creation of the coupling alarm to
later in initialization so that the variable simulationStartTime is
available.  With this change, it was also necessary to change the way
the SLM time level is calculated on a restart to take the floor of the
elapsed time divided by the coupling interval, rather than requiring
that there be no remainder.  This adds a little fragility because there
is no way to double check that is the correct SLM time level, but if
this is set up correctly, it should be handled properly.  Finally, as
part of these changes, I also removed the check on init that the
coupling interval divides evenly into the restart interval, because
that's no longer a requirement.  That's sort of too bad, because it was
a lot of work to figure out how to make that check!  But it's nicer to
not have that restriction.
This doesn't serve any internal purpose, but it could help a user detect an error
in their configuration.
It's not needed, and if the restart time is not a coupling interval, it
will make the SLM get out of sync.
…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
Addes `regionEdgeMask` and `regionVertexMask` to the registry so the
additional mask variables can be included in the `regionsInput` stream.
Co-authored-by: Matt Hoffman <wyeast@gmail.com>
`regionVertexMasks` can be added to the registry later when it's needed.
I've also added `regionEdgeMasks` to the restart stream and fixed and
xml type I made in the previous commit.
…evelop

This PR follows #82, which added subglacial hydrology (SGH) quantities to the
global stats analysis member, by adding SGH quantities to the regional stats
analysis member.

This PR also address a bug introduced in #82 where the calculation of
groundingLineFlux and groundingLineMigrationFlux were moved within an
if config_SGH then condition. The bug prevents groundingLineFlux and
groundingLineMigrationFlux from being calculated by global stats unless
the SGH model is turned on, despite these quantities applying to simulations
where SGH is not used.

* MALI-Dev/andrewdnolan/mali/hydro_regional_stats:
  Fix registry typo Matt caught in review.
  Remove `regionVertexMasks` from registry to minimize file size.
  Apply suggestions from code review
  Use `regionEdgeMask` to calculate SGH regional stats defined on edges.
  Deallocate `regionalSumFlotationFraction`.
  Add missing `regionCellMasks` call from SGH regional stats terms
  Add grounded ice mask to `externalWaterInput` term
  Move reduction of `fluxAcrossGroundingLine` outside SGH condition.
  Add support for subglacial hydro quantities in regional stats.
Epetra solver stack is no longer available, and this change will be needed with newer versions of Albany.
See sandialabs/Albany#1028
@mperego mperego requested a review from trhille March 8, 2024 18:44
@mperego mperego self-assigned this Mar 8, 2024
@trhille
Copy link
Contributor

trhille commented Mar 8, 2024

@mperego, we should merge this into MALI-Dev/develop instead of directly into E3SM-Project/master.

@mperego mperego closed this Mar 8, 2024
@mperego
Copy link
Contributor Author

mperego commented Mar 8, 2024

Wrong repo, sorry.

@trhille trhille deleted the mperego/removeBuildType branch March 27, 2024 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants