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
feat(P3): Gauss-Legendre quadrature parameter, velocity-aware bounds, and P3 property refactors
Once every integrand kink is a quadrature subinterval boundary, the P3
size-distribution integrals are smooth, so a low-order Gauss-Legendre rule
reaches the accuracy that previously needed a high-order Chebyshev-Gauss rule.
Quadrature:
- Default to Gauss-Legendre at every order (arbitrary n >= 1); at matched order
it is ~20x more accurate than Chebyshev-Gauss on the smooth P3 integrands,
verified against an adaptive QuadGK reference.
- Pass the quadrature rule directly on the parameters (P3IceParams.quad); remove
build_quadrature and the quadrature_order field/kwarg, so the rule is a single
explicit object rather than an order-to-rule indirection.
- Lower the default order to 12 (~1e-5 worst-case relative error on the
domain-reduced integrals, the accuracy previously reached at order 16).
- Make quad a required argument of integrate and the P3 process functions,
removing the hidden ChebyshevGauss(100) default; the rule is threaded from the
parameters.
- Resolve the Chen small/large-ice velocity D_cutoff kink as a subinterval
boundary (velocity_integral_bounds), so velocity-weighted integrals converge
geometrically instead of plateauing at the kink.
Ice self-collection:
- Integrate the double integral over the upper triangle D_1 <= D_2, which folds
the D_1 = D_2 diagonal and every regime breakpoint onto quadrature bounds and
halves the integrand evaluations.
Particle properties:
- regime_value: one branchless selector for the five P3 mass/area regimes,
replacing the duplicated regime conditionals in ice_area, ice_mass_coeffs, and
ϕ_material_density.
- ϕᵢ uses the per-regime material density (oblate spheroid model), with aᵢ^{3/2}
written as aᵢ * sqrt(aᵢ), a hardware sqrt and a multiply in place of a
runtime-exponent power call.
- Select the ice terminal-velocity aspect-ratio correction by type
(UseAspectRatio / NoAspectRatio) so the branch resolves at compile time.
Robustness:
- Floor the air density to non-negative in the Chen velocity coefficients; a
slightly-negative sub-domain density otherwise throws in their fractional
powers.
0 commit comments