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

P3 skeleton framework #185

Merged
merged 19 commits into from
Aug 24, 2024
Merged

P3 skeleton framework #185

merged 19 commits into from
Aug 24, 2024

Conversation

rorlija1
Copy link
Contributor

@rorlija1 rorlija1 commented Jul 30, 2024

This PR aims to add compatibility in KiD to test the 1D framework described in case 1 of Cholette et al 2019 using P3.

Only P3 terminal velocity is included with this PR.

For future reference, the configuration I've been using for testing is as follows:

config = parse_commandline()
config["precipitation_choice"] = "PrecipitationP3"
config["moisture_choice"] = "MoistureP3"
config["n_elem"] = 24
config["z_max"] = 3000
config["t_end"] = 75
config["w1"] = 0
config["dt"] = Float64(0.5)

Note: the p3_boundary_condition command line argument controls whether we use an initial signal of ice or we introduce ice mass via the boundary, and the same argument is also used to customize the characteristics of the initial/boundary condition particles.

@rorlija1
Copy link
Contributor Author

@sajjadazimi I've just tagged you for review on this PR—I haven't added tests for P3 and have not squashed/rebased yet, but I'm hoping to get your feedback on the code as I prepare to merge this. Thanks!!

@rorlija1 rorlija1 changed the title Add P3 Initial Profile, Tendency P3 skeleton framework in KiD Aug 19, 2024
@rorlija1 rorlija1 changed the title P3 skeleton framework in KiD P3 skeleton framework Aug 19, 2024
Copy link
Member

@sajjadazimi sajjadazimi left a comment

Choose a reason for hiding this comment

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

Thank you!
It looks good to me. I left some small comments.

Comment on lines 65 to 92
@. θ_liq_ice = TD.liquid_ice_pottemp(thermo_params, ts)
@. θ_liq_ice = θ_dry #TD.liquid_ice_pottemp(thermo_params, ts) - prevents error...
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change this line?

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if the fact that we are running it with q_vap = 0 is the problem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just changed it back to using θ_liq_ice from Thermodynamics, and no error! So whatever was causing it when I originally commented it out must be fixed now

)
@. dY.N_aer += -∂(aux.prescribed_velocity.ρw / If(aux.thermo_variables.ρ) * If(Y.N_aer))

if Bool(aux.kid_params.qtot_flux_correction)
Copy link
Member

Choose a reason for hiding this comment

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

remove this condition. Always apply fcc here

Comment on lines 436 to 440
_q_flux = FT(0.65e-4)
_N_flux = FT(40000)
_F_rim = FT(0.2)
_F_liq = FT(0.2)
_ρ_r_init = FT(900)
Copy link
Member

Choose a reason for hiding this comment

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

These should not be hardcoded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right—thanks. Would it be acceptable to add them as elements of the PrecipitationP3 struct that can be initialized in run_KiD_simulation? If so, would the best place be to add them as command line arguments in parse_commandline? Otherwise, I could add them in aux as command line arguments as well. Maybe a command line argument that is used in aux could be the cleanest way to do it?

Copy link
Member

Choose a reason for hiding this comment

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

I think they would fit better in the case setup. Since they only come about because the case specifies the top fluxes. In an actual simulation we would make sure that our domain is high enough that we don't have to worry about anything else falling in

This comment was marked as outdated.

_F_liq = FT(0.2)
_ρ_r_init = FT(900)

_flux = FT(0.5)
Copy link
Member

Choose a reason for hiding this comment

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

same here

Comment on lines 108 to 118
# commenting here the configuration which has been used for p3:
# config["precipitation_choice"] = "PrecipitationP3"
# config["moisture_choice"] = "MoistureP3"
# config["n_elem"] = 24
# config["z_max"] = 3000
# config["t_end"] = 75
# config["w1"] = 0
# config["rv_0"] = 0
# config["rv_1"] = 0
# config["rv_2"] = 0
# config["dt"] = Float64(0.5)
Copy link
Member

Choose a reason for hiding this comment

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

These lines should be removed before merging

N_rai::FT = FT(0)

# q_tot - single p3 category + 2M categories
q_tot::FT = q_ice + q_liq + q_rai
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could add some water vapor to this setup. Such that q_tot = q_vap + q_liq + q_ice?

This comment was marked as outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah—update: I could also use the same profile of water vapor which I just noticed that's used in the normal 1D testing setup. I'm guessing that would be the best way forward.

# config["dt"] = Float64(0.5)
cloudy_params = nothing
init = map(
coord -> CO.p3_initial_condition(
Copy link
Member

Choose a reason for hiding this comment

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

why do we need a special case for the P3 scheme? Could it be handled in the same way as other bulk microphysics cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think if we want to initialize particles with specific P3 properties, we have to have another initial condition function, and in that initial condition, we specify our own temperature and pressure gradients, and we can add vapor pressure, etc. In the future we could try other initial conditions, but maybe for now this way is easiest for testing if you agree?

@trontrytel
Copy link
Member

Could we also add this case to our buildkite jobs: https://github.com/CliMA/KinematicDriver.jl/blob/main/.buildkite/pipeline.yml

@rorlija1 rorlija1 marked this pull request as ready for review August 21, 2024 21:11
Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 83.12500% with 27 lines in your changes missing coverage. Please review.

Project coverage is 78.96%. Comparing base (872a766) to head (ea3a326).
Report is 13 commits behind head on main.

Files Patch % Lines
src/Common/tendency.jl 48.97% 25 Missing ⚠️
src/Common/ode_utils.jl 83.33% 1 Missing ⚠️
src/K1DModel/tendency.jl 98.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
- Coverage   80.82%   78.96%   -1.86%     
==========================================
  Files          28       28              
  Lines        1945     2225     +280     
==========================================
+ Hits         1572     1757     +185     
- Misses        373      468      +95     

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

@rorlija1 rorlija1 merged commit a70f197 into main Aug 24, 2024
7 checks passed
@rorlija1 rorlija1 deleted the ro/p3testing branch August 24, 2024 01:03
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.

3 participants