Skip to content

Enable non-zero mu_r#52

Open
cjvogl wants to merge 10 commits into
mainfrom
feature-dynamic-mur
Open

Enable non-zero mu_r#52
cjvogl wants to merge 10 commits into
mainfrom
feature-dynamic-mur

Conversation

@cjvogl

@cjvogl cjvogl commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Refactoring of sedimentation, evaporation, and size limiters to enable non-zero mu_r (e.g., mu_r=1 as used by EAMxx).

Tested with the following:

  1. verified adiabatic case output with $\mu_r=0$ without lookup tables is within machine precision of prior result, i.e., ./rainshaft --use_zero_mur=1 from this branch vs ./rainshaft from main
  2. verified adiabatic case output with $\mu_r=0$ and and lookup tables is within machine precision of prior result, i.e., ./rainshaft --use_lookup=1 --use_zero_mur=1 from this branch vs ./rainshaft --use_lookup=1 from main
  3. verified adiabatic case output with $\mu_r=1$ seems reasonable, i.e., that the initial $\lambda_r$ values are scaled by $4^{1/3}$ compared to $\mu_r=0$
  4. verified using numerical integration with $mu_r = 1$ results in an error message stating this is not supported

Note that machine precision here refers to an RMS difference $\approx 10^{-20}$ relative to the RMS norm of the prior solution $\approx 10^{-4}$

Here is a summary of the changes, as compiled by Claude Code, seemingly mostly from my commit messages (with me confirming the accuracy of the description):

Key Changes

Core Physics Refactoring:

  • Refactored evaporation calculations to support non-zero mu_r, consolidating the Vevapi integral computation with
    proper gamma function arguments
  • Updated sedimentation and rain fall speed calculations for the gamma distribution with non-zero mu_r
  • Consolidated various implementations of lambda_r to consistently use mu_r from constants
  • Updated size limiters to reference constants.mur consistently throughout

Configuration:

  • Added mur as a configurable parameter in RainshaftConstants
  • Made zero vs non-zero mu_r a CLI argument in the driver
  • Added exception for numerical evaporation integration which does not support non-zero mu_r

Build System:

  • Fixed CMake SUNDIALS integration to avoid unnecessary rebuilds when SUNDIALS repo is updated
  • Corrected SUNDIALS CMake variable name (SUNDIALS_ENABLE_C_EXAMPLES)
  • Fixed NetCDF CMake module to explicitly link HDF5 target, preserving HDF5 paths

@cjvogl cjvogl marked this pull request as ready for review June 9, 2026 01:07
@cjvogl cjvogl changed the title WIP: Enable non-zero mu_r Enable non-zero mu_r Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential bug in gradient computation for "gamma" rain fall speeds

1 participant