diff --git a/config/model_configs/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.yml b/config/model_configs/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.yml index a35a1f85f4..2eebd5f6a7 100644 --- a/config/model_configs/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.yml +++ b/config/model_configs/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.yml @@ -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" diff --git a/src/diagnostics/diagnostic.jl b/src/diagnostics/diagnostic.jl index b03bb8e865..326c45c1ca 100644 --- a/src/diagnostics/diagnostic.jl +++ b/src/diagnostics/diagnostic.jl @@ -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") diff --git a/src/diagnostics/tracer_diagnostics.jl b/src/diagnostics/tracer_diagnostics.jl new file mode 100644 index 0000000000..94b77b1da2 --- /dev/null +++ b/src/diagnostics/tracer_diagnostics.jl @@ -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), +)