Skip to content

Commit b266046

Browse files
committed
implement rainwater path diagnostic, change m-2 to m^-2
1 parent 3ea8d3b commit b266046

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

src/diagnostics/core_diagnostics.jl

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ add_diagnostic_variable!(
10261026
short_name = "clwvi",
10271027
long_name = "Condensed Water Path",
10281028
standard_name = "atmosphere_mass_content_of_cloud_condensed_water",
1029-
units = "kg m-2",
1029+
units = "kg m^-2",
10301030
comments = """
10311031
Mass of condensed (liquid + ice) water in the column divided by the area of the column
10321032
(not just the area of the cloudy portion of the column). It doesn't include precipitating hydrometeors.
@@ -1066,7 +1066,7 @@ add_diagnostic_variable!(
10661066
short_name = "lwp",
10671067
long_name = "Liquid Water Path",
10681068
standard_name = "atmosphere_mass_content_of_cloud_liquid_water",
1069-
units = "kg m-2",
1069+
units = "kg m^-2",
10701070
comments = """
10711071
The total mass of liquid water in cloud per unit area.
10721072
(not just the area of the cloudy portion of the column). It doesn't include precipitating hydrometeors.
@@ -1106,7 +1106,7 @@ add_diagnostic_variable!(
11061106
short_name = "clivi",
11071107
long_name = "Ice Water Path",
11081108
standard_name = "atmosphere_mass_content_of_cloud_ice",
1109-
units = "kg m-2",
1109+
units = "kg m^-2",
11101110
comments = """
11111111
The total mass of ice in cloud per unit area.
11121112
(not just the area of the cloudy portion of the column). It doesn't include precipitating hydrometeors.
@@ -1503,3 +1503,43 @@ add_diagnostic_variable!(
15031503
comments = "Energy available to a parcel lifted moist adiabatically from the surface. We assume fully reversible phase changes and no precipitation.",
15041504
compute! = compute_cape!,
15051505
)
1506+
1507+
###
1508+
# Rain water path (2d)
1509+
###
1510+
compute_rwp!(out, state, cache, time) =
1511+
compute_rwp!(out, state, cache, time, cache.atmos.moisture_model)
1512+
compute_rwp!(_, _, _, _, model::T) where {T} =
1513+
error_diagnostic_variable("rwp", model)
1514+
1515+
function compute_rwp!(
1516+
out,
1517+
state,
1518+
cache,
1519+
time,
1520+
moisture_model::T,
1521+
) where {T <: Union{EquilMoistModel, NonEquilMoistModel}}
1522+
if isnothing(out)
1523+
out = zeros(axes(Fields.level(state.f, half)))
1524+
rw = cache.scratch.ᶜtemp_scalar
1525+
@. rw = state.c.ρq_rai
1526+
Operators.column_integral_definite!(out, rw)
1527+
return out
1528+
else
1529+
rw = cache.scratch.ᶜtemp_scalar
1530+
@. rw = state.c.ρq_rai
1531+
Operators.column_integral_definite!(out, rw)
1532+
end
1533+
end
1534+
1535+
add_diagnostic_variable!(
1536+
short_name = "rwp",
1537+
long_name = "Rainwater Path",
1538+
standard_name = "atmosphere_mass_content_of_rain_liquid_water",
1539+
units = "kg m^-2",
1540+
comments = """
1541+
The total mass of liquid water in rain per unit area.
1542+
(not just the area of the cloudy portion of the column).
1543+
""",
1544+
compute! = compute_rwp!,
1545+
)

0 commit comments

Comments
 (0)