Skip to content

Commit 786b518

Browse files
committed
implement rainwater path diagnostic, change m-2 to m^-2
1 parent 3213588 commit 786b518

File tree

3 files changed

+84
-5
lines changed

3 files changed

+84
-5
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

config/model_configs/diagnostic_edmfx_era5_initial_condition.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ output_default_diagnostics: false
3939
diagnostics:
4040
- short_name: [ta, ua, wa, va, rhoa, hur, hus, clw, cli]
4141
period: 60mins
42-
- short_name: [rsut, rlut, ts, pr]
42+
- short_name: [rsut, rlut, ts, pr, mslp]
4343
period: 60mins

src/diagnostics/core_diagnostics.jl

Lines changed: 79 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,79 @@ 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+
# Mean sea level pressure (2d)
1509+
###
1510+
function compute_mslp!(out, state, cache, time)
1511+
thermo_params = CAP.thermodynamics_params(cache.params)
1512+
g = TD.Parameters.grav(thermo_params)
1513+
R_m_surf = Fields.level(
1514+
lazy.(TD.gas_constant_air.(thermo_params, cache.precomputed.ᶜts)),
1515+
1,
1516+
)
1517+
1518+
# get pressure, temperature, and height at the lowest atmospheric level
1519+
p_level = Fields.level(cache.precomputed.ᶜp, 1)
1520+
t_level = Fields.level(
1521+
lazy.(TD.air_temperature.(thermo_params, cache.precomputed.ᶜts)),
1522+
1,
1523+
)
1524+
z_level = Fields.level(Fields.coordinate_field(state.c.ρ).z, 1)
1525+
1526+
# compute sea level pressure using the hypsometric equation
1527+
if isnothing(out)
1528+
return @. p_level * exp(g * z_level / (R_m_surf * t_level))
1529+
else
1530+
@. out = p_level * exp(g * z_level / (R_m_surf * t_level))
1531+
end
1532+
end
1533+
1534+
add_diagnostic_variable!(
1535+
short_name = "mslp",
1536+
long_name = "Mean Sea Level Pressure",
1537+
standard_name = "mean_sea_level_pressure",
1538+
units = "Pa",
1539+
comments = "Mean sea level pressure computed from the hypsometric equation",
1540+
compute! = compute_mslp!,
1541+
)
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)