Skip to content

Hail diagnostic vn14.2 - #21

Draft
paulfield2024 wants to merge 9 commits into
MetOffice:mainfrom
paulfield2024:hail_diagnostic_vn14.2
Draft

Hail diagnostic vn14.2#21
paulfield2024 wants to merge 9 commits into
MetOffice:mainfrom
paulfield2024:hail_diagnostic_vn14.2

Conversation

@paulfield2024

@paulfield2024 paulfield2024 commented Aug 14, 2026

Copy link
Copy Markdown

PR Summary

Sci/Tech Reviewer:
Code Reviewer:

Hail diagnostic based on Mason 1956 "Melting of Hailstones"

Code Quality Checklist

(Some checks are automatically carried out via the CI pipeline)

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings

Testing

  • If shared files have been modified, I have run the UM and LFRic Apps rose
    stem suites
  • If any tests fail (rose-stem or CI) the reason is understood and
    acceptable (eg. kgo changes)
  • I have added tests to cover new functionality as appropriate (eg. system
    tests, unit tests, etc.)

trac.log

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

Performance Impact

  • Performance of the code has been considered and, if applicable, suitable performance measurements have been conducted

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Documentation

  • Where appropriate I have updated documentation related to this change and confirmed that it builds correctly

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

Please alert the code reviewer via a tag when you have approved the SR

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • CLA compliance has been confirmed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Performance impact is acceptable

@github-actions github-actions Bot added the cla-signed The CLA has been signed as part of this PR - added by GA label Aug 14, 2026
@paulfield2024

paulfield2024 commented Aug 14, 2026

Copy link
Copy Markdown
Author

This is linked to UM PR to plumb through the hail diagnostic requests
UM#118

Purpose: Implements a new physically-based hail-size/melting diagnostic in
CASIM microphysics.

Files changed (3):

src/hail_diag_fast_mod.F90 (new, ~206 lines)
New module hail_diagnostic_fast_mod with diagnose_hail_fast: builds a
hail size distribution from the graupel PSD at the melting level, then
integrates hailstone melting downward to the surface using Mason (1971)
melting physics. Returns the largest surviving hailstone diameter at the
surface, a critical/threshold diameter, a hail flag, and the surface hail
precipitation rate.
src/generic_diagnostic_variables.F90
Adds an l_hail flag and five new 2D diagnostic arrays
(hail_d_max_sfc, hail_d_crit, hail_d0_thresh, hail_flag_sfc,
hail_precip_rate) with allocate/deallocate/reset logic, following the
existing pattern used for other diagnostics (e.g. radar).
src/micro_main.F90
Calls diagnose_hail_fast per grid column when l_hail is set, and stores
the results into the new diagnostic arrays.
Impact on results/performance: Additive and opt-in (gated by l_hail,
only set when the UM requests the corresponding STASH items). Adds one
physics-based diagnostic call per column; negligible cost when hail
diagnostics are disabled. No existing microphysics behavior is changed.

Detail: src/hail_diag_fast_mod.F90 (module hail_diagnostic_fast_mod)

Algorithm, per grid column:

Find the melting level (find_melting_level) — scans from the top
of the column down for the 0°C crossing (T0 = 273.15 K) and
linearly interpolates its height. If the whole column (including the
surface) is already below freezing, there's no melting layer aloft and
it returns ierr=2.

Build a hail size distribution at the melting level — reads the
graupel particle size distribution parameters (dist_mu, dist_lambda,
dist_n0) from CASIM's distributions module at the melting level, then
discretizes hail into 7 fixed diameter bins (edges hardcoded from
1 mm to 300 mm) and computes the number concentration in each bin from
the gamma-distribution graupel PSD. If total concentration across all
bins is below a threshold, returns ierr=2 (no significant hail).
Melt each bin down to the surface — for each size bin, steps
level-by-level from the melting level down to the surface, shrinking the
stone's radius each level via mason_melt (a Mason 1971 melting-rate
formulation using latent heat of fusion, thermal conductivities of water/
air, and a ventilation coefficient derived from the Reynolds number of
the falling stone). Terminal velocity uses a simple power law
(V = a_v * D_cm^b_v).
Accumulate surface results — if a stone in a given bin survives
(radius > 0) with concentration above threshold, it contributes to the
surface hail precipitation rate (concentration × velocity × mass × air density), updates the flag (hail_flag = 1), and updates
D_max_sfc to the largest surviving diameter. precip_rate is the sum
of all bins' contributions (kg m⁻² s⁻¹).
Notes:

beta is set to 0 to explicitly ignore condensation evaporation effects. This allows hailstones to fall further.
density of hail is set to 900kg/m3 whereas the density of the graupel for the distribution from which the hail are spawned is lower. Again this allows the hailstones to fall further before melting completely.

The 7 hail-size bins and their edges (1 mm–300 mm) are hardcoded rather
than derived from the actual distribution — a coarse, fixed
discretization.

How it fits together
The two branches are complementary: casim/hail_diagnostic adds the physics
and storage for the new hail diagnostics, and um/hail_diagnostic wires up
STASH so a UM run can request them as output. Together they let a run output:
a hail flag, max hail diameter at the surface (mm), hail precipitation rate,
and accumulated hail precipitation amount.

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

Labels

cla-signed The CLA has been signed as part of this PR - added by GA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants