Skip to content

Commit

Permalink
Merge branch 'develop' into support/HAFS
Browse files Browse the repository at this point in the history
  • Loading branch information
BinLiu-NOAA committed May 1, 2020
2 parents 23c49d0 + bc9aa3b commit 4afd8a4
Show file tree
Hide file tree
Showing 53 changed files with 3,330 additions and 3,113 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ endif()

if(CCPP)
add_definitions(-DCCPP)
if(STATIC)
add_definitions(-DSTATIC)
endif()
endif()

add_subdirectory(cpl)
Expand Down Expand Up @@ -113,6 +110,7 @@ add_library(

if(CCPP)
target_include_directories(fv3cap PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver/mod)
add_dependencies(fv3cap ccppdriver ccppphys)
endif()
target_include_directories(fv3cap PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/stochastic_physics)
target_compile_definitions(fv3cap PRIVATE -DESMF_VERSION_MAJOR=${ESMF_VERSION_MAJOR})
Expand Down
4 changes: 2 additions & 2 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ subroutine setup_exportdata (rc)

if (IPD_Control%cplflx) then
! MEAN Zonal compt of momentum flux (N/m**2)
idx = queryfieldlist(exportFieldsList,'mean_zonal_moment_flx')
idx = queryfieldlist(exportFieldsList,'mean_zonal_moment_flx_atm')
if (idx > 0 ) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
Expand All @@ -2057,7 +2057,7 @@ subroutine setup_exportdata (rc)
endif

! MEAN Merid compt of momentum flux (N/m**2)
idx = queryfieldlist(exportFieldsList,'mean_merid_moment_flx')
idx = queryfieldlist(exportFieldsList,'mean_merid_moment_flx_atm')
if (idx > 0 ) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
Expand Down
26 changes: 3 additions & 23 deletions ccpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.0)

# Use rpaths on MacOSX
set(CMAKE_MACOSX_RPATH 1)

if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif(POLICY CMP0048)

if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)

PROJECT(CCPP-FV3)
project(CCPP-FV3
LANGUAGES C CXX Fortran)
set(PROJECT "CCPP-FV3")

ENABLE_LANGUAGE(Fortran)

include(CMakeForceCompiler)

#------------------------------------------------------------------------------
Expand Down Expand Up @@ -177,27 +171,13 @@ if (MPI)
ADD_DEFINITIONS(-DMPI)
endif (MPI)

#------------------------------------------------------------------------------
# Set flags for static building/linking of CCPP
if (STATIC)
ADD_DEFINITIONS(-DSTATIC)
endif (STATIC)

#------------------------------------------------------------------------------
# Set flag for 32bit dynamics build
if (DYN32)
message(STATUS "Dynamics compiled with 32-bit option, adjust fv_sat_adj types")
ADD_DEFINITIONS(-DOVERLOAD_R4)
endif (DYN32)

#------------------------------------------------------------------------------
# If a dynamic build is requested, set TARGET_SUPPORTS_SHARED_LIBS to TRUE; on
# some systems, cmake doesn't set this even though the system supports shared
# libraries (e.g. Cray systems)
if(NOT STATIC)
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
endif(NOT STATIC)

#------------------------------------------------------------------------------
# Add model-specific flags for C/C++/Fortran preprocessor
ADD_DEFINITIONS(-DMOIST_CAPPA -DUSE_COND -DNEMS_GSM)
Expand Down
60 changes: 9 additions & 51 deletions ccpp/build_ccpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu

# List of valid/tested machines
VALID_MACHINES=( wcoss_cray wcoss_dell_p3 gaea.intel jet.intel \
hera.intel hera.gnu \
hera.intel hera.gnu orion.intel \
cheyenne.intel cheyenne.intel-impi cheyenne.gnu cheyenne.pgi endeavor.intel \
stampede.intel supermuc_phase2.intel macosx.gnu \
linux.intel linux.gnu linux.pgi )
Expand All @@ -25,11 +25,9 @@ function usage {
echo " REPRO=Y/N (default N)"
echo " OPENMP=Y/N (default Y)"
echo " 32BIT=Y/N (default N, affects dynamics/fast physics only)"
echo " STATIC=Y/N (default N, STATIC=Y requires SUITES=...)"
echo " SUITES=ABC,XYZ (comma-separated list of CCPP suites; "
echo " corresponding filenames: suite_ABC.xml. ...)"
echo " MULTI_GASES=Y/N (default N)"
echo " INTEL16=Y/N (default N)"
echo " clean_before [optional] can be 'YES' (default) or 'NO'"
echo " clean_after [optional] can be 'YES' (default) or 'NO'"
exit 1
Expand Down Expand Up @@ -125,31 +123,14 @@ if [[ "${MAKE_OPT}" == *"32BIT=Y"* ]]; then
else
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DDYN32=OFF"
fi
if [[ "${MAKE_OPT}" == *"STATIC=Y"* ]]; then
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DSTATIC=ON"
else
# hera.gnu uses the NCEPLIBS-external/NCEPLIBS umbrella build libraries,
# which cannot be linked dynamically at this point (missing -fPIC flag)
if [[ "${MACHINE_ID}" == "hera.gnu" ]]; then
echo "Dynamic CCPP build not supported on hera.gnu at this time."
exit 1
fi
# Dynamic builds require linking the NCEPlibs, provide path to them
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DSTATIC=OFF -DBACIO_LIB4=${BACIO_LIB4} -DSP_LIBd=${SP_LIBd} -DW3NCO_LIBd=${W3NCO_LIBd}"
fi
if [[ "${MAKE_OPT}" == *"MULTI_GASES=Y"* ]]; then
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DMULTI_GASES=ON"
else
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DMULTI_GASES=OFF"
fi
if [[ "${MAKE_OPT}" == *"INTEL16=Y"* ]]; then
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=ON"
elif [[ "${MACHINE_ID}" == "wcoss_cray" ]]; then
echo "In ccpp_build.sh: flag to cmake that wcoss_cray uses Intel 16"
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=ON"
else
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=OFF"
fi

# Flag to cmake that modern Intel compilers are used
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLEGACY_INTEL=OFF"

# Generate additional CCPP cmake flags depending on machine / compiler
if [[ "${MACHINE_ID}" == "macosx.gnu" ]]; then
Expand All @@ -170,20 +151,6 @@ elif [[ "${MACHINE_ID}" == "gaea.intel" || "${MACHINE_ID}" == "wcoss_cray" ]]; t
if [[ "${MACHINE_ID}" == "gaea.intel" ]]; then
CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DLIBXML2_LIB_DIR=${LIBXML2_LIB_DIR} -DLIBXML2_INCLUDE_DIR=${LIBXML2_INCLUDE_DIR}"
fi
# DH* At this time, it is not possible to use the dynamic CCPP
# build on gaea/wcoss_cray. While compiling/linking works, the model
# crashes immediately. This may be related to 64bit/32bit mismatches
# in the MPI libraries (missing "-fPIC" flags when the MPI libraries
# were compiled on the system?) - to be investigated.
if [[ "${MAKE_OPT}" == *"STATIC=Y"* ]]; then
:
else
## FOR DYNAMIC BUILD, SET ENVIRONMENT VARIABLE CRAYPE_LINK_TYPE
#export CRAYPE_LINK_TYPE=dynamic
echo "Dynamic CCPP build not supported on gaea/wcoss_cray at this time."
exit 1
fi
# *DH
fi

CCPP_CMAKE_FLAGS=$(trim "${CCPP_CMAKE_FLAGS}")
Expand Down Expand Up @@ -211,21 +178,12 @@ make ${CCPP_MAKE_FLAGS} install

# Generate ESMF makefile fragment

# Explicitly append libxml2, with or without path
CCPP_XML2_LIB="${LIBXML2_LIB_DIR:+-L${LIBXML2_LIB_DIR} }-lxml2"
set -u
if ( echo "${MAKE_OPT}" | grep STATIC=Y ) ; then
# Set linker flags for static build
CCPP_LINK_OBJS="-L${PATH_CCPP_LIB} -lccpp -lccppphys ${CCPP_XML2_LIB}"
else
# Set link objects
if ( echo "$MACHINE_ID" | grep gaea ) ; then
CCPP_LINK_OBJS="-dynamic -L${PATH_CCPP_LIB} -lccpp ${CCPP_XML2_LIB} ${CRAY_PMI_POST_LINK_OPTS} -lpmi"
else
CCPP_LINK_OBJS="-L${PATH_CCPP_LIB} -lccpp ${CCPP_XML2_LIB}"
fi
fi
echo "ESMF_DEP_INCPATH=${PATH_CCPP_INC}" > ${CCPP_MK}

# Set linker flags
CCPP_LINK_OBJS="-L${PATH_CCPP_LIB} -lccpp -lccppphys"

echo "ESMF_DEP_INCPATH=${PATH_CCPP_INC} ${PATH_CCPP_BUILD}/physics" > ${CCPP_MK}
echo "ESMF_DEP_LINK_OBJS=${CCPP_LINK_OBJS}" >> ${CCPP_MK}

if [ $clean_after = YES ]; then
Expand Down
118 changes: 114 additions & 4 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@

HOST_MODEL_IDENTIFIER = "FV3"

# Add all files with metadata tables on the host model side,
# relative to basedir = top-level directory of host model
# 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.
VARIABLE_DEFINITION_FILES = [
'FV3/ccpp/physics/physics/machine.F',
'FV3/ccpp/physics/physics/radsw_param.f',
'FV3/ccpp/physics/physics/radlw_param.f',
'FV3/gfsphysics/CCPP_layer/CCPP_typedefs.F90',
'FV3/gfsphysics/GFS_layer/GFS_typedefs.F90',
'FV3/gfsphysics/CCPP_layer/CCPP_data.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_optical_props.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/extensions/cloud_optics/mo_cloud_optics.F90',
'FV3/ccpp/physics/physics/rte-rrtmgp/rte/mo_source_functions.F90',
]

TYPEDEFS_NEW_METADATA = {
Expand Down Expand Up @@ -56,6 +62,27 @@
'GFS_stateout_type' : 'GFS_Data(cdata%blk_no)%Stateout',
'GFS_typedefs' : '',
},
'mo_gas_concentrations' : {
'ty_gas_concs' : '',
'mo_gas_concentrations' : '',
},
'mo_gas_optics_rrtmgp' : {
'ty_gas_optics_rrtmgp' : '',
'mo_gas_optics_rrtmgp' : '',
},
'mo_optical_props' : {
'ty_optical_props_1scl' : '',
'ty_optical_props_2str' : '',
'mo_optical_props' : '',
},
'mo_cloud_optics' : {
'ty_cloud_optics' : '',
'mo_cloud_optics' : '',
},
'mo_source_functions' : {
'ty_source_func_lw' : '',
'mo_source_functions' : '',
},
}

# Add all physics scheme dependencies relative to basedir - note that the CCPP
Expand Down Expand Up @@ -144,6 +171,33 @@
'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_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/rte-rrtmgp/extensions/cloud_optics/mo_cloud_sampling.F90',
# derived data type definitions
'FV3/gfsphysics/GFS_layer/GFS_typedefs.F90',
'FV3/gfsphysics/CCPP_layer/CCPP_typedefs.F90',
Expand Down Expand Up @@ -241,12 +295,37 @@
'FV3/ccpp/physics/physics/mp_fer_hires.F90' : [ 'slow_physics' ],
# for testing the <init> and <finalize> sections
'FV3/ccpp/physics/physics/GFS_suite_init_finalize_test.F90' : [ 'slow_physics' ],
# RRTMGP
'FV3/ccpp/physics/physics/rrtmg_lw_cloud_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmg_sw_cloud_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_aux.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_lw_gas_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_lw_cloud_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_sw_gas_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_sw_cloud_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_sw_aerosol_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_lw_rte.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_lw_cloud_sampling.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_sw_rte.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_sw_cloud_sampling.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_lw_aerosol_optics.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/GFS_rrtmgp_setup.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/GFS_rrtmgp_pre.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/rrtmgp_lw_pre.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/GFS_rrtmgp_sw_pre.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/GFS_rrtmgp_lw_post.F90' : [ 'slow_physics' ],
'FV3/ccpp/physics/physics/GFS_rrtmgp_sw_post.F90' : [ 'slow_physics' ],
}

# Default build dir, relative to current working directory,
# if not specified as command-line argument
DEFAULT_BUILD_DIR = 'FV3'

# Auto-generated makefile/cmakefile snippets that contain all type definitions
TYPEDEFS_MAKEFILE = '{build_dir}/ccpp/physics/CCPP_TYPEDEFS.mk'
TYPEDEFS_CMAKEFILE = '{build_dir}/ccpp/physics/CCPP_TYPEDEFS.cmake'
TYPEDEFS_SOURCEFILE = '{build_dir}/ccpp/physics/CCPP_TYPEDEFS.sh'

# Auto-generated makefile/cmakefile snippets that contain all schemes
SCHEMES_MAKEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.mk'
SCHEMES_CMAKEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.cmake'
Expand Down Expand Up @@ -276,9 +355,40 @@
# if no entry is made here. Possible values are: 'all', 'none',
# or a list of standard_names: [ 'var1', 'var3' ].
OPTIONAL_ARGUMENTS = {
'rrtmgp_sw_rte' : {
'rrtmgp_sw_rte_run' : [
'components_of_surface_downward_shortwave_fluxes',
'sw_fluxes_sfc',
'sw_fluxes_toa',
],
},
'GFS_rrtmgp_sw_post' : {
'GFS_rrtmgp_sw_post_run' : [
'components_of_surface_downward_shortwave_fluxes',
'sw_fluxes_sfc',
'sw_fluxes_toa',
],
},
'rrtmgp_lw_rte' : {
'rrtmgp_lw_rte_run' : [
'lw_fluxes_sfc',
'lw_fluxes_toa',
],
},
'GFS_rrtmgp_lw_post' : {
'GFS_rrtmgp_lw_post_run' : [
'lw_fluxes_sfc',
'lw_fluxes_toa',
],
},
'GFS_rrtmgp_post' : {
'GFS_rrtmgp_post_run' : [
'components_of_surface_downward_shortwave_fluxes',
],
},
'rrtmg_sw' : {
'rrtmg_sw_run' : [
'tendency_of_air_temperature_due_to_shortwave_heating_assuming_clear_sky_on_radiation_time_step',
'tendency_of_air_temperature_due_to_shortwave_heating_assuming_clear_sky_on_radiation_time_step_and_radiation_levels',
'components_of_surface_downward_shortwave_fluxes',
'cloud_liquid_water_path',
'mean_effective_radius_for_liquid_cloud',
Expand All @@ -292,7 +402,7 @@
},
'rrtmg_lw' : {
'rrtmg_lw_run' : [
'tendency_of_air_temperature_due_to_longwave_heating_assuming_clear_sky_on_radiation_time_step',
'tendency_of_air_temperature_due_to_longwave_heating_assuming_clear_sky_on_radiation_time_step_and_radiation_levels',
'cloud_liquid_water_path',
'mean_effective_radius_for_liquid_cloud',
'cloud_ice_water_path',
Expand Down
Loading

0 comments on commit 4afd8a4

Please sign in to comment.