Skip to content

Commit ab00b3b

Browse files
authored
Merge pull request #3620 from CliMA/aj/cloud_effective_radius
Prescribe effective radius, add to diagnostics output
2 parents b0c695e + 88f0a88 commit ab00b3b

File tree

7 files changed

+120
-12
lines changed

7 files changed

+120
-12
lines changed

.buildkite/Manifest-v1.11.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.11.3"
44
manifest_format = "2.0"
5-
project_hash = "5971c6c9602125f1301878afca0ead7416797e54"
5+
project_hash = "435748ba4bd3e84a898785b2d03f015c42fbae0c"
66

77
[[deps.ADTypes]]
88
git-tree-sha1 = "e1ce448a0d7f88168ffe2eeac4549c32d45a42d1"
@@ -394,9 +394,9 @@ version = "0.2.12"
394394

395395
[[deps.ClimaParams]]
396396
deps = ["TOML"]
397-
git-tree-sha1 = "1e17ed5997da08f1ca186df1882ef10010f70481"
397+
git-tree-sha1 = "e8f4589e684b5053660ee3981bb2236221d5ad27"
398398
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
399-
version = "0.10.18"
399+
version = "0.10.19"
400400

401401
[[deps.ClimaReproducibilityTests]]
402402
deps = ["OrderedCollections", "PrettyTables"]
@@ -436,9 +436,9 @@ version = "0.1.13"
436436

437437
[[deps.CloudMicrophysics]]
438438
deps = ["ClimaParams", "DocStringExtensions", "ForwardDiff", "HCubature", "LazyArtifacts", "QuadGK", "RootSolvers", "SpecialFunctions", "Thermodynamics"]
439-
git-tree-sha1 = "ce0a087e03585d89fa925ffdb18246309ad40e55"
439+
git-tree-sha1 = "98c77aaefaedaa185a7bb676af16ab19aede7ff3"
440440
uuid = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
441-
version = "0.22.6"
441+
version = "0.22.8"
442442

443443
[deps.CloudMicrophysics.extensions]
444444
EmulatorModelsExt = ["DataFrames", "MLJ"]
@@ -1986,9 +1986,9 @@ version = "1.11.0"
19861986

19871987
[[deps.RRTMGP]]
19881988
deps = ["Adapt", "Artifacts", "ClimaComms", "DocStringExtensions", "Random"]
1989-
git-tree-sha1 = "bf25b44442e3bedd7ea0b487a863608c7e99a8d4"
1989+
git-tree-sha1 = "d258e9495bb6a1b7ad2b28683c9382c0053dafc1"
19901990
uuid = "a01a1ee8-cea4-48fc-987c-fc7878d79da1"
1991-
version = "0.20.0"
1991+
version = "0.20.1"
19921992
weakdeps = ["CUDA", "ClimaParams"]
19931993

19941994
[deps.RRTMGP.extensions]

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ AtmosphericProfilesLibrary = "0.1.7"
4343
ClimaComms = "0.6.6"
4444
ClimaCore = "0.14.24"
4545
ClimaDiagnostics = "0.2.12"
46-
ClimaParams = "0.10.17"
46+
ClimaParams = "0.10.19"
4747
ClimaTimeSteppers = "0.8.2"
4848
ClimaUtilities = "0.1.22"
49-
CloudMicrophysics = "0.22.4"
49+
CloudMicrophysics = "0.22.8"
5050
Dates = "1"
5151
DiffEqBase = "6.145"
5252
FastGaussQuadrature = "0.5, 1"
@@ -59,7 +59,7 @@ Logging = "1"
5959
NCDatasets = "0.14.2"
6060
NullBroadcasts = "0.1"
6161
NVTX = "0.3"
62-
RRTMGP = "0.19, 0.20"
62+
RRTMGP = "0.20.1"
6363
Random = "1"
6464
SciMLBase = "2.12"
6565
StaticArrays = "1.7"

config/model_configs/sphere_aquaplanet_rhoe_nonequilmoist_allsky.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ insolation: "timevarying"
1515
rayleigh_sponge: true
1616
surface_setup: "DefaultMoninObukhov"
1717
toml: [toml/sphere_aquaplanet_1M.toml]
18+
diagnostics:
19+
- short_name: [reffclw, reffcli]
20+
period: 1hours

src/callbacks/callbacks.jl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ClimaCore.DataLayouts as DL
22
import .RRTMGPInterface as RRTMGPI
33
import Thermodynamics as TD
4+
import CloudMicrophysics as CM
45
import LinearAlgebra
56
import ClimaCore.Fields
67
import ClimaComms
@@ -15,6 +16,7 @@ import ClimaCore.Fields: ColumnField
1516

1617
import ClimaUtilities.TimeVaryingInputs: evaluate!
1718

19+
1820
include("callback_helpers.jl")
1921

2022
function flux_accumulation!(integrator)
@@ -95,6 +97,7 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
9597

9698
FT = Spaces.undertype(axes(Y.c))
9799
thermo_params = CAP.thermodynamics_params(params)
100+
cmc = CAP.microphysics_cloud_params(params)
98101
T_min = CAP.optics_lookup_temperature_min(params)
99102
T_max = CAP.optics_lookup_temperature_max(params)
100103

@@ -183,6 +186,7 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
183186
)
184187
# RRTMGP needs lwp and iwp in g/m^2
185188
kg_to_g_factor = 1000
189+
m_to_um_factor = FT(1e6)
186190
cloud_liquid_water_content =
187191
radiation_mode.cloud isa PrescribedCloudInRadiation ?
188192
p.radiation.prescribed_clouds_field.clwc :
@@ -203,8 +207,18 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
203207
max(cloud_fraction, eps(FT))
204208
@. ᶜfrac = cloud_fraction
205209
# RRTMGP needs effective radius in microns
206-
@. ᶜreliq = FT(12)
207-
@. ᶜreice = FT(25)
210+
@. ᶜreliq = ifelse(
211+
cloud_liquid_water_content > FT(0),
212+
CM.CloudDiagnostics.effective_radius_const(cmc.liquid) *
213+
m_to_um_factor,
214+
FT(0),
215+
)
216+
@. ᶜreice = ifelse(
217+
cloud_ice_water_content > FT(0),
218+
CM.CloudDiagnostics.effective_radius_const(cmc.ice) *
219+
m_to_um_factor,
220+
FT(0),
221+
)
208222
end
209223
end
210224

src/diagnostics/radiation_diagnostics.jl

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,3 +857,88 @@ add_diagnostic_variable!(
857857
comments = "Upwelling clear-sky longwave radiation at the top of the atmosphere",
858858
compute! = compute_rlutcs!,
859859
)
860+
861+
862+
###
863+
# Effective radius for liquid clouds (3d)
864+
###
865+
compute_reffclw!(out, state, cache, time) =
866+
compute_reffclw!(out, state, cache, time, cache.atmos.radiation_mode)
867+
compute_reffclw!(_, _, _, _, radiation_mode::T) where {T} =
868+
error_diagnostic_variable("reffclw", radiation_mode)
869+
870+
function compute_reffclw!(
871+
out,
872+
state,
873+
cache,
874+
time,
875+
radiation_mode::Union{
876+
RRTMGPI.AllSkyRadiationWithClearSkyDiagnostics,
877+
RRTMGPI.AllSkyRadiation,
878+
},
879+
)
880+
FT = eltype(state)
881+
if isnothing(out)
882+
return Fields.array2field(
883+
cache.radiation.rrtmgp_model.center_cloud_liquid_effective_radius,
884+
axes(state.c),
885+
) .* FT(1e-6) # RRTMGP stores r_eff in microns
886+
else
887+
out .=
888+
Fields.array2field(
889+
cache.radiation.rrtmgp_model.center_cloud_liquid_effective_radius,
890+
axes(state.c),
891+
) .* FT(1e-6)
892+
end
893+
end
894+
895+
add_diagnostic_variable!(
896+
short_name = "reffclw",
897+
long_name = "Effective radius for liquid clouds",
898+
standard_name = "effective_radius_of_cloud_liquid_particles",
899+
units = "m",
900+
comments = "In-cloud ratio of the third moment over the second moment of the particle size distribution. Set to zero outside of clouds.",
901+
compute! = compute_reffclw!,
902+
)
903+
904+
###
905+
# Effective radius for ice clouds (3d)
906+
###
907+
compute_reffcli!(out, state, cache, time) =
908+
compute_reffcli!(out, state, cache, time, cache.atmos.radiation_mode)
909+
compute_reffcli!(_, _, _, _, radiation_mode::T) where {T} =
910+
error_diagnostic_variable("reffcli", radiation_mode)
911+
912+
function compute_reffcli!(
913+
out,
914+
state,
915+
cache,
916+
time,
917+
radiation_mode::Union{
918+
RRTMGPI.AllSkyRadiationWithClearSkyDiagnostics,
919+
RRTMGPI.AllSkyRadiation,
920+
},
921+
)
922+
FT = eltype(state)
923+
if isnothing(out)
924+
return Fields.array2field(
925+
cache.radiation.rrtmgp_model.center_cloud_ice_effective_radius,
926+
axes(state.c),
927+
) .* FT(1e-6) # RRTMGP stores r_eff in microns
928+
else
929+
out .=
930+
Fields.array2field(
931+
cache.radiation.rrtmgp_model.center_cloud_ice_effective_radius,
932+
axes(state.c),
933+
) .* FT(1e-6)
934+
end
935+
end
936+
937+
add_diagnostic_variable!(
938+
short_name = "reffcli",
939+
long_name = "Effective radius for ice clouds",
940+
standard_name = "effective_radius_of_cloud_ice_particles",
941+
units = "m",
942+
comments = "In-cloud ratio of the third moment over the second moment of the particle size distribution. Set to zero outside of clouds.",
943+
compute! = compute_reffcli!,
944+
)

toml/sphere_aquaplanet.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ value = 40000.0
66

77
[precipitation_timescale]
88
value = 400
9+
10+
[liquid_cloud_effective_radius]
11+
value = 12e-6

toml/sphere_aquaplanet_1M.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ value = 40000.0
99

1010
[zd_rayleigh]
1111
value = 40000.0
12+
13+
[liquid_cloud_effective_radius]
14+
value = 12e-6

0 commit comments

Comments
 (0)