Skip to content

Commit

Permalink
Merge pull request #1 from NCAR/dtc/develop
Browse files Browse the repository at this point in the history
Dtc/develop
  • Loading branch information
panll authored Jul 30, 2020
2 parents 333980d + 30b3ba4 commit ffce47b
Show file tree
Hide file tree
Showing 245 changed files with 52,148 additions and 12,494 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/basic_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Basic checks for CCPP physics schemes

on: [push, pull_request]

jobs:
build:

runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Init submodules
run: git submodule update --init --recursive
#- name: Update packages
# run: |
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# #brew install autoconf automake coreutils gcc@9 libtool mpich gnu-sed wget
# brew install automake coreutils mpich gnu-sed
- name: Check for ASCII encoding
run: ./tools/check_encoding.py
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "physics/rte-rrtmgp"]
path = physics/rte-rrtmgp
url = https://github.com/RobertPincus/rte-rrtmgp
branch = dtc/ccpp
134 changes: 42 additions & 92 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,21 @@ if(NOT PROJECT)
endif (NOT PROJECT)

#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.0)

project(ccppphys
VERSION 4.0.0
LANGUAGES C CXX Fortran)

# Use rpaths on MacOSX
set(CMAKE_MACOSX_RPATH 1)

if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
project(ccppphys VERSION 3.0.0)
else(POLICY CMP0048)
project(ccppphys)
set(PROJECT_VERSION 3.0.0)
set(PROJECT_VERSION_MAJOR 3)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 0)
endif(POLICY CMP0048)

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

#------------------------------------------------------------------------------
set(PACKAGE "ccpp-physics")
set(AUTHORS "Grant J. Firl" "Dom Heinzeller")

#------------------------------------------------------------------------------
# Enable Fortran
enable_language(Fortran)

if (PROJECT STREQUAL "CCPP-SCM")
#------------------------------------------------------------------------------
# CMake Modules
# Set the CMake module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../framework/cmake")
endif (PROJECT STREQUAL "CCPP-SCM")
set(AUTHORS "Grant Firl" "Dom Heinzeller" "Man Zhang" "Laurie Carson")

#------------------------------------------------------------------------------
# Set OpenMP flags for C/C++/Fortran
Expand Down Expand Up @@ -77,41 +58,42 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()

#------------------------------------------------------------------------------
# By default we want a shared library (unless a static build is requested)
if(STATIC)
option(BUILD_SHARED_LIBS "Build a static library" OFF)
else(STATIC)
option(BUILD_SHARED_LIBS "Build a shared library" ON)
endif(STATIC)
# Request a static build
option(BUILD_SHARED_LIBS "Build a shared library" OFF)

#------------------------------------------------------------------------------
# Add the CCPP include/module directory
set(CCPP_INCLUDE_DIRS "" CACHE FILEPATH "Path to ccpp includes")
set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES ${CCPP_INCLUDE_DIRS})

#------------------------------------------------------------------------------
# Add the CCPP library
set(CCPP_LIB_DIRS "" CACHE FILEPATH "Path to ccpp library")
link_directories(${CCPP_LIB_DIRS})
list(APPEND LIBS "ccpp")
# Set the sources: physics type definitions
set(TYPEDEFS $ENV{CCPP_TYPEDEFS})
if(TYPEDEFS)
message(STATUS "Got CCPP TYPEDEFS from environment variable: ${TYPEDEFS}")
else(TYPEDEFS)
include(./CCPP_TYPEDEFS.cmake)
message(STATUS "Got CCPP TYPEDEFS from cmakefile include file: ${TYPEDEFS}")
endif(TYPEDEFS)

# Generate list of Fortran modules from the CCPP type
# definitions that need need to be installed
foreach(typedef_module ${TYPEDEFS})
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${typedef_module})
endforeach()

#------------------------------------------------------------------------------
# Set the sources: physics schemes
set(SCHEMES $ENV{CCPP_SCHEMES})
if(SCHEMES)
message(INFO "Got CCPP_SCHEMES from environment variable: ${SCHEMES}")
message(STATUS "Got CCPP SCHEMES from environment variable: ${SCHEMES}")
else(SCHEMES)
include(./CCPP_SCHEMES.cmake)
message(INFO "Got SCHEMES from cmakefile include file: ${SCHEMES}")
message(STATUS "Got CCPP SCHEMES from cmakefile include file: ${SCHEMES}")
endif(SCHEMES)

# Set the sources: physics scheme caps
set(CAPS $ENV{CCPP_CAPS})
if(CAPS)
message(INFO "Got CAPS from environment variable: ${CAPS}")
message(STATUS "Got CCPP CAPS from environment variable: ${CAPS}")
else(CAPS)
include(./CCPP_CAPS.cmake)
message(INFO "Got CAPS from cmakefile include file: ${CAPS}")
message(STATUS "Got CCPP CAPS from cmakefile include file: ${CAPS}")
endif(CAPS)

# Create empty lists for schemes with special compiler optimization flags
Expand Down Expand Up @@ -191,15 +173,17 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
${CMAKE_CURRENT_SOURCE_DIR}/physics/cu_gf_sh.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_bl_mynn.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNPBL_wrapper.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_sf_mynn.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNSFC_wrapper.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNrad_pre.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNrad_post.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_mp_thompson_make_number_concentrations.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_SF_JSFC.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_BL_MYJPBL.F90
PROPERTIES COMPILE_FLAGS "-r8 -ftz")

# Reduce optimization for module_sf_mynn.F90 (to avoid an apparent compiler bug with Intel 18 on Hera)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/physics/module_sf_mynn.F90
PROPERTIES COMPILE_FLAGS "${CMAKE_Fortran_FLAGS_OPT} -O1")
list(APPEND SCHEMES_SFX_OPT ${CMAKE_CURRENT_SOURCE_DIR}/physics/module_sf_mynn.F90)

# Replace -xHost or -xCORE-AVX2 with -xCORE-AVX-I for certain files
set(CMAKE_Fortran_FLAGS_LOPT1 ${CMAKE_Fortran_FLAGS_OPT})
string(REPLACE "-xHOST" "-xCORE-AVX-I"
Expand Down Expand Up @@ -340,51 +324,19 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
set_property(SOURCE ${CAPS} APPEND_STRING PROPERTY COMPILE_FLAGS " -Mnobounds ")
endif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")

if (PROJECT STREQUAL "CCPP-SCM")
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/ccpp/framework/src)
endif (PROJECT STREQUAL "CCPP-SCM")

#------------------------------------------------------------------------------

if(STATIC)
add_library(ccppphys STATIC ${SCHEMES} ${SCHEMES_SFX_OPT} ${CAPS})
# Generate list of Fortran modules from defined sources
foreach(source_f90 ${CAPS})
get_filename_component(tmp_source_f90 ${source_f90} NAME)
string(REGEX REPLACE ".F90" ".mod" tmp_module_f90 ${tmp_source_f90})
string(TOLOWER ${tmp_module_f90} module_f90)
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${module_f90})
endforeach()
else(STATIC)
add_library(ccppphys SHARED ${SCHEMES} ${SCHEMES_SFX_OPT} ${CAPS})
endif(STATIC)

if (NOT STATIC)
target_link_libraries(ccppphys LINK_PUBLIC ${LIBS} ${BACIO_LIB4} ${SP_LIBd} ${W3NCO_LIBd})
endif (NOT STATIC)
add_library(ccppphys STATIC ${SCHEMES} ${SCHEMES_SFX_OPT} ${CAPS})
# Generate list of Fortran modules from defined sources
foreach(source_f90 ${CAPS})
get_filename_component(tmp_source_f90 ${source_f90} NAME)
string(REGEX REPLACE ".F90" ".mod" tmp_module_f90 ${tmp_source_f90})
string(TOLOWER ${tmp_module_f90} module_f90)
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${module_f90})
endforeach()

set_target_properties(ccppphys PROPERTIES VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR})

# DH* Hack for PGI compiler: rename objects in scheme cap object files for ISO_C compliancy,
# this is only needed for dynamics builds - static build generates plain Fortran code.
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
if (NOT STATIC)
set(CAPOBJS)
foreach(cap ${CAPS})
string(REPLACE "_cap.F90" "_cap.F90.o" capobj "./${CMAKE_FILES_DIRECTORY}/ccppphys.dir/${cap}")
list(APPEND CAPOBJS ${capobj})
endforeach(cap)

add_custom_command(TARGET ccppphys
PRE_LINK
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pgifix.py --cmake ${CAPOBJS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running pgifix_wrapper.py over all scheme caps")
endif (NOT STATIC)
endif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
# *DH end hack for PGI compiler

if (PROJECT STREQUAL "CCPP-FV3")
# Define where to install the library
install(TARGETS ccppphys
Expand All @@ -398,9 +350,7 @@ if (PROJECT STREQUAL "CCPP-FV3")
FILE ccppphys-config.cmake
DESTINATION lib/cmake
)
if(STATIC)
# Define where to install the C headers and Fortran modules
#install(FILES ${HEADERS_C} DESTINATION include)
install(FILES ${MODULES_F90} DESTINATION include)
endif(STATIC)
# Define where to install the C headers and Fortran modules
#install(FILES ${HEADERS_C} DESTINATION include)
install(FILES ${MODULES_F90} DESTINATION include)
endif (PROJECT STREQUAL "CCPP-FV3")
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# GMTB GFS Physics
# CCPP Physics

This repository contains the GFS Physics scheme.
The Common Community Physics Package (CCPP) is designed to facilitate the implementation of physics innovations in state-of-the-art atmospheric models, the use of various models to develop physics, and the acceleration of transition of physics innovations to operational NOAA models.

Please see more information about the CCPP at the locations below.

- [CCPP website hosted by the Developmental Testbed Center (DTC)](https://dtcenter.org/ccpp)
- [CCPP public release information](https://dtcenter.org/community-code/common-community-physics-package-ccpp/ccpp-scm-version-4-0)
- [CCPP Technical Documentation](https://ccpp-techdoc.readthedocs.io/en/latest/)
- [CCPP Scientific Documentation](https://dtcenter.org/GMTB/v4.0/sci_doc/)
- [CCPP Physics GutHub wiki](https://github.com/NCAR/ccpp-physics/wiki)
- [CCPP Framework GitHub wiki](https://github.com/NCAR/ccpp-framework/wiki)

For the use of CCPP with its Single Column Model, see the [Single Column Model User's Guide](https://dtcenter.org/GMTB/v4.0/scm-ccpp-guide-v4.0.pdf).

For the use of CCPP with NOAA's Unified Forecast System (UFS), see the [UFS Medium-Range Application User's Guide](https://ufs-mrweather-app.readthedocs.io/en/latest/) and the [UFS Weather Model User's Guide](https://ufs-weather-model.readthedocs.io/en/latest/).

Questions can be directed to the [CCPP Help Desk](mailto:[email protected]). When using the CCPP with NOAA's UFS, questions can be posted in the [UFS Weather Model](https://forums.ufscommunity.org/forum/ufs-weather-model) section of the [UFS Forum](https://forums.ufscommunity.org/)
93 changes: 0 additions & 93 deletions pgifix.py

This file was deleted.

Loading

0 comments on commit ffce47b

Please sign in to comment.