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

add aerosol diagnostics #3187

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
szy21 marked this conversation as resolved.
Show resolved Hide resolved
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),
)
Loading