Skip to content

Commit 7d7b3bc

Browse files
authored
Merge pull request #749 from climbfuji/debug-array-alloc-ccpp-caps
Metadata bug fixes, cleanup of active_gases_array use in RRTMGP, cleanup of Ferrier-Aligo variables, remove redundant consistency checks
2 parents b12e6c3 + c68c864 commit 7d7b3bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+167
-436
lines changed

physics/GFS_DCNV_generic.meta

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
standard_name = cumulative_change_of_state_variables
478478
long_name = diagnostic tendencies for state variables
479479
units = various
480-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
480+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
481481
type = real
482482
kind = kind_phys
483483
intent = inout

physics/GFS_GWD_generic.meta

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
standard_name = cumulative_change_of_state_variables
187187
long_name = diagnostic tendencies for state variables
188188
units = various
189-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
189+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
190190
type = real
191191
kind = kind_phys
192192
intent = inout
@@ -368,7 +368,7 @@
368368
standard_name = cumulative_change_of_state_variables
369369
long_name = diagnostic tendencies for state variables
370370
units = various
371-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
371+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
372372
type = real
373373
kind = kind_phys
374374
intent = inout

physics/GFS_MP_generic.meta

+1-1
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@
823823
standard_name = cumulative_change_of_state_variables
824824
long_name = diagnostic tendencies for state variables
825825
units = various
826-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
826+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
827827
type = real
828828
kind = kind_phys
829829
intent = inout

physics/GFS_PBL_generic.meta

+1-1
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@
820820
standard_name = cumulative_change_of_state_variables
821821
long_name = diagnostic tendencies for state variables
822822
units = various
823-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
823+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
824824
type = real
825825
kind = kind_phys
826826
intent = inout

physics/GFS_SCNV_generic.meta

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@
433433
standard_name = cumulative_change_of_state_variables
434434
long_name = diagnostic tendencies for state variables
435435
units = various
436-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
436+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
437437
type = real
438438
kind = kind_phys
439439
intent = inout

physics/GFS_debug.F90

-6
Original file line numberDiff line numberDiff line change
@@ -1393,12 +1393,6 @@ subroutine GFS_interstitialtoscreen_run (Model, Statein, Stateout, Sfcprop, Coup
13931393
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%icemp ', Interstitial%icemp )
13941394
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%rainmp ', Interstitial%rainmp )
13951395
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%snowmp ', Interstitial%snowmp )
1396-
! Ferrier-Aligo
1397-
else if (Model%imp_physics == Model%imp_physics_fer_hires) then
1398-
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%f_ice ', Interstitial%f_ice )
1399-
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%f_rain ', Interstitial%f_rain )
1400-
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%f_rimef ', Interstitial%f_rimef )
1401-
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%cwm ', Interstitial%cwm )
14021396
! Morrison-Gettelman
14031397
else if (Model%imp_physics == Model%imp_physics_mg) then
14041398
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%ncgl ', Interstitial%ncgl )

physics/GFS_radiation_surface.F90

+2-12
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,21 @@ module GFS_radiation_surface
1313
!> \section arg_table_GFS_radiation_surface_init Argument Table
1414
!! \htmlinclude GFS_radiation_surface_init.html
1515
!!
16-
subroutine GFS_radiation_surface_init (me, sfcalb, ialb, iems, errmsg, errflg)
16+
subroutine GFS_radiation_surface_init (me, ialb, iems, errmsg, errflg)
1717

1818
use physparam, only: ialbflg, iemsflg
19-
use module_radiation_surface, only: NF_ALBD, sfc_init
19+
use module_radiation_surface, only: sfc_init
2020

2121
implicit none
2222

2323
integer, intent(in) :: me, ialb, iems
24-
real(kind=kind_phys), dimension(:,:), intent(in) :: sfcalb
2524
character(len=*), intent(out) :: errmsg
2625
integer, intent(out) :: errflg
2726

2827
! Initialize CCPP error handling variables
2928
errmsg = ''
3029
errflg = 0
3130

32-
! Consistency check that the number of albedo components in array
33-
! sfcalb matches the parameter NF_ALBD from radiation_surface.f
34-
if (size(sfcalb,dim=2)/=NF_ALBD) then
35-
errmsg = 'Error in GFS_radiation_surface_init: second' // &
36-
' dimension of array sfcalb does not match' // &
37-
' parameter NF_ALBD in radiation_surface.f'
38-
errflg = 1
39-
end if
40-
4131
ialbflg= ialb ! surface albedo control flag
4232
iemsflg= iems ! surface emissivity control flag
4333

physics/GFS_radiation_surface.meta

-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@
1515
type = integer
1616
intent = in
1717
optional = F
18-
[sfcalb]
19-
standard_name = surface_albedo_components
20-
long_name = surface albedo IR/UV/VIS components
21-
units = frac
22-
dimensions = (horizontal_dimension,number_of_components_for_surface_albedo)
23-
type = real
24-
kind = kind_phys
25-
intent = in
26-
optional = F
2718
[ialb]
2819
standard_name = control_for_surface_albedo
2920
long_name = flag for using climatology alb, based on sfc type

physics/GFS_rrtmg_setup.F90

+3-55
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ subroutine GFS_rrtmg_setup_init ( &
4848
icliq_sw, crick_proof, ccnorm, &
4949
imp_physics, &
5050
norad_precip, idate, iflip, &
51-
do_RRTMGP, im, faerlw, faersw, aerodp, & ! for consistency checks
52-
me, errmsg, errflg)
51+
do_RRTMGP, me, errmsg, errflg)
5352
! ================= subprogram documentation block ================ !
5453
! !
5554
! subprogram: GFS_rrtmg_setup_init - a subprogram to initialize radiation !
@@ -145,10 +144,6 @@ subroutine GFS_rrtmg_setup_init ( &
145144
! !
146145
! =================================================================== !
147146
!
148-
use module_radsw_parameters, only: NBDSW
149-
use module_radlw_parameters, only: NBDLW
150-
use module_radiation_aerosols,only: NF_AELW, NF_AESW, NSPC1
151-
152147
implicit none
153148

154149
! interface variables
@@ -172,24 +167,11 @@ subroutine GFS_rrtmg_setup_init ( &
172167
logical, intent(in) :: norad_precip
173168
integer, intent(in) :: idate(:)
174169
integer, intent(in) :: iflip
175-
! For consistency checks
176-
177-
logical, intent(in) :: do_RRTMGP
178-
integer, intent(in) :: im
179-
real(kind_phys), intent(in) :: faerlw(:,:,:,:)
180-
real(kind_phys), intent(in) :: faersw(:,:,:,:)
181-
real(kind_phys), intent(in) :: aerodp(:,:)
182-
! End for consistency checks
183-
integer, intent(in) :: me
170+
logical, intent(in) :: do_RRTMGP
171+
integer, intent(in) :: me
184172
character(len=*), intent(out) :: errmsg
185173
integer, intent(out) :: errflg
186174

187-
! For consistency checks
188-
real(kind_phys), dimension(im,levr+ltp,NBDLW,NF_AELW) :: faerlw_check
189-
real(kind_phys), dimension(im,levr+ltp,NBDSW,NF_AESW) :: faersw_check
190-
real(kind_phys), dimension(im,NSPC1) :: aerodp_check
191-
! End for consistency checks
192-
193175
! Initialize the CCPP error handling variables
194176
errmsg = ''
195177
errflg = 0
@@ -202,41 +184,7 @@ subroutine GFS_rrtmg_setup_init ( &
202184
return
203185
end if
204186

205-
! Consistency checks for dimensions of arrays, this is required
206-
! to detect differences in FV3's parameters that are used to
207-
! dimension certain arrays and the values in ccpp-physics
208-
if (size(faerlw(1,:,:,:)).ne.size(faerlw_check(1,:,:,:))) then
209-
write(errmsg,"(3a,4i4,a,4i4)") &
210-
"Runtime error: dimension mismatch for faerlw,", &
211-
" check definitions of levr, ltp, nbdlw, nf_aelw:", &
212-
" expected shape ", shape(faerlw_check(:,:,:,:)), &
213-
" but got ", shape(faerlw(:,:,:,:))
214-
errflg = 1
215-
return
216-
end if
217-
if (size(faersw(1,:,:,:)).ne.size(faersw_check(1,:,:,:))) then
218-
write(errmsg,"(3a,4i4,a,4i4)") &
219-
"Runtime error: dimension mismatch for faersw,", &
220-
" check definitions of levr, ltp, nbdsw, nf_aesw:", &
221-
" expected shape ", shape(faersw_check(:,:,:,:)), &
222-
" but got ", shape(faersw(:,:,:,:))
223-
errflg = 1
224-
return
225-
end if
226-
if (size(aerodp(1,:)).ne.size(aerodp_check(1,:))) then
227-
write(errmsg,"(3a,2i4,a,2i4)") &
228-
"Runtime error: dimension mismatch for aerodp,", &
229-
" check definitions of nspc1:", &
230-
" expected shape ", shape(aerodp_check(:,:)), &
231-
" but got ", shape(aerodp(:,:))
232-
errflg = 1
233-
return
234-
end if
235-
236-
! End of consistency checks
237-
238187
isolar = isol ! solar constant control flag
239-
240188
ictmflg= ictm ! data ic time/date control flag
241189
ico2flg= ico2 ! co2 data source control flag
242190
ioznflg= ntoz ! ozone data source control flag

physics/GFS_rrtmg_setup.meta

-35
Original file line numberDiff line numberDiff line change
@@ -177,41 +177,6 @@
177177
type = logical
178178
intent = in
179179
optional = F
180-
[im]
181-
standard_name = horizontal_dimension
182-
long_name = horizontal dimension
183-
units = count
184-
dimensions = ()
185-
type = integer
186-
intent = in
187-
optional = F
188-
[faerlw]
189-
standard_name = aerosol_optical_properties_for_longwave_bands_01_16
190-
long_name = optical properties for longwave bands 01-16
191-
units = various
192-
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation,number_of_aerosol_bands_for_longwave_radiation,number_of_aerosol_output_fields_for_longwave_radiation)
193-
type = real
194-
kind = kind_phys
195-
intent = in
196-
optional = F
197-
[faersw]
198-
standard_name = aerosol_optical_properties_for_shortwave_bands_01_16
199-
long_name = aerosol optical properties for shortwave bands 01-16
200-
units = various
201-
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation,number_of_aerosol_bands_for_shortwave_radiation,number_of_aerosol_output_fields_for_shortwave_radiation)
202-
type = real
203-
kind = kind_phys
204-
intent = in
205-
optional = F
206-
[aerodp]
207-
standard_name = atmosphere_optical_thickness_due_to_ambient_aerosol_particles
208-
long_name = vertical integrated optical depth for various aerosol species
209-
units = none
210-
dimensions = (horizontal_dimension,number_of_species_for_aerosol_optical_depth)
211-
type = real
212-
kind = kind_phys
213-
intent = in
214-
optional = F
215180
[me]
216181
standard_name = mpi_rank
217182
long_name = current MPI-rank

physics/GFS_rrtmgp_pre.F90

+10-9
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ module GFS_rrtmgp_pre
2121
! Save trace gas indices.
2222
integer :: iStr_h2o, iStr_co2, iStr_o3, iStr_n2o, iStr_ch4, iStr_o2, iStr_ccl4, &
2323
iStr_cfc11, iStr_cfc12, iStr_cfc22
24-
character(len=32),dimension(:),allocatable :: &
25-
active_gases_array
2624

2725
public GFS_rrtmgp_pre_run,GFS_rrtmgp_pre_init,GFS_rrtmgp_pre_finalize
2826
contains
@@ -33,12 +31,15 @@ module GFS_rrtmgp_pre
3331
!! \section arg_table_GFS_rrtmgp_pre_init
3432
!! \htmlinclude GFS_rrtmgp_pre_init.html
3533
!!
36-
subroutine GFS_rrtmgp_pre_init(nGases, active_gases, errmsg, errflg)
34+
subroutine GFS_rrtmgp_pre_init(nGases, active_gases, active_gases_array, errmsg, errflg)
3735
! Inputs
3836
integer, intent(in) :: &
3937
nGases ! Number of active gases in RRTMGP
4038
character(len=*), intent(in) :: &
41-
active_gases ! List of active gases from namelist.
39+
active_gases ! List of active gases from namelist
40+
character(len=*), dimension(:), intent(out) :: &
41+
active_gases_array ! List of active gases from namelist as array
42+
4243
! Outputs
4344
character(len=*), intent(out) :: &
4445
errmsg ! Error message
@@ -73,7 +74,6 @@ subroutine GFS_rrtmgp_pre_init(nGases, active_gases, errmsg, errflg)
7374
gasIndices(nGases,2)=len(trim(active_gases))
7475

7576
! Now extract the gas names
76-
allocate(active_gases_array(nGases))
7777
do ij=1,nGases
7878
active_gases_array(ij) = active_gases(gasIndices(ij,1):gasIndices(ij,2))
7979
if(trim(active_gases_array(ij)) .eq. 'h2o') istr_h2o = ij
@@ -99,8 +99,8 @@ end subroutine GFS_rrtmgp_pre_init
9999
subroutine GFS_rrtmgp_pre_run(nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhswr, fhlwr, &
100100
xlat, xlon, prsl, tgrs, prslk, prsi, qgrs, tsfc, con_eps, con_epsm1, con_fvirt, &
101101
con_epsqs, minGPpres, maxGPpres, minGPtemp, maxGPtemp, raddt, p_lay, t_lay, p_lev, &
102-
t_lev, tsfg, tsfa, qs_lay, q_lay, tv_lay, relhum, tracer, gas_concentrations, &
103-
tsfc_radtime, errmsg, errflg)
102+
t_lev, tsfg, tsfa, qs_lay, q_lay, tv_lay, relhum, tracer, active_gases_array, &
103+
gas_concentrations, tsfc_radtime, errmsg, errflg)
104104

105105
! Inputs
106106
integer, intent(in) :: &
@@ -159,7 +159,9 @@ subroutine GFS_rrtmgp_pre_run(nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhswr, f
159159
t_lev ! Temperature at model-interface
160160
real(kind_phys), dimension(nCol, nLev, nTracers),intent(inout) :: &
161161
tracer ! Array containing trace gases
162-
type(ty_gas_concs),intent(inout) :: &
162+
character(len=*), dimension(:), intent(in) :: &
163+
active_gases_array ! List of active gases from namelist as array
164+
type(ty_gas_concs), intent(inout) :: &
163165
gas_concentrations ! RRTMGP DDT: gas volumne mixing ratios
164166

165167
! Local variables
@@ -169,7 +171,6 @@ subroutine GFS_rrtmgp_pre_run(nCol, nLev, nTracers, i_o3, lsswr, lslwr, fhswr, f
169171
real(kind_phys) :: es, tem1, tem2
170172
real(kind_phys), dimension(nCol,nLev) :: o3_lay
171173
real(kind_phys), dimension(nCol,nLev, NF_VGAS) :: gas_vmr
172-
character(len=32), dimension(gas_concentrations%get_num_gases()) :: active_gases
173174

174175
! Initialize CCPP error handling variables
175176
errmsg = ''

physics/GFS_rrtmgp_pre.meta

+25-7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
[ccpp-arg-table]
99
name = GFS_rrtmgp_pre_init
1010
type = scheme
11+
[nGases]
12+
standard_name = number_of_active_gases_used_by_RRTMGP
13+
long_name = number of gases available used by RRTMGP (Model%nGases)
14+
units = count
15+
dimensions = ()
16+
type = integer
17+
intent = in
18+
optional = F
1119
[active_gases]
1220
standard_name = active_gases_used_by_RRTMGP
1321
long_name = active gases used by RRTMGP
@@ -17,13 +25,14 @@
1725
kind = len=128
1826
intent = in
1927
optional = F
20-
[nGases]
21-
standard_name = number_of_active_gases_used_by_RRTMGP
22-
long_name = number of gases available used by RRTMGP (Model%nGases)
23-
units = count
24-
dimensions = ()
25-
type = integer
26-
intent = in
28+
[active_gases_array]
29+
standard_name = list_of_active_gases_used_by_RRTMGP
30+
long_name = list of active gases used by RRTMGP
31+
units = none
32+
dimensions = (number_of_active_gases_used_by_RRTMGP)
33+
type = character
34+
kind = len=128
35+
intent = out
2736
optional = F
2837
[errmsg]
2938
standard_name = ccpp_error_message
@@ -374,6 +383,15 @@
374383
kind = kind_phys
375384
intent = inout
376385
optional = F
386+
[active_gases_array]
387+
standard_name = list_of_active_gases_used_by_RRTMGP
388+
long_name = list of active gases used by RRTMGP
389+
units = none
390+
dimensions = (number_of_active_gases_used_by_RRTMGP)
391+
type = character
392+
kind = len=*
393+
intent = in
394+
optional = F
377395
[gas_concentrations]
378396
standard_name = Gas_concentrations_for_RRTMGP_suite
379397
long_name = DDT containing gas concentrations for RRTMGP radiation scheme

physics/GFS_suite_interstitial.meta

+2-2
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
standard_name = cumulative_change_of_state_variables
669669
long_name = diagnostic tendencies for state variables
670670
units = various
671-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
671+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
672672
type = real
673673
kind = kind_phys
674674
intent = inout
@@ -1993,7 +1993,7 @@
19931993
standard_name = cumulative_change_of_state_variables
19941994
long_name = diagnostic tendencies for state variables
19951995
units = various
1996-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
1996+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
19971997
type = real
19981998
kind = kind_phys
19991999
intent = inout

physics/cires_ugwp.meta

+1-1
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@
879879
standard_name = cumulative_change_of_state_variables
880880
long_name = diagnostic tendencies for state variables
881881
units = various
882-
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
882+
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
883883
type = real
884884
kind = kind_phys
885885
active = (flag_for_diagnostics_3D)

0 commit comments

Comments
 (0)