Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some microphysics if-else branches are not exercised #323

Closed
charleskawczynski opened this issue Sep 28, 2021 · 2 comments
Closed

Some microphysics if-else branches are not exercised #323

charleskawczynski opened this issue Sep 28, 2021 · 2 comments
Assignees
Labels

Comments

@charleskawczynski
Copy link
Member

charleskawczynski commented Sep 28, 2021

I was looking at refactoring a bit of the microphysics code, specifically here. What I came up with looks like

struct Rain1M end
struct RainCutoff end
struct RainNone end

function compute_qr_src(::Rain1M, ts, liq_type, rain_type, q_pt, qr, ρ0, dt)
    qr_src1 = q_pt.liq / dt
    qr_src2 = CM1.conv_q_liq_to_q_rai(ts.param_set, q_pt.liq) +
              CM1.accretion(ts.param_set, liq_type, rain_type, q_pt.liq, qr, ρ0)
    return min(qr_src1, qr_src2)
end

function compute_qr_src(::RainCutoff, ts, liq_type, rain_type, q_pt, qr, ρ0, dt)
    qsat = TD.q_vap_saturation(ts)
    qr_src1 = q_pt.liq / dt
    qr_src2 = -CM0.remove_precipitation(ts.param_set, q_pt, qsat)
    return min(qr_src1, qr_src2)
end

compute_qr_src(::RainNone, ts, liq_type, rain_type, q_pt, qr, ρ0, dt) = 0

function microphysics_rain_src(param_set::APS, rain_model, q_pt, qr, area, ρ0, dt, ts)
    area > 0.0 && return mph_struct(;qr_src=0, thl_rain_src=0)
    qr_src = compute_qr_src(rain_model, ts, liq_type, rain_type, q_pt, qr, ρ0, dt)
    thl_rain_src = rain_source_to_θ_liq(ts, qr_src)
    return mph_struct(;thl_rain_src, qr_src)
end

and I was going to open a PR, but I then noticed that liq_type and rain_type are not defined, and so I thought it might be better to just copy this code here and point this out.

@trontrytel
Copy link
Member

@charleskawczynski - I think that the recent microphysics related PRs solved this issue? Could you double check?

@charleskawczynski
Copy link
Member Author

Yes, I believe so. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants