Skip to content

Commit cc9fb7d

Browse files
committed
implement rwp diagnostic, change m-2 to m^-2
1 parent df84868 commit cc9fb7d

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ ClimaAtmos.jl Release Notes
44
main
55
-------
66

7+
### Add RWP diagnostic
8+
PR [#3946](https://github.com/CliMA/ClimaAtmos.jl/pull/3946) adds rainwater path diagnostic variable.
9+
710
v0.31.1
811
-------
912

10-
PR [#3917](https://github.com/CliMA/ClimaAtmos.jl/pull/3917) adds common numercis configs for different resolutions.
13+
PR [#3917](https://github.com/CliMA/ClimaAtmos.jl/pull/3917) adds common numerics configs for different resolutions.
1114
These configurations are intended to serve as the default settings. Please modify them only if you are certain of the implications.
1215

1316
v0.31.0

src/diagnostics/core_diagnostics.jl

Lines changed: 46 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.
@@ -1504,6 +1504,9 @@ add_diagnostic_variable!(
15041504
compute! = compute_cape!,
15051505
)
15061506

1507+
###
1508+
# Mean sea level pressure (2d)
1509+
###
15071510
function compute_mslp!(out, state, cache, time)
15081511
thermo_params = CAP.thermodynamics_params(cache.params)
15091512
g = TD.Parameters.grav(thermo_params)
@@ -1536,3 +1539,43 @@ add_diagnostic_variable!(
15361539
comments = "Mean sea level pressure computed from the hypsometric equation",
15371540
compute! = compute_mslp!,
15381541
)
1542+
1543+
###
1544+
# Rainwater path (2d)
1545+
###
1546+
compute_rwp!(out, state, cache, time) =
1547+
compute_rwp!(out, state, cache, time, cache.atmos.microphysics_model)
1548+
compute_rwp!(_, _, _, _, model::T) where {T} =
1549+
error_diagnostic_variable("rwp", model)
1550+
1551+
function compute_rwp!(
1552+
out,
1553+
state,
1554+
cache,
1555+
time,
1556+
moisture_model::T,
1557+
) where {T <: Union{Microphysics1Moment, Microphysics2Moment}}
1558+
if isnothing(out)
1559+
out = zeros(axes(Fields.level(state.f, half)))
1560+
rw = cache.scratch.ᶜtemp_scalar
1561+
@. rw = state.c.ρq_rai
1562+
Operators.column_integral_definite!(out, rw)
1563+
return out
1564+
else
1565+
rw = cache.scratch.ᶜtemp_scalar
1566+
@. rw = state.c.ρq_rai
1567+
Operators.column_integral_definite!(out, rw)
1568+
end
1569+
end
1570+
1571+
add_diagnostic_variable!(
1572+
short_name = "rwp",
1573+
long_name = "Rainwater Path",
1574+
standard_name = "atmosphere_mass_content_of_rainwater",
1575+
units = "kg m^-2",
1576+
comments = """
1577+
The total mass of rainwater per unit area.
1578+
(not just the area of the cloudy portion of the column).
1579+
""",
1580+
compute! = compute_rwp!,
1581+
)

0 commit comments

Comments
 (0)