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

Add 1-moment microphysics to prognostic EDMF #2858

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Conversation

trontrytel
Copy link
Member

@trontrytel trontrytel commented Mar 29, 2024

This PR adds 1-moment microphysics scheme to prognostic EDMF.

Precipitation (rain and snow) is only computed as a grid mean quantity (i.e. we don't have updraft and environment precipitation variables). The sources to precipitation are computed as a sum of contributions from updrafts and the environment. The precipitation sinks (evaporation, melting, deposition/sublimation) are only computed on the grid mean.

My main priority was to only have one definition of compute_precipitation_sources! and compute_precipitation_sinks!. This is where I loop over all microphysics processes and I don't want to have multiple versions of it. That function returns 4 outputs (source terms to total water, rain, snow and energy) and I didn't know how to write it outside of a colidx loop.

Things I don't like about the code right now:

  • the additional colidx loop
  • all the additional variables I'm adding to the cache
  • compute_precipitation_sinks! and compute_precipitation_sources! behave differently. The sources one zeroes out the cached S before adding to it. The sinks does not. This is because when used without EDMF, the sinks are done after the sources and add to the same cached values. This is clunky, but I didn't have a better idea and I did not want to add another 4 variables to the cache

Also, can I re-use my tmp scalar between different updraft j-s and the environment?

    tmp1 = p.scratch.ᶜtemp_scalar
    n = number of updrafts

    do colidx
        # Sources from the updrafts
        for j in 1:n
            foo!(
                tmp1[colidx],
               all_the_sgs_j_variables_and_dollars[colidx]
            )
        end

Copy link
Member

@szy21 szy21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just some minor comments for now. I will go through the rest later today or over the weekend.

config/model_configs/prognostic_edmfx_trmm_column_0M.yml Outdated Show resolved Hide resolved
src/parameterized_tendencies/microphysics/precipitation.jl Outdated Show resolved Hide resolved
Copy link
Member

@szy21 szy21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought. Looking at the code, another way to calculate sources for one moment microphysics is to dispatch on compute_precipitation_sources! by the sgs model, rather than saving the precipitation sources in edmf precomputed quantities. We can keep this for now and see what would be better as we add more options.

@trontrytel
Copy link
Member Author

Just a thought. Looking at the code, another way to calculate sources for one moment microphysics is to dispatch on compute_precipitation_sources! by the sgs model, rather than saving the precipitation sources in edmf precomputed quantities. We can keep this for now and see what would be better as we add more options.

Sounds good. I agree, there should be a more elegant way to switch between 0M/1M w/wo EDMF(diagnostic and prognostic). And also w/wo quadratures in the future. I think with the promised advent of fusion I could write the whole 1-moment microphysics as a point-wise function that returns a tuple of numbers. Instead of having to use it inside colidx call.

But it is easier for me to write a better solution once we have something working.

@trontrytel trontrytel force-pushed the aj/edmf_1M_part2 branch 2 times, most recently from aa75505 to 49d1144 Compare April 2, 2024 23:19
@trontrytel trontrytel added this pull request to the merge queue Apr 3, 2024
Merged via the queue into main with commit 1c4e63f Apr 3, 2024
9 of 11 checks passed
@trontrytel trontrytel deleted the aj/edmf_1M_part2 branch April 3, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants