-
Notifications
You must be signed in to change notification settings - Fork 446
EAMxx: water thermo fixer #7758
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
Conversation
|
the global mean addition is on the order of ~1 W/m2 |
jgfouca
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.
LGTM, just a minor point
| } | ||
|
|
||
| void MassAndEnergyConservationCheck::global_fixer(const bool & print_debug_info) | ||
| void MassAndEnergyConservationCheck::global_fixer(const bool & print_debug_info, const bool & ieflx_fixer) |
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.
bools don't really need to be passed by ref. A const copy should be fine. Also, should ieflx_fixer be defaulted to false?
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 followed the print_debug_info to keep the same style. Should I change both while at it?
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.
yes, plz
| }); | ||
| Kokkos::fence(); | ||
| } else { | ||
| m_h2otemp_global_mean = 0.0; |
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.
Shouldn't this return some invalid value like a negative?
Maybe I just haven't thought it through.
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.
Well, this is the else-branch in applying the ieflx fixer. If we are not applying the fixer, then we are adding NOTHING (zero) to the sens flux. Does that sound reasonable to you? Btw, this only used for printing a debug statement in the logs (if the debug info is requested). Usually, this value is ~1 W/m2 in ne4 coupled cases (instant time step)
bartgol
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.
Can we use a different name than ieflx_fixer? For someone that doesn't already know what it is, it conveys very little meaning. I assume flx stands for flux, but saving that one char doesn't really seem worth it. And maybe spell out what IE stands for too? I assume these are ported from existing pieces in EAM, but I think we can improve names.
Agree, ieflx stands for internal energy fixer and there's a lot of controversy about this --- in an ideal world, we won't have this stuff in the code. I will edit. Also, I am discussing with Mark and Oksana a potential change to the way we do this. Currently, it is carbon-copy from EAM, but this is a good time to consider improvements. |
3893fc0 to
621f0e2
Compare
|
|
||
| <!-- Fields that we need to initialize, but are not in an initial condition file need to be inited here --> | ||
| <surf_evap>0.0</surf_evap> <!-- TODO, Delete this when the IC fixes come in --> | ||
| <h2otemp>0.0</h2otemp> <!-- this is in W/m2, comes from ocean for water thermo fixer --> |
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.
@bartgol two questions
- will adding this field here avoid fails in the standalone tests? I think they just need this field to be available somewhere, but I may have missed something
- This is a weird name, so if you want to improve, let me know. This is what it is called in the coupler. It's the energy flux (W/m2) due to a mismatch in the temperature of water in the atmosphere and ocean, and so it is often thought of as a heat flux to compensate that; "h2o" is water and "temp" is temperature, I suppose, but I dislike the fact that the name implies that the term itself is a temperature in units of K
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.
- No: the xml defaults file is only used by CIME. You need to add a line with
h20temp: 0.0to allinput.yamlfiles of tests that use this var. - If the name refers to a varname from the cpl, then i'm ok using it. My rant above was more for eamxx var/option names.
621f0e2 to
05f5ff9
Compare
| in-fields. <= 0 disables hashing. --> | ||
| <enable_column_conservation_checks>false</enable_column_conservation_checks> | ||
| <enable_energy_fixer type="logical" doc="Turn on energy fixer for dycore (fixes dycore, pressure adjustment, PD coupling)">true</enable_energy_fixer> | ||
| <enable_air_sea_surface_water_thermo_fixer type="logical" doc="Turn on energy fixer for inconsistent internal energy due to mismatch with ocean water temperature, works by adding to energy fixer above">true</enable_air_sea_surface_water_thermo_fixer> |
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.
Much better! Thanks!
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.
due to mismatch with ocean water temperature should be due to mismatch with ocean water thermodynamics
|
|
||
| // Add h2otemp contribution to energy change if air sea surface water thermo fixer is enabled | ||
| if (air_sea_surface_water_thermo_fixer && h2otemp_ptr != nullptr) { | ||
| energy_change(i) += h2otemp_ptr[i] * dt; |
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.
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.
Well, since the view will never be a subview of something else, using the raw ptr should yield the correct result (meaning there would be no funky offsets calc in a 1d view anyways).
That said, using a view may make it clearer. But you do need to decl the view before the if statement:
typename Field::view_dev<const Real*> h2otemp_v;
if (...) {
h2otemp_v = m_fields["h2otemp"].get_view<const Real*>();
}It's not a big deal, but in case someone changes the code a bit, and messes with indices, the view approach may help with debugging, as we can turn on bounds checks.
|
This should only be merged after @oksanaguba approves. Please hold off merging. I will assign someone once Oksana reviews (and eventually approves). |
|
I made a minor change in your description's first line. For the second line, that this is nonbfb only for coupled runs -- I believe that IEFLX is used in old e3sm in AMIP runs, and i think its absence would be detected in long AMIP simulations in RESTOM-RESSURF value. (not to delay this PR, maybe, for future tasks) Since there is no good test for IEFLX, it would be good to run at least diagnostics with its magnitude. For that one can disable energy fixer (just comment out in the code, because namelist change won't probably work) and run it. There is already some diagnostics (at least, T tendency) for the fixer, one should confirm that the magnitude of IEFLX is as expected (in range [-4,4] W/m2 at most, depending on time step, in 1 degree runs). The fixer without IEFLX (from old e3sm runs) is in range [-2,2] W/m2. |
|
for @bartgol + @jgfouca, ready to merge, please feel free to merge (or request further edits) at your convenience for @whannah1 + @crterai, if you're interested in the test Oksana mentions, we can conduct that later (I can write precise instructions on how to conduct it or I can do it myself). Up to you, but I view this as a secondary task to the PR itself, so we should integrate and then we can separately document the effect. For the most part this fixer shouldn't be active in in regular eamxx simulations we conduct nowadays, but will definitely be active in coupled cases |
EAMxx: water thermo fixer add "air sea surface water thermos fixer" (in EAM known as IEFLX) in the same general area as "energy fixer" [NBFB] only for coupled eamxx cases such as WCYCLXX2010
add "air sea surface water thermos fixer" (in EAM known as IEFLX) in the same general area as "energy fixer"
[NBFB] only for coupled eamxx cases such as WCYCLXX2010