Skip to content

Commit

Permalink
Merge pull request #3187 from CliMA/zs/aerosol_diagnostics
Browse files Browse the repository at this point in the history
add aerosol diagnostics
  • Loading branch information
szy21 authored Jul 11, 2024
2 parents a884680 + 6f2c6cd commit 8131ef3
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ surface_setup: "DefaultMoninObukhov"
prescribed_aerosols: ["CB1", "CB2", "SO4"]
toml: [toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.toml]
diagnostics:
- short_name: [edt, evu]
- short_name: [edt, evu, mmrso4, mmrbcpo, mmrbcpi]
reduction_time: average
period: "1days"
1 change: 1 addition & 0 deletions src/diagnostics/diagnostic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ end
include("core_diagnostics.jl")
include("radiation_diagnostics.jl")
include("edmfx_diagnostics.jl")
include("tracer_diagnostics.jl")

# Default diagnostics and higher level interfaces
include("default_diagnostics.jl")
98 changes: 98 additions & 0 deletions src/diagnostics/tracer_diagnostics.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# This file is included in Diagnostics.jl

# Tracers

function compute_aerosol!(out, state, cache, time, aerosol_name)
:prescribed_aerosols_field in propertynames(cache.tracers) ||
error("Aerosols do not exist in the model")
aerosol_name in propertynames(cache.tracers.prescribed_aerosols_field) ||
error("$aerosol_name does not exist in the model")
if isnothing(out)
return copy(
getproperty(cache.tracers.prescribed_aerosols_field, aerosol_name),
)
else
out .=
getproperty(cache.tracers.prescribed_aerosols_field, aerosol_name)
end
end

###
# Dust concentration (3d)
###
add_diagnostic_variable!(
short_name = "mmrdust",
long_name = "Dust Aerosol Mass Mixing Ratio",
standard_name = "mass_fraction_of_dust_dry_aerosol_particles_in_air",
units = "kg kg^-1",
comments = "Prescribed dry mass fraction of dust aerosol particles in air. Only the smallest size is included.",
compute! = (out, u, p, t) -> compute_aerosol!(out, u, p, t, :DST01),
)

###
# Sea salt concentration (3d)
###
add_diagnostic_variable!(
short_name = "mmrss",
long_name = "Sea-Salt Aerosol Mass Mixing Ratio",
standard_name = "mass_fraction_of_sea_salt_dry_aerosol_particles_in_air",
units = "kg kg^-1",
comments = "Prescribed dry mass fraction of sea salt aerosol particles in air. Only the smallest size is included.",
compute! = (out, u, p, t) -> compute_aerosol!(out, u, p, t, :SSLT01),
)

###
# Sulfate concentration (3d)
###
add_diagnostic_variable!(
short_name = "mmrso4",
long_name = "Aerosol Sulfate Mass Mixing Ratio",
standard_name = "mass_fraction_of_sulfate_dry_aerosol_particles_in_air",
units = "kg kg^-1",
comments = "Prescribed dry mass of sulfate (SO4) in aerosol particles as a fraction of air mass.",
compute! = (out, u, p, t) -> compute_aerosol!(out, u, p, t, :SO4),
)

###
# Hydrophobic black carbon concentration (3d)
###
add_diagnostic_variable!(
short_name = "mmrbcpo",
long_name = "Hydrophobic Elemental Carbon Mass Mixing Ratio",
units = "kg kg^-1",
comments = "Prescribed dry mass fraction of hydrophobic black carbon aerosol particles in air.",
compute! = (out, u, p, t) -> compute_aerosol!(out, u, p, t, :CB1),
)

###
# Hydrophilic black carbon concentration (3d)
###
add_diagnostic_variable!(
short_name = "mmrbcpi",
long_name = "Hydrophilic Elemental Carbon Mass Mixing Ratio",
units = "kg kg^-1",
comments = "Prescribed dry mass fraction of hydrophilic black carbon aerosol particles in air.",
compute! = (out, u, p, t) -> compute_aerosol!(out, u, p, t, :CB2),
)

###
# Hydrophobic organic carbon concentration (3d)
###
add_diagnostic_variable!(
short_name = "mmrocpo",
long_name = "Hydrophobic Organic Carbon Mass Mixing Ratio",
units = "kg kg^-1",
comments = "Prescribed dry mass fraction of hydrophobic organic carbon aerosol particles in air.",
compute! = (out, u, p, t) -> compute_aerosol!(out, u, p, t, :OC1),
)

###
# Hydrophilic organic carbon concentration (3d)
###
add_diagnostic_variable!(
short_name = "mmrocpi",
long_name = "Hydrophilic Organic Carbon Mass Mixing Ratio",
units = "kg kg^-1",
comments = "Prescribed dry mass fraction of hydrophilic organic carbon aerosol particles in air.",
compute! = (out, u, p, t) -> compute_aerosol!(out, u, p, t, :OC2),
)

0 comments on commit 8131ef3

Please sign in to comment.