Skip to content

Commit 16a1d88

Browse files
authored
Merge pull request NCAR#189 from climbfuji/feature/ccpp_prebuild_opt_args
Introduce optional arguments in ccpp schemes and metadata
2 parents 89ddce7 + 7e59eba commit 16a1d88

File tree

193 files changed

+2213
-841
lines changed

Some content is hidden

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

193 files changed

+2213
-841
lines changed

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ SET_PROPERTY(SOURCE ${SCHEMES} ${CAPS}
142142
# Lower optimization for certain schemes when compiling with Intel in Release mode
143143
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
144144
# Define a list of schemes that need lower optimization with Intel in Release mode
145-
set(SCHEME_NAMES_LOWER_OPTIMIZATION module_sf_mynn.F90)
145+
set(SCHEME_NAMES_LOWER_OPTIMIZATION module_sf_mynn.F90
146+
mynnedmf_wrapper.F90
147+
gcycle.F90)
146148
foreach(SCHEME_NAME IN LISTS SCHEME_NAMES_LOWER_OPTIMIZATION)
147149
set(SCHEMES_TMP ${SCHEMES})
148150
# Need to determine the name of the scheme with its path

physics/CONV/C3/cu_c3_deep.F90

+7-4
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ subroutine cu_c3_deep_run( &
167167
real(kind=kind_phys), dimension (its:) &
168168
,intent (in ) :: rand_mom,rand_vmas
169169
!$acc declare copyin(rand_clos,rand_mom,rand_vmas)
170-
real(kind=kind_phys), intent(in), dimension (its:) :: ca_deep(:)
170+
real(kind=kind_phys), intent(in), dimension (its:), optional :: ca_deep(:)
171171
integer, intent(in) :: do_capsuppress
172172
real(kind=kind_phys), intent(in), dimension(:) :: cap_suppress_j
173173
!$acc declare create(cap_suppress_j)
@@ -188,7 +188,10 @@ subroutine cu_c3_deep_run( &
188188
frh_out,rainevap
189189
real(kind=kind_phys), dimension (its:,kts:) &
190190
,intent (in ) :: &
191-
tmf, qmicro, sigmain, forceqv_spechum
191+
tmf
192+
real(kind=kind_phys), dimension (its:,kts:) &
193+
,intent (in ), optional :: &
194+
qmicro, sigmain, forceqv_spechum
192195
real(kind=kind_phys), dimension (its:) &
193196
,intent (inout ) :: &
194197
pre,xmb_out
@@ -223,7 +226,7 @@ subroutine cu_c3_deep_run( &
223226
q,qo,zuo,zdo,zdm
224227
!$acc declare sigmaout
225228
real(kind=kind_phys), dimension (its:,kts:) &
226-
,intent (out) :: &
229+
,intent (out), optional :: &
227230
sigmaout
228231
real(kind=kind_phys), dimension (its:) &
229232
,intent (in ) :: &
@@ -376,7 +379,7 @@ subroutine cu_c3_deep_run( &
376379
!$acc ktopdby,kbconx,ierr2,ierr3,kbmax)
377380

378381
integer, dimension (its:), intent(inout) :: ierr
379-
integer, dimension (its:), intent(in) :: csum
382+
integer, dimension (its:), intent(in), optional :: csum
380383
logical, intent(in) :: do_ca, progsigma
381384
logical, intent(in) :: flag_init, flag_restart
382385
!$acc declare copy(ierr) copyin(csum)

physics/CONV/C3/cu_c3_driver.F90

+40-36
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,19 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
111111
real (kind=kind_phys), intent(in) :: g,cp,fv,r_d,xlv,r_v,betascu,betamcu,betadcu
112112
logical, intent(in ) :: ldiag3d
113113
logical, intent(in ) :: progsigma
114-
real(kind=kind_phys), intent(inout) :: dtend(:,:,:)
114+
real(kind=kind_phys), intent(inout), optional :: dtend(:,:,:)
115115
!$acc declare copy(dtend)
116116
integer, intent(in) :: dtidx(:,:), &
117117
index_of_x_wind, index_of_y_wind, index_of_temperature, &
118118
index_of_process_scnv, index_of_process_dcnv, ntqv, ntcw, ntiw
119119
!$acc declare copyin(dtidx)
120-
real(kind=kind_phys), dimension( : , : ), intent(in ) :: forcet,forceqv_spechum,w,phil,delp
121-
real(kind=kind_phys), dimension ( : , : ), intent(in ) :: sigmain,qmicro
120+
real(kind=kind_phys), dimension( : , : ), intent(in ), optional :: forcet,forceqv_spechum
121+
real(kind=kind_phys), dimension( : , : ), intent(in ) :: w,phil,delp
122+
real(kind=kind_phys), dimension ( : , : ), intent(in ), optional :: sigmain,qmicro
122123
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: t,us,vs
123-
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: qci_conv
124+
real(kind=kind_phys), dimension( : , : ), intent(inout ), optional :: qci_conv
124125
real(kind=kind_phys), dimension( : , : ), intent(out ) :: cnvw_moist,cnvc
125-
real(kind=kind_phys), dimension ( : , : ), intent(out ) :: sigmaout
126+
real(kind=kind_phys), dimension ( : , : ), intent(out ), optional :: sigmaout
126127
real(kind=kind_phys), dimension( : , : ), intent(inout ) :: cliw, clcw
127128
real(kind=kind_phys), dimension ( : , : , :), intent(in ) :: tmf
128129
!$acc declare copyin(forcet,forceqv_spechum,w,phil)
@@ -134,27 +135,31 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
134135
integer, intent(in) :: dfi_radar_max_intervals
135136
real(kind=kind_phys), intent(in) :: fhour, fh_dfi_radar(:)
136137
integer, intent(in) :: num_dfi_radar, ix_dfi_radar(:)
137-
real(kind=kind_phys), intent(in) :: cap_suppress(:,:)
138+
real(kind=kind_phys), intent(in), optional :: cap_suppress(:,:)
138139
!$acc declare copyin(fh_dfi_radar,ix_dfi_radar,cap_suppress)
139140

140141
integer, dimension (:), intent(out) :: hbot,htop,kcnv
141142
integer, dimension (:), intent(in) :: xland
142-
real(kind=kind_phys), dimension (:), intent(in) :: pbl,maxMF
143+
real(kind=kind_phys), dimension (:), intent(in) :: pbl
144+
real(kind=kind_phys), dimension (:), intent(in), optional :: maxMF
143145
!$acc declare copyout(hbot,htop,kcnv)
144146
!$acc declare copyin(xland,pbl)
145147
integer, dimension (im) :: tropics
146148
!$acc declare create(tropics)
147149
! ruc variable
148-
real(kind=kind_phys), dimension (:), intent(in) :: hfx2,qfx2,psuri,ca_deep
149-
real(kind=kind_phys), dimension (:,:), intent(out) :: ud_mf,dd_mf,dt_mf
150-
real(kind=kind_phys), dimension (:), intent(out) :: raincv,cld1d,maxupmf,rainevap
150+
real(kind=kind_phys), dimension (:), intent(in) :: hfx2,qfx2,psuri
151+
real(kind=kind_phys), dimension (:), intent(in), optional :: ca_deep
152+
real(kind=kind_phys), dimension (:,:), intent(out), optional :: ud_mf
153+
real(kind=kind_phys), dimension (:,:), intent(out) :: dd_mf,dt_mf
154+
real(kind=kind_phys), dimension (:), intent(out) :: raincv,cld1d,rainevap
155+
real(kind=kind_phys), dimension (:), intent(out), optional :: maxupmf
151156
real(kind=kind_phys), dimension (:,:), intent(in) :: t2di,p2di
152157
!$acc declare copyin(hfx2,qfx2,psuri,t2di,p2di)
153158
!$acc declare copyout(ud_mf,dd_mf,dt_mf,raincv,cld1d)
154159
! Specific humidity from FV3
155160
real(kind=kind_phys), dimension (:,:), intent(in) :: qv2di_spechum
156161
real(kind=kind_phys), dimension (:,:), intent(inout) :: qv_spechum
157-
real(kind=kind_phys), dimension (:), intent(inout) :: aod_gf
162+
real(kind=kind_phys), dimension (:), intent(inout), optional :: aod_gf
158163
!$acc declare copyin(qv2di_spechum) copy(qv_spechum,aod_gf)
159164
! Local water vapor mixing ratios and cloud water mixing ratios
160165
real(kind=kind_phys), dimension (im,km) :: qv2di, qv, forceqv, cnvw
@@ -165,7 +170,7 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
165170
real(kind=kind_phys), intent(in ) :: dt
166171

167172
integer, intent(in ) :: imfshalcnv
168-
integer, dimension(:), intent(inout) :: cactiv,cactiv_m
173+
integer, dimension(:), intent(inout), optional :: cactiv,cactiv_m
169174
!$acc declare copy(cactiv,cactiv_m)
170175

171176
character(len=*), intent(out) :: errmsg
@@ -841,30 +846,29 @@ subroutine cu_c3_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
841846
,ca_deep &
842847
,mconv &
843848
,omeg &
844-
845-
,cactiv &
846-
,cnvwt &
847-
,zu &
848-
,zd &
849-
,zdm & ! hli
850-
,edt &
851-
,edtm & ! hli
852-
,xmb &
853-
,xmbm &
854-
,xmbs &
855-
,pret &
856-
,outu &
857-
,outv &
858-
,outt &
859-
,outq &
860-
,outqc &
861-
,kbcon &
862-
,ktop &
863-
,cupclw &
864-
,frhd &
865-
,rainevap &
866-
,ierr &
867-
,ierrc &
849+
,cactiv &
850+
,cnvwt &
851+
,zu &
852+
,zd &
853+
,zdm & ! hli
854+
,edt &
855+
,edtm & ! hli
856+
,xmb &
857+
,xmbm &
858+
,xmbs &
859+
,pret &
860+
,outu &
861+
,outv &
862+
,outt &
863+
,outq &
864+
,outqc &
865+
,kbcon &
866+
,ktop &
867+
,cupclw &
868+
,frhd &
869+
,rainevap &
870+
,ierr &
871+
,ierrc &
868872
! the following should be set to zero if not available
869873
,rand_mom & ! for stochastics mom, if temporal and spatial patterns exist
870874
,rand_vmas & ! for stochastics vertmass, if temporal and spatial patterns exist

physics/CONV/C3/cu_c3_driver.meta

+15
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,15 @@
156156
dimensions = (horizontal_loop_extent)
157157
type = integer
158158
intent = inout
159+
optional = True
159160
[cactiv_m]
160161
standard_name = counter_for_grell_freitas_mid_level_convection
161162
long_name = mid-level cloud convective activity memory
162163
units = none
163164
dimensions = (horizontal_loop_extent)
164165
type = integer
165166
intent = inout
167+
optional = True
166168
[g]
167169
standard_name = gravitational_acceleration
168170
long_name = gravitational acceleration
@@ -219,6 +221,7 @@
219221
type = real
220222
kind = kind_phys
221223
intent = in
224+
optional = True
222225
[forceqv_spechum]
223226
standard_name = tendendy_of_specific_humidity_due_to_nonphysics
224227
long_name = moisture tendency due to dynamics only
@@ -227,6 +230,7 @@
227230
type = real
228231
kind = kind_phys
229232
intent = in
233+
optional = True
230234
[tmf]
231235
standard_name = tendency_of_vertically_diffused_tracer_concentration
232236
long_name = updated tendency of the tracers due to vertical diffusion in PBL scheme
@@ -243,6 +247,7 @@
243247
type = real
244248
kind = kind_phys
245249
intent = in
250+
optional = True
246251
[sigmain]
247252
standard_name = prognostic_updraft_area_fraction_in_convection
248253
long_name = convective updraft area fraction
@@ -251,6 +256,7 @@
251256
type = real
252257
kind = kind_phys
253258
intent = in
259+
optional = True
254260
[sigmaout]
255261
standard_name = updraft_area_fraction_updated_by_physics
256262
long_name = convective updraft area fraction updated by physics
@@ -259,6 +265,7 @@
259265
type = real
260266
kind = kind_phys
261267
intent = out
268+
optional = True
262269
[betascu]
263270
standard_name = tuning_param_for_shallow_cu
264271
long_name = tuning param for shallow cu in case prognostic closure is used
@@ -438,6 +445,7 @@
438445
type = real
439446
kind = kind_phys
440447
intent = inout
448+
optional = True
441449
[cliw]
442450
standard_name = ice_water_mixing_ratio_convective_transport_tracer
443451
long_name = ratio of mass of ice water to mass of dry air plus vapor (without condensates) in the convectively transported tracer array
@@ -470,6 +478,7 @@
470478
type = real
471479
kind = kind_phys
472480
intent = out
481+
optional = True
473482
[dd_mf]
474483
standard_name = instantaneous_atmosphere_downdraft_convective_mass_flux
475484
long_name = (downdraft mass flux) * delt
@@ -531,6 +540,7 @@
531540
type = real
532541
kind = kind_phys
533542
intent = inout
543+
optional = True
534544
[dtidx]
535545
standard_name = cumulative_change_of_state_variables_outer_index
536546
long_name = index of state-variable and process in last dimension of diagnostic tendencies array AKA cumulative_change_index
@@ -616,6 +626,7 @@
616626
type = real
617627
kind = kind_phys
618628
intent = inout
629+
optional = True
619630
[fhour]
620631
standard_name = forecast_time
621632
long_name = current forecast time
@@ -661,6 +672,7 @@
661672
type = real
662673
kind = kind_phys
663674
intent = in
675+
optional = True
664676
[ca_deep]
665677
standard_name = cellular_automata_area_fraction_for_deep_convection_from_coupled_process
666678
long_name = fraction of cellular automata for deep convection
@@ -669,6 +681,7 @@
669681
type = real
670682
kind = kind_phys
671683
intent = in
684+
optional = True
672685
[rainevap]
673686
standard_name = physics_field_for_coupling
674687
long_name = physics_field_for_coupling
@@ -685,6 +698,7 @@
685698
type = real
686699
kind = kind_phys
687700
intent = out
701+
optional = True
688702
[maxMF]
689703
standard_name = maximum_mass_flux
690704
long_name = maximum mass flux within a column
@@ -693,6 +707,7 @@
693707
type = real
694708
kind = kind_phys
695709
intent = in
710+
optional = True
696711
[do_mynnedmf]
697712
standard_name = flag_for_mellor_yamada_nakanishi_niino_pbl_scheme
698713
long_name = flag to activate MYNN-EDMF

physics/CONV/C3/cu_c3_driver_post.F90

+8-7
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ subroutine cu_c3_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
2626
real(kind_phys), intent(in) :: t(:,:)
2727
real(kind_phys), intent(in) :: q(:,:)
2828
real(kind_phys), dimension(:),intent(in) :: garea
29-
real(kind_phys), intent(out) :: prevst(:,:)
30-
real(kind_phys), intent(out) :: prevsq(:,:)
31-
integer, intent(in) :: cactiv(:)
32-
integer, intent(in) :: cactiv_m(:)
33-
real(kind_phys), intent(out) :: conv_act(:)
34-
real(kind_phys), intent(out) :: conv_act_m(:)
29+
real(kind_phys), intent(out), optional :: prevst(:,:)
30+
real(kind_phys), intent(out), optional :: prevsq(:,:)
31+
integer, intent(in), optional :: cactiv(:)
32+
integer, intent(in), optional :: cactiv_m(:)
33+
real(kind_phys), intent(out), optional :: conv_act(:)
34+
real(kind_phys), intent(out), optional :: conv_act_m(:)
3535
! for Radar reflectivity
3636
real(kind_phys), intent(in) :: dt
37-
real(kind_phys), intent(in) :: raincv(:), maxupmf(:)
37+
real(kind_phys), intent(in) :: raincv(:)
38+
real(kind_phys), intent(in), optional :: maxupmf(:)
3839
real(kind_phys), intent(inout) :: refl_10cm(:,:)
3940
character(len=*), intent(out) :: errmsg
4041
!$acc declare copyin(t,q,cactiv,cactiv_m) copyout(prevst,prevsq,conv_act,conv_act_m)

physics/CONV/C3/cu_c3_driver_post.meta

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
type = real
4646
kind = kind_phys
4747
intent = out
48+
optional = True
4849
[prevsq]
4950
standard_name = specific_humidity_on_previous_timestep
5051
long_name = moisture from previous time step
@@ -53,20 +54,23 @@
5354
type = real
5455
kind = kind_phys
5556
intent = out
57+
optional = True
5658
[cactiv]
5759
standard_name = counter_for_grell_freitas_convection
5860
long_name = convective activity memory
5961
units = none
6062
dimensions = (horizontal_loop_extent)
6163
type = integer
6264
intent = in
65+
optional = True
6366
[cactiv_m]
6467
standard_name = counter_for_grell_freitas_mid_level_convection
6568
long_name = midlevel convective activity memory
6669
units = none
6770
dimensions = (horizontal_loop_extent)
6871
type = integer
6972
intent = in
73+
optional = True
7074
[conv_act]
7175
standard_name = consecutive_calls_for_grell_freitas_convection
7276
long_name = Memory counter for GF
@@ -75,6 +79,7 @@
7579
type = real
7680
kind = kind_phys
7781
intent = out
82+
optional = True
7883
[conv_act_m]
7984
standard_name = consecutive_calls_for_grell_freitas_mid_level_convection
8085
long_name = Memory counter for GF midlevel
@@ -83,6 +88,7 @@
8388
type = real
8489
kind = kind_phys
8590
intent = out
91+
optional = True
8692
[dt]
8793
standard_name = timestep_for_physics
8894
long_name = physics time step
@@ -115,6 +121,7 @@
115121
type = real
116122
kind = kind_phys
117123
intent = in
124+
optional = True
118125
[refl_10cm]
119126
standard_name = radar_reflectivity_10cm
120127
long_name = instantaneous refl_10cm

0 commit comments

Comments
 (0)