Skip to content

Commit d8ab33c

Browse files
Merge pull request #3822 from CliMA/ne/fix_metric_scaling
Only scale rad diagnostics with deep atmosphere
2 parents 1313221 + 5a009ca commit d8ab33c

File tree

1 file changed

+52
-26
lines changed

1 file changed

+52
-26
lines changed

src/diagnostics/radiation_diagnostics.jl

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ function compute_rsd!(
3737
axes(state.f),
3838
),
3939
)
40-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
40+
radiation_mode.deep_atmosphere &&
41+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
4142
return out
4243
else
4344
out .= Fields.array2field(
4445
cache.radiation.rrtmgp_model.face_sw_flux_dn,
4546
axes(state.f),
4647
)
4748
@assert out !== nothing "Output field 'out' must not be `nothing` in this branch"
48-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
49+
radiation_mode.deep_atmosphere &&
50+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
4951
end
5052
end
5153

@@ -87,7 +89,8 @@ function compute_rsdt!(
8789
nlevels + half,
8890
),
8991
)
90-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
92+
radiation_mode.deep_atmosphere &&
93+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
9194
return out
9295
else
9396
out .= Fields.level(
@@ -97,7 +100,8 @@ function compute_rsdt!(
97100
),
98101
nlevels + half,
99102
)
100-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
103+
radiation_mode.deep_atmosphere &&
104+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
101105
end
102106
end
103107

@@ -180,14 +184,16 @@ function compute_rsu!(
180184
axes(state.f),
181185
),
182186
)
183-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
187+
radiation_mode.deep_atmosphere &&
188+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
184189
return out
185190
else
186191
out .= Fields.array2field(
187192
cache.radiation.rrtmgp_model.face_sw_flux_up,
188193
axes(state.f),
189194
)
190-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
195+
radiation_mode.deep_atmosphere &&
196+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
191197
end
192198
end
193199

@@ -229,7 +235,8 @@ function compute_rsut!(
229235
nlevels + half,
230236
),
231237
)
232-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
238+
radiation_mode.deep_atmosphere &&
239+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
233240
return out
234241
else
235242
out .= Fields.level(
@@ -239,7 +246,8 @@ function compute_rsut!(
239246
),
240247
nlevels + half,
241248
)
242-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
249+
radiation_mode.deep_atmosphere &&
250+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
243251
end
244252
end
245253

@@ -322,14 +330,16 @@ function compute_rld!(
322330
axes(state.f),
323331
),
324332
)
325-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
333+
radiation_mode.deep_atmosphere &&
334+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
326335
return out
327336
else
328337
out .= Fields.array2field(
329338
cache.radiation.rrtmgp_model.face_lw_flux_dn,
330339
axes(state.f),
331340
)
332-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
341+
radiation_mode.deep_atmosphere &&
342+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
333343
end
334344
end
335345

@@ -412,14 +422,16 @@ function compute_rlu!(
412422
axes(state.f),
413423
),
414424
)
415-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
425+
radiation_mode.deep_atmosphere &&
426+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
416427
return out
417428
else
418429
out .= Fields.array2field(
419430
cache.radiation.rrtmgp_model.face_lw_flux_up,
420431
axes(state.f),
421432
)
422-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
433+
radiation_mode.deep_atmosphere &&
434+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
423435
end
424436
end
425437

@@ -461,7 +473,8 @@ function compute_rlut!(
461473
nlevels + half,
462474
),
463475
)
464-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
476+
radiation_mode.deep_atmosphere &&
477+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
465478
return out
466479
else
467480
out .= Fields.level(
@@ -471,7 +484,8 @@ function compute_rlut!(
471484
),
472485
nlevels + half,
473486
)
474-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
487+
radiation_mode.deep_atmosphere &&
488+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
475489
end
476490
end
477491

@@ -554,14 +568,16 @@ function compute_rsdcs!(
554568
axes(state.f),
555569
),
556570
)
557-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
571+
radiation_mode.deep_atmosphere &&
572+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
558573
return out
559574
else
560575
out .= Fields.array2field(
561576
cache.radiation.rrtmgp_model.face_clear_sw_flux_dn,
562577
axes(state.f),
563578
)
564-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
579+
radiation_mode.deep_atmosphere &&
580+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
565581
end
566582
end
567583

@@ -644,14 +660,16 @@ function compute_rsucs!(
644660
axes(state.f),
645661
),
646662
)
647-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
663+
radiation_mode.deep_atmosphere &&
664+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
648665
return out
649666
else
650667
out .= Fields.array2field(
651668
cache.radiation.rrtmgp_model.face_clear_sw_flux_up,
652669
axes(state.f),
653670
)
654-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
671+
radiation_mode.deep_atmosphere &&
672+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
655673
end
656674
end
657675

@@ -693,7 +711,8 @@ function compute_rsutcs!(
693711
nlevels + half,
694712
),
695713
)
696-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
714+
radiation_mode.deep_atmosphere &&
715+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
697716
return out
698717
else
699718
out .= Fields.level(
@@ -703,7 +722,8 @@ function compute_rsutcs!(
703722
),
704723
nlevels + half,
705724
)
706-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
725+
radiation_mode.deep_atmosphere &&
726+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
707727
end
708728
end
709729

@@ -787,14 +807,16 @@ function compute_rldcs!(
787807
axes(state.f),
788808
),
789809
)
790-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
810+
radiation_mode.deep_atmosphere &&
811+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
791812
return out
792813
else
793814
out .= Fields.array2field(
794815
cache.radiation.rrtmgp_model.face_clear_lw_flux_dn,
795816
axes(state.f),
796817
)
797-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
818+
radiation_mode.deep_atmosphere &&
819+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
798820
end
799821
end
800822

@@ -877,14 +899,16 @@ function compute_rlucs!(
877899
axes(state.f),
878900
),
879901
)
880-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
902+
radiation_mode.deep_atmosphere &&
903+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
881904
return out
882905
else
883906
out .= Fields.array2field(
884907
cache.radiation.rrtmgp_model.face_clear_lw_flux_up,
885908
axes(state.f),
886909
)
887-
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
910+
radiation_mode.deep_atmosphere &&
911+
apply_geometric_scaling!(out, z_lev, planet_radius, FT)
888912
end
889913
end
890914

@@ -926,7 +950,8 @@ function compute_rlutcs!(
926950
nlevels + half,
927951
),
928952
)
929-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
953+
radiation_mode.deep_atmosphere &&
954+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
930955
return out
931956
else
932957
out .= Fields.level(
@@ -936,7 +961,8 @@ function compute_rlutcs!(
936961
),
937962
nlevels + half,
938963
)
939-
apply_geometric_scaling!(out, z_max, planet_radius, FT)
964+
radiation_mode.deep_atmosphere &&
965+
apply_geometric_scaling!(out, z_max, planet_radius, FT)
940966
end
941967
end
942968

0 commit comments

Comments
 (0)