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

Implementing Chen 2022 Formulas (rain, ice, snow) into 1M scheme #149

Closed
wants to merge 1 commit into from

Conversation

apoorva-thanvantri
Copy link
Contributor

@apoorva-thanvantri apoorva-thanvantri commented Jul 28, 2023

Purpose

Implementing formulas from Chen 2022 into the 1M scheme

To-do

Content

  • formulas
  • documentation
  • unit tests

  • I have read and checked the items on the review checklist.

@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (abec798) 97.67% compared to head (9c32355) 97.68%.

❗ Current head 9c32355 differs from pull request most recent head 49e3f7d. Consider uploading reports for the commit 49e3f7d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #149      +/-   ##
==========================================
+ Coverage   97.67%   97.68%   +0.01%     
==========================================
  Files          12       12              
  Lines         818      822       +4     
==========================================
+ Hits          799      803       +4     
  Misses         19       19              
Files Changed Coverage Δ
src/Common.jl 100.00% <100.00%> (ø)
src/CommonTypes.jl 80.00% <100.00%> (+2.22%) ⬆️
src/Microphysics1M.jl 100.00% <100.00%> (ø)
src/Microphysics2M.jl 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@trontrytel trontrytel force-pushed the at/terminal_velocity_1M branch 2 times, most recently from 474ce0b to 4a44974 Compare August 11, 2023 00:36
@trontrytel
Copy link
Member

trontrytel commented Aug 11, 2023

@apoorva-thanvantri - Thank you for adding all the parameterizations to the 1-moment scheme. It's really cool that you added the aspect ratio computation for snow!

I squashed and rebased everything and modified the velocity comparison plots and the documentation. I think that to avoid conflicts the easiest thing would be to delete or rename your old branch. And then checkout to a new branch from main and pull the changes. Otherwise you will be resolving many conflicts.

A couple of things to do before we can merge this:

  • I think the test for ice terminal velocity was wrong before. Because it was using the snow size distribution parameters when computing lambda for ice. Let me know if you agree. If yes, then we should fix the test.
  • Where are the hardcoded numbers in tests come from?
  • Would be great to add a plot of how the snow aspect ratio depends on the size
  • Would be great to also add a plot of individual terminal velocity for ice particles
  • We should move the free parameters to CLIMAParameters. Similar to what I did for the 2-moment rain PR.
    Let me know if you could take those on. Also, please take a look at the documentation page and see if you agree with the changes there!

I'll think some more on how to refactor the 1-moment terminal velocity functions such that we could keep the function signature the same and just dispatch based on the particle and scheme type. - Done!

@trontrytel
Copy link
Member

trontrytel commented Aug 11, 2023

See also issue #154 To fully update the bulk 1-moment scheme to Chen et al 2022 velocities we would also have to re-do the integrals such as accretion, evaporation and such. Maybe we should meet for some integral party at some point. Those are not hard, but it will be annoying (especially for snow...)

Copy link
Member

@amylu00 amylu00 left a comment

Choose a reason for hiding this comment

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

It looks beautiful, you did great Apoorva! A lot of my suggestions are just changing some whole numbers to FT(number) just to keep things consistent, not sure if there's any value in that computationally, but just in case? My other suggestions are related to the valid range of D_r. I think these changes would make it easier on future users/developers because it's so easy to be unaware that you're out of the valid range.

The rain ``a_i``, ``b_i``, and ``c_i`` are listed in the table below.
The formula is applicable when ``D > 0.1 mm``,
$q$ refers to ``q = e^{0.115231 \; \rho_a}``, where ``\rho_a`` is air density [kg/m3].
The units are: [v] = m/s, [D]=mm, [``a_i``] = ``mm^{-b_i} m/s``, [``b_i``] is dimensionless, [``c_i``] = 1/mm.
Copy link
Member

Choose a reason for hiding this comment

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

It looks like in the actual code, D [=] meters. Maybe note that here so that the user doesn't get confused with units when using the code.

The rain ``a_i``, ``b_i``, and ``c_i`` are listed in the table below.
The formula is applicable when ``D > 0.1 mm``,
$q$ refers to ``q = e^{0.115231 \; \rho_a}``, where ``\rho_a`` is air density [kg/m3].
The units are: [v] = m/s, [D]=mm, [``a_i``] = ``mm^{-b_i} m/s``, [``b_i``] is dimensionless, [``c_i``] = 1/mm.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The units are: [v] = m/s, [D]=mm, [``a_i``] = ``mm^{-b_i} m/s``, [``b_i``] is dimensionless, [``c_i``] = 1/mm.
The units are: [v] = m/s, [D] = mm, [``a_i``] = ``mm^{-b_i} m/s``, [``b_i``] is dimensionless, [``c_i``] = 1/mm.

((16 * (a0_comb)^3 * (ρ_i)^2) / (9 * π * (m0_comb)^2)) *
(D_r / (2 * _r0 * 1000))^(3 * ae_comb - 2 * me_comb)
aspect_ratio = aspect_ratio^(α)
vt = 0
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
vt = 0
vt = FT(0)

k = 3 #for mass weighted terminal velocity

if precip isa CT.RainType && spherical
ϕ = 1
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ϕ = 1
ϕ = FT(1)

Copy link
Member

Choose a reason for hiding this comment

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

Definitely! Otherwise it's not type stable. I'll try to refactor the code a little to have the same function signature for all 1-moment terminal velocities. I can change all of those

src/Microphysics1M.jl Outdated Show resolved Hide resolved
src/Microphysics1M.jl Outdated Show resolved Hide resolved
docs/src/TerminalVelocityComparisons.jl Show resolved Hide resolved
docs/src/TerminalVelocityComparisons.jl Show resolved Hide resolved
docs/src/TerminalVelocityComparisons.jl Show resolved Hide resolved
src/Microphysics1M.jl Outdated Show resolved Hide resolved
@apoorva-thanvantri
Copy link
Contributor Author

apoorva-thanvantri commented Aug 11, 2023 via email

@trontrytel
Copy link
Member

Closing in favour of #163

@trontrytel trontrytel closed this Aug 17, 2023
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.

3 participants