Skip to content

Conversation

zhangshixuan1987
Copy link
Contributor

@zhangshixuan1987 zhangshixuan1987 commented May 16, 2025

This pull request introduces a new module and function in the MPAS-Ocean (MPAS-O) model to compute and apply a scaling factor on precipitation fluxes. The goal of this feature is to help maintain freshwater balance in ocean-only simulations by mitigating the spurious linear trend observed in sea surface height (SSH) over time. The updates specifically target uncoupled ocean configurations, including:

  • G-case: ocean + sea ice with data atmosphere
  • J-case: land + river + ocean + sea ice with data atmosphere

These configurations do not include a dynamically coupled atmosphere, and thus lack the feedback mechanisms necessary for naturally maintaining freshwater balance. This PR provides a workaround by dynamically adjusting the precipitation flux.

[NML]
[BFB] - stealth feature, off by default


Problem Overview

In E3SM preindustrial (1850) spin-up simulations using standalone ocean or ocean-plus-land configurations—particularly when driven by prescribed historical atmospheric forcing—a pronounced linear trend appears in the sea surface height (SSH) anomaly fields (Figure 1). This trend signals a breakdown in the freshwater budget, which is normally maintained in fully coupled simulations. Without an interactive atmosphere, the ocean component cannot influence freshwater fluxes such as precipitation and snowfall, eliminating the feedback mechanisms necessary for a balanced system. As a result, the standalone spin-up generates unrealistic SSH states, degrading the initial conditions used for fully coupled production runs.
Figure 1

Solution Summary
This pull request introduces a mechanism to dynamically enforce freshwater balance in standalone ocean configurations of E3SM. It implements a scaling scheme that adjusts the atmospheric precipitation fluxes (rain + snow) passed to the ocean model. The scaling factor is derived from the diagnosed imbalance between precipitation, evaporation, and river runoff, ensuring that the net freshwater input to the ocean evolves conservatively over time. This approach helps mitigate the spurious sea surface height drift typically observed in long spin-up simulations without interactive atmospheric feedbacks (see example in Figure 2 for time evolution of SSH after applying the scaling scheme in this pull request).
Figure 2

Key Features

  • Precipitation scaling logic: Applies a time-evolving or constant scaling factor to rain and snow fluxes from the prescribed atmosphere to maintain freshwater balance.

  • Runtime diagnostics: Tracks and reports freshwater flux terms to evaluate the effectiveness of the adjustment.

  • Targeted simulation: Designed for use in standalone ocean and ocean-land E3SM configurations, particularly during long spin-up phases.

Design and Documentation
Full technical details, including derivation of the scaling algorithm, code structure, verification strategy, and validation results, are documented at:
Design Document: Dynamical adjustment on freshwater fluxes balance for E3SM runs

@zhangshixuan1987 zhangshixuan1987 self-assigned this May 16, 2025
@zhangshixuan1987 zhangshixuan1987 added mpas-ocean data-ocean data-models MPAS-Ocean standalone Issues and features for standalone MPAS-Ocean code that dont impact E3SM. labels May 16, 2025
@zhangshixuan1987 zhangshixuan1987 changed the title Zhan391/precfactor Dynamical adjustment on freshwater fluxes balance for E3SM runs May 16, 2025
@xylar
Copy link
Contributor

xylar commented May 17, 2025

@zhangshixuan1987, this seems like a nice capability. I'll take a look early this coming week.

Concerning labels, I would not use data-ocean, which I think is used for when the ocean itself is in data mode, or MPAS-Ocean standalone, which we use for features that are used outside of E3SM entirely when we build MPAS-Ocean in standalone mode.

@zhangshixuan1987 zhangshixuan1987 removed data-ocean data-models MPAS-Ocean standalone Issues and features for standalone MPAS-Ocean code that dont impact E3SM. labels May 18, 2025
@zhangshixuan1987
Copy link
Contributor Author

@zhangshixuan1987, this seems like a nice capability. I'll take a look early this coming week.

Concerning labels, I would not use data-ocean, which I think is used for when the ocean itself is in data mode, or MPAS-Ocean standalone, which we use for features that are used outside of E3SM entirely when we build MPAS-Ocean in standalone mode.

Hi @xylar : Thank you for the clarification. I removed the labels "data-ocean" and "MPAS-Ocean".

Copy link
Contributor

@xylar xylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zhangshixuan1987! This looks promising!

A few questions and suggested changes to begin with. The bulk of the code looks very good to me, similar to the scaled DISMF/DIB approach.

@zhangshixuan1987 zhangshixuan1987 requested a review from rljacob May 19, 2025 19:35
@xylar
Copy link
Contributor

xylar commented May 19, 2025

Thanks @zhangshixuan1987! That's nice to have fixed up (not just your additions but other problems left by others in the registry).

@rljacob
Copy link
Member

rljacob commented May 19, 2025

This only affects uncoupled cases? The PR description needs to have a more brief summary at the top.

@zhangshixuan1987
Copy link
Contributor Author

@rljacob : Hi Rob, thank you for the suggestions. Yes, the pull request currently only targets the uncoupled cases (G-case or GCase+ ICase). I added a "Brief description" section at the top, and hopefully this is a correct understanding on your suggestions.

@rljacob
Copy link
Member

rljacob commented May 19, 2025

That's better. Is this a stealth feature or is it on by default?

@zhangshixuan1987
Copy link
Contributor Author

zhangshixuan1987 commented May 20, 2025

That's better. Is this a stealth feature or is it on by default?

@rljacob: I think we need to ask the ocean team members @xylar @cbegeman @jonbob and @maltrud to see if this should be turned on by default.

@vanroekel
Copy link
Contributor

@rljacob does stealth impact G/G-I/C cases? I guess so if we have G-cases in testing. I'd want to see impacts in a much longer test before this is turned on by default (at least a couple JRA cycles)

@rljacob
Copy link
Member

rljacob commented May 20, 2025

Yes we test G-cases. My question is about how its currently implemented. You can always change it later.

@jonbob
Copy link
Contributor

jonbob commented May 20, 2025

I think this should be a stealth feature until it undergoes a lot more testing in a lot of configurations. But I think as it is coded, it is a stealth feature and is off by default

@maltrud
Copy link
Contributor

maltrud commented May 20, 2025

I agree with @jonbob and @vanroekel. it should be stealth for now.

@cbegeman
Copy link
Contributor

I agree. Let's keep it a stealth feature.

@jonbob jonbob added BFB PR leaves answers BFB NML labels Jul 24, 2025
@jonbob
Copy link
Contributor

jonbob commented Jul 24, 2025

@zhangshixuan1987 - we have some scripts to make the bld files consistent with the changes to Registry. I ran them and they came up with some changes, which I have pushed to your branch. However, I noticed that you added more documentation to the namelist_definition_mpaso.xml file than was in Registry, so you might want to look at the changes and think about modifying Registry to reflect the enhanced descriptions. I can always run the scripts again, if you decide to do so

@jonbob
Copy link
Contributor

jonbob commented Jul 24, 2025

Passes (with expected NML DIFFs):

  • SMS_D_Ld1.ne30pg2_r05_IcoswISC30E3r5.WCYCL1850.chrysalis_intel.allactive-wcprod
  • ERS.ne30pg2_r05_IcoswISC30E3r5.GPMPAS-JRA.chrysalis_intel.mosart-rof_ocn_2way
  • e3sm_cryo_developer on chrysalis

@zhangshixuan1987
Copy link
Contributor Author

namelist_definition_mpaso.xml

@zhangshixuan1987
Copy link
Contributor Author

@zhangshixuan1987 - we have some scripts to make the bld files consistent with the changes to Registry. I ran them and they came up with some changes, which I have pushed to your branch. However, I noticed that you added more documentation to the namelist_definition_mpaso.xml file than was in Registry, so you might want to look at the changes and think about modifying Registry to reflect the enhanced descriptions. I can always run the scripts again, if you decide to do so

@jonbob: Hi Jon, could you please explain a little bit more about the "you added more documentation to the namelist_definition_mpaso.xml file than was in Registry, so you might want to look at the changes and think about modifying Registry to reflect the enhanced descriptions"

@zhangshixuan1987
Copy link
Contributor Author

Hi @jonbob, Following up on your comments — if I understand correctly, you're suggesting that we ensure consistency in the descriptions of the relevant namelist variables introduced in this pull request between namelist_defaults_mpaso.xml and Registry.xml, correct? If so, I’ve updated Registry.xml to use exactly the same definitions as those in namelist_defaults_mpaso.xml. Please take a look and let me know if I’ve misunderstood anything. I’m happy to make further adjustments if needed.

@jonbob
Copy link
Contributor

jonbob commented Jul 30, 2025

@zhangshixuan1987 -- sorry, I realize that wasn't very clear. We have scripts that take the information in the Registry files and make the bld files -- like namelist_definitions_mpaso.xml. So any changes you made to that file by hand will be lost when we re-generate them. So if there's documentation you have added to namelist_definitions_mpaso.xml and not Registry, you may want to transfer that documentation to Registry and I'll remake the bld files to match it

@jonbob
Copy link
Contributor

jonbob commented Jul 30, 2025

Hi @zhangshixuan1987 -- I didn't see any changes recently, so I'm not sure what you're referring to. Let me see if I can explain the process better. We don't modify namelist_definitions_mpaso.xml directly -- it is auto-generated by scripts using the descriptions and other information in the Registry files. I ran those scripts on this branch committed the updates, but noticed that you had added documentation to namelist_definitions_mpaso.xml that this would overwrite. I just wanted to make sure nothing important is getting lost, so if you want to keep the extra descriptions you added to namelist_definitions_mpaso.xml, we'll need to move them to Registry and I will rerun the scripts. Right now -- or at least after my commit -- they are consistent.

@zhangshixuan1987
Copy link
Contributor Author

@jonbob :

Apologies for the confusion earlier. I realized that I had been working under a separate branch, precfactor_rebase, where I intended to make the recent modifications.

Following your explanations above, I have updated the Registry.xml in this branch to improve the clarity of the descriptions. I also made corresponding changes to namelist_defaults_mpaso.xml—perhaps not strictly necessary, but I did so to avoid any potential confusion going forward.

Please take another look when you have a chance, and let me know if you have any further questions or suggestions.

Apologies again for the mix-up, and thank you for your guidance.

@jonbob
Copy link
Contributor

jonbob commented Jul 31, 2025

Thanks @zhangshixuan1987 -- I guess I still wasn't clear about the namelist_definitions_mpaso.xml and namelist_defaults_mpaso.xml files. Those files are auto-generated (mostly) from the Registry files, so there is no need to modify them. Mostly we just need definitions and descriptions to be made in Registry, and then the scripts use those updates to populate the namelist_ files. But I see you have added more text to Registry, so I'll run the scripts again and hopefully we'll be good to go.

@zhangshixuan1987
Copy link
Contributor Author

Thanks @zhangshixuan1987 -- I guess I still wasn't clear about the namelist_definitions_mpaso.xml and namelist_defaults_mpaso.xml files. Those files are auto-generated (mostly) from the Registry files, so there is no need to modify them. Mostly we just need definitions and descriptions to be made in Registry, and then the scripts use those updates to populate the namelist_ files. But I see you have added more text to Registry, so I'll run the scripts again and hopefully we'll be good to go.

Thank you, @jonbob, for the further explanation. I believe I now fully understand the intent. The descriptions I’ve added to the Registry.xml reflect the final version I would like to keep based on this understanding. Please try to rerun the script and let me know if you have other concerns on the Registry.xml .

@jonbob jonbob added the Stealth PR has feature which, if turned on, could change climate. fka FCC label Aug 5, 2025
jonbob added a commit that referenced this pull request Aug 5, 2025
Dynamical adjustment on freshwater fluxes balance for E3SM runs

This pull request introduces a new module and function in the MPAS-Ocean
(MPAS-O) model to compute and apply a scaling factor on precipitation
fluxes. The goal of this feature is to help maintain freshwater balance
in ocean-only simulations by mitigating the spurious linear trend
observed in sea surface height (SSH) over time. The updates specifically
target uncoupled ocean configurations, including:
* G-case: ocean + sea ice with data atmosphere
* GP- or J-case: land + river + ocean + sea ice with data atmosphere
These configurations do not include a dynamically coupled atmosphere,
and thus lack the feedback mechanisms necessary for naturally
maintaining freshwater balance. This PR provides a workaround by
dynamically adjusting the precipitation flux.

[NML]
[BFB] - stealth feature, off by default
@jonbob
Copy link
Contributor

jonbob commented Aug 5, 2025

Passes:

  • new SMS_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5.chrysalis_intel.mpaso-precip_scaling_jra_1958 test
  • SMS_D_Ld1.ne30pg2_r05_IcoswISC30E3r5.WCYCL1850.chrysalis_intel.allactive-wcprod with expected NML DIFF

merged to next

@jonbob jonbob merged commit 3179a41 into master Aug 6, 2025
6 checks passed
@jonbob jonbob deleted the zhan391/precfactor branch August 6, 2025 16:11
@jonbob
Copy link
Contributor

jonbob commented Aug 6, 2025

merged to master and expected NML DIFFs blessed except for pm-cpu prod and developer, which have not yet reported

@jonbob
Copy link
Contributor

jonbob commented Aug 6, 2025

blessed everywhere now

jonbob added a commit that referenced this pull request Aug 19, 2025
Fix a minor documentation issue in mpaso Registry.xml

In the mpaso Registry file, the possible_values for
config_land_ice_draft_mode had a missing single quote:
   possible_values="'data,'pressure-dependent'"
This fixes that and updates the bld files to be consistent. Those
updates also pick up changes that must have been missed in PR #7361.

[BFB]
jonbob added a commit that referenced this pull request Aug 21, 2025
Fix a minor documentation issue in mpaso Registry.xml

In the mpaso Registry file, the possible_values for
config_land_ice_draft_mode had a missing single quote:
   possible_values="'data,'pressure-dependent'"
This fixes that and updates the bld files to be consistent. Those
updates also pick up changes that must have been missed in PR #7361.

[BFB]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB mpas-ocean NML Stealth PR has feature which, if turned on, could change climate. fka FCC v3.1beta
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants