Skip to content

Commit 30b4892

Browse files
authored
Merge pull request #4038 from CliMA/zs/sfc_flux_diagnostics
add sensible and latent heat flux diagnostics
2 parents 2f5e9b7 + ce77da9 commit 30b4892

12 files changed

+116
-19
lines changed

config/model_configs/les_isdac_box.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ restart_file: "/groups/esm/hervik/climaatmos-les-artifacts/les_isdac_day0.0.hdf5
3333
dt_save_state_to_disk: "1mins"
3434
netcdf_interpolation_num_points: [30, 30, 150]
3535
diagnostics:
36-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, husra, cl, clw, cli, hussfc, evspsbl, hfes, pr]
36+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, husra, cl, clw, cli, hussfc, hfss, hfls, evspsbl, pr]
3737
period: 10mins
38-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, husra, cl, clw, cli, hussfc, evspsbl, hfes, pr]
38+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, husra, cl, clw, cli, hussfc, hfss, hfls, evspsbl, pr]
3939
reduction_time: average
4040
period: 60mins

config/model_configs/prognostic_edmfx_aquaplanet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ toml: [toml/prognostic_edmfx.toml]
3333
output_default_diagnostics: false
3434
reproducibility_test: true
3535
diagnostics:
36-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfes, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
36+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfss, hfls, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
3737
reduction_time: average
3838
period: 1hours
3939
- short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix]

config/model_configs/prognostic_edmfx_aquaplanet_dense_autodiff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dt_save_state_to_disk: 600secs
3535
toml: [toml/prognostic_edmfx.toml]
3636
output_default_diagnostics: false
3737
diagnostics:
38-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfes, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
38+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfss, hfls, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
3939
reduction_time: average
4040
period: 40mins
4141
- short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix]

config/model_configs/prognostic_edmfx_aquaplanet_gpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dt_save_state_to_disk: 600secs
3434
toml: [toml/prognostic_edmfx.toml]
3535
output_default_diagnostics: false
3636
diagnostics:
37-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfes, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
37+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfss, hfls, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
3838
reduction_time: average
3939
period: 1hours
4040
- short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix]

config/model_configs/prognostic_edmfx_aquaplanet_gpu_dense_autodiff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dt_save_state_to_disk: 600secs
3636
toml: [toml/prognostic_edmfx.toml]
3737
output_default_diagnostics: false
3838
diagnostics:
39-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfes, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
39+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfss, hfls, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
4040
reduction_time: average
4141
period: 1hours
4242
- short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix]

config/model_configs/prognostic_edmfx_aquaplanet_gpu_sparse_autodiff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dt_save_state_to_disk: 600secs
3737
toml: [toml/prognostic_edmfx.toml]
3838
output_default_diagnostics: false
3939
diagnostics:
40-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfes, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
40+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfss, hfls, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
4141
reduction_time: average
4242
period: 1hours
4343
- short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix]

config/model_configs/prognostic_edmfx_aquaplanet_sparse_autodiff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dt_save_state_to_disk: 600secs
3636
toml: [toml/prognostic_edmfx.toml]
3737
output_default_diagnostics: false
3838
diagnostics:
39-
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfes, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
39+
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hfss, hfls, hur, hus, cl, clw, cli, evspsbl, pr, rsd, rsu, rld, rlu]
4040
reduction_time: average
4141
period: 40mins
4242
- short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix]

post_processing/ci_plots.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ function make_plots(
995995
simdirs = SimDir.(output_paths)
996996

997997
short_names_3D, reduction = ["ua", "ta", "hus"], "average"
998-
short_names_2D = ["hfes", "evspsbl", "pr"]
998+
short_names_2D = ["hfss", "hfls", "pr"]
999999
vars_3D = map_comparison(simdirs, short_names_3D) do simdir, short_name
10001000
get(simdir; short_name, reduction) |> ClimaAnalysis.average_lon
10011001
end
@@ -1035,8 +1035,8 @@ function make_plots(
10351035
"rlds",
10361036
"rlut",
10371037
"rlus",
1038-
"hfes",
1039-
"evspsbl",
1038+
"hfss",
1039+
"hfls",
10401040
"pr",
10411041
]
10421042
available_periods = ClimaAnalysis.available_periods(
@@ -1114,8 +1114,8 @@ function make_plots(
11141114
"rlds",
11151115
"rlut",
11161116
"rlus",
1117-
"hfes",
1118-
"evspsbl",
1117+
"hfss",
1118+
"hfls",
11191119
"ts",
11201120
"pr",
11211121
]
@@ -1174,8 +1174,8 @@ function make_plots(
11741174
"rlds",
11751175
"rlut",
11761176
"rlus",
1177-
"hfes",
1178-
"evspsbl",
1177+
"hfss",
1178+
"hfls",
11791179
"pr",
11801180
]
11811181
available_periods = ClimaAnalysis.available_periods(
@@ -1233,8 +1233,8 @@ function make_plots(::Aquaplanet1MPlots, output_paths::Vector{<:AbstractString})
12331233
"rlds",
12341234
"rlut",
12351235
"rlus",
1236-
"hfes",
1237-
"evspsbl",
1236+
"hfss",
1237+
"hfls",
12381238
"pr",
12391239
]
12401240
available_periods = ClimaAnalysis.available_periods(

reproducibility_tests/ref_counter.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
265
1+
266
22

33
# **README**
44
#
@@ -20,6 +20,10 @@
2020

2121

2222
#=
23+
266
24+
- No behavior change, but some new diagnostics are added, and the reference
25+
simulations don't have those diagnostics for plotting
26+
2327
265
2428
- Modify advection to discretely conserve vorticity
2529

src/diagnostics/core_diagnostics.jl

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,96 @@ add_diagnostic_variable!(
720720
compute! = compute_evspsbl!,
721721
)
722722

723+
###
724+
# Latent heat flux (2d)
725+
###
726+
compute_hfls!(out, state, cache, time) =
727+
compute_hfls!(out, state, cache, time, cache.atmos.moisture_model)
728+
compute_hfls!(_, _, _, _, model::T) where {T} =
729+
error_diagnostic_variable("hfls", model)
730+
731+
function compute_hfls!(
732+
out,
733+
state,
734+
cache,
735+
time,
736+
moisture_model::T,
737+
) where {T <: Union{EquilMoistModel, NonEquilMoistModel}}
738+
(; ρ_flux_q_tot) = cache.precomputed.sfc_conditions
739+
(; surface_ct3_unit) = cache.core
740+
thermo_params = CAP.thermodynamics_params(cache.params)
741+
LH_v0 = TD.Parameters.LH_v0(thermo_params)
742+
743+
if isnothing(out)
744+
return dot.(ρ_flux_q_tot, surface_ct3_unit) .* LH_v0
745+
else
746+
out .= dot.(ρ_flux_q_tot, surface_ct3_unit) .* LH_v0
747+
end
748+
end
749+
750+
add_diagnostic_variable!(
751+
short_name = "hfls",
752+
long_name = "Surface Upward Latent Heat Flux",
753+
standard_name = "surface_upward_latent_heat_flux",
754+
units = "W m^-2",
755+
compute! = compute_hfls!,
756+
)
757+
758+
###
759+
# Sensible heat flux (2d)
760+
###
761+
compute_hfss!(out, state, cache, time) =
762+
compute_hfss!(out, state, cache, time, cache.atmos.moisture_model)
763+
compute_hfss!(_, _, _, _, model::T) where {T} =
764+
error_diagnostic_variable("hfss", model)
765+
766+
function compute_hfss!(
767+
out,
768+
state,
769+
cache,
770+
time,
771+
moisture_model::T,
772+
) where {T <: DryModel}
773+
(; ρ_flux_h_tot) = cache.precomputed.sfc_conditions
774+
(; surface_ct3_unit) = cache.core
775+
776+
if isnothing(out)
777+
return dot.(ρ_flux_h_tot, surface_ct3_unit)
778+
else
779+
out .= dot.(ρ_flux_h_tot, surface_ct3_unit)
780+
end
781+
end
782+
783+
function compute_hfss!(
784+
out,
785+
state,
786+
cache,
787+
time,
788+
moisture_model::T,
789+
) where {T <: Union{EquilMoistModel, NonEquilMoistModel}}
790+
(; ρ_flux_h_tot, ρ_flux_q_tot) = cache.precomputed.sfc_conditions
791+
(; surface_ct3_unit) = cache.core
792+
thermo_params = CAP.thermodynamics_params(cache.params)
793+
LH_v0 = TD.Parameters.LH_v0(thermo_params)
794+
795+
if isnothing(out)
796+
return dot.(ρ_flux_h_tot, surface_ct3_unit) .-
797+
dot.(ρ_flux_q_tot, surface_ct3_unit) .* LH_v0
798+
else
799+
out .=
800+
dot.(ρ_flux_h_tot, surface_ct3_unit) .-
801+
dot.(ρ_flux_q_tot, surface_ct3_unit) .* LH_v0
802+
end
803+
end
804+
805+
add_diagnostic_variable!(
806+
short_name = "hfss",
807+
long_name = "Surface Upward Sensible Heat Flux",
808+
standard_name = "surface_upward_sensible_heat_flux",
809+
units = "W m^-2",
810+
compute! = compute_hfss!,
811+
)
812+
723813
###
724814
# Precipitation (2d)
725815
###

0 commit comments

Comments
 (0)