@@ -264,7 +264,6 @@ struct RRTMGPModel{R, I, B, L, P, LWS, SWS, AS, V}
264
264
radiation_mode:: R
265
265
interpolation:: I
266
266
bottom_extrapolation:: B
267
- implied_values:: Symbol
268
267
lookups:: L
269
268
params:: P
270
269
lw_solver:: LWS
@@ -303,11 +302,8 @@ After constructing an `RRTMGPModel`, use it as follows:
303
302
- use the values of any fluxes of interest; e.g.,
304
303
`field2array(face_flux_field) .= model.face_flux`
305
304
306
- To construct the `RRTMGPModel`, one must specify `center_pressure` and
307
- `center_temperature`, or `face_pressure` and `face_temperature`, or all four
308
- values. If only the values at cell centers are specified, the values at cell
309
- faces are "implied values". Likewise, if only the values at faces are specified,
310
- the values at centers are "implied values".
305
+ The `RRTMGPModel` assumes that pressure and temperature live on cell centers,
306
+ and internally interpolates data to cell faces when needed.
311
307
312
308
Every keyword argument that corresponds to an array of cell center or cell face
313
309
values can be specified as a scalar (corresponding to a constant value
@@ -430,49 +426,9 @@ function RRTMGPModel(
430
426
GrayRadiation"
431
427
end
432
428
433
- if (
434
- :center_pressure in keys (dict) &&
435
- :center_temperature in keys (dict) &&
436
- :face_pressure in keys (dict) &&
437
- :face_temperature in keys (dict)
438
- )
439
- if ! (interpolation isa NoInterpolation)
440
- @warn " interpolation is ignored if both center and face pressures/\
441
- temperatures are specified"
442
- end
443
- implied_values = :none
444
- elseif (
445
- :center_pressure in keys (dict) &&
446
- :center_temperature in keys (dict) &&
447
- ! (:face_pressure in keys (dict)) &&
448
- ! (:face_temperature in keys (dict))
449
- )
450
- if interpolation isa NoInterpolation
451
- error (" interpolation cannot be NoInterpolation if only center \
452
- pressures/temperatures are specified" )
453
- end
454
- implied_values = :face
455
- elseif (
456
- ! (:center_pressure in keys (dict)) &&
457
- ! (:center_temperature in keys (dict)) &&
458
- :face_pressure in keys (dict) &&
459
- :face_temperature in keys (dict)
460
- )
461
- if interpolation isa NoInterpolation
462
- error (" interpolation cannot be NoInterpolation if only face \
463
- pressures/temperatures are specified" )
464
- end
465
- implied_values = :center
466
- else
467
- error (" please specify either center_pressure and center_temperature, \
468
- or face_pressure and face_temperature, or all four values" )
469
- end
470
-
471
- if implied_values != :face
472
- if ! (bottom_extrapolation isa SameAsInterpolation)
473
- @warn " bottom_extrapolation is ignored if face_pressure and \
474
- face_temperature are specified"
475
- end
429
+ if interpolation isa NoInterpolation
430
+ error (" interpolation cannot be NoInterpolation if only center \
431
+ pressures/temperatures are specified" )
476
432
end
477
433
478
434
lookups = NamedTuple ()
@@ -652,20 +608,14 @@ function RRTMGPModel(
652
608
653
609
p_lev = DA {FT} (undef, nlay + 1 , ncol)
654
610
t_lev = DA {FT} (undef, nlay + 1 , ncol)
655
- if implied_values != :face
656
- set_and_save! (p_lev, " face_pressure" , t... , dict)
657
- set_and_save! (t_lev, " face_temperature" , t... , dict)
658
- end
659
611
t_sfc = DA {FT} (undef, ncol)
660
612
set_and_save! (t_sfc, " surface_temperature" , t... , dict)
661
613
662
614
if radiation_mode isa GrayRadiation
663
615
p_lay = DA {FT} (undef, nlay, ncol)
664
616
t_lay = DA {FT} (undef, nlay, ncol)
665
- if implied_values != :center
666
- set_and_save! (p_lay, " center_pressure" , t... , dict)
667
- set_and_save! (t_lay, " center_temperature" , t... , dict)
668
- end
617
+ set_and_save! (p_lay, " center_pressure" , t... , dict)
618
+ set_and_save! (t_lay, " center_temperature" , t... , dict)
669
619
670
620
z_lev = DA {FT} (undef, nlay + 1 , ncol) # TODO : z_lev required but unused
671
621
@@ -696,11 +646,9 @@ function RRTMGPModel(
696
646
p_lay = view (layerdata, 2 , :, :)
697
647
t_lay = view (layerdata, 3 , :, :)
698
648
rh_lay = view (layerdata, 4 , :, :)
699
- if implied_values != :center
700
- set_and_save! (p_lay, " center_pressure" , t... , dict)
701
- set_and_save! (t_lay, " center_temperature" , t... , dict)
702
- set_and_save! (rh_lay, " center_relative_humidity" , t... , dict)
703
- end
649
+ set_and_save! (p_lay, " center_pressure" , t... , dict)
650
+ set_and_save! (t_lay, " center_temperature" , t... , dict)
651
+ set_and_save! (rh_lay, " center_relative_humidity" , t... , dict)
704
652
vmr_str = " volume_mixing_ratio_"
705
653
gas_names = filter (
706
654
gas_name ->
@@ -899,7 +847,6 @@ function RRTMGPModel(
899
847
radiation_mode,
900
848
interpolation,
901
849
bottom_extrapolation,
902
- implied_values,
903
850
lookups,
904
851
params,
905
852
lw_solver,
@@ -988,7 +935,7 @@ NVTX.@annotate function update_fluxes!(model, seedval)
988
935
)
989
936
radiation_mode. reset_rng_seed && Random. seed! (seedval)
990
937
end
991
- model . implied_values != :none && update_implied_values! (model)
938
+ update_implied_values! (model)
992
939
model. radiation_mode. add_isothermal_boundary_layer &&
993
940
update_boundary_layer! (model)
994
941
clip_values! (model)
@@ -1015,25 +962,18 @@ function update_implied_values!(model)
1015
962
z_lay = parent (model. center_z)
1016
963
z_lev = parent (model. face_z)
1017
964
end
1018
- if model. implied_values == :center
1019
- mode = model. interpolation
1020
- outs = requires_z (mode) ? (p_lay, t_lay, z_lay) : (p_lay, t_lay)
1021
- ins = requires_z (mode) ? (p_lev, t_lev, z_lev) : (p_lev, t_lev)
1022
- update_views (interp!, mode, outs, ins, (), 1 : nlay, 1 : nlay, 2 : (nlay + 1 ))
1023
- else # model.implied_values == :face
1024
- mode = model. interpolation
1025
- outs = requires_z (mode) ? (p_lev, t_lev, z_lev) : (p_lev, t_lev)
1026
- ins = requires_z (mode) ? (p_lay, t_lay, z_lay) : (p_lay, t_lay)
1027
- update_views (interp!, mode, outs, ins, (), 2 : nlay, 1 : (nlay - 1 ), 2 : nlay)
1028
- others = (t_sfc, model. params)
1029
- update_views (extrap!, mode, outs, ins, others, nlay + 1 , nlay, nlay - 1 )
1030
- mode =
1031
- model. bottom_extrapolation isa SameAsInterpolation ?
1032
- model. interpolation : model. bottom_extrapolation
1033
- outs = requires_z (mode) ? (p_lev, t_lev, z_lev) : (p_lev, t_lev)
1034
- ins = requires_z (mode) ? (p_lay, t_lay, z_lay) : (p_lay, t_lay)
1035
- update_views (extrap!, mode, outs, ins, others, 1 , 1 , 2 )
1036
- end
965
+ mode = model. interpolation
966
+ outs = requires_z (mode) ? (p_lev, t_lev, z_lev) : (p_lev, t_lev)
967
+ ins = requires_z (mode) ? (p_lay, t_lay, z_lay) : (p_lay, t_lay)
968
+ update_views (interp!, mode, outs, ins, (), 2 : nlay, 1 : (nlay - 1 ), 2 : nlay)
969
+ others = (t_sfc, model. params)
970
+ update_views (extrap!, mode, outs, ins, others, nlay + 1 , nlay, nlay - 1 )
971
+ mode =
972
+ model. bottom_extrapolation isa SameAsInterpolation ?
973
+ model. interpolation : model. bottom_extrapolation
974
+ outs = requires_z (mode) ? (p_lev, t_lev, z_lev) : (p_lev, t_lev)
975
+ ins = requires_z (mode) ? (p_lay, t_lay, z_lay) : (p_lay, t_lay)
976
+ update_views (extrap!, mode, outs, ins, others, 1 , 1 , 2 )
1037
977
end
1038
978
1039
979
update_views (f, mode, outs, ins, others, out_range, in_range1, in_range2) = f (
0 commit comments