Skip to content

Conversation

@haakon-e
Copy link
Member

@haakon-e haakon-e commented Nov 14, 2025

The treatment of various microphysical tracers is typically nearly identical. This pull request implements this abstraction by making extensive use of ClimaCores @name construct to refer to, and extract data related to, the various microphysical tracers like q_liq, q_rai, etc.

A few other significant features include:

  • fusing sums over subdomains
  • reducing and/or eliminating the use of cache and temporary quantities.
    • For example, ᶜwₛʲs and friends are not used at all anymore (though I haven't deleted the code that precomputes updraft sedimentation velocities just yet)
  • fixes the bug identified in Bug in rain 2M+PEDMF terminal velocity calculation #4117

More details below:


This pull request introduces several utility functions and refactors existing code to improve clarity and maintainability in microphysics and variable manipulation modules. The main focus is on adding helper functions for terminal velocities, tracer field name conversions, and subdomain density handling. It also includes minor refactoring and documentation improvements.

Microphysics utilities:

  • Added new functions in microphysics_wrappers.jl to select and compute terminal velocity functions for different microphysical schemes (1-moment and 2-moment), using the tracer name to dispatch the correct velocity calculation.

Tracer and field name utilities:

  • Introduced a suite of helper functions in variable_manipulations.jl to map between grid-scale tracer names and related field names, such as get_ᶜwᵪ_name_from_qᵪ_name, get_ᶜwₙᵪ_name_from_qᵪ_name, and get_nᵪ_name_from_qᵪ_name, each with clear documentation and examples.
  • Added ᶜspecific_gs_tracer to lazily compute the specific tracer field from a grid-scale tracer name, and refactored ᶜspecific_gs_tracers to use this helper for improved clarity. [1] [2]

Subdomain density handling:

  • Refactored and documented the logic for computing area-weighted environment density (ρa⁰) and for accessing subdomain densities, introducing ᶜρaʲs_list and ρaʲ helpers for both prognostic and diagnostic EDMFX models.

General utilities and refactoring:

  • Changed draft_sum to use unrolled_mapreduce for consistency and flexibility in summing over multiple subdomain states.
  • Added a new vector abbreviation WVec in abbreviations.jl.
  • Minor code cleanup and documentation improvements, including examples for new utility functions and improved docstrings. [1] [2]

These changes collectively improve the modularity, readability, and extensibility of the codebase, particularly for microphysics and tracer field management.

@haakon-e haakon-e force-pushed the he/chore-add-show-method-for branch from 6343795 to d5fe42d Compare November 14, 2025 00:59
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from c087a6e to f7d4b6f Compare November 14, 2025 00:59
@haakon-e haakon-e force-pushed the he/chore-add-show-method-for branch from d5fe42d to 2512576 Compare November 14, 2025 01:00
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from f7d4b6f to 66c4dac Compare November 14, 2025 01:00
Base automatically changed from he/chore-add-show-method-for to main November 14, 2025 03:38
YuzeHao2023

This comment was marked as off-topic.

@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from 66c4dac to a1e43c4 Compare November 14, 2025 22:24
@haakon-e haakon-e changed the base branch from main to he/rft-clean-up-diagnostics November 14, 2025 22:24
@haakon-e haakon-e force-pushed the he/rft-clean-up-diagnostics branch from 092ab4e to c0af6f7 Compare November 15, 2025 23:01
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch 2 times, most recently from 09aae22 to 3630586 Compare November 15, 2025 23:31
@haakon-e haakon-e force-pushed the he/rft-clean-up-diagnostics branch from c0af6f7 to 9405d3c Compare November 15, 2025 23:34
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from 3630586 to 63bdc13 Compare November 15, 2025 23:34
@haakon-e haakon-e force-pushed the he/rft-clean-up-diagnostics branch from 9405d3c to a85a7a4 Compare November 20, 2025 17:40
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from 63bdc13 to 5fbc160 Compare November 20, 2025 17:40
@haakon-e haakon-e force-pushed the he/rft-clean-up-diagnostics branch from a85a7a4 to 0b16fd3 Compare November 20, 2025 17:45
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from 5fbc160 to a020cb3 Compare November 20, 2025 17:45
@haakon-e haakon-e force-pushed the he/rft-clean-up-diagnostics branch from 0b16fd3 to 32cc140 Compare November 21, 2025 05:09
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from a020cb3 to bde4417 Compare November 21, 2025 05:09
@haakon-e haakon-e force-pushed the he/rft-clean-up-diagnostics branch 2 times, most recently from 9004d38 to 8f9cb8c Compare November 25, 2025 00:57
@haakon-e haakon-e changed the base branch from he/rft-clean-up-diagnostics to he/rft-clean-surface-code November 25, 2025 00:57
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from bde4417 to 8167c35 Compare November 25, 2025 00:57
@haakon-e haakon-e marked this pull request as ready for review November 25, 2025 00:59
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from 8167c35 to 09c6176 Compare November 25, 2025 01:12
@haakon-e haakon-e changed the title chore: clean up some files rft: clean up precip cache computation Nov 25, 2025
@haakon-e haakon-e linked an issue Nov 25, 2025 that may be closed by this pull request
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch 2 times, most recently from 1d3e74f to 390a982 Compare November 25, 2025 21:43
@haakon-e haakon-e changed the base branch from he/rft-clean-surface-code to main November 25, 2025 21:44
@haakon-e haakon-e force-pushed the he/chore-clean-up-some-files branch from 390a982 to e70fbab Compare November 25, 2025 21:44
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.

Bug in rain 2M+PEDMF terminal velocity calculation

3 participants