Skip to content

Conversation

oksanaguba
Copy link
Contributor

@oksanaguba oksanaguba commented Jul 28, 2025

Adds (dycore) energy fixer. The infrastructure can be used for another process (and will be used for IEFLX),
but the current impl is for the dycore.
It is identical to the EAM impl, where pressure adjustment and dycore energy leaks are fixed as one
global change to temperature for each column/level as the same temperature tendency.

There is a check if fixer debug output is on ( enable_energy_fixer_debug_info ) ,
which computes global energy after the fixer to confirm
that it does match. This debug output is used in a test that has postproc *py script to
confirm that the energy is fixed up to a tolerance.

For full discussion see #7276 .

Climo results ( model vs model, with fixer and without from the same branch) https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.onguba/theta/fixerJuly24-2025/latlon-pdf-vs-default/viewer/lat_lon/index.html .

[nonBFB] for any cime runs with eamxx and dycore. Potentially climate-changing, too.

@oksanaguba
Copy link
Contributor Author

Discussing with @bartgol results from CI tests:
gcc-openmp/* and gcc-cuda/* (4 suites total) all fail for baseline comp tests with homme with cprnc output in the form

  A total number of    245 fields were compared
          of which      0 had non-zero differences
               and     14 had differences in fill patterns
               and      0 had different dimension sizes
               and      0 had different data types

That is, fill patterns changed (dp, water species, z-based fields), because of code

  get_field_out("pseudo_density",pgn).get_header().get_tracking().update_time_stamp(start_of_step_ts());

that we needed initially to make cime tests with certain IO pass (otherwise dp is not init-ed properly before homme, but it is needed for the fixer).

Standalone sp and fpe tests do not run homme, this is why they pass.

Cime tests with baselines fail in comparison, but pass if there is no baseline comparison.
IMO CI testing looks ok then.

@oksanaguba oksanaguba requested review from bartgol and mahf708 July 28, 2025 22:38
@oksanaguba oksanaguba self-assigned this Jul 28, 2025
@oksanaguba oksanaguba requested a review from tcclevenger July 28, 2025 22:38
@oksanaguba oksanaguba added Atmosphere non-BFB PR makes roundoff changes to answers. CC PR is climate changing HOMME labels Jul 28, 2025
@oksanaguba oksanaguba changed the title [eamxx] dycore energy fixer EAMxx: dycore energy fixer Jul 29, 2025
Copy link
Contributor

@bartgol bartgol left a comment

Choose a reason for hiding this comment

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

I have some last minute comments.

}

//OG do we really need this check? It gets triggered for homme, but i do not see much use of this, disabling.
#if 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove the chunk of code then, rather than ifdeffing it out...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

<!-- Frequency in physics steps to output a global hash over the dycore's
in-fields. <= 0 disables hashing. -->
<enable_column_conservation_checks>false</enable_column_conservation_checks>
<enable_energy_fixer>true</enable_energy_fixer>
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind adding some metadata to these new XML entries? Namely, the "type" and "doc" metadata. We use these metadata entries when we auto-generate documentation for model inputs (which gets deployed on the online docs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

@mahf708 mahf708 requested a review from jgfouca July 29, 2025 20:07
<!-- Frequency in physics steps to output a global hash over the dycore's
in-fields. <= 0 disables hashing. -->
<enable_column_conservation_checks>false</enable_column_conservation_checks>
<enable_energy_fixer>true</enable_energy_fixer>
Copy link
Contributor

Choose a reason for hiding this comment

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

do you have a preference for this being true as opposed to false for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fixer should be on always, otherwise we have a model that leaks energy (though it is a question how much is leaked and at what resolutions, we only know a little about these numbers from ne30 EAM runs). I believe the idea was to have the fixer on for all runs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I agree, I meant from the perspective of integration. If you wanted to integrate all-BFB then in a follow-up PR do the NBFB, or just go at once. Either way is fine, up to you

Copy link
Contributor

@tcclevenger tcclevenger left a comment

Choose a reason for hiding this comment

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

One small comment, feel free to ignore if you like.

Copy link
Member

@jgfouca jgfouca left a comment

Choose a reason for hiding this comment

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

I took a pretty close look at the new python. It looks good for the most part, just a cpl suggestions.

oksanaguba added a commit that referenced this pull request Jul 31, 2025
Adds (dycore) energy fixer. The infrastructure can be used for another process (and will be used for IEFLX),
but the current impl is for the dycore.
It is identical to the EAM impl, where pressure adjustment and dycore energy leaks are fixed as one
global change to temperature for each column/level as the same temperature tendency.

There is a check if fixer debug output is on ( enable_energy_fixer_debug_info ) ,
which computes global energy after the fixer to confirm
that it does match. This debug output is used in a test that has postproc *py script to
confirm that the energy is fixed up to a tolerance.

For full discussion see #7276 .

Climo results ( model vs model, with fixer and without from the same branch)
https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.onguba/theta/
fixerJuly24-2025/latlon-pdf-vs-default/viewer/lat_lon/index.html .

[nonBFB] for any cime runs with eamxx and dycore. Potentially climate-changing, too.
@oksanaguba
Copy link
Contributor Author

in next. i reintroduced #include "ekat/kokkos/ekat_kokkos_utils.hpp" in mass_and_energy...hpp in a conflict resolution. if this gets thru i will check if it is really needed and put other small fixes in a small PR as i promised a few people.

oksanaguba added a commit that referenced this pull request Jul 31, 2025
Adds (dycore) energy fixer. The infrastructure can be used for another process (and will be used for IEFLX),
but the current impl is for the dycore.
It is identical to the EAM impl, where pressure adjustment and dycore energy leaks are fixed as one
global change to temperature for each column/level as the same temperature tendency.

There is a check if fixer debug output is on ( enable_energy_fixer_debug_info ) ,
which computes global energy after the fixer to confirm
that it does match. This debug output is used in a test that has postproc *py script to
confirm that the energy is fixed up to a tolerance.

For full discussion see #7276 .

Climo results ( model vs model, with fixer and without from the same branch)
https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.onguba/theta/
fixerJuly24-2025/latlon-pdf-vs-default/viewer/lat_lon/index.html .

[nonBFB] for any cime runs with eamxx and dycore. Potentially climate-changing, too.
@jgfouca jgfouca self-requested a review August 4, 2025 17:33
@oksanaguba oksanaguba requested review from jgfouca and removed request for jgfouca August 4, 2025 18:32
Copy link
Member

@jgfouca jgfouca left a comment

Choose a reason for hiding this comment

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

Oksana will do the python stuff in a subsequent PR.

@oksanaguba oksanaguba merged commit d545d88 into master Aug 4, 2025
5 of 19 checks passed
@oksanaguba oksanaguba deleted the oksanaguba/eamxx/fixer-clean branch August 4, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Atmosphere CC PR is climate changing HOMME non-BFB PR makes roundoff changes to answers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants