Skip to content

Rain formation as a function of air velocity - #770

Open
trontrytel wants to merge 3 commits into
mainfrom
aj/regime_rain_formation
Open

trontrytel wants to merge 3 commits into
mainfrom
aj/regime_rain_formation

Conversation

@trontrytel

@trontrytel trontrytel commented Jul 30, 2026

Copy link
Copy Markdown
Member

This PR adds rain autoconversion function that depends on air vertical velocity. The idea is to differentiate between the stratiform (less turbulent, slower) and convective (more turbulent, fast) regime.

Screenshot 2026-09-04 at 12 15 47 PM

This requires adding vertical velocity to bulk microphysics tendencies. So once approved this will be a breaking release for Atmos.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.85%. Comparing base (140cd05) to head (0de026a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #770      +/-   ##
==========================================
+ Coverage   92.74%   92.85%   +0.10%     
==========================================
  Files          56       56              
  Lines        2990     3022      +32     
==========================================
+ Hits         2773     2806      +33     
+ Misses        217      216       -1     
Components Coverage Δ
src 93.61% <100.00%> (+0.10%) ⬆️
ext 69.47% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@trontrytel
trontrytel force-pushed the aj/regime_rain_formation branch 2 times, most recently from fece4e6 to a0ea034 Compare July 30, 2026 19:00
@trontrytel
trontrytel force-pushed the aj/regime_rain_formation branch 2 times, most recently from a9ff8c6 to c1a7204 Compare August 14, 2026 00:53
@trontrytel
trontrytel force-pushed the aj/regime_rain_formation branch 2 times, most recently from 716fcbb to 2b2415c Compare September 4, 2026 19:11
@trontrytel
trontrytel marked this pull request as ready for review September 4, 2026 19:16
@trontrytel
trontrytel requested a review from szy21 September 4, 2026 19:16
@trontrytel trontrytel self-assigned this Sep 4, 2026
@trontrytel
trontrytel force-pushed the aj/regime_rain_formation branch from 2b2415c to 0c0b9b1 Compare September 4, 2026 20:41
Comment thread src/Microphysics1M.jl

@inline function rain_autoconversion_timescale(::CMP.VelocityDependent, mp, w)
(; τ_slow, τ_fast, w_0) = mp.process_params.rain_autoconversion
f = w^4 / (w^4 + w_0^4)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any physical reason for the fourth power?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Just wanted something smooth that still provides a fast transition between the two regimes. I added some comments in the docs

Comment thread src/Microphysics1M.jl Outdated
Comment thread test/gpu_tests.jl Outdated
@trontrytel
trontrytel force-pushed the aj/regime_rain_formation branch from 0c0b9b1 to 8aee3c9 Compare September 14, 2026 21:13
trontrytel and others added 2 commits September 15, 2026 17:21
- rain_autoconversion_timescale checks option/parameter consistency with
  _consistent_params for Kessler1M, PrescribedNd and VelocityDependent, so a
  mismatched pair throws instead of returning a wrong timescale; tests added
- GPU tests: the array-vs-scalar isequal checks were vacuous; compare
  element-wise with isequal(FT(bad_value)) so unwritten outputs are caught
- docs: explain the fourth power in f(w) as a modelling choice (steep, smooth,
  even step with f = 1/2 at w_0) and list the ClimaParams keys; the fast
  timescale default is 1000 s (rain_autoconversion_timescale), not 900 s
- bulk_tendencies_tests: pass w to the three stiff PrescribedIceNumber test
  calls added in #787 that were still using the pre-PR argument order (they
  compiled because nsub has a default, and failed with q_tot = 0)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- Bump the version to 0.41: adding w to the 1M bulk_microphysics_tendencies
  signatures is a breaking change and v0.40.0 is already released
- Type Δt::AbstractFloat and nsub::Integer in the LinearizedAverage method:
  the pre-0.41 call shape (no w, trailing dt, nsubs) otherwise still
  dispatches with nsubs bound to Δt and returns garbage silently; test added
- Make w a required argument of every rain_autoconversion_timescale method
  (the Kessler1M and PrescribedNd tendencies pass zero(q_lcl)); include w in
  the FT promotion of _microphysics_source_terms
- Reject w_0 <= 0 and non-positive timescales when reading VelDepAcnv from
  the TOML dict (w_0 = 0 gives 0/0 at w = 0)
- Docs: which vertical velocity w is meant (draft velocity in an EDMF host;
  with grid-mean GCM w the option reduces to Kessler with τ_slow), the
  thermo convention and the module usage example now include w
- Tests pin the fourth power through f(w_0) = 1/2, f(w_0/2) = 1/17,
  f(2 w_0) = 16/17, check τ_slow > τ_fast on the defaults, and cover the
  timescale helper under mixed Dual/plain arguments

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@trontrytel

Copy link
Copy Markdown
Member Author

This is a breaking release for Atmos, because it requires BMTs to have vertical velocity as input. I already have a branch in Atmos that updates this. But with all the other issues we are having there right now, I'll hold off till next week with merging it. I don't want to add to the reverting PRs

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants