Align MALI/MPAS-Ocean constants with E3SM shared values and unify glacier-ice density defaults#174
Align MALI/MPAS-Ocean constants with E3SM shared values and unify glacier-ice density defaults#174Copilot wants to merge 22 commits into
Conversation
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/3d8f95f7-8b68-42cc-8c3b-19e1b8bfb47c Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/3d8f95f7-8b68-42cc-8c3b-19e1b8bfb47c Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
|
Leaving this as a draft but tagging @matthewhoffman, @xylar, @stephenprice, @mperego for discussion. |
|
@mperego Are any of these constants going to be inconsistent with values used by Albany? |
|
@trhille We don't use the enthalpy-related constants for coupled (MPAS-Albany) forward runs. For initialization we would need to match them. I don't think we have "defaults" for those constants in Albany.. but most of our input yaml files will have to be changed. If you change ice and water densities I think we would definitely have to redo the initialization of the Greenland grids. |
@mperego where can I find a list of the Albany parameter names that we'd need to change for the yaml files? |
You can find it here: However, the ones that matter for MALI forward simulations are ice density, water density, gravity acceleration and Clausius Clapeyoron coefficient ( |
matthewhoffman
left a comment
There was a problem hiding this comment.
@trhille , thanks for tackling this needed but fussy set of changes. I've made some comments about additional constants that could be aligned with shr_const_mod. I think ideally we would end up with no constants that don't come from there when running in E3SM, so I also flagged constants that could be added to shr_const_mod to enable that. (The only exception is scyr which I think is fine to remain outside the ifdef block.)
The issue you ask about related to ice and ocean densities is a tougher one and the main reason I had put off trying to address this set of changes. I will follow up on that item in a separate comment.
| #endif | ||
|
|
||
| real (kind=RKIND), parameter, public :: kin_visc_water = 1.793e-6_RKIND !< kinematic viscosity of freshwater at 0 deg C (m^2 s^-1) | ||
| real (kind=RKIND), parameter, public :: idealGasConstant = 8.314_RKIND !< ideal gas constant (J mol^-1 K^-1) |
There was a problem hiding this comment.
This one can be aligned with SHR_CONST_RGAS
There was a problem hiding this comment.
This could be rewritten in terms of this:
https://github.com/E3SM-Project/E3SM/blob/master/share/util/shr_const_mod.F90#L65-L66
@xylar , what do you think? oceanFreezingTempDepthDependence is used in 3 places in MALI:
- Jourdain ice-shelf melt rate param for adjusting Tf with depth
- vertical TF extrapolation
- calculating basal temperature of ice shelves in thermodynamics calculation
There was a problem hiding this comment.
We should instead see if we can add this (or these) to PCD. But it's a pretty ad hoc constant. We do need a citation at least.
|
|
||
| #endif | ||
|
|
||
| real (kind=RKIND), parameter, public :: kin_visc_water = 1.793e-6_RKIND !< kinematic viscosity of freshwater at 0 deg C (m^2 s^-1) |
There was a problem hiding this comment.
@xylar , should this be added to share/util/shr_const_mod.F90?
|
Regarding the density of ice in ice sheets, I've always felt 917 kg/m3 is the wrong value to use, because glacier ice is known to have slightly lower density than that. It's not a big enough difference to overcomplicate things, so I can be convinced to live with 917 if it just makes other things easier. But in looking at where this constant is used in E3SM outside of MALI, it is in the sea ice, land, and ocean components. I think it makes sense for sea ice and land to continue using Rather than using So the situation is MALI and MPAS-Ocean both only support the density of glacier ice as coming from their respective namelists with no way to ensure consistency. I propose the following solution:
This solution would allow the following:
|
|
Oof, we are trying to move shr_const_mod itself to use Physical Constants Dictionary (https://github.com/E3SM-Project/E3SM/blob/master/share/util/pcd_const.F90), original sources: https://github.com/E3SM-Project/E3SM/blob/master/share/pcd.yaml It would be a bit unfortunate to try to add anything new to |
|
Regarding ice density, I don't have strong feelings. Please do delete the unused |
|
@xylar , thanks for the reminder about PCD; I had totally forgotten about that migration! |
Align pi with SHR_CONST_PI and express scyr in terms of seconds_per_day. Co-authored-by: Matt Hoffman <wyeast@gmail.com>
|
@xylar , to elaborate on PCD, it looks like the proper way to introduce changes is through this standalone PCD repo which autoupdates E3SM: https://github.com/e3sm-project/PhysicalConstantsDictionary (Sorry, @trhille , that would mean a substantial refactor of this PR, though, granted, it's not a ton of lines.) |
trhille
left a comment
There was a problem hiding this comment.
Telling @copilot what to do next based on the above discussion.
In addition to the changes requested in line comments, do the following:
- delete the unused rho_ice from MPAS-Ocean.
- Add a shared constant for ice density (something like SHR_CONST_RHOGLACIERICE to the Physical Constants Dictionary (PCD): https://github.com/E3SM-Project/E3SM/blob/master/share/pcd.yaml
- Add logic to MALI and MPAS-Ocean to use a default density defined in their respective mpas_*_constants.F module when their respective ice density namelists are set to negative values
- In the MALI and MPAS-Ocean respective mpas_*_constants.F modules, use SHR_CONST_RHOGLACIERICE` when in E3SM and 910 when not.
- Update namelist_defaults.xml for both components to set their respective glacier ice density namelist variables to -1 in E3SM to trigger the use of the shr_const version.
|
|
||
| #endif | ||
|
|
||
| real (kind=RKIND), parameter, public :: kin_visc_water = 1.793e-6_RKIND !< kinematic viscosity of freshwater at 0 deg C (m^2 s^-1) |
There was a problem hiding this comment.
Add this to https://github.com/E3SM-Project/E3SM/blob/master/share/pcd.yaml and use that definition for MALI.
| #endif | ||
|
|
||
| real (kind=RKIND), parameter, public :: kin_visc_water = 1.793e-6_RKIND !< kinematic viscosity of freshwater at 0 deg C (m^2 s^-1) | ||
| real (kind=RKIND), parameter, public :: idealGasConstant = 8.314_RKIND !< ideal gas constant (J mol^-1 K^-1) |
There was a problem hiding this comment.
Align idealGasConstant with SHR_CONST_RGAS.
There was a problem hiding this comment.
Add oceanFreezingTempDepthDependence to https://github.com/E3SM-Project/E3SM/blob/master/share/pcd.yaml and use that value for MALI.
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/74693bcd-9e18-4d93-87b5-a1f4bdd572f4 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/74693bcd-9e18-4d93-87b5-a1f4bdd572f4 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
There was a problem hiding this comment.
@copilot, instead of adding values to this module, please add them to https://github.com/MALI-Dev/E3SM/blob/develop/share/pcd.yaml and have MALI import them from https://github.com/MALI-Dev/E3SM/blob/develop/share/util/pcd_const.F90.
There was a problem hiding this comment.
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/a5a1e2e0-9606-4ef4-a46d-4466f200b763 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
There was a problem hiding this comment.
@copilot, this file should not be edited directly, as it is auto-generated from pcd.yaml
See the header in https://github.com/E3SM-Project/E3SM/blob/master/share/util/pcd_const.F90
! WARNING! DO NOT EDIT THIS FILE!
! This file was generated automatically from pcd.yaml
! For more information, visit https://github.com/e3sm-project/PhysicalConstantsDictionary
There was a problem hiding this comment.
Addressed in b1ba1c4: I restored share/util/pcd_const.F90 to the autogenerated form (including the generated-file header) and removed the direct usage of manually-added pcd_const symbols in MALI/MPAS-Ocean code paths.
Agent-Logs-Url: https://github.com/MALI-Dev/E3SM/sessions/dfd195c1-4eeb-4b8e-9d97-572d8c024e74 Co-authored-by: trhille <17446278+trhille@users.noreply.github.com>
Yes, that's exactly right. |
@trhille, we can't edit this file. It needs to be done upstream in the https://github.com/e3sm-project/PhysicalConstantsDictionary repo. |
@matthewhoffman, should this be |
|
mpas_li_constants.Fhad hard-coded values that diverged from E3SM shared constants, creating cross-component inconsistency risk for thermodynamic and time-conversion constants. This PR aligns those constants and extends the fix to unify glacier-ice density behavior between MALI and MPAS-Ocean in coupled E3SM runs.Shared-constant propagation (
MPAS_ESM_SHR_CONST)shr_const_modwhere appropriate, including:iceConductivity => SHR_CONST_CONDICEkelvin_to_celsius => SHR_CONST_TKFRZseconds_per_day => SHR_CONST_CDAYidealGasConstantaligned viaSHR_CONST_RGASFallback value alignment (
#else)cp_ice:2009.0→2.11727e3latent_heat_ice:335.0e3→3.337e5cp_seawater:3.974e3→3.996e3scyroutside the conditional block and defined it fromseconds_per_day.Glacier-ice density consistency across MALI and MPAS-Ocean
rho_icefrom MPAS-Ocean constants and uses a glacier-ice default variable for land-ice flux logic.config_ice_density < 0config_land_ice_flux_rho_ice < 0config_ice_density = -1.0(MALI)config_land_ice_flux_rho_ice = -1(MPAS-Ocean)PCD file handling correction
share/util/pcd_const.F90is treated as auto-generated fromshare/pcd.yamland is no longer manually authored.Code-level example
This keeps standalone configurability while ensuring coupled E3SM defaults are aligned and consistent across components.