Skip to content

Aj/bulk micro options part2#717

Open
trontrytel wants to merge 1 commit into
mainfrom
aj/bulk_micro_options_part2
Open

Aj/bulk micro options part2#717
trontrytel wants to merge 1 commit into
mainfrom
aj/bulk_micro_options_part2

Conversation

@trontrytel
Copy link
Copy Markdown
Member

@trontrytel trontrytel commented May 21, 2026

Refactor 1-moment microphysics process options

Summary

This PR refactors how individual microphysical processes are enabled and disabled in the 1-moment scheme. Every process now has an explicit No* option that returns zero tendency, and each process is addressed individually via option dispatch. Accretion processes are added to the options struct for the first time. The VarTimescaleAcnv option has been moved from CM2 to CM1 module and its parameters are consolidated into the 1M parameter tree. All callers — bulk tendencies, tests, docs — are updated.

Changes

src/parameters/Microphysics1MOptions.jl

  • Added No* option singletons for every process so each one can be individually disabled: NoCloudLiquidFormation, NoCloudIceFormation, NoRainAutoconversion, NoSnowAutoconversion, NoRainCondensationEvaporation, NoSnowDepositionSublimation, NoSnowMelt, and one for each accretion pair.
  • Renamed options for clarity and consistency:
    • CloudIceMeltToLiquidCloudIceMelt
    • LiquidAutoconv1MRainAutoconversion1M
    • LiquidAutoconv2MRainAutoconversionPrescribedNd
    • SnowAutoconvNoSupersat/WithSupersatSnowAutoconversionNoSupersaturation/WithSupersaturation
    • EvaporationOnlyRainEvaporation
    • SublimationOnlySnowSublimation
    • DepositionSublimationSnowDepositionSublimation
    • Field rain_evaporationrain_condensation_evaporation
    • Field snow_sublimationsnow_deposition_sublimation
    • Field cloud_liquid_autoconversionrain_autoconversion
  • Added accretion processes to Microphysics1MOptions: CloudLiquidRainAccretion, CloudLiquidSnowAccretion, CloudIceRainAccretion, CloudIceSnowAccretion, RainSnowAccretion (each with a corresponding No* variant).
  • Removed RainIceAccretion (previously an undifferentiated accretion flag).

src/parameters/Microphysics1MParams.jl

  • Removed the top-level prescribed_Nc field; droplet number concentration is now stored inside VarTimescaleAcnv.Nc.
  • Removed the FT type parameter from Microphysics1MParams.

src/parameters/Microphysics1M.jl

  • Added VarTimescaleAcnv export and definition (moved from Microphysics2M.jl). It now holds τ, α, and Nc as a single struct.

src/parameters/Microphysics2M.jl

  • Removed VarTimescaleAcnv struct, constructor, and export (moved to Microphysics1M.jl).

src/Microphysics1M.jl

  • Converted conv_q_lcl_to_q_rai from a direct Acnv1M-struct-based call to option dispatch: conv_q_lcl_to_q_rai(::NoRainAutoconversion | ::RainAutoconversion1M | ::RainAutoconversionPrescribedNd, mp, tps, micro, thermo).
  • Converted accretion wrappers to option dispatch for all four cloud-precip pairs (CloudLiquidRainAccretion, CloudLiquidSnowAccretion, CloudIceRainAccretion, CloudIceSnowAccretion).
  • Added high-level accretion_snow_rain(::NoRainSnowAccretion | ::RainSnowAccretion, mp, tps, micro, thermo) that calls both the cold and warm collision arms and returns (; S_rai_sno, S_sno_rai, S_melt).
  • Removed the accretion_rain_sink public docstring (it is now an internal-only low-level kernel).

src/BulkMicrophysicsTendencies.jl

  • Updated the 1M tendency function to dispatch on all new accretion options from Microphysics1MOptions, passing the full mp struct through to each process wrapper.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 96.12403% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.24%. Comparing base (5dd0a90) to head (0f0343e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #717      +/-   ##
==========================================
+ Coverage   92.19%   92.24%   +0.05%     
==========================================
  Files          55       55              
  Lines        2420     2450      +30     
==========================================
+ Hits         2231     2260      +29     
- Misses        189      190       +1     
Components Coverage Δ
src 93.16% <96.12%> (+0.04%) ⬆️
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/bulk_micro_options_part2 branch from 9c23633 to 0f0343e Compare May 22, 2026 21:39
@trontrytel trontrytel marked this pull request as ready for review May 22, 2026 22:01
@trontrytel trontrytel self-assigned this May 22, 2026
@trontrytel trontrytel added Refactor 🌟 Large-scale code improvement Needs review Please review my pull request labels May 22, 2026
Copy link
Copy Markdown
Member

@sajjadazimi sajjadazimi left a comment

Choose a reason for hiding this comment

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

Thank you!

Comment thread src/Microphysics1M.jl
return accretion(mp.cloud.ice, mp.precip.rain, mp.terminal_velocity.rain, mp.collision, q_icl, q_rai, ρ)
end

@inline accretion(::CMP.NoCloudIceSnowAccretion, mp, tps, micro, thermo) = zero(thermo.T)
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.

These define different processes. Maybe renaming them to what converts to what is useful. For example accretion_ice_snow, accretion_ice_rain, accretion_liquid_rain. This also helps avoid the confusion that what processes must be chosen by a non-expert user.

Copy link
Copy Markdown
Member

@haakon-e haakon-e left a comment

Choose a reason for hiding this comment

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

My concerns from #714 remain, but if I view this PR within the framework adopted by the previous PR, I think the changes look good!

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

Labels

Needs review Please review my pull request Refactor 🌟 Large-scale code improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants