Skip to content

Commit

Permalink
Add dependencies to CCPP metadata (#153)
Browse files Browse the repository at this point in the history
This PR removes dependency information from the CCPP prebuild config. See NCAR/ccpp-framework#308 and NCAR/ccpp-framework#317 for details on the motivation for this change and the actual implementation. It also removes some legacy code used by the dynamic CCPP build in the past.

This PR also contains the changes in #156, i.e. the completion of adding the active attribute to GFS_typedefs.F90. On top of this PR, the missing active attribute for phy_fctd is added.

Additionally, gfortran-10 compiler flags are added to CCPP's CMakeLists.txt.
  • Loading branch information
climbfuji authored Sep 2, 2020
1 parent 53fadef commit 223f092
Show file tree
Hide file tree
Showing 8 changed files with 416 additions and 177 deletions.
7 changes: 4 additions & 3 deletions ccpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ set (CMAKE_Fortran_FLAGS_OPT "")
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -ffree-line-length-none -fno-range-check")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbacktrace -cpp")
if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
endif()
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffpe-trap=invalid,zero,overflow -fcheck=bounds -fbacktrace -fno-range-check -Wall")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffpe-trap=invalid,zero,overflow -fcheck=bounds -fbacktrace -fno-range-check")
elseif (${CMAKE_BUILD_TYPE} MATCHES "Bitforbit")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
endif (${CMAKE_BUILD_TYPE} MATCHES "Debug")
Expand Down
190 changes: 21 additions & 169 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

# Add all files with metadata tables on the host model side and in CCPP,
# relative to basedir = top-level directory of host model. This includes
# kind and type definitions used in CCPP physics.
# kind and type definitions used in CCPP physics. Also add any internal
# dependencies of these files to the list.
VARIABLE_DEFINITION_FILES = [
# actual variable definition files
'FV3/ccpp/physics/physics/machine.F',
'FV3/ccpp/physics/physics/radsw_param.f',
'FV3/ccpp/physics/physics/radlw_param.f',
Expand Down Expand Up @@ -85,128 +87,6 @@
},
}

# Add all physics scheme dependencies relative to basedir - note that the CCPP
# rules stipulate that dependencies are not shared between the schemes!
SCHEME_FILES_DEPENDENCIES = [
'FV3/ccpp/physics/physics/GFDL_parse_tracers.F90',
'FV3/ccpp/physics/physics/aer_cloud.F',
'FV3/ccpp/physics/physics/aerclm_def.F',
'FV3/ccpp/physics/physics/aerinterp.F90',
'FV3/ccpp/physics/physics/calpreciptype.f90',
'FV3/ccpp/physics/physics/cldwat2m_micro.F',
'FV3/ccpp/physics/physics/cldmacro.F',
'FV3/ccpp/physics/physics/date_def.f',
'FV3/ccpp/physics/physics/funcphys.f90',
'FV3/ccpp/physics/physics/gcycle.F90',
'FV3/ccpp/physics/physics/gfs_phy_tracer_config.F',
'FV3/ccpp/physics/physics/gocart_tracer_config_stub.f',
'FV3/ccpp/physics/physics/h2o_def.f',
'FV3/ccpp/physics/physics/h2ointerp.f90',
'FV3/ccpp/physics/physics/iccn_def.F',
'FV3/ccpp/physics/physics/iccninterp.F90',
'FV3/ccpp/physics/physics/iounitdef.f',
'FV3/ccpp/physics/physics/machine.F',
'FV3/ccpp/physics/physics/mersenne_twister.f',
'FV3/ccpp/physics/physics/mfpbl.f',
'FV3/ccpp/physics/physics/micro_mg_utils.F90',
'FV3/ccpp/physics/physics/micro_mg2_0.F90',
'FV3/ccpp/physics/physics/micro_mg3_0.F90',
'FV3/ccpp/physics/physics/module_bfmicrophysics.f',
'FV3/ccpp/physics/physics/multi_gases.F90',
'FV3/ccpp/physics/physics/module_gfdl_cloud_microphys.F90',
'FV3/ccpp/physics/physics/module_nst_model.f90',
'FV3/ccpp/physics/physics/module_nst_parameters.f90',
'FV3/ccpp/physics/physics/module_nst_water_prop.f90',
'FV3/ccpp/physics/physics/module_mp_radar.F90',
'FV3/ccpp/physics/physics/module_mp_thompson.F90',
'FV3/ccpp/physics/physics/module_mp_thompson_make_number_concentrations.F90',
'FV3/ccpp/physics/physics/module_MP_FER_HIRES.F90',
'FV3/ccpp/physics/physics/module_bl_mynn.F90',
'FV3/ccpp/physics/physics/module_sf_mynn.F90',
'FV3/ccpp/physics/physics/module_SF_JSFC.F90',
'FV3/ccpp/physics/physics/module_BL_MYJPBL.F90',
'FV3/ccpp/physics/physics/module_sf_noahmp_glacier.f90',
'FV3/ccpp/physics/physics/module_sf_noahmplsm.f90',
'FV3/ccpp/physics/physics/cires_ugwp_module.F90',
'FV3/ccpp/physics/physics/ugwp_driver_v0.F',
'FV3/ccpp/physics/physics/cires_ugwp_triggers.F90',
'FV3/ccpp/physics/physics/cires_ugwp_initialize.F90',
'FV3/ccpp/physics/physics/cires_ugwp_solvers.F90',
'FV3/ccpp/physics/physics/cires_ugwp_utils.F90',
'FV3/ccpp/physics/physics/cires_orowam2017.f',
'FV3/ccpp/physics/physics/cires_vert_lsatdis.F90',
'FV3/ccpp/physics/physics/cires_vert_orodis.F90',
'FV3/ccpp/physics/physics/cires_vert_wmsdis.F90',
'FV3/ccpp/physics/physics/namelist_soilveg.f',
'FV3/ccpp/physics/physics/mfpblt.f',
'FV3/ccpp/physics/physics/mfpbltq.f',
'FV3/ccpp/physics/physics/mfscu.f',
'FV3/ccpp/physics/physics/mfscuq.f',
'FV3/ccpp/physics/physics/noahmp_tables.f90',
'FV3/ccpp/physics/physics/num_parthds.F',
'FV3/ccpp/physics/physics/ozne_def.f',
'FV3/ccpp/physics/physics/ozinterp.f90',
'FV3/ccpp/physics/physics/physcons.F90',
'FV3/ccpp/physics/physics/physparam.f',
'FV3/ccpp/physics/physics/radcons.f90',
'FV3/ccpp/physics/physics/radiation_aerosols.f',
'FV3/ccpp/physics/physics/radiation_astronomy.f',
'FV3/ccpp/physics/physics/radiation_clouds.f',
'FV3/ccpp/physics/physics/radiation_gases.f',
'FV3/ccpp/physics/physics/radiation_surface.f',
'FV3/ccpp/physics/physics/radlw_datatb.f',
'FV3/ccpp/physics/physics/radlw_param.f',
'FV3/ccpp/physics/physics/radsw_datatb.f',
'FV3/ccpp/physics/physics/radsw_param.f',
'FV3/ccpp/physics/physics/samfaerosols.F',
'FV3/ccpp/physics/physics/sfcsub.F',
'FV3/ccpp/physics/physics/sflx.f',
'FV3/ccpp/physics/physics/set_soilveg.f',
'FV3/ccpp/physics/physics/flake.F90',
'FV3/ccpp/physics/physics/surface_perturbation.F90',
'FV3/ccpp/physics/physics/cu_gf_deep.F90',
'FV3/ccpp/physics/physics/cu_gf_sh.F90',
'FV3/ccpp/physics/physics/tridi.f',
'FV3/ccpp/physics/physics/wv_saturation.F',
'FV3/ccpp/physics/physics/module_sf_ruclsm.F90',
'FV3/ccpp/physics/physics/namelist_soilveg_ruc.F90',
'FV3/ccpp/physics/physics/set_soilveg_ruc.F90',
'FV3/ccpp/physics/physics/module_soil_pre.F90',
# RRTMGP
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_gas_optics.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_constants.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_util_reorder.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_util_string.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/kernels/mo_gas_optics_kernels.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/kernels/mo_rrtmgp_util_reorder_kernels.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_fluxes.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_rte_util_array.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_optical_props.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_rte_kind.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_rte_lw.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_rte_sw.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_rte_config.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_source_functions.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/kernels/mo_fluxes_broadband_kernels.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/kernels/mo_optical_props_kernels.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/kernels/mo_rte_solver_kernels.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/mo_compute_bc.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/mo_fluxes_byband.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/mo_fluxes_byband_kernels.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/mo_fluxes_bygpoint.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/mo_heating_rates.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/mo_rrtmgp_clr_all_sky.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/cloud_optics/mo_cloud_optics.F90',
'FV3/ccpp/physics/physics/rrtmg_lw_cloud_optics.F90' ,
'FV3/ccpp/physics/physics/rrtmg_sw_cloud_optics.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_aux.F90' ,
# derived data type definitions
'FV3/gfsphysics/GFS_layer/GFS_typedefs.F90',
'FV3/gfsphysics/CCPP_layer/CCPP_typedefs.F90',
]

# Add all physics scheme files relative to basedir
SCHEME_FILES = [
# Relative path to source (from where ccpp_prebuild.py is called) : [ list of physics sets in which scheme may be called ];
Expand Down Expand Up @@ -300,25 +180,24 @@
# HAFSFER_HIRES
'FV3/ccpp/physics/physics/mp_fer_hires.F90',
# RRTMGP
'FV3/ccpp/physics/physics/rrtmgp_lw_gas_optics.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_lw_cloud_optics.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_sw_gas_optics.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_sw_cloud_optics.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_sw_aerosol_optics.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_lw_rte.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_sw_rte.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_lw_aerosol_optics.F90' ,
'FV3/ccpp/physics/physics/GFS_rrtmgp_setup.F90' ,
'FV3/ccpp/physics/physics/GFS_rrtmgp_pre.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_lw_pre.F90' ,
'FV3/ccpp/physics/physics/GFS_rrtmgp_sw_pre.F90' ,
'FV3/ccpp/physics/physics/GFS_rrtmgp_lw_post.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_lw_cloud_sampling.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_sw_cloud_sampling.F90' ,
'FV3/ccpp/physics/physics/GFS_cloud_diagnostics.F90' ,
'FV3/ccpp/physics/physics/mo_cloud_sampling.F90' ,
'FV3/ccpp/physics/physics/GFS_rrtmgp_gfdlmp_pre.F90' ,
'FV3/ccpp/physics/physics/GFS_rrtmgp_zhaocarr_pre.F90' ,
'FV3/ccpp/physics/physics/rrtmgp_lw_gas_optics.F90',
'FV3/ccpp/physics/physics/rrtmgp_lw_cloud_optics.F90',
'FV3/ccpp/physics/physics/rrtmgp_sw_gas_optics.F90',
'FV3/ccpp/physics/physics/rrtmgp_sw_cloud_optics.F90',
'FV3/ccpp/physics/physics/rrtmgp_sw_aerosol_optics.F90',
'FV3/ccpp/physics/physics/rrtmgp_lw_rte.F90',
'FV3/ccpp/physics/physics/rrtmgp_sw_rte.F90',
'FV3/ccpp/physics/physics/rrtmgp_lw_aerosol_optics.F90',
'FV3/ccpp/physics/physics/GFS_rrtmgp_setup.F90',
'FV3/ccpp/physics/physics/GFS_rrtmgp_pre.F90',
'FV3/ccpp/physics/physics/rrtmgp_lw_pre.F90',
'FV3/ccpp/physics/physics/GFS_rrtmgp_sw_pre.F90',
'FV3/ccpp/physics/physics/GFS_rrtmgp_lw_post.F90',
'FV3/ccpp/physics/physics/rrtmgp_lw_cloud_sampling.F90',
'FV3/ccpp/physics/physics/rrtmgp_sw_cloud_sampling.F90',
'FV3/ccpp/physics/physics/GFS_cloud_diagnostics.F90',
'FV3/ccpp/physics/physics/GFS_rrtmgp_gfdlmp_pre.F90',
'FV3/ccpp/physics/physics/GFS_rrtmgp_zhaocarr_pre.F90',
'FV3/ccpp/physics/physics/GFS_rrtmgp_sw_post.F90'
]

Expand All @@ -336,13 +215,6 @@
SCHEMES_CMAKEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.cmake'
SCHEMES_SOURCEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.sh'

# CCPP host cap in which to insert the ccpp_field_add statements;
# determines the directory to place ccpp_{modules,fields}.inc
TARGET_FILES = [
'FV3/atmos_cubed_sphere/driver/fvGFS/atmosphere.F90',
'FV3/ccpp/driver/CCPP_Driver.F90',
]

# Auto-generated makefile/cmakefile snippets that contain all caps
CAPS_MAKEFILE = '{build_dir}/ccpp/physics/CCPP_CAPS.mk'
CAPS_CMAKEFILE = '{build_dir}/ccpp/physics/CCPP_CAPS.cmake'
Expand Down Expand Up @@ -453,12 +325,6 @@
#'subroutine_name_2' : [ 'var1', 'var3'],
}

# Names of Fortran include files in the host model cap (do not change);
# both files will be written to the directory of each target file, only
# used by the dynamic builds
MODULE_INCLUDE_FILE = 'ccpp_modules_{set}.inc'
FIELDS_INCLUDE_FILE = 'ccpp_fields_{set}.inc'

# Directory where to write static API to
STATIC_API_DIR = '{build_dir}/ccpp/physics'
STATIC_API_SRCFILE = '{build_dir}/ccpp/physics/CCPP_STATIC_API.sh'
Expand All @@ -471,17 +337,3 @@

# LaTeX document containing the provided vs requested CCPP variables
LATEX_VARTABLE_FILE = '{build_dir}/ccpp/framework/doc/DevelopersGuide/CCPP_VARIABLES_FV3.tex'


###############################################################################
# Template code to generate include files #
###############################################################################

# Name of the CCPP data structure in the host model cap;
# in the case of FV3, this is a 2-dimensional array with
# the number of blocks as the first and the number of
# OpenMP threads as the second dimension; nb is the loop
# index for the current block, nt for the current thread.
# Internally, the model uses an associate construct to
# reference cdata(nb,nt) with cdata (recommended).
CCPP_DATA_STRUCTURE = 'cdata'
2 changes: 1 addition & 1 deletion ccpp/physics
Submodule physics updated 128 files
5 changes: 5 additions & 0 deletions gfsphysics/CCPP_layer/CCPP_data.meta
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[ccpp-table-properties]
name = CCPP_data
type = module
dependencies = ../../ccpp/framework/src/ccpp_types.F90,CCPP_typedefs.F90,../GFS_layer/GFS_typedefs.F90

[ccpp-arg-table]
name = CCPP_data
type = module
Expand Down
10 changes: 10 additions & 0 deletions gfsphysics/CCPP_layer/CCPP_typedefs.meta
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[ccpp-table-properties]
name = CCPP_interstitial_type
type = ddt
dependencies =

[ccpp-arg-table]
name = CCPP_interstitial_type
type = ddt
Expand Down Expand Up @@ -334,6 +339,11 @@
type = integer

########################################################################
[ccpp-table-properties]
name = CCPP_typedefs
type = module
dependencies = ../../ccpp/physics/physics/machine.F

[ccpp-arg-table]
name = CCPP_typedefs
type = module
Expand Down
3 changes: 3 additions & 0 deletions gfsphysics/GFS_layer/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7101,6 +7101,9 @@ subroutine interstitial_phys_reset (Interstitial, Model)
!
end subroutine interstitial_phys_reset

! DH* 20200901: this routine is no longer used by CCPP's GFS_debug.F90. When new variables are
! added to the GFS_interstitial_type, it is best to add the variable to both interstitial_print
! below and to GFS_interstitialtoscreen in ccpp/physics/physics/GFS_debug.F90
subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno)
!
implicit none
Expand Down
Loading

0 comments on commit 223f092

Please sign in to comment.