Skip to content

Conversation

tcclevenger
Copy link
Contributor

@tcclevenger tcclevenger commented May 20, 2025

Fixes FPE introduced in #7188 from temporary values being computed which attempt to take sqrt(some negative value). These values weren't being used, so not an actual bug.

[BFB]

@tcclevenger tcclevenger requested review from bartgol and mahf708 May 20, 2025 15:01
@tcclevenger tcclevenger self-assigned this May 20, 2025
@tcclevenger tcclevenger added the EAMxx Issues related to EAMxx label May 20, 2025
// Set length scale to vertical grid if unstable, otherwise the stability adjusted value.
shoc_mix(k).set(stable_mask, limited_len, dz_zt(k));
// Define length scale for stable cells
const auto length_tmp = ekat::sqrt(0.76*tk(k)/0.1/ekat::sqrt(brunt_tmp + 1.e-10));
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity: this should work with sqrt instead of ekat::sqrt right? ADL rule should get it right, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right. I think we have this in many other places too, I will look into creating a PR simplifying some of these calls.

Copy link
Contributor

Choose a reason for hiding this comment

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

No need.

tcclevenger added a commit that referenced this pull request May 21, 2025
Fixes FPE introduced in #7188 from temporary values being computed
which attempt to take sqrt(some negative value). These values weren't
being used, so not an actual bug.

[BFB]
@tcclevenger tcclevenger merged commit a987dd0 into E3SM-Project:master May 21, 2025
19 of 20 checks passed
@tcclevenger tcclevenger deleted the tcclevenger/eamxx/fpe_shoc_fix branch May 21, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EAMxx Issues related to EAMxx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants