Skip to content

Commit cf56256

Browse files
committed
Merge branch 'ufs/dev' into feature/rad-fix_gjf
2 parents 4e5a6e9 + 8a5f4f5 commit cf56256

166 files changed

Lines changed: 9889 additions & 6048 deletions

File tree

Some content is hidden

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

CMakeLists.txt

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.18)
22

33
project(ccpp_physics
44
VERSION 5.0.0
55
LANGUAGES Fortran)
66

77
#------------------------------------------------------------------------------
88
set(PACKAGE "ccpp-physics")
9-
set(AUTHORS "Grant Firl" "Dustin Swales" "Man Zhang" "Mike Kavulich" )
9+
set(AUTHORS "Grant Firl" "Dustin Swales" "Dom Heinzeller" "Man Zhang" "Mike Kavulich")
10+
11+
include(GNUInstallDirs)
1012

1113
#------------------------------------------------------------------------------
1214
# Set MPI flags for Fortran with MPI F08 interface
@@ -17,7 +19,7 @@ endif()
1719

1820
#------------------------------------------------------------------------------
1921
# Set OpenMP flags for C/C++/Fortran
20-
if (OPENMP)
22+
if(OPENMP)
2123
find_package(OpenMP REQUIRED)
2224
endif()
2325

@@ -51,12 +53,6 @@ else(TYPEDEFS)
5153
endif(TYPEDEFS)
5254
list(REMOVE_DUPLICATES TYPEDEFS)
5355

54-
# Generate list of Fortran modules from the CCPP type
55-
# definitions that need need to be installed
56-
foreach(typedef_module ${TYPEDEFS})
57-
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${typedef_module})
58-
endforeach()
59-
6056
#------------------------------------------------------------------------------
6157
# Set the sources: physics schemes
6258
set(SCHEMES $ENV{CCPP_SCHEMES})
@@ -137,7 +133,21 @@ endif()
137133

138134
# Assign standard floating point precision flags to all remaining schemes and caps
139135
SET_PROPERTY(SOURCE ${SCHEMES} ${CAPS}
140-
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_Fortran_FLAGS_PHYSICS} ${OpenMP_Fortran_FLAGS}")
136+
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_Fortran_FLAGS_PHYSICS}")
137+
if(OPENMP)
138+
SET_PROPERTY(SOURCE ${SCHEMES} ${CAPS}
139+
APPEND_STRING PROPERTY COMPILE_FLAGS " ${OpenMP_Fortran_FLAGS}")
140+
endif()
141+
142+
# For CAPS, remove bounds checks with Intel Classic (ifort), Intel LLVM (ifx),
143+
# and GNU (gfortran) to avoid the compilation being killed or taking forever
144+
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM")
145+
set_PROPERTY(SOURCE ${CAPS}
146+
APPEND_STRING PROPERTY COMPILE_FLAGS " -check nobounds")
147+
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
148+
set_PROPERTY(SOURCE ${CAPS}
149+
APPEND_STRING PROPERTY COMPILE_FLAGS " -fcheck=no-bounds")
150+
endif()
141151

142152
# Lower optimization for certain schemes when compiling with Intel in Release mode
143153
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM"))
@@ -171,21 +181,19 @@ endif()
171181

172182
#------------------------------------------------------------------------------
173183

184+
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR})
185+
174186
add_library(ccpp_physics STATIC ${SCHEMES} ${SCHEMES_OPENMP_OFF} ${SCHEMES_DYNAMICS} ${CAPS})
175-
# Generate list of Fortran modules from defined sources
176-
foreach(source_f90 ${CAPS})
177-
get_filename_component(tmp_source_f90 ${source_f90} NAME)
178-
string(REGEX REPLACE ".F90" ".mod" tmp_module_f90 ${tmp_source_f90})
179-
string(TOLOWER ${tmp_module_f90} module_f90)
180-
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${module_f90})
181-
endforeach()
182187

183188
set_target_properties(ccpp_physics PROPERTIES VERSION ${PROJECT_VERSION}
184189
SOVERSION ${PROJECT_VERSION_MAJOR})
185190

186191
target_include_directories(ccpp_physics PUBLIC
187-
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
192+
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}>
193+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
194+
)
188195

196+
target_link_libraries(ccpp_physics PRIVATE MPI::MPI_Fortran)
189197
target_link_libraries(ccpp_physics PUBLIC w3emc::w3emc_d
190198
sp::sp_d
191199
NetCDF::NetCDF_Fortran)
@@ -202,6 +210,5 @@ install(EXPORT ccpp_physics-targets
202210
FILE ccpp_physics-config.cmake
203211
DESTINATION lib/cmake
204212
)
205-
# Define where to install the C headers and Fortran modules
206-
#install(FILES ${HEADERS_C} DESTINATION include)
207-
install(FILES ${MODULES_F90} DESTINATION include)
213+
214+
install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

physics/CONV/C3/cu_c3_deep.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ subroutine cu_c3_deep_run( &
190190
,intent (in ) :: &
191191
tmf
192192
real(kind=kind_phys), dimension (its:,kts:) &
193-
,intent (in ), optional :: &
193+
,intent (in ), optional :: &
194194
qmicro, sigmain, forceqv_spechum
195195
real(kind=kind_phys), dimension (its:) &
196196
,intent (inout ) :: &
@@ -226,7 +226,7 @@ subroutine cu_c3_deep_run( &
226226
q,qo,zuo,zdo,zdm
227227
!$acc declare sigmaout
228228
real(kind=kind_phys), dimension (its:,kts:) &
229-
,intent (out), optional :: &
229+
,intent (out), optional :: &
230230
sigmaout
231231
real(kind=kind_phys), dimension (its:) &
232232
,intent (in ) :: &

physics/CONV/C3/cu_c3_driver_post.F90

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +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), 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(:)
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(:)
3535
! for Radar reflectivity
3636
real(kind_phys), intent(in) :: dt
3737
real(kind_phys), intent(in) :: raincv(:)
38-
real(kind_phys), intent(in), optional :: maxupmf(:)
38+
real(kind_phys), intent(in) :: maxupmf(:)
3939
real(kind_phys), intent(inout) :: refl_10cm(:,:)
4040
character(len=*), intent(out) :: errmsg
4141
!$acc declare copyin(t,q,cactiv,cactiv_m) copyout(prevst,prevsq,conv_act,conv_act_m)

physics/CONV/C3/cu_c3_driver_post.meta

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
type = real
4646
kind = kind_phys
4747
intent = out
48-
optional = True
4948
[prevsq]
5049
standard_name = specific_humidity_on_previous_timestep
5150
long_name = moisture from previous time step
@@ -54,23 +53,20 @@
5453
type = real
5554
kind = kind_phys
5655
intent = out
57-
optional = True
5856
[cactiv]
5957
standard_name = counter_for_grell_freitas_convection
6058
long_name = convective activity memory
6159
units = none
6260
dimensions = (horizontal_loop_extent)
6361
type = integer
6462
intent = in
65-
optional = True
6663
[cactiv_m]
6764
standard_name = counter_for_grell_freitas_mid_level_convection
6865
long_name = midlevel convective activity memory
6966
units = none
7067
dimensions = (horizontal_loop_extent)
7168
type = integer
7269
intent = in
73-
optional = True
7470
[conv_act]
7571
standard_name = consecutive_calls_for_grell_freitas_convection
7672
long_name = Memory counter for GF
@@ -79,7 +75,6 @@
7975
type = real
8076
kind = kind_phys
8177
intent = out
82-
optional = True
8378
[conv_act_m]
8479
standard_name = consecutive_calls_for_grell_freitas_mid_level_convection
8580
long_name = Memory counter for GF midlevel
@@ -88,7 +83,6 @@
8883
type = real
8984
kind = kind_phys
9085
intent = out
91-
optional = True
9286
[dt]
9387
standard_name = timestep_for_physics
9488
long_name = physics time step
@@ -121,7 +115,6 @@
121115
type = real
122116
kind = kind_phys
123117
intent = in
124-
optional = True
125118
[refl_10cm]
126119
standard_name = radar_reflectivity_10cm
127120
long_name = instantaneous refl_10cm

physics/CONV/C3/cu_c3_driver_pre.F90

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ subroutine cu_c3_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,
3030
real(kind_phys), intent(in) :: dtp
3131
real(kind_phys), intent(in) :: t(:,:)
3232
real(kind_phys), intent(in) :: q(:,:)
33-
real(kind_phys), intent(in), optional :: prevst(:,:)
34-
real(kind_phys), intent(in), optional :: prevsq(:,:)
33+
real(kind_phys), intent(in) :: prevst(:,:)
34+
real(kind_phys), intent(in) :: prevsq(:,:)
3535
!$acc declare copyin(t,q,prevst,prevsq)
36-
real(kind_phys), intent(out), optional :: forcet(:,:)
37-
real(kind_phys), intent(out), optional :: forceq(:,:)
38-
integer, intent(out), optional :: cactiv(:)
39-
integer, intent(out), optional :: cactiv_m(:)
36+
real(kind_phys), intent(out) :: forcet(:,:)
37+
real(kind_phys), intent(out) :: forceq(:,:)
38+
integer, intent(out) :: cactiv(:)
39+
integer, intent(out) :: cactiv_m(:)
4040
!$acc declare copyout(forcet,forceq,cactiv,cactiv_m)
41-
real(kind_phys), intent(in), optional :: conv_act(:)
42-
real(kind_phys), intent(in), optional :: conv_act_m(:)
41+
real(kind_phys), intent(in) :: conv_act(:)
42+
real(kind_phys), intent(in) :: conv_act_m(:)
4343
!$acc declare copyin(conv_act,conv_act_m)
4444
character(len=*), intent(out) :: errmsg
4545
integer, intent(out) :: errflg

physics/CONV/C3/cu_c3_driver_pre.meta

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
type = real
6969
kind = kind_phys
7070
intent = in
71-
optional = True
7271
[prevsq]
7372
standard_name = specific_humidity_on_previous_timestep
7473
long_name = moisture from previous time step
@@ -77,7 +76,6 @@
7776
type = real
7877
kind = kind_phys
7978
intent = in
80-
optional = True
8179
[forcet]
8280
standard_name = tendency_of_air_temperature_due_to_nonphysics
8381
long_name = temperature tendency due to dynamics only
@@ -86,7 +84,6 @@
8684
type = real
8785
kind = kind_phys
8886
intent = out
89-
optional = True
9087
[forceq]
9188
standard_name = tendendy_of_specific_humidity_due_to_nonphysics
9289
long_name = moisture tendency due to dynamics only
@@ -95,23 +92,20 @@
9592
type = real
9693
kind = kind_phys
9794
intent = out
98-
optional = True
9995
[cactiv]
10096
standard_name = counter_for_grell_freitas_convection
10197
long_name = convective activity memory
10298
units = none
10399
dimensions = (horizontal_loop_extent)
104100
type = integer
105101
intent = out
106-
optional = True
107102
[cactiv_m]
108103
standard_name = counter_for_grell_freitas_mid_level_convection
109104
long_name = midlevel convective activity memory
110105
units = none
111106
dimensions = (horizontal_loop_extent)
112107
type = integer
113108
intent = out
114-
optional = True
115109
[conv_act]
116110
standard_name = consecutive_calls_for_grell_freitas_convection
117111
long_name = Memory counter for GF
@@ -120,7 +114,6 @@
120114
type = real
121115
kind = kind_phys
122116
intent = in
123-
optional = True
124117
[conv_act_m]
125118
standard_name = consecutive_calls_for_grell_freitas_mid_level_convection
126119
long_name = Memory counter for GF midlevel
@@ -129,7 +122,6 @@
129122
type = real
130123
kind = kind_phys
131124
intent = in
132-
optional = True
133125
[errmsg]
134126
standard_name = ccpp_error_message
135127
long_name = error message for error handling in CCPP

physics/CONV/C3/cu_c3_sh.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ subroutine cu_c3_sh_run ( &
104104
,intent (in ) :: &
105105
tmf
106106
real(kind=kind_phys), dimension (its:,kts:) &
107-
,intent (in ), optional :: &
107+
,intent (in ), optional :: &
108108
qmicro, sigmain, forceqv_spechum
109109

110110
real(kind=kind_phys), dimension (its:) &
@@ -139,7 +139,7 @@ subroutine cu_c3_sh_run ( &
139139
dtime,tcrit,fv,r_d,betascu,betamcu,betadcu
140140
!$acc declare sigmaout
141141
real(kind=kind_phys), dimension (its:,kts:) &
142-
,intent (out), optional :: &
142+
,intent (out), optional :: &
143143
sigmaout
144144

145145

physics/CONV/Chikira_Sugiyama/cs_conv.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, &
195195
!
196196
! modified arguments
197197
!
198-
real(kind_phys), intent(inout), optional :: CBMFX(:,:) ! cloud base mass flux (kg/m2/s)
198+
real(kind_phys), intent(inout) :: CBMFX(:,:) ! cloud base mass flux (kg/m2/s)
199199
!
200200
! output arguments
201201
!
202202
! updraft, downdraft, and detrainment mass flux (kg/m2/s)
203-
real(kind_phys), intent(inout), dimension(:,:), optional :: ud_mf
203+
real(kind_phys), intent(inout), dimension(:,:) :: ud_mf
204204
real(kind_phys), intent(inout), dimension(:,:) :: dd_mf, dt_mf
205205

206206
real(kind_phys), intent(out) :: rain1(:) ! lwe thickness of deep convective precipitation amount (m)

physics/CONV/Chikira_Sugiyama/cs_conv.meta

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@
159159
type = real
160160
kind = kind_phys
161161
intent = inout
162-
optional = True
163162
[dd_mf]
164163
standard_name = instantaneous_atmosphere_downdraft_convective_mass_flux
165164
long_name = (downdraft mass flux) * delt
@@ -216,7 +215,6 @@
216215
type = real
217216
kind = kind_phys
218217
intent = inout
219-
optional = True
220218
[mype]
221219
standard_name = mpi_rank
222220
long_name = current MPI rank

physics/CONV/Grell_Freitas/cu_gf_driver.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart, gf_co
8282
integer :: ichoicem=13 ! 0 2 5 13
8383
integer :: ichoice_s=3 ! 0 1 2 3
8484
integer, intent(in) :: spp_cu_deep ! flag for using SPP perturbations
85-
real(kind_phys), dimension(:,:), intent(in),optional :: &
85+
real(kind_phys), dimension(:,:), optional, intent(in) :: &
8686
& spp_wts_cu_deep
8787
real(kind=kind_phys) :: spp_wts_cu_deep_tmp
8888

@@ -129,7 +129,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart, gf_co
129129
integer, dimension (:), intent(out) :: hbot,htop,kcnv
130130
integer, dimension (:), intent(in) :: xland
131131
real(kind=kind_phys), dimension (:), intent(in) :: pbl
132-
real(kind=kind_phys), dimension (:), intent(in), optional :: maxMF
132+
real(kind=kind_phys), dimension (:), intent(in) :: maxMF
133133
!$acc declare copyout(hbot,htop,kcnv)
134134
!$acc declare copyin(xland,pbl)
135135
integer, dimension (im) :: tropics

0 commit comments

Comments
 (0)