Skip to content

Commit e1ad82e

Browse files
authored
Merge pull request #3631 from CliMA/ck/rrtmgp_aero
add AOD to diagnostics
2 parents 6e76c79 + 8558c73 commit e1ad82e

File tree

8 files changed

+100
-7
lines changed

8 files changed

+100
-7
lines changed

.buildkite/Manifest-v1.11.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,9 +1983,9 @@ version = "1.11.0"
19831983

19841984
[[deps.RRTMGP]]
19851985
deps = ["Adapt", "Artifacts", "ClimaComms", "DocStringExtensions", "Random"]
1986-
git-tree-sha1 = "d258e9495bb6a1b7ad2b28683c9382c0053dafc1"
1986+
git-tree-sha1 = "d2318b99ce2d40d563d63c401f2bd264a76e0f41"
19871987
uuid = "a01a1ee8-cea4-48fc-987c-fc7878d79da1"
1988-
version = "0.20.1"
1988+
version = "0.21.0"
19891989
weakdeps = ["CUDA", "ClimaParams"]
19901990

19911991
[deps.RRTMGP.extensions]

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Logging = "1"
5959
NCDatasets = "0.14.2"
6060
NullBroadcasts = "0.1"
6161
NVTX = "0.3"
62-
RRTMGP = "0.20.1"
62+
RRTMGP = "0.21"
6363
Random = "1"
6464
SciMLBase = "2.12"
6565
StaticArrays = "1.7"

config/longrun_configs/amip_target_diagedmf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ t_end: "120days"
3434
toml: [toml/longrun_aquaplanet_diagedmf.toml]
3535
netcdf_output_at_levels: true
3636
diagnostics:
37-
- short_name: [mmrso4, mmrdust, mmrss, o3]
37+
- short_name: [mmrso4, mmrdust, mmrss, o3, od550aer, odsc550aer]
3838
reduction_time: average
3939
period: "1months"
4040

config/model_configs/sphere_aquaplanet_rhoe_nonequilmoist_allsky_gw_res.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ reproducibility_test: true
2323
prescribed_aerosols: ["CB1", "CB2", "SO4"]
2424
toml: [toml/sphere_aquaplanet_1M.toml]
2525
diagnostics:
26-
- short_name: [edt, evu, mmrso4, mmrbcpo, mmrbcpi, o3]
26+
- short_name: [edt, evu, mmrso4, mmrbcpo, mmrbcpi, o3, od550aer, odsc550aer]
2727
reduction_time: average
2828
period: "1days"

src/diagnostics/radiation_diagnostics.jl

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,3 +942,88 @@ add_diagnostic_variable!(
942942
comments = "In-cloud ratio of the third moment over the second moment of the particle size distribution. Set to zero outside of clouds.",
943943
compute! = compute_reffcli!,
944944
)
945+
946+
###
947+
# Aerosol extinction optical depth (2d)
948+
###
949+
compute_od550aer!(out, state, cache, time) =
950+
compute_od550aer!(out, state, cache, time, cache.atmos.radiation_mode)
951+
compute_od550aer!(_, _, _, _, radiation_mode::T) where {T} =
952+
error_diagnostic_variable("od550aer", radiation_mode)
953+
954+
function compute_od550aer!(
955+
out,
956+
state,
957+
cache,
958+
time,
959+
radiation_mode::Union{
960+
RRTMGPI.AllSkyRadiationWithClearSkyDiagnostics,
961+
RRTMGPI.AllSkyRadiation,
962+
RRTMGPI.ClearSkyRadiation,
963+
},
964+
)
965+
@assert cache.atmos.radiation_mode.aerosol_radiation "aerosol_radiation must be true to enable aerosol optical depth diagnostics"
966+
FT = eltype(state)
967+
if isnothing(out)
968+
return Fields.array2field(
969+
cache.radiation.rrtmgp_model.aod_sw_extinction,
970+
axes(Fields.level(state.f, half)),
971+
)
972+
else
973+
out .= Fields.array2field(
974+
cache.radiation.rrtmgp_model.aod_sw_extinction,
975+
axes(Fields.level(state.f, half)),
976+
)
977+
end
978+
end
979+
980+
add_diagnostic_variable!(
981+
short_name = "od550aer",
982+
long_name = "Ambient Aerosol Optical Thickness at 550nm",
983+
standard_name = "atmosphere_optical_thickness_due_to_ambient_aerosol_particles",
984+
units = "",
985+
comments = "Aerosol optical depth from the ambient aerosols at wavelength 550 nm",
986+
compute! = compute_od550aer!,
987+
)
988+
989+
###
990+
# Aerosol scattering optical depth (2d)
991+
###
992+
compute_odsc550aer!(out, state, cache, time) =
993+
compute_odsc550aer!(out, state, cache, time, cache.atmos.radiation_mode)
994+
compute_odsc550aer!(_, _, _, _, radiation_mode::T) where {T} =
995+
error_diagnostic_variable("odsc550aer", radiation_mode)
996+
997+
function compute_odsc550aer!(
998+
out,
999+
state,
1000+
cache,
1001+
time,
1002+
radiation_mode::Union{
1003+
RRTMGPI.AllSkyRadiationWithClearSkyDiagnostics,
1004+
RRTMGPI.AllSkyRadiation,
1005+
RRTMGPI.ClearSkyRadiation,
1006+
},
1007+
)
1008+
@assert cache.atmos.radiation_mode.aerosol_radiation "aerosol_radiation must be true to enable aerosol optical depth diagnostics"
1009+
FT = eltype(state)
1010+
if isnothing(out)
1011+
return Fields.array2field(
1012+
cache.radiation.rrtmgp_model.aod_sw_scattering,
1013+
axes(Fields.level(state.f, half)),
1014+
)
1015+
else
1016+
out .= Fields.array2field(
1017+
cache.radiation.rrtmgp_model.aod_sw_scattering,
1018+
axes(Fields.level(state.f, half)),
1019+
)
1020+
end
1021+
end
1022+
1023+
add_diagnostic_variable!(
1024+
short_name = "odsc550aer",
1025+
long_name = "Ambient Scattering Aerosol Optical Thickness at 550nm",
1026+
units = "",
1027+
comments = "Aerosol scattering optical depth from the ambient aerosols at wavelength 550 nm",
1028+
compute! = compute_odsc550aer!,
1029+
)

src/parameterized_tendencies/radiation/RRTMGPInterface.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,11 @@ function RRTMGPModel(
824824
end
825825

826826
if radiation_mode.aerosol_radiation
827+
aod_sw_ext = DA{FT}(undef, ncol)
828+
aod_sw_sca = DA{FT}(undef, ncol)
827829
aero_mask = DA{Bool}(undef, nlay, ncol)
830+
set_and_save!(aod_sw_ext, "aod_sw_extinction", t..., dict)
831+
set_and_save!(aod_sw_sca, "aod_sw_scattering", t..., dict)
828832

829833
n_aerosol_sizes = maximum(values(idx_aerosize))
830834
n_aerosols = length(idx_aerosol)
@@ -882,6 +886,8 @@ function RRTMGPModel(
882886
)
883887
end
884888
aerosol_state = RRTMGP.AtmosphericStates.AerosolState(
889+
aod_sw_ext,
890+
aod_sw_sca,
885891
aero_mask,
886892
aero_size,
887893
aero_mass,

src/parameterized_tendencies/radiation/radiation.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ function radiation_model_cache(
262262
else
263263
kwargs = (;
264264
kwargs...,
265+
aod_sw_extinction = NaN,
266+
aod_sw_scattering = NaN,
265267
# assuming fixed aerosol radius
266268
center_dust1_radius = 0.55,
267269
center_dust2_radius = 1.4,

test/restart.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ function test_restart(test_dict; job_id, comms_ctx, more_ignore = Symbol[])
246246

247247
simulation_restarted = CA.get_simulation(config_should_be_same)
248248

249-
if pkgversion(CA.RRTMGP) < v"0.21"
250-
# Versions of RRTMGP older than 0.21 have a bug and do not set the
249+
if pkgversion(CA.RRTMGP) < v"0.22"
250+
# Versions of RRTMGP older than 0.22 have a bug and do not set the
251251
# flux_dn_dir, so that face_clear_sw_direct_flux_dn and
252252
# face_sw_direct_flux_dn is uninitialized and not deterministic
253253
rrtmgp_clear_fix =

0 commit comments

Comments
 (0)