-
Notifications
You must be signed in to change notification settings - Fork 6
/
Microphysics2M.jl
632 lines (543 loc) · 16.1 KB
/
Microphysics2M.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
export KK2000, B1994, TC1980, LD2004, VarTimescaleAcnv, SB2006
"""
AcnvKK2000
Khairoutdinov and Kogan (2000) autoconversion parameters
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct AcnvKK2000{FT} <: ParametersType{FT}
"Autoconversion coefficient A"
A::FT
"Autoconversion coefficient a"
a::FT
"Autoconversion coefficient b"
b::FT
"Autoconversion coefficient c"
c::FT
end
function AcnvKK2000(td::CP.AbstractTOMLDict)
name_map = (;
:KK2000_autoconversion_coeff_A => :A,
:KK2000_autoconversion_coeff_a => :a,
:KK2000_autoconversion_coeff_b => :b,
:KK2000_autoconversion_coeff_c => :c,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return AcnvKK2000{FT}(; parameters...)
end
"""
AccrKK2000
Khairoutdinov and Kogan (2000) accretion parameters
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct AccrKK2000{FT} <: ParametersType{FT}
"Accretion coefficient A"
A::FT
"Accretion coefficient a"
a::FT
"Accretion coefficient b"
b::FT
end
function AccrKK2000(td::CP.AbstractTOMLDict)
name_map = (;
:KK2000_accretion_coeff_A => :A,
:KK2000_accretion_coeff_a => :a,
:KK2000_accretion_coeff_b => :b,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return AccrKK2000{FT}(; parameters...)
end
"""
KK2000
The type and parameters for 2-moment precipitation formation by
Khairoutdinov and Kogan (2000)
DOI:10.1175/1520-0493(2000)128<0229:ANCPPI>2.0.CO;2
# Fields
$(DocStringExtensions.FIELDS)
"""
struct KK2000{FT, AV, AR} <: Precipitation2MType{FT}
"Autoconversion parameters"
acnv::AV
"Accretion parameters"
accr::AR
end
KK2000(::Type{FT}) where {FT <: AbstractFloat} = KK2000(CP.create_toml_dict(FT))
function KK2000(toml_dict::CP.AbstractTOMLDict)
acnv = AcnvKK2000(toml_dict)
accr = AccrKK2000(toml_dict)
FT = CP.float_type(toml_dict)
return KK2000{FT, typeof(acnv), typeof(accr)}(acnv, accr)
end
"""
AcnvB1994
Beheng (1994) autoconversion parameters
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct AcnvB1994{FT} <: ParametersType{FT}
"Autoconversion coeff C"
C::FT
"Autoconversion coeff a"
a::FT
"Autoconversion coeff b"
b::FT
"Autoconversion coeff c"
c::FT
"Autoconversion coeff N_0"
N_0::FT
"Autoconversion coeff d_low"
d_low::FT
"Autoconversion coeff d_high"
d_high::FT
"Threshold for smooth tranistion steepness"
k::FT
end
function AcnvB1994(td::CP.AbstractTOMLDict)
name_map = (;
:B1994_autoconversion_coeff_C => :C,
:B1994_autoconversion_coeff_a => :a,
:B1994_autoconversion_coeff_b => :b,
:B1994_autoconversion_coeff_c => :c,
:B1994_autoconversion_coeff_N_0 => :N_0,
:B1994_autoconversion_coeff_d_low => :d_low,
:B1994_autoconversion_coeff_d_high => :d_high,
:threshold_smooth_transition_steepness => :k,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return AcnvB1994{FT}(; parameters...)
end
"""
AccrB1994
Beheng (1994) accretion parameters
# Fields
$(DocStringExtensions.FIELDS)
"""
struct AccrB1994{FT} <: ParametersType{FT}
"Accretion coefficient A"
A::FT
end
function AccrB1994(toml_dict::CP.AbstractTOMLDict)
(; B1994_accretion_coeff_A) = CP.get_parameter_values(
toml_dict,
"B1994_accretion_coeff_A",
"CloudMicrophysics",
)
FT = CP.float_type(toml_dict)
return AccrB1994{FT}(B1994_accretion_coeff_A)
end
"""
B1994
The type and parameter for 2-moment precipitation formation by Beheng (1994)
DOI: 10.1016/0169-8095(94)90020-5
# Fields
$(DocStringExtensions.FIELDS)
"""
struct B1994{FT, AV, AR} <: Precipitation2MType{FT}
"Autoconversion coeff C"
acnv::AV
"Autoconversion coeff a"
accr::AR
end
B1994(::Type{FT}) where {FT <: AbstractFloat} = B1994(CP.create_toml_dict(FT))
function B1994(toml_dict::CP.AbstractTOMLDict)
acnv = AcnvB1994(toml_dict)
accr = AccrB1994(toml_dict)
FT = CP.float_type(toml_dict)
return B1994{FT, typeof(acnv), typeof(accr)}(acnv, accr)
end
"""
AcnvTC1980
Tripoli and Cotton (1980) autoconversion parameters
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct AcnvTC1980{FT} <: ParametersType{FT}
"Autoconversion coefficient a"
a::FT
"Autoconversion coefficient b"
b::FT
"Autoconversion coefficient D"
D::FT
"Autoconversion coefficient r_0"
r_0::FT
"Autoconversion coefficient me_liq"
me_liq::FT
"Autoconversion coefficient m0_liq_coeff"
m0_liq_coeff::FT
"Threshold for smooth tranistion steepness"
k::FT
end
function AcnvTC1980(td::CP.AbstractTOMLDict)
name_map = (;
:TC1980_autoconversion_coeff_a => :a,
:TC1980_autoconversion_coeff_b => :b,
:TC1980_autoconversion_coeff_D => :D,
:TC1980_autoconversion_coeff_r_0 => :r_0,
:TC1980_autoconversion_coeff_me_liq => :me_liq,
:threshold_smooth_transition_steepness => :k,
:density_liquid_water => :m0_liq_coeff,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
m0_liq_coeff = 4 / 3 * π * parameters.m0_liq_coeff
FT = CP.float_type(td)
return AcnvTC1980{FT}(; parameters..., m0_liq_coeff)
end
"""
AccrTC1980
Tripoli and Cotton (1980) accretion parameters
# Fields
$(DocStringExtensions.FIELDS)
"""
struct AccrTC1980{FT} <: ParametersType{FT}
"Accretion coefficient A"
A::FT
end
function AccrTC1980(toml_dict::CP.AbstractTOMLDict)
(; TC1980_accretion_coeff_A) = CP.get_parameter_values(
toml_dict,
"TC1980_accretion_coeff_A",
"CloudMicrophysics",
)
FT = CP.float_type(toml_dict)
return AccrTC1980{FT}(TC1980_accretion_coeff_A)
end
"""
TC1980
The type and parameters for 2-moment precipitation formation by
Tripoli and Cotton (1980)
DOI: 10.1175/1520-0450(1980)019<1037:ANIOSF>2.0.CO;2
# Fields
$(DocStringExtensions.FIELDS)
"""
struct TC1980{FT, AV, AR} <: Precipitation2MType{FT}
"Autoconversion parameters"
acnv::AV
"Accretion parameters"
accr::AR
end
TC1980(::Type{FT}) where {FT <: AbstractFloat} = TC1980(CP.create_toml_dict(FT))
function TC1980(toml_dict::CP.AbstractTOMLDict)
acnv = AcnvTC1980(toml_dict)
accr = AccrTC1980(toml_dict)
FT = CP.float_type(toml_dict)
return TC1980{FT, typeof(acnv), typeof(accr)}(acnv, accr)
end
"""
LD2004
The type and parameters for 2-moment precipitation formation by
Liu and Daum (2004)
DOI: 10.1175/1520-0469(2004)061<1539:POTAPI>2.0.CO;2
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct LD2004{FT} <: Precipitation2MType{FT}
"Autoconversion coefficient R_6C_0"
R_6C_0::FT
"Autoconversion coefficient E_0"
E_0::FT
"liquid water density [kg/m3]"
ρ_w::FT
"Threshold for smooth tranistion steepness"
k::FT
end
LD2004(::Type{FT}) where {FT <: AbstractFloat} = LD2004(CP.create_toml_dict(FT))
function LD2004(td::CP.AbstractTOMLDict)
name_map = (;
:LD2004_R_6C_coeff => :R_6C_0,
:LD2004_E_0_coeff => :E_0,
:density_liquid_water => :ρ_w,
:threshold_smooth_transition_steepness => :k,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return LD2004{FT}(; parameters...)
end
"""
VarTimescaleAcnv
The type for 2-moment precipitation formation based on the
1-moment parameterization with variable time scale Azimi et al (2023)
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct VarTimescaleAcnv{FT} <: Precipitation2MType{FT}
"Timescale [s]"
τ::FT
"Powerlaw coefficient [-]"
α::FT
end
VarTimescaleAcnv(::Type{FT}) where {FT <: AbstractFloat} =
VarTimescaleAcnv(CP.create_toml_dict(FT))
function VarTimescaleAcnv(td::CP.AbstractTOMLDict)
name_map = (;
:rain_autoconversion_timescale => :τ,
:Variable_time_scale_autoconversion_coeff_alpha => :α,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return VarTimescaleAcnv{FT}(; parameters...)
end
"""
RainParticlePDF_SB2006
Rain size distribution parameters from SB2006
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct RainParticlePDF_SB2006{FT} <: ParametersType{FT}
"Raindrop size distribution coefficient νr"
νr::FT
"Raindrop size distribution coefficient μr"
μr::FT
"Raindrop minimal mass"
xr_min::FT
"Raindrop maximum mass"
xr_max::FT
"Raindrop size distribution coefficient N0 min"
N0_min::FT
"Raindrop size distribution coefficient N0 max"
N0_max::FT
"Raindrop size distribution coefficient lambda min"
λ_min::FT
"Raindrop size distribution coefficient lambda max"
λ_max::FT
"Cloud liquid water density [kg/m3]"
ρw::FT
"Reference air density [kg/m3]"
ρ0::FT
end
function RainParticlePDF_SB2006(td::CP.AbstractTOMLDict)
name_map = (;
:SB2006_rain_distribution_coeff_nu => :νr,
:SB2006_rain_distribution_coeff_mu => :μr,
:SB2006_raindrops_min_mass => :xr_min,
:SB2006_raindrops_max_mass => :xr_max,
:SB2006_raindrops_size_distribution_coeff_N0_min => :N0_min,
:SB2006_raindrops_size_distribution_coeff_N0_max => :N0_max,
:SB2006_raindrops_size_distribution_coeff_lambda_min => :λ_min,
:SB2006_raindrops_size_distribution_coeff_lambda_max => :λ_max,
:density_liquid_water => :ρw,
:SB2006_reference_air_density => :ρ0,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return RainParticlePDF_SB2006{FT}(; parameters...)
end
"""
CloudParticlePDF_SB2006
Cloud droplets size distribution parameters from SB2006
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct CloudParticlePDF_SB2006{FT} <: ParametersType{FT}
"Cloud droplet size distribution coefficient νc"
νc::FT
"Cloud droplet size distribution coefficient μc"
μc::FT
end
function CloudParticlePDF_SB2006(td::CP.AbstractTOMLDict)
name_map = (;
:SB2006_cloud_gamma_distribution_parameter => :νc,
:SB2006_cloud_gamma_distribution_coeff_mu => :μc,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return CloudParticlePDF_SB2006{FT}(; parameters...)
end
"""
AcnvSB2006
Autoconversion parameters from SB2006
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct AcnvSB2006{FT} <: ParametersType{FT}
"Collection kernel coefficient"
kcc::FT
"Cloud gamma distribution coefficient"
νc::FT
"Minimum mass of rain droplets"
x_star::FT
"Reference air density [kg/m3]"
ρ0::FT
"Autoconversion correcting function coeff A"
A::FT
"Autoconversion correcting function coeff a"
a::FT
"Autoconversion correcting function coeff b"
b::FT
end
function AcnvSB2006(td::CP.AbstractTOMLDict)
name_map = (;
:SB2006_collection_kernel_coeff_kcc => :kcc,
:SB2006_cloud_gamma_distribution_parameter => :νc,
:SB2006_raindrops_min_mass => :x_star,
:SB2006_reference_air_density => :ρ0,
:SB2006_autoconversion_correcting_function_coeff_A => :A,
:SB2006_autoconversion_correcting_function_coeff_a => :a,
:SB2006_autoconversion_correcting_function_coeff_b => :b,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return AcnvSB2006{FT}(; parameters...)
end
"""
AccrSB2006
Accretion parameters from SB2006
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct AccrSB2006{FT} <: ParametersType{FT}
"Collection kernel coefficient Kcr"
kcr::FT
"Accretion correcting function coefficient τ_0"
τ0::FT
"Reference air density [kg/m3]"
ρ0::FT
"Accretion correcting function coefficient c"
c::FT
end
function AccrSB2006(td::CP.AbstractTOMLDict)
name_map = (;
:SB2006_collection_kernel_coeff_kcr => :kcr,
:SB2006_accretion_correcting_function_coeff_tau0 => :τ0,
:SB2006_reference_air_density => :ρ0,
:SB2006_accretion_correcting_function_coeff_c => :c,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return AccrSB2006{FT}(; parameters...)
end
"""
SelfColSB2006
Rain selfcollection parameters from SB2006
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct SelfColSB2006{FT} <: ParametersType{FT}
"Collection kernel coefficient krr"
krr::FT
"Collection kernel coefficient kappa rr"
κrr::FT
"Raindrop self collection coefficient d"
d::FT
end
function SelfColSB2006(td::CP.AbstractTOMLDict)
name_map = (;
:SB2006_collection_kernel_coeff_krr => :krr,
:SB2006_collection_kernel_coeff_kapparr => :κrr,
Symbol("SB2006_raindrops_self-collection_coeff_d") => :d,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return SelfColSB2006{FT}(; parameters...)
end
"""
BreakupSB2006
Rain breakup parameters from SB2006
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct BreakupSB2006{FT} <: ParametersType{FT}
"Raindrop equilibrium mean diamater"
Deq::FT
"Raindrop breakup mean diamater threshold"
Dr_th::FT
"Raindrops breakup coefficient kbr"
kbr::FT
"Raindrops breakup coefficient kappa br"
κbr::FT
end
function BreakupSB2006(td::CP.AbstractTOMLDict)
name_map = (;
:SB2006_raindrops_equlibrium_mean_diameter => :Deq,
:SB2006_raindrops_breakup_mean_diameter_threshold => :Dr_th,
:SB2006_raindrops_breakup_coeff_kbr => :kbr,
:SB2006_raindrops_breakup_coeff_kappabr => :κbr,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return BreakupSB2006{FT}(; parameters...)
end
"""
EvaporationSB2006
Rain evaporation parameters from SB2006
# Fields
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct EvaporationSB2006{FT} <: ParametersType{FT}
"Ventillation coefficient a"
av::FT
"Ventillation coefficient b"
bv::FT
"Rain evapoartion coefficient α"
α::FT
"Rain evapoartion coefficient β"
β::FT
"Reference air density [kg/m3]"
ρ0::FT
end
function EvaporationSB2006(td::CP.AbstractTOMLDict)
name_map = (;
:SB2006_ventilation_factor_coeff_av => :av,
:SB2006_ventilation_factor_coeff_bv => :bv,
:SB2006_rain_evaportation_coeff_alpha => :α,
:SB2006_rain_evaportation_coeff_beta => :β,
:SB2006_reference_air_density => :ρ0,
)
parameters = CP.get_parameter_values(td, name_map, "CloudMicrophysics")
FT = CP.float_type(td)
return EvaporationSB2006{FT}(; parameters...)
end
"""
SB2006
The type and parameters for 2-moment precipitation formation by
Seifert and Beheng (2006)
DOI: 10.1007/s00703-005-0112-4
# Fields
$(DocStringExtensions.FIELDS)
"""
struct SB2006{FT, PDc, PDr, AV, AR, SC, BR, EV} <: Precipitation2MType{FT}
"Cloud particle size distribution parameters"
pdf_c::PDc
"Rain particle size distribution parameters"
pdf_r::PDr
"Autoconversion parameters"
acnv::AV
"Accretion parameters"
accr::AR
"Rain selfcollection parameters"
self::SC
"Rain breakup parameters"
brek::BR
"Rain evaporation parameters"
evap::EV
end
SB2006(::Type{FT}) where {FT <: AbstractFloat} = SB2006(CP.create_toml_dict(FT))
function SB2006(toml_dict::CP.AbstractTOMLDict)
pdf_c = CloudParticlePDF_SB2006(toml_dict)
pdf_r = RainParticlePDF_SB2006(toml_dict)
acnv = AcnvSB2006(toml_dict)
accr = AccrSB2006(toml_dict)
self = SelfColSB2006(toml_dict)
brek = BreakupSB2006(toml_dict)
evap = EvaporationSB2006(toml_dict)
FT = CP.float_type(toml_dict)
PDc = typeof(pdf_c)
PDr = typeof(pdf_r)
AN = typeof(acnv)
AR = typeof(accr)
SE = typeof(self)
BR = typeof(brek)
EV = typeof(evap)
return SB2006{FT, PDc, PDr, AN, AR, SE, BR, EV}(
pdf_c,
pdf_r,
acnv,
accr,
self,
brek,
evap,
)
end