Skip to content
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

Fix valgrind errors in eamxx_homme_iop.cpp #2859

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/eamxx/src/dynamics/homme/eamxx_homme_iop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,9 @@ apply_iop_forcing(const Real dt)
// Restrict nudging of T and qv to certain levels if requested by user
// IOP pressure variable is in unitis of [Pa], while iop_nudge_tq_low/high
// is in units of [hPa], thus convert iop_nudge_tq_low/high
Mask nudge_level;
for (int p=0; p<Pack::n; ++p) {
const auto lev = k*Pack::n + p;
Mask nudge_level(false);
Copy link
Member Author

Choose a reason for hiding this comment

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

I assume I should default this mask to all false?

int max_size = hyam.size();
for (int lev=k*Pack::n, p = 0; p < Pack::n && lev < max_size; ++lev, ++p) {
const auto pressure_from_iop = hyam(lev)*ps0 + hybm(lev)*ps_iop;
nudge_level.set(p, pressure_from_iop <= iop_nudge_tq_low*100
Copy link
Member Author

Choose a reason for hiding this comment

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

@bogensch , this looks like a bug. How can pressure ever be both low and high? This and should be an or I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a bug, just confusing names..... Valid example values: iop_nudge_tq_low = 1000 hPa; iop_nudge_tq_high=700 hPa. Thus low/high refers to the relative position in the atmosphere with respect to the surface rather than the value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Makes sense now.

and
Expand Down