Skip to content

critical radius and supersat: return infinities if kappa=0 instead of… - #498

Open
pdziekan wants to merge 1 commit into
igfuw:masterfrom
pdziekan:kappa_0
Open

critical radius and supersat: return infinities if kappa=0 instead of…#498
pdziekan wants to merge 1 commit into
igfuw:masterfrom
pdziekan:kappa_0

Conversation

@pdziekan

Copy link
Copy Markdown
Contributor

… throwing an assert

Copilot AI lite review requested due to automatic review settings August 14, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the kappa-Köhler diagnostics helpers to avoid asserting on kappa == 0 (nonhygroscopic particles), aiming to return “infinite” critical radius/supersaturation values instead.

Changes:

  • Relaxed assert(kappa > 0) to assert(kappa >= 0) in rw3_cr() and S_cr().
  • Added early returns for kappa == 0 in rw3_cr() and S_cr().
Suppressed comments (1)

include/libcloudph++/common/kappa_koehler.hpp:181

  • Same as rw3_cr(): for kappa==0 this returns a finite value (44) even though the intent/comment says “infinity (or close)”. Returning a true infinity makes it unambiguous to API consumers that activation is impossible for nonhygroscopic particles.
        if(kappa == 0) return 44; // return infinity (or close) - nonhygroscopic particles do not activate, S_cr is used for diagnostics only

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

{
assert(kappa > 0);
assert(kappa >= 0);
if(kappa == 0) return real_t(44) * si::cubic_metres; // return infinity (or close) - nonhygroscopic particles do not activate, and rw3_cr is used for diagnostics only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants