Skip to content

Conversation

@pressel
Copy link
Contributor

@pressel pressel commented Jan 17, 2026

P3 Autoconversion: Physics Property Tests and Technical Documentation

Description:
This PR introduces a new "Physics Property Test" strategy for the P3 microphysics scheme, starting with the cloud water to rain autoconversion process. Unlike traditional BFB regression tests which only detect changes from a baseline, these tests validate that the implementation adheres to the fundamental physical principles of the parameterization (Khairoutdinov and Kogan, 2000).

In addition, this PR establishes a new section in the Technical Guide for detailed physics documentation.

Key Changes:

  1. Enhanced Unit Tests (p3_autoconversion_unit_tests.cpp):

    • Phase Space Sweep: Tests cover a wide range of regimes ($q_c$ from $5 \times 10^{-9}$ to $10^{-2}$ kg/kg, $N_c$ from $10^6$ to $10^9$ #/m³).
    • Physical Properties Validated:
      • Thresholds: Verifies rate is zero below $q_c = 10^{-8}$ kg/kg.
      • Monotonicity: Checks correct sensitivity to inputs ($\partial R/\partial q_c > 0$ and $\partial R/\partial N_c < 0$).
      • Conservation: Verifies specific mass loss equals specific number loss ($N_{loss} = R \cdot N_c/q_c$).
      • Limits: Verifies autoconversion is negligible in the "Haze Limit" ($r < 1\mu m$).
      • Self-Consistency: Verifies the implicit mass of new raindrops corresponds to the characteristic radius ($r_{auto} \approx 25\mu m$).
    • Parameter Validation: Ensures runtime configuration matches KK2000 constants.
  2. New Documentation (docs/technical/physics/p3/autoconversion.md):

    • Documents the mathematical formulation of the autoconversion rate and number tendencies.
    • Explains the implementation details (thresholds, variance scaling status).
    • Details the test strategy and the specific physical properties being verified.
  3. Documentation Structure:

    • Updated components/eamxx/mkdocs.yml to include a new Physics section under the Technical Guide.

Testing:

  • Ran p3_autoconversion_unit_tests on pm-cpu (GNU).
  • All property checks pass.
  • The test correctly identifies that subgrid variance scaling is currently disabled in the implementation.

@pressel pressel added BFB PR leaves answers BFB Testing Anything related to unit/system tests EAMxx C++ based E3SM atmosphere model (aka SCREAM) labels Jan 17, 2026
Copy link
Contributor

Copilot AI left a comment

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 introduces a comprehensive physics property testing framework for the P3 microphysics autoconversion process, replacing simple positivity checks with rigorous validation of physical principles from Khairoutdinov and Kogan (2000). It also establishes technical documentation infrastructure for detailed physics descriptions.

Changes:

  • Enhanced unit tests with physics-based property validation across a wide parameter space (5×10⁻⁹ to 10⁻² kg/kg for qc, 10⁶ to 10⁹ #/m³ for Nc)
  • Added comprehensive technical documentation describing the mathematical formulation, implementation details, and testing strategy
  • Extended mkdocs configuration to include a new Physics section under the Technical Guide

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
components/eamxx/src/physics/p3/tests/p3_autoconversion_unit_tests.cpp Replaced simple positivity test with comprehensive physics property tests validating thresholds, monotonicity, conservation, limits, and variance scaling
components/eamxx/docs/technical/physics/p3/autoconversion.md New technical documentation detailing KK2000 formulation, implementation specifics, and property-based test strategy
components/eamxx/mkdocs.yml Added Physics > P3 > Autoconversion section to documentation navigation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pressel pressel marked this pull request as draft January 17, 2026 00:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@E3SM-Project E3SM-Project deleted a comment from Copilot AI Jan 17, 2026
@pressel pressel self-assigned this Jan 18, 2026
@github-actions
Copy link

github-actions bot commented Jan 19, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://E3SM-Project.github.io/E3SM/pr-preview/pr-7999/

Built to branch gh-pages at 2026-01-20 15:57 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@bartgol bartgol added the CI: approved Allow gh actions PR testing on ghci-snl-* machines label Jan 19, 2026
@pressel pressel requested a review from mahf708 January 20, 2026 15:29
@pressel pressel marked this pull request as ready for review January 20, 2026 15:32
@AaronDonahue AaronDonahue added CI: approved Allow gh actions PR testing on ghci-snl-* machines and removed CI: approved Allow gh actions PR testing on ghci-snl-* machines labels Jan 20, 2026
@mahf708 mahf708 marked this pull request as draft January 20, 2026 17:56
@mahf708 mahf708 marked this pull request as ready for review January 20, 2026 17:56
Copy link
Contributor

@mahf708 mahf708 left a comment

Choose a reason for hiding this comment

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

I skimmed this PR, and this looks pretty good. I added some minor comments which can be addressed later. Some equations in https://docs.e3sm.org/E3SM/pr-preview/pr-7999/EAMxx/technical/physics/p3/autoconversion/ aren't loading correctly in my browser, just double check that one more time before merging

Comment on lines +194 to +198
#ifdef SCREAM_DOUBLE_PRECISION
const Real identity_tol = 1e-14; // ~100x machine epsilon (double)
#else
const Real identity_tol = 1e-7; // ~1000x machine epsilon (float)
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

can also use something from std/kokkos numerics here for the automatically detected epsilon with <Real>

Copy link
Contributor

Choose a reason for hiding this comment

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

e.g.

// A numerical tolerance
auto tol = std::numeric_limits<Real>::epsilon() * 100;

Spack qc_incld, nc_incld(1e7), qc2qr_autoconv_tend(0.0), nc2nr_autoconv_tend(0.0), ncautr(0.0);
for(int si=0; si<Spack::n; ++si){
qc_incld[si] = 1e-6 * i * Spack::n + si;
void validate_autoconversion_parameters() {
Copy link
Contributor

Choose a reason for hiding this comment

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

note that we set the defaults in the xmls and the hardcoded items below may cause fails that will require code edits here again? nbd, we can always edit the items below, just noting it here for your consideration

$$

\equiv \texttt{nc_incld} \cdot \texttt{sp(1.e-6)} \cdot \rho
### Number Tendencies
Copy link
Contributor

Choose a reason for hiding this comment

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

need a line above this "title" otherwise linter will keep crying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BFB PR leaves answers BFB CI: approved Allow gh actions PR testing on ghci-snl-* machines EAMxx C++ based E3SM atmosphere model (aka SCREAM) Testing Anything related to unit/system tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants