1
1
# A set of wrappers for using CloudMicrophysics.jl functions inside EDMFX loops
2
2
3
3
import Thermodynamics as TD
4
+ import CloudMicrophysics. ThermodynamicsInterface as CMTDI
4
5
import CloudMicrophysics. Microphysics0M as CM0
5
6
import CloudMicrophysics. Microphysics1M as CM1
6
7
import CloudMicrophysics. Microphysics2M as CM2
7
8
import CloudMicrophysics. MicrophysicsNonEq as CMNe
9
+ import CloudMicrophysics. AerosolModel as CMAM
10
+ import CloudMicrophysics. AerosolActivation as CMAA
8
11
import CloudMicrophysics. Parameters as CMP
9
12
10
13
# Define some aliases and functions to make the code more readable
11
14
const Tₐ = TD. air_temperature
15
+ const Pₐ = TD. air_pressure
12
16
const PP = TD. PhasePartition
13
17
const qᵥ = TD. vapor_specific_humidity
14
18
@@ -25,33 +29,6 @@ function limit(q, dt, n::Int)
25
29
return max (FT (0 ), q) / float (dt) / n
26
30
end
27
31
28
- """
29
- ml_N_cloud_liquid_droplets(cmc, c_dust, c_seasalt, c_SO4, q_liq)
30
-
31
- - cmc - a struct with cloud and aerosol parameters
32
- - c_dust, c_seasalt, c_SO4 - dust, seasalt and ammonium sulfate mass concentrations [kg/kg]
33
- - q_liq - liquid water specific humidity
34
-
35
- Returns the liquid cloud droplet number concentration diagnosed based on the
36
- aerosol loading and cloud liquid water.
37
- """
38
- function ml_N_cloud_liquid_droplets (cmc, c_dust, c_seasalt, c_SO4, q_liq)
39
- # We can also add w, T, RH, w' ...
40
- # Also consider lookind only at around cloud base height
41
- (; α_dust, α_seasalt, α_SO4, α_q_liq) = cmc. aml
42
- (; c₀_dust, c₀_seasalt, c₀_SO4, q₀_liq) = cmc. aml
43
- N₀ = cmc. N_cloud_liquid_droplets
44
-
45
- FT = eltype (N₀)
46
- return N₀ * (
47
- FT (1 ) +
48
- α_dust * (log (max (c_dust, eps (FT))) - log (c₀_dust)) +
49
- α_seasalt * (log (max (c_seasalt, eps (FT))) - log (c₀_seasalt)) +
50
- α_SO4 * (log (max (c_SO4, eps (FT))) - log (c₀_SO4)) +
51
- α_q_liq * (log (max (q_liq, eps (FT))) - log (q₀_liq))
52
- )
53
- end
54
-
55
32
"""
56
33
cloud_sources(cm_params, thp, qₜ, qₗ, qᵢ, qᵣ, qₛ, ρ, Tₐ, dt)
57
34
@@ -386,60 +363,127 @@ end
386
363
# ####
387
364
388
365
"""
389
- aerosol_activation_sources(cm_params, thp, ρ, Tₐ, qₜ, qₗ, qᵢ, qᵣ, qₛ, n_dp, n_dp_prescribed, dt)
390
-
391
- - cm_params - CloudMicrophysics parameters struct for cloud water or ice condensate
392
- - thp - Thermodynamics parameters struct
393
- - ρ - air density
394
- - Tₐ - air temperature
395
- - qₜ - total specific humidity
396
- - qₗ - liquid specific humidity
397
- - qᵢ - ice specific humidity
398
- - qᵣ - rain specific humidity
399
- - qₛ - snow specific humidity
400
- - n_dp - number concentration droplets (liquid or ice) per mass
401
- _ n_dp_prescribed - prescribed number concentration of droplets (liquid or ice) per mass
402
- - dt - model time step
366
+ aerosol_activation_sources(
367
+ seasalt_num,
368
+ seasalt_mean_radius,
369
+ sulfate_num,
370
+ nₗ,
371
+ ρ,
372
+ w,
373
+ air_params,
374
+ aerosol_params,
375
+ arg_params,
376
+ thermo_params,
377
+ ts,
378
+ dt,
379
+ )
403
380
404
- Returns the activation rate. #TODO This function temporarily computes activation rate
405
- based on mass rates and a prescribed droplet mass (no activation parameterization yet).
381
+ Computes the source term for cloud droplet number concentration per mass due to aerosol activation,
382
+ based on the Abdul-Razzak and Ghan (2000) parameterization.
383
+
384
+ This function estimates the number of aerosols activated into cloud droplets per mass of air per second
385
+ from a bi-modal aerosol distribution (sea salt and sulfate), given local supersaturation and vertical
386
+ velocity. The result is returned as a tendency (per second) of liquid droplet number concentration.
387
+
388
+ # Arguments
389
+ - `seasalt_num`: Number concentration per mass of sea salt aerosols [kg⁻¹].
390
+ - `seasalt_mean_radius`: Mean dry radius of sea salt aerosol mode [m].
391
+ - `sulfate_num`: Number concentration per mass of sulfate aerosols [kg⁻¹].
392
+ - `qₜ`, `qₗ`, `qᵢ` - total water, cloud liquid and cloud ice specific humidity
393
+ - `nₗ`, - cloud liquid number concentration per mass [kg⁻¹]
394
+ - `ρ`: Air density [kg/m³].
395
+ - `w`: Vertical velocity [m/s].
396
+ - `air_params`: Struct containing physical constants related to air.
397
+ - `aerosol_params`: Struct containing aerosol properties, such as hygroscopicity parameters (κ).
398
+ - `arg_params`: Activation scheme parameters specific to Abdul-Razzak and Ghan (2000).
399
+ - `thermo_params`: Thermodynamic parameters for computing saturation, pressure, temperature, etc.
400
+ - `ts`: Thermodynamic state (e.g., prognostic variables) used for evaluating the phase partition.
401
+ - `dt`: Time step (s) over which the activation tendency is applied.
402
+
403
+ # Returns
404
+ - Tendency of cloud droplet number concentration per mass of air due to aerosol activation [m⁻³/s].
406
405
"""
407
406
function aerosol_activation_sources (
408
- cm_params:: CMP.CloudLiquid{FT} ,
409
- thp,
410
- ρ,
411
- Tₐ,
407
+ seasalt_num,
408
+ seasalt_mean_radius,
409
+ sulfate_num,
412
410
qₜ,
413
411
qₗ,
414
412
qᵢ,
415
- qᵣ,
416
- qₛ,
417
- n_dp,
418
- n_dp_prescribed,
413
+ nₗ,
414
+ ρ,
415
+ w,
416
+ cmc,
417
+ thermo_params,
418
+ ts,
419
419
dt,
420
- ) where {FT}
421
- r_dp = FT (2e-6 ) # 2 μm
422
- m_dp = 4 / 3 * FT (π) * r_dp^ 3 * cm_params. ρw
423
- Sn = cloud_sources (cm_params, thp, qₜ, qₗ, qᵢ, qᵣ, qₛ, ρ, Tₐ, dt) / m_dp
420
+ )
421
+
422
+ FT = eltype (nₗ)
423
+ air_params = cmc. aps
424
+ arg_params = cmc. arg
425
+ aerosol_params = cmc. aerosol
426
+ T = Tₐ (thermo_params, ts)
427
+ p = Pₐ (thermo_params, ts)
428
+ S = CMTDI. supersaturation_over_liquid (thermo_params, qₜ, qₗ, qᵢ, ρ, T)
429
+ n_aer = seasalt_num + sulfate_num
430
+
431
+ seasalt_mode = CMAM. Mode_κ (
432
+ seasalt_mean_radius,
433
+ aerosol_params. seasalt_std,
434
+ seasalt_num * ρ,
435
+ (FT (1 ),),
436
+ (FT (1 ),),
437
+ (FT (0 ),),
438
+ (aerosol_params. seasalt_kappa,),
439
+ )
440
+ sulfate_mode = CMAM. Mode_κ (
441
+ aerosol_params. sulfate_radius,
442
+ aerosol_params. sulfate_std,
443
+ sulfate_num * ρ,
444
+ (FT (1 ),),
445
+ (FT (1 ),),
446
+ (FT (0 ),),
447
+ (aerosol_params. sulfate_kappa,),
448
+ )
449
+
450
+ aerosol_dist = CMAM. AerosolDistribution ((seasalt_mode, sulfate_mode))
451
+
452
+ args = (
453
+ arg_params,
454
+ aerosol_dist,
455
+ air_params,
456
+ thermo_params,
457
+ T,
458
+ p,
459
+ w,
460
+ qₜ,
461
+ qₗ,
462
+ qᵢ,
463
+ ρ * nₗ,
464
+ FT (0 ),
465
+ ) # assuming no ice particles
466
+ S_max = CMAA. max_supersaturation (args... )
467
+ n_act = CMAA. total_N_activated (args... ) / ρ
424
468
425
469
return ifelse (
426
- Sn > FT ( 0 ) ,
427
- triangle_inequality_limiter (Sn, limit ((n_dp_prescribed - n_dp), dt, 2 ) ),
428
- - triangle_inequality_limiter (abs (Sn), limit (n_dp, dt, 2 )) ,
470
+ S < 0 || S_max < S || isnan (n_act) || n_act < nₗ ,
471
+ FT ( 0 ),
472
+ triangle_inequality_limiter (n_act - nₗ, n_aer - nₗ) / dt ,
429
473
)
430
474
end
431
475
432
476
"""
433
477
compute_warm_precipitation_sources_2M!(Sᵖ, S₂ᵖ, Snₗᵖ, Snᵣᵖ, Sqₗᵖ, Sqᵣᵖ, ρ, nₗ, nᵣ, qₜ, qₗ, qᵢ, qᵣ, qₛ, ts, dt, sb, thp)
434
478
435
- - Sᵖ, S₂ᵖ - temporary containters to help compute precipitation source terms
436
- - Snₗᵖ, Snᵣᵖ, Sqₗᵖ, Sqᵣᵖ - cached storage for precipitation source terms
437
- - ρ - air density
438
- - nₗ, nᵣ - cloud liquid and rain number concentration per mass [1 / kg of moist air]
439
- - qₜ, qₗ, qᵢ, qᵣ, qₛ - total water, cloud liquid, cloud ice, rain and snow specific humidity
440
- - ts - thermodynamic state (see td package for details)
441
- - dt - model time step
442
- - thp, mp - structs with thermodynamic and microphysics parameters
479
+ - `Sᵖ`, ` S₂ᵖ` - temporary containters to help compute precipitation source terms
480
+ - ` Snₗᵖ`, ` Snᵣᵖ`, ` Sqₗᵖ`, ` Sqᵣᵖ` - cached storage for precipitation source terms
481
+ - `ρ` - air density
482
+ - `nₗ`, `nᵣ` - cloud liquid and rain number concentration per mass [1 / kg of moist air]
483
+ - `qₜ`, `qₗ`, `qᵢ`, `qᵣ`, `qₛ` - total water, cloud liquid, cloud ice, rain and snow specific humidity
484
+ - `ts` - thermodynamic state (see td package for details)
485
+ - `dt` - model time step
486
+ - ` thp`, `mp` - structs with thermodynamic and microphysics parameters
443
487
444
488
Computes precipitation number and mass sources due to warm precipitation processes based on the 2-moment
445
489
[Seifert and Beheng (2006) scheme](https://clima.github.io/CloudMicrophysics.jl/dev/Microphysics2M/).
0 commit comments