Skip to content

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

@cjvogl

Description

@cjvogl

I believe there is a bug in the computation of the rain number fall speed derivatives using the "non-numerical" approach. Leveraging that

$$\frac{\partial v_i}{\partial \lambda_r}(\lambda_r,\mu_r) = \frac{\mu_r+i+1}{\lambda_r}\big( v_i(\lambda_r,\mu_r) - v_{i+1}(\lambda_r,\mu_r)\big)$$

and

$$v_k(\lambda_r,\mu_r) = \frac{1}{\Gamma(\mu_r+k+1)} \sum_{j=1}^4 \alpha_j \left( \frac{\pi \rho_w}{6}\right)^{\beta_j} \lambda_r^{-3\beta_j} \big[ \Gamma(\mu_r+k+3\beta_j+1, D_j \lambda_r) - \Gamma(\mu_r+k+3\beta_j+1, D_{j+1} \lambda_r)\big)$$

I believe that the $1 / \Gamma(\mu_r+i+2)$ coefficient is missing for $v_{i+1}$ where $i=0$ and $\mu_r = 0$ (i.e., there's a missing 1/2):

const double term1v0_dl = (term1v0 - int1_fac * tgamma_lower(4., lambdar_size1) * lambdar_neg_2) / lambdar;
const double term2v0_dl = (term2v0 - int2_fac * (tgamma(3., lambdar_size1) - tgamma(3., lambdar_size2)) * lambdar_neg_1) / lambdar;
const double term3v0_dl = (term3v0 - int3_fac * (tgamma(2.5, lambdar_size2) - tgamma(2.5, lambdar_size3)) * lambdar_neg_0_5) / lambdar;
const double term4v0_dl = (term4v0 - int4_fac * tgamma(2., lambdar_size3)) / lambdar;

I plan on addressing this as I implement $\mu_r \ne 0$; however, I thought it worth noting here as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions