You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The analytical solution for ρ_d has a denominator that is 0/0 as
F_rim → 0. In Float32 the cancellation drives ρ_d, and therefore ρ_g,
negative, which later raises a DomainError in get_D_gr. Rewrite get_ρ_d
with the relative exponential functions exprel1 and exprel2 so the
cancellation is removed; ρ_g then stays positive for every physical
input, with no clipping. Add the derivation and an error-cancellation
figure to the P3 documentation, and a Float32 stability test.
- [Niesen & Wright (2009), A Krylov subspace algorithm for evaluating the φ-functions appearing in exponential integrators](https://arxiv.org/abs/0907.4631)
145
+
"""
146
+
@inlinefunctionexprel(x, ::Val{k}) where {k}
147
+
k ==1&&returnexprel1(x)
148
+
k ==2&&returnexprel2(x)
149
+
throw(ArgumentError("exprel is only implemented for k = 1 and k = 2"))
150
+
end
151
+
114
152
"""
115
153
get_ρ_d(mass::MassPowerLaw, F_rim, ρ_rim)
116
154
get_ρ_d(state::P3State)
@@ -119,19 +157,42 @@ Exact solution for the density of the unrimed portion of the particle as
119
157
function of the rime mass fraction `F_rim`, mass power law parameters `mass`,
120
158
and rime density `ρ_rim`.
121
159
160
+
For the derivation of the numerically stable form used here, see the P3 scheme
0 commit comments