Skip to content

Commit

Permalink
add rainfall and snowfall flux diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Oct 2, 2024
1 parent aedb998 commit b91d61c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
64 changes: 64 additions & 0 deletions src/diagnostics/core_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,70 @@ add_diagnostic_variable!(
compute! = compute_pr!,
)

compute_prra!(out, state, cache, time) =
compute_prra!(out, state, cache, time, cache.atmos.precip_model)
compute_prra!(_, _, _, _, precip_model::T) where {T} =
error_diagnostic_variable("prra", precip_model)

function compute_prra!(
out,
state,
cache,
time,
precip_model::Union{
NoPrecipitation,
Microphysics0Moment,
Microphysics1Moment,
},
)
if isnothing(out)
return cache.precipitation.surface_rain_flux
else
out .= cache.precipitation.surface_rain_flux
end
end

add_diagnostic_variable!(
short_name = "prra",
long_name = "Rainfall Flux",
standard_name = "rainfall_flux",
units = "kg m^-2 s^-1",
comments = "Precipitation including all forms of water in the liquid phase",
compute! = compute_prra!,
)

compute_prsn!(out, state, cache, time) =
compute_prsn!(out, state, cache, time, cache.atmos.precip_model)
compute_prsn!(_, _, _, _, precip_model::T) where {T} =
error_diagnostic_variable("prsn", precip_model)

function compute_prsn!(
out,
state,
cache,
time,
precip_model::Union{
NoPrecipitation,
Microphysics0Moment,
Microphysics1Moment,
},
)
if isnothing(out)
return cache.precipitation.surface_snow_flux
else
out .= cache.precipitation.surface_snow_flux
end
end

add_diagnostic_variable!(
short_name = "prsn",
long_name = "Snowfall Flux",
standard_name = "snowfall_flux",
units = "kg m^-2 s^-1",
comments = "Precipitation including all forms of water in the solid phase",
compute! = compute_prsn!,
)

###
# Precipitation (3d)
###
Expand Down
2 changes: 2 additions & 0 deletions src/diagnostics/default_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ function default_diagnostics(
"hussfc",
"evspsbl",
"pr",
"prra",
"prsn",
"prw",
"lwp",
"clwvi",
Expand Down

0 comments on commit b91d61c

Please sign in to comment.