CliMA / CloudMicrophysics.jl

A library of cloud microphysics parameterizations
Apache License 2.0
38 stars 6 forks source link

P3 predicted variables helper #453

Open rorlija1 opened 1 month ago

rorlija1 commented 1 month ago

During my brief testing of P3 in KiD I had the idea that a function like the one implemented here might be useful for calculating the "predicted variables"—F_rim, p_rim, F_liq. I'm envisioning that after the state variables are calculated at each time step, we call this p3_predictor(), or like we talked about throw it in with thresholds(), distribution_parameter_solver(), etc... using the computed F_rim, p_rim, F_liq.

The advantage of having a call to P3 to compute the predicted variables is to catch limit cases early and ensure that we're passing physically reasonable values to the rest of the P3 functions, instead of hard-coding these things in KiD every time we compute the predicted quantities, so I thought I may as well implement this solution for fun! But no hard feelings if this PR gets closed and is never merged!

NOTE: This PR also allows the rime density to be 0. (Previously it had to be greater than 0.) I thought maybe this change could be useful because we could return 0 rime density for when we have no rime or no total ice content.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.91%. Comparing base (9582b2d) to head (67bdfdc).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #453 +/- ## ========================================== + Coverage 96.89% 96.91% +0.02% ========================================== Files 41 41 Lines 1480 1490 +10 ========================================== + Hits 1434 1444 +10 Misses 46 46 ``` | [Components](https://app.codecov.io/gh/CliMA/CloudMicrophysics.jl/pull/453/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA) | Coverage Δ | | |---|---|---| | [src](https://app.codecov.io/gh/CliMA/CloudMicrophysics.jl/pull/453/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA) | `98.78% <100.00%> (+<0.01%)` | :arrow_up: | | [ext](https://app.codecov.io/gh/CliMA/CloudMicrophysics.jl/pull/453/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA) | `69.79% <ø> (ø)` | |