Skip to content

Commit b1f9b0d

Browse files
authored
Merge pull request #630 from CliMA/rc/params_updt
Synchronised parameter names with ClimaParams main
2 parents 566b884 + ccf666f commit b1f9b0d

13 files changed

+48
-52
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CloudMicrophysics"
22
uuid = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
33
authors = ["Climate Modeling Alliance"]
4-
version = "0.26.4"
4+
version = "0.27"
55

66
[deps]
77
ClimaParams = "5c42b081-d73a-476f-9059-fd94b934656c"
@@ -23,7 +23,7 @@ MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
2323
EmulatorModelsExt = ["DataFrames", "MLJ"]
2424

2525
[compat]
26-
ClimaParams = "0.10.35, 0.11"
26+
ClimaParams = "0.12"
2727
DataFrames = "1.6"
2828
DocStringExtensions = "0.8, 0.9"
2929
ForwardDiff = "0.10, 1"
@@ -33,6 +33,6 @@ MLJ = "0.20"
3333
RootSolvers = "0.3, 0.4, 1"
3434
SpecialFunctions = "1, 2"
3535
StaticArrays = "1.9"
36-
Thermodynamics = "0.12.14, 0.13"
36+
Thermodynamics = "0.14"
3737
UnrolledUtilities = "0.1"
3838
julia = "1.6"

src/ThermodynamicsInterface.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ grav(tps::PS) = TD.Parameters.grav(tps) # Needed in parcel model
1111

1212
Rᵥ(tps::PS) = TD.Parameters.R_v(tps)
1313
Rd(tps::PS) = TD.Parameters.R_d(tps)
14-
Rd_over_Rv(tps::PS) = 1 / TD.Parameters.molmass_ratio(tps)
14+
Rd_over_Rv(tps::PS) = 1 / TD.Parameters.Rv_over_Rd(tps)
1515

1616
# Gas constant for moist air
1717
Rₘ(tps::PS, qₜ, qₗ, qᵢ) = TD.gas_constant_air(tps, qₜ, qₗ, qᵢ)
@@ -34,7 +34,7 @@ q_vap(q_tot, q_liq, q_ice) = q_tot - q_liq - q_ice
3434
q_vap(q_tot, q_liq, q_ice, q_rai, q_sno) = q_tot - q_liq - q_ice - q_rai - q_sno
3535

3636
# Get specific content from partial pressure
37-
p2q(tps::PS, T, ρ, pᵥ) = TD.q_vap_saturation_from_density(tps, T, ρ, pᵥ)
37+
p2q(tps::PS, T, ρ, pᵥ) = TD.q_vap_from_p_vap(tps, T, ρ, pᵥ)
3838

3939
# Get partial pressure from specific content
4040
q2p(tps::PS, T, ρ, qᵥ) = qᵥ * ρ * Rᵥ(tps) * T

src/parameters/AerosolActivation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ AerosolActivationParameters(::Type{FT}) where {FT <: AbstractFloat} =
4242
function AerosolActivationParameters(td::CP.AbstractTOMLDict)
4343
name_map = (;
4444
:molar_mass_water => :M_w,
45-
:gas_constant => :R,
45+
:universal_gas_constant => :R,
4646
:density_liquid_water => :ρ_w,
4747
:density_ice_water => :ρ_i,
4848
:surface_tension_water => ,

src/parameters/Microphysics1M.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ function Rain(toml_dict::CP.AbstractTOMLDict)
257257
:cloud_liquid_water_specific_humidity_autoconversion_threshold =>
258258
:q_threshold,
259259
:threshold_smooth_transition_steepness => :k,
260-
:rain_ventillation_coefficient_a => :a,
261-
:rain_ventillation_coefficient_b => :b,
260+
:rain_ventilation_coefficient_a => :a,
261+
:rain_ventilation_coefficient_b => :b,
262262
)
263263
p = CP.get_parameter_values(toml_dict, name_map, "CloudMicrophysics")
264264

@@ -346,8 +346,8 @@ function Snow(toml_dict::CP.AbstractTOMLDict)
346346
:temperature_water_freeze => :T_freeze,
347347
:snow_flake_size_distribution_coefficient_mu => ,
348348
:snow_flake_size_distribution_coefficient_nu => ,
349-
:snow_ventillation_coefficient_a => :a,
350-
:snow_ventillation_coefficient_b => :b,
349+
:snow_ventilation_coefficient_a => :a,
350+
:snow_ventilation_coefficient_b => :b,
351351
:snow_aspect_ratio => ,
352352
:snow_aspect_ratio_coefficient => ,
353353
)

src/parameters/Microphysics2M.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ end
458458

459459
function CloudParticlePDF_SB2006(td::CP.AbstractTOMLDict)
460460
name_map = (;
461-
:SB2006_cloud_gamma_distribution_parameter => :νc,
461+
:SB2006_cloud_gamma_distribution_coeff_nu => :νc,
462462
:SB2006_cloud_gamma_distribution_coeff_mu => :μc,
463463
:SB2006_cloud_droplets_min_mass => :xc_min,
464464
:SB2006_raindrops_min_mass => :xc_max,
@@ -587,7 +587,7 @@ end
587587

588588
function BreakupSB2006(td::CP.AbstractTOMLDict)
589589
name_map = (;
590-
:SB2006_raindrops_equlibrium_mean_diameter => :Deq,
590+
:SB2006_raindrops_equilibrium_mean_diameter => :Deq,
591591
:SB2006_raindrops_breakup_mean_diameter_threshold => :Dr_th,
592592
:SB2006_raindrops_breakup_coeff_kbr => :kbr,
593593
:SB2006_raindrops_breakup_coeff_kappabr => :κbr,
@@ -622,8 +622,8 @@ function EvaporationSB2006(td::CP.AbstractTOMLDict)
622622
name_map = (;
623623
:SB2006_ventilation_factor_coeff_av => :av,
624624
:SB2006_ventilation_factor_coeff_bv => :bv,
625-
:SB2006_rain_evaportation_coeff_alpha => ,
626-
:SB2006_rain_evaportation_coeff_beta => ,
625+
:SB2006_rain_evaporation_coeff_alpha => ,
626+
:SB2006_rain_evaporation_coeff_beta => ,
627627
:SB2006_reference_air_density => :ρ0,
628628
)
629629
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")

test/Project.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1212
EnsembleKalmanProcesses = "aa8a2aa5-91d8-4396-bcef-d4f2ec43552d"
1313
EvoTrees = "f6006082-12f8-11e9-0c9c-0d5d367ab1e5"
1414
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
15-
GaussianProcesses = "891a1506-143c-57d2-908e-e1f8e92e6de9"
1615
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
1716
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
1817
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
@@ -21,7 +20,6 @@ LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
2120
MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
2221
MLJFlux = "094fc8d1-fd35-5302-93ea-dabda2abf845"
2322
MLJModels = "d491faf4-2d78-11e9-2867-c94bc002c0b7"
24-
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
2523
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
2624
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
2725
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
@@ -32,7 +30,5 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3230
Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
3331

3432
[compat]
35-
ClimaParams = "0.10.35"
3633
KernelAbstractions = "0.9"
3734
MLJFlux = "0.4"
38-
Optim = "<1.9.3"

test/cloud_diagnostics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function test_cloud_diagnostics(FT)
5252
N_rai = [FT(510859), FT(510859), FT(0), FT(0), FT(5.136e-18)]
5353

5454
# reference values
55-
rr = [FT(-12.561951), FT(-12.579899), FT(-150), FT(-150), FT(-150)]
55+
rr = [FT(-12.559725319858543), FT(-12.579899), FT(-150), FT(-150), FT(-150)]
5656
reff = [FT(2.319383e-5), FT(6.91594e-5), FT(0), FT(0), FT(0)]
5757

5858
for (qₗ, Nₗ, qᵣ, Nᵣ, rₑ, Z) in zip(q_liq, N_liq, q_rai, N_rai, reff, rr)

test/gpu_tests.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ function test_gpu(FT)
860860
kernel!(liquid, ice, tps, output, ρ, T, qᵥ_sl, qᵢ, qᵢ_s, ; ndrange)
861861

862862
# test that nonequilibrium cloud formation is callable and returns a reasonable value
863-
TT.@test Array(output)[1] FT(3.763783850665844e-5)
863+
TT.@test Array(output)[1] FT(3.76347635339803e-5)
864864
TT.@test Array(output)[2] FT(-1e-4)
865865
end
866866

@@ -976,7 +976,7 @@ function test_gpu(FT)
976976
kernel!(snow, blk1mvel, aps, tps, output, ρ, T, qs, ; ndrange)
977977

978978
# test if 1-moment snow melt is callable and returns reasonable values
979-
TT.@test Array(output)[1] FT(9.518235437405256e-6)
979+
TT.@test Array(output)[1] FT(9.516553267013084e-6)
980980
TT.@test Array(output)[2] FT(0)
981981
TT.@test Array(output)[3] FT(0)
982982
end
@@ -1054,11 +1054,11 @@ function test_gpu(FT)
10541054
ndrange = ndrange,
10551055
)
10561056

1057-
TT.@test isapprox(Array(output)[1], FT(-4.083606e-7), rtol = 1e-6)
1058-
TT.@test isapprox(Array(output)[2], FT(-3769.4827), rtol = 1e-6)
1059-
TT.@test isapprox(Array(output)[3], FT(4.083606e-7), rtol = 1e-6)
1060-
TT.@test isapprox(Array(output)[4], FT(1884.7413), rtol = 1e-6)
1061-
TT.@test isapprox(Array(output)[5], FT(-31040.115), rtol = 1e-6)
1057+
TT.@test isapprox(Array(output)[1], FT(-5.742569998787898e-7), rtol = 1e-6)
1058+
TT.@test isapprox(Array(output)[2], FT(-5300.833845034984), rtol = 1e-6)
1059+
TT.@test isapprox(Array(output)[3], FT(5.742569998787898e-7), rtol = 1e-6)
1060+
TT.@test isapprox(Array(output)[4], FT(2650.416922517492), rtol = 1e-6)
1061+
TT.@test isapprox(Array(output)[5], FT(-33859.96615496501), rtol = 1e-6)
10621062
TT.@test isapprox(Array(output)[6], FT(-6.358926e-6), rtol = 1e-6)
10631063
TT.@test isapprox(Array(output)[7], FT(-317946.28), rtol = 1e-6)
10641064
TT.@test isapprox(Array(output)[8], FT(6.358926e-6), rtol = 1e-6)
@@ -1070,12 +1070,12 @@ function test_gpu(FT)
10701070
TT.@test isapprox(Array(output)[13], FT(4.517734), rtol = 1e-6)
10711071
TT.@test isapprox(
10721072
Array(output)[14],
1073-
FT(-260774.56803),
1073+
FT(-260791.30068415933),
10741074
rtol = 1e-6,
10751075
)
10761076
TT.@test isapprox(
10771077
Array(output)[15],
1078-
FT(-0.0037092913),
1078+
FT(-0.003709529301871412),
10791079
rtol = 1e-6,
10801080
)
10811081
end
@@ -1084,10 +1084,10 @@ function test_gpu(FT)
10841084
TT.@test isapprox(Array(output)[11], FT(0), rtol = 1e-6)
10851085
TT.@test isapprox(Array(output)[12], FT(2.6429e-3), rtol = 1e-4)
10861086
TT.@test isapprox(Array(output)[13], FT(0.1149338), rtol = 1e-5)
1087-
TT.@test isapprox(Array(output)[14], FT(-56712.917), rtol = 1e-6)
1087+
TT.@test isapprox(Array(output)[14], FT(-56716.556198709244), rtol = 1e-6)
10881088
TT.@test isapprox(
10891089
Array(output)[15],
1090-
FT(-0.0001003405),
1090+
FT(-0.00010034697555076008),
10911091
rtol = 1e-6,
10921092
)
10931093
end
@@ -1122,7 +1122,7 @@ function test_gpu(FT)
11221122
kernel!(H2SO4_prs, tps, output, x_sulph, T; ndrange)
11231123

11241124
# test if a_w_xT is callable and returns reasonable values
1125-
TT.@test Array(output)[1] FT(0.92824538441)
1125+
TT.@test Array(output)[1] FT(0.928418590276476)
11261126

11271127
dims = (1, 1)
11281128
(; output, ndrange) = setup_output(dims, FT)
@@ -1134,7 +1134,7 @@ function test_gpu(FT)
11341134
kernel!(tps, output, e, T; ndrange)
11351135

11361136
# test if a_w_eT is callable and returns reasonable values
1137-
TT.@test Array(output)[1] FT(0.880978146)
1137+
TT.@test Array(output)[1] FT(0.880951366899518)
11381138

11391139
dims = (1, 1)
11401140
(; output, ndrange) = setup_output(dims, FT)
@@ -1145,7 +1145,7 @@ function test_gpu(FT)
11451145
kernel!(tps, output, T; ndrange)
11461146

11471147
# test if a_w_ice is callable and returns reasonable values
1148-
TT.@test Array(output)[1] FT(0.653191723)
1148+
TT.@test Array(output)[1] FT(0.6538439184585567)
11491149
end
11501150

11511151
TT.@testset "Ice Nucleation kernels" begin

test/microphysics1M_tests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function test_microphysics1M(FT)
176176
qₗ = FT(0)
177177
qᵢ = FT(0.03) * qᵥ
178178
qₜ = qᵥ + qₗ + qᵢ + qᵣ + qₛ
179-
ref = FT(2.5405159487552133e-9)
179+
ref = FT(2.5408135723057333e-9)
180180
TT.@test CM1.conv_q_ice_to_q_sno(ice, aps, tps, qₜ, qₗ, qᵢ, qᵣ, qₛ, ρ, T) ref
181181
end
182182

@@ -425,7 +425,7 @@ function test_microphysics1M(FT)
425425
ρ = FT(1.2)
426426
q_sno = FT(1e-4)
427427
TT.@test CM1.snow_melt(snow, blk1mvel.snow, aps, tps, q_sno, ρ, T)
428-
FT(9.518235437405256e-6)
428+
FT(9.516553267013085e-6)
429429

430430
# no snow -> no snow melt
431431
T = FT(273.15 + 2)

test/microphysics2M_tests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ function test_microphysics2M(FT)
709709
# Sanity checks of specific content and number concentration with mass distribution
710710
Nx = P3.integrate(Mⁿ(0, f_x), x_min, x_max)
711711
qx = P3.integrate(Mⁿ(1, f_x), x_min, x_max) / ρₐ
712-
TT.@test qx qₗ rtol = 1e-5
712+
TT.@test qx qₗ rtol = 2e-5
713713
TT.@test Nx Nₗ rtol = 1e-5
714714

715715
# Sanity checks of specific content and number concentration with diameter distribution
@@ -719,8 +719,8 @@ function test_microphysics2M(FT)
719719
qD_psd = P3.integrate(Mⁿ(3, psd), D_min, D_max) * k_m / ρₐ
720720
TT.@test ND Nₗ rtol = 1e-5
721721
TT.@test ND_psd Nₗ rtol = 1e-5
722-
TT.@test qD qₗ rtol = 1e-5
723-
TT.@test qD_psd qₗ rtol = 1e-5
722+
TT.@test qD qₗ rtol = 2e-5
723+
TT.@test qD_psd qₗ rtol = 2e-5
724724
end
725725

726726
TT.@testset "2M_microphysics - Horn 2012 number concentration adjustment" begin

0 commit comments

Comments
 (0)