Skip to content

Commit

Permalink
add aerosol diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Jul 11, 2024
1 parent c9a5754 commit 9e07966
Show file tree
Hide file tree
Showing 3 changed files with 32 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]
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")
30 changes: 30 additions & 0 deletions src/diagnostics/tracer_diagnostics.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file is included in Diagnostics.jl

# Tracers

###
# Sulfate concentration (3d)
###
compute_mmrso4!(out, state, cache, time) =
compute_mmrso4!(out, state, cache, time, cache.tracers)

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

add_diagnostic_variable!(
short_name = "mmrso4",
long_name = "Aerosol Sulfate Mass Mixing Ratio",
standard_name = "smass_fraction_of_sulfate_dry_aerosol_particles_in_air",
units = "kg kg^-3",
comments = "Prescribed dry mass of sulfate (SO4) in aerosol particles as a fraction of air mass.",
compute! = compute_mmrso4!,
)

0 comments on commit 9e07966

Please sign in to comment.