-
Notifications
You must be signed in to change notification settings - Fork 0
Add 3d thermal forcing to OCN-GLC coupling #121
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 3d thermal forcing to OCN-GLC coupling #121
Conversation
b8b7531 to
c275d15
Compare
|
@cbegeman , @xylar , I marked you both as reviewers. I think a review from one of you is sufficient, but I wanted this on both of your radars. Other people who may want to look at this or weigh in on details (but I don't think a review is required): @irenavankova, @darincomeau , @alexolinhager, @trhille |
|
@jonbob , see note above about new OCN2GLC_TF_SMAPNAME mapping files. Let me know if you want me to create those or if you prefer to do so. |
|
After talking with @darincomeau , it became clear that there already is an unused coupler variable for ice-sheet runoff flux to the ocean, Here is a figure showing that the facemeling flux in MALI is being received by MPAS-Ocean properly. You have to zoom far in to see the nonzero facemelt flux values on the 8km MALI mesh, so they are highlighted with red circles. This run dies in sea ice, so more work needs to go into confirming the flux magnitude is reasonable (for reference, the value at the mouth of the Amazon is 2e-4) and if some sort of smoothing needs to be added (which might requires separating this flux from |
7243469 to
83c89bb
Compare
|
@cbegeman and @xylar , I tried changing the melt flux from MALI to MPAS-Ocean to occur through For the intermediate step of this PR, do you think it is better to switch back to Also, are you sure that |
|
I'm fine with switching back to |
|
@matthewhoffman, I would feel best about using |
xylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthewhoffman, I have only partially looked through the code but wanted to flag a significant problem before I continue.
You are using a z-level approach to find the depth that each value in glcZLevels corresponds to. This is not really a safe assumption anywhere in MPAS-Ocean but it is particularly poor for the Antarctic application because the vertical coordinate is very far from z-level inside of and within about a 20-cell ring around ice-shelf cavities. Instead, we need to find zMid that is closest to a given entry in glcZLevels.
| -ninst_glc NINST_GLC for this case | ||
| -mali_dynamic turns on dynamic ice sheet mode | ||
| Options are: FALSE, TRUE | ||
| -glc_nzoc number of z-ocean classes [0 | 4 | 30] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanting to check that these are the only 3 supported values. It sounded in our discussion like the number was flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, these are hard-coded in glc_zocnclass_init_default()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. I followed the implementation of land model multiple elevation classes. In principle any number of levels (and any array of level elevations) is supported, but in practice a small set of numbers of levels are hard-coded and each has a hard-coded array of level positions. This seems like a reasonable tradeoff between flexibility and complexity.
| -ninst_ocn NINST_OCN for this case | ||
| -ocn_tidal_mixing variable for defining if to run with parameterized tidal mixing | ||
| Options are: false, true. Default is false | ||
| -glc_nzoc number of z-ocean classes for indirect glc-ocn coupling [0 | 4 | 30] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above: is this restricted to only these 3 values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my longer response to a related question below. I followed the implementation of the land multiple elevation classes, which hardcodes a small number of options for the number of levels, and each one corresponds to a preset array of levels. There is functionality (in land MECs and also my new ocean z-levels) to initialize to a custom array of levels, but there is not at present a way to read them in from file. That would need to be added in the future if we wanted to support that level of generality.
| lines.append(' output_interval="none">') | ||
| lines.append(' output_interval="00-00-01_00:00:00">') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to make this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for flagging - there are a number of streams settings I've committed for convenience but I will need to remove once the draft version of this PR is complete. I've separated such changes in commits with obvious names.
components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Outdated
Show resolved
Hide resolved
components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Outdated
Show resolved
Hide resolved
components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Outdated
Show resolved
Hide resolved
components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Outdated
Show resolved
Hide resolved
xylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've looked through the code and what I've mentioned so far seem like my only concerns. I really appreciate what a heap of work this has been. It's really exciting!
components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Outdated
Show resolved
Hide resolved
| -ninst_glc NINST_GLC for this case | ||
| -mali_dynamic turns on dynamic ice sheet mode | ||
| Options are: FALSE, TRUE | ||
| -glc_nzoc number of z-ocean classes [0 | 4 | 30] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, these are hard-coded in glc_zocnclass_init_default()
| select case (glc_nzoc) | ||
| case(0) | ||
| ! do nothing | ||
| case(4) | ||
| zocn_levels = [-250._r8, -750._r8, -1250._r8, -1750._r8] | ||
| case(30) | ||
| zocn_levels = [ -30._r8, -90._r8, -150._r8, -210._r8, -270._r8, & | ||
| -330._r8, -390._r8, -450._r8, -510._r8, -570._r8, & | ||
| -630._r8, -690._r8, -750._r8, -810._r8, -870._r8, & | ||
| -930._r8, -990._r8, -1050._r8, -1110._r8, -1170._r8, & | ||
| -1230._r8, -1290._r8, -1350._r8, -1410._r8, -1470._r8, & | ||
| -1530._r8, -1590._r8, -1650._r8, -1710._r8, -1770._r8] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way to make this more general (at least in the longer term)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably - and that is what I had originally imagined doing - but the way I implemented it is how the LND multiple elevation classes are handled: https://github.com/E3SM-Project/E3SM/blob/master/driver-mct/shr/glc_elevclass_mod.F90#L85-L109 and after thinking about it more, the likelihood of wanting to specify a custom set of z-levels seems pretty low.
That said, the land multiple elevation class module includes an override version of the init routine that supports passing a pre-defined array instead of using one of the hard-coded ones: https://github.com/E3SM-Project/E3SM/blob/master/driver-mct/shr/glc_elevclass_mod.F90#L33-L36
I've included that functionality in the new z-level module. The override functionality is not used anywhere, but if we ever wanted to add that, we would control that here: https://github.com/E3SM-Project/E3SM/blob/master/driver-mct/shr/seq_flds_mod.F90#L472 The more complicated part would be implementing a mechanism by which to input the desired list of z-levels (presumably in a case xml file).
xylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more small things that I'm changing in the update I'm working on. Just want to point them out for posterity.
components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Outdated
Show resolved
Hide resolved
components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Outdated
Show resolved
Hide resolved
|
@matthewhoffman, I moved the 3d thermal forcing calculation to a subroutine of its own. I switched to finding the depth of the glc z levels using I made sure that the test you ran above also passed for me: That's as far as I got so far. It would be really good if we could write out the time-averaged fields on both the MPAS-Ocean and the MALI sides and carefully look at them (before extrapolation) to make sure they make sense. |
cd548ea to
1d8243c
Compare
|
Sorry for the force-push. Bad practice. I had an uncommitted change that I didn't want to add in an extra fix-up commit but probably should have. |
xylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the remaining check boxes (mapping files and removing temp commits) get checked, I think this is ready to move to E3SM from my point of view.
These liquid runoff fluxes are currently added to the river runoff flux in the coupler before being passed to the ocean. If we want to change the horizontal or vertical distribution of how these are handled in the ocean, we'll need to separate them in the future. Also needed is time averaging of fluxes, which has not yet been implemented in MALI.
This way it will also extract latent heat from the ocean. Note that doing it this way, it will be combined with the calving flux. Long term, we will likely want to handle them separately so they can use different horizontal and vertical distributions. But at present MALI's calving flux is not even hooked up, so that will need to be addressed at a later date.
This updates GLC2OCN_LIQ_RMAPNAME and GLC2OCN_ICE_RMAPNAME mapping files to use nearest neighbor with runoff area rescaling. The old mapping files did not have the area-scaling applied. This needs to be updated for other meshes using these mappers once the updated mapping files are generated.
This commit adds a 3d mask field to MPAS-Ocean for tracking what fraction of time steps in the time average are valid. If the fraction exceeds 0.9, then the driver considers that location valid and passes the value to the coupler along with a coupler mask value of 1. This new coupler mask field matches the dimensionality of the 3d TF field and is passed to MALI. MALI evaluates the mask in its import routine and only uses TF from locations that have at least 50% overlap with MPAS-Ocean cells. In those locations, it uses the TF passed through the coupler, scaled by the area fraction. In location that don't satisfy that criterion, the MALI extrapolation mask is set to 0 and an invalid TF value is inserted in the 3d TF field.
This merge uses zMid instead of refBottomDepth to determine how to linearly interpolate temperature, salinity and pressure to z-levels (`glcZLevels`), then uses them to compute thermal forcing.
With TF-driven ice-shelf basal melt being passed through rofi, it is possible that field will be negative in places where TF<0 and ice shelves experience freeze-on. This commit removes a check that was assuming this could not happen,
The existing test for 2d TF coupling has been replaced. Now that 3d TF is automatically activated when OCN and GLC are both active, the test for this can be simplified - a testmod to enable TF coupling is no longer required, so that ocn_glc_tf_coupling testmod has been removed. Tests using the 3d TF coupling for both GIS and AIS low res meshes have been added to e3sm_ocnice_stealth_features suite.
This new variable in driver-mct/cime_config/config_component_e3sm.xml replaces the existing MPASO_ISMF variable in components/mpas-ocean/cime_config/config_component.xml. This variable is available to both MPAS-O and MALI (even if one of the components is inactive). The new neutrally-located variable would allow both components to know how to handle ISMF consistently if they are both active, as well as support all the ISMF modes each component uses when the other component is inactive, e.g. in standard B or G cases (i.e., no MALI active) or IG cases (i.e., no MPAS-O active).
Its functionality has been replaced by the 3d TF coupling in this branch. The old 2d version is removed to reduce code maintenance overhead.
This is to be consistent with the routine for calculating 3d TF and typical MPAS-O conventions.
The TF fields do not require the 0-based indexing that the land multiple elevation classes uses for bare land. Also remove unneeded metadata calls, as those are handled in the routine that sets up all the z-level classes.
'none' is set when the compset does not include the ocean
7cc1e0f to
abd197b
Compare
|
@xylar , FYI, I removed the temporary changes to the MPAS-O streams file from the commit where they occurred and force-pushed. I also made a list in the PR description of the mapping files that need to be updated. Once I've coordinated with Jon to get those in place, I'll move this PR over to the main repo for final review. |
|
@matthewhoffman -- the new files have been added to this branch, and staged on the inputdata repo. Please test as much as you think is necessary |
TestingUltra low res ocean
Low res ocean
|
5fb229f to
105edf3
Compare
Both Greenland meshes currently have issues that cause problems when using OCN2GLC_TF_SMAPNAME mapping files that don't have extrapolation. For the gis4to40 mesh, there is an "inland sea" region that does not get valid ocean thermal forcing, leading to MALI errors in facemelting. Here, I've switched the map file to one that includes extrapolation to work around this issue. The inland sea problem is being fixed in a different PR, and after that is merged, this map file can be switched back to the version without extrapolation, so that the bathymetry-aware extrapolation inside of MALI can be used instead. The gis1to10kmR2 mesh has a different problem - the ocean "gutter" is too narrow and only overlaps the IcoswISC30E3r5 grid in a few places. Switching to a OCN2GLC_TF_SMAPNAME mapping file that includes extrapolation similarly works around this problem. A more thorough solution will require creating a new high-res GIS mesh with a larger gutter.
|
With the workarounds in the most recent commit (1e3b2e1), the 3 Greenland tests that failed now pass. The larger issues related to those failures are outside the scope of this PR, so I can consider this PR ready to merge. I will move this PR to the main repo and any further evaluation can occur there. |
|
PR moved to E3SM-Project#7215 |






This pull request extends the existing thermal forcing functionality from a single depth to a predefined set of z-levels. The coupler implementation follows that of multiple elevation classes in the LND-GLC coupling. A new coupler variable is added, GLC_NZOC. It has a default value of 0, meaning TF coupling is disabled. The standard value for when the coupling is activated is 30, which follows the TF z-levels used by ISMIP6. Other values are supported, and an additional example with 4 levels is included. A new coupler module, glc_zocnclass_mod.F90, is added which is follows very closely from glc_elevclass_mod.F90. It contains subroutines and functions to initialize the ocean z-level classes and to access the z-level values. It also has subroutines to provide the z-level indices as strings, which the coupling field initialization code and the component import/export routines uses to create GLC_NZOC fields, one for each layer.
The intention is that this 3d TF coupling will be used for facemelting (melting at vertical glacier margins terminating in the ocean), and so is used for a process that we do not anticipate resolving explicitly in MPAS-Ocean. As such, this coupling should be included anytime both OCN and GLC are active, and logic has been added so that this is the case based on compset definition. There are versions of the GLC_NZOC variable in both the MPAS-Ocean and MALI Registries so that it can be set by namelist settings controlled by CIME/build operations.
The MPAS-Ocean mpas_ocn_time_average_coupled.F module has been modified to loop over the z-levels and calculate TF at each one. Then, the time-averaged 3d TF values are passed to the coupler, where they are remapped to the GLC mesh and passed to MALI. MALI assigns the values to the existing 3d TF field, and the uses its bathymetry-aware extrapolation routine to extrapolate the TF values from the edge of the MPAS-Ocean domain to wherever the ice-sheet margin is on the MALI mesh. From there, the TF is used to force the facemelting parameterization.
The facemelting flux in MALI is exported to the previously unused Fogg_rofl flux, which already gets combined in the coupler with river runoff to be imported in MPAS-Ocean in the Foxx_rofl flux. Long term, we may want to separate these runoff fluxes so that the horizontal and vertical distribution of facemelting can be handled differently than river runoff, but this provides a reasonable first approximation.
Note that this 3d TF can also be used to force the ISMIP6 ice-shelf basal melt parameterization in MALI, which provides a less sophisticated alternative to using ice-shelf basal melt rates calculated in the coupler (or MPAS-Ocean). This simpler approach will be used for the few, small ice shelves in Greenland, which are not included in the MPAS-Ocean meshes (and would not be resolved even if they were). This approach could also be used for Antarctica as an alternative that avoids grounding line migration issues in MPAS-Ocean by taking advantage of the TF extrapolation in MALI.
This PR is now functional, but some additional work is needed before this is complete and ready for review at the main E3SM repo:
ERS_Ld5.TL319_oQU240wLI_gis4to40.MPAS_FOLISIO_JRA1p5.mpaso-jra_1958and theocn_glc_tf_couplingtestmod should be removed fromcomponents/mpas-ocean/cime_config/testdefs/testmods_dirs/mpaso/ERS_Ld5.TL319_oQU240wLI_ais8to30.MPAS_LISIO_JRA1p5.mpaso-jra_1958Required mapping files
OCN2GLC_TF_SMAPNAME: bilinear without extrapolation
GLC2OCN_LIQ_RMAPNAME: nearest-neighbor from rof2ocn masked
GLC2OCN_ICE_RMAPNAME: nearest-neighbor from rof2ocn no-mask