Repository navigation
Description
Summary
The semi-Lagrangian sedimentation routine nislfv_rain_plm (and its variants nislfv_rain_plm6 and nislfv_rain_plmr) does not conserve mass. It is used for rain, snow, graupel, hail and cloud ice in WSM3, WSM5, WSM7, WDM5, WDM6 and WDM7, and the same code is in WSM6 in MMM-physics. There are two separate faults.
Fault A: arrivals in the top two layers are dropped
In the remap loop intp, find_kt searches kk=kt,km for the first arrival interface za(kk) at or above the top of target layer k, zi(k+1). With downward fall, za(km) < zi(km), so for the top two layers (k = km-1, km) no kk <= km qualifies. The loop ends without setting kt, kt keeps the stale value from the layer below, and kt = kt - 1 leaves it below kb. Neither branch then sets qn(k), so it stays 0. Whatever mass arrives in those two layers, including the sliver lifted when the 3rd-order interface speed wi goes slightly negative near the top, is lost. The search should include za(km+1), and the part of a layer above za(km+1) is empty.
Fault B: the partly below-ground cell is rained out at its mean
In sum_precip, the arrival cell that straddles the ground is rained out as qa(k)*(0.0-za(k)), the cell mean times the below-ground width. The above-ground part of the same cell goes to layer 1 through the PLM (piecewise linear) integral. When that cell has a slope (qpi(k) /= qmi(k), possible for k >= 2, that is when the fall in one step is deeper than the lowest layer), the two parts do not add up to the cell's mass. With mass increasing upward, as below a rain shaft, the surface precipitation is too high and mass is created.
Size
A standalone copy of the routine (from develop), REAL32, gfortran 16.2.0:
- A uniform column of 8 units: 6.25 after one call (1.75 lost from the top). A linear ramp of 10 units with fall past the lowest layer: 10.125 (0.125 created at the ground).
- An Earth-like rain column (50 layers, lowest layer 50 m, rain peak 0.5 g m-3 at 2 km, fall speed 3 to 9 m/s, top layers empty, so only fault B acts): surface precipitation per call too high by 1.06 % (dt 20 s), 0.75 % (60 s) and 0.09 % (120 s). The column aloft is unchanged.
- Random columns with mass in every layer: worst relative mass error per call 57 % to 68 % (these use extreme Courant numbers, so they overstate real cases).
Where
Line numbers on release-v4.8.1 (find_kt loop / partial-cell precip line):
phys/module_mp_wsm3.F:nislfv_rain_plm1415 / 1467 (nislfv_rain_pcm, 1190, has fault A but is not called)phys/module_mp_wsm5.F:nislfv_rain_plm1595 / 1647phys/mic-wsm5-3-5-code.h: the vectorizednislfv_rain_plm, 1729 / 1804 (the scalar copy under#if 0, 1356 / 1408, is not compiled)phys/module_mp_wsm7.F:nislfv_rain_plm2446 / 2501,nislfv_rain_plm62713 / 2765phys/module_mp_wdm5.F:nislfv_rain_plm2088 / 2140phys/module_mp_wdm6.F:nislfv_rain_plmr2621 / 2673,nislfv_rain_plm62883 / 2935phys/module_mp_wdm7.F:nislfv_rain_plmr3003 / 3055,nislfv_rain_plm63265 / 3317
The code is the same on develop (1086c86), release-v4.8.1 (10b0659) and master (06d4240). WSM6 (physics_mmm/mp_wsm6.F90, NCAR/MMM-physics 550b5b494) has both faults in nislfv_rain_plm and nislfv_rain_plm6; I will report it there too.
Suggested fix
A minimal change that leaves every column where neither fault acts bit-for-bit unchanged:
- Let
find_ktrun tokm+1. If no interface qualifies, setkt = km+1and cap the layer top atza(km+1); use that capped top in the twothlines, and scaleqn(k)by the filled fraction of the layer. - Rain out the below-ground part of a sloped cell with the same PLM integral the remap uses:
(qqd*tl*tl + qmi(k)*tl)*dza(k), withtl = (0.0-za(k))/dza(k),qqd = 0.5*(qpi(k)-qmi(k)).
A PR follows.
Activity
dudhia commentedon Nov 17, 2026
@Songyou184 related information on issue.