Skip to content

Commit

Permalink
Stoch updates (#372)
Browse files Browse the repository at this point in the history
Addition of stochastic physics restarts in netCDF format that will be written at the restart interval, and at end of run.
Addition of stochastic cloud perturbation and microphysics perturbations for SPPT.
Clean up of stochastic physics code.

Co-authored-by: mlee03 <Mikyung.Lee@noaa.gov>
Co-authored-by: MinsukJi-NOAA <minsuk.ji@noaa.gov>
Co-authored-by: Brian Curtis <brian.curtis@noaa.gov>
  • Loading branch information
4 people authored Mar 21, 2021
1 parent 694e139 commit 3e46f5b
Show file tree
Hide file tree
Showing 20 changed files with 2,186 additions and 2,251 deletions.
71 changes: 15 additions & 56 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,56 +139,27 @@ endif()
###############################################################################
### FMS
###############################################################################
include(fms_files.cmake)
add_library(fms ${fms_src_files} ${fms_headers})

list(APPEND _fms_defs_public use_libMPI
use_netCDF
GFS_PHYS
INTERNAL_FILE_NML)
if(QUAD_PRECISION)
list(APPEND _fms_defs_public ENABLE_QUAD_PRECISION)
endif()
set(GFS_PHYS ON CACHE BOOL "Enable GFS Physics")
if(NOT 32BIT)
set(64BIT ON CACHE BOOL "Enable 64-bit")

# check gettid
include(CheckFunctionExists)
check_function_exists(gettid HAVE_GETTID)
if(HAVE_GETTID)
list(APPEND _fms_defs_public HAVE_GETTID)
endif()

target_compile_definitions(fms PUBLIC "${_fms_defs_public}")

if(32BIT)
list(APPEND _fms_defs_private OVERLOAD_R4
OVERLOAD_R8)
if(NOT QUAD_PRECISION)
set(ENABLE_QUAD_PRECISION OFF CACHE BOOL "Enable Quad-precision")
endif()

target_compile_definitions(fms PRIVATE "${_fms_defs_private}")

target_include_directories(fms PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/fms>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/fms2_io/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/FMS/mod>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FMS/mpp/include>)
target_include_directories(fms INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/mod>)
target_link_libraries(fms PUBLIC MPI::MPI_Fortran
NetCDF::NetCDF_Fortran)
if(OpenMP_Fortran_FOUND)
target_link_libraries(fms PRIVATE OpenMP::OpenMP_Fortran)
add_subdirectory(FMS)

if(32BIT)
add_library(fms ALIAS fms_r4)
else()
add_library(fms ALIAS fms_r8)
endif()
set_target_properties(fms PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FMS)
set_target_properties(fms PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FMS/mod)
set_target_properties(fms PROPERTIES PUBLIC_HEADER "${fms_headers}" )

###############################################################################
### stochastic_physics
###############################################################################
if(NOT DATM)
add_subdirectory(stochastic_physics)
endif()

###############################################################################
### FV3 or Data Atmosphere
Expand Down Expand Up @@ -291,7 +262,7 @@ endif()
target_include_directories(ufs INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>
$<INSTALL_INTERFACE:mod>)

target_link_libraries(ufs PUBLIC esmf)
target_link_libraries(ufs PUBLIC esmf stochastic_physics)

if(DATM)
target_link_libraries(ufs PUBLIC datatm)
Expand All @@ -304,7 +275,7 @@ if(S2S)
FRONT_CICE6=ice_comp_nuopc
CMEPS
FRONT_CMEPS=MED)
add_dependencies(ufs mom6 cice cmeps)
add_dependencies(ufs mom6 cice cmeps stochastic_physics)
target_link_libraries(ufs PUBLIC mom6
cice
cmeps)
Expand Down Expand Up @@ -336,26 +307,14 @@ if(DATM)
endif()
target_link_libraries(ufs_model PRIVATE ufs
esmf
NetCDF::NetCDF_Fortran
${MKL_LIB})
NetCDF::NetCDF_Fortran)

###############################################################################
### Install
###############################################################################
install(
TARGETS fms
EXPORT fms-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include )

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FMS/mod DESTINATION ${CMAKE_INSTALL_PREFIX})

install(EXPORT fms-config
DESTINATION lib/cmake
)
install(
TARGETS ufs

EXPORT ufs-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
Expand Down
2 changes: 1 addition & 1 deletion FMS
Submodule FMS updated 2 files
+3 −1 CHANGELOG.md
+5 −5 CMakeLists.txt
92 changes: 0 additions & 92 deletions fms_files.cmake

This file was deleted.

6 changes: 3 additions & 3 deletions modulefiles/macosx.gnu/fv3
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ fi
##
## Intel MKL library
##
export MKL_DIR=${MKL_DIR:-/opt/intel/compilers_and_libraries_2019.4.233/mac/mkl}
export MKL_INC="-m64 -I${MKL_DIR}/include"
export MKL_LIB="-L${MKL_DIR}/lib -Wl,-rpath,${MKL_DIR}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl"
#export MKL_DIR=${MKL_DIR:-/opt/intel/compilers_and_libraries_2019.4.233/mac/mkl}
#export MKL_INC="-m64 -I${MKL_DIR}/include"
#export MKL_LIB="-L${MKL_DIR}/lib -Wl,-rpath,${MKL_DIR}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl"
6 changes: 3 additions & 3 deletions modulefiles/macosx.gnu/fv3_debug
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ fi
##
## Intel MKL library
##
export MKL_DIR=${MKL_DIR:-/opt/intel/compilers_and_libraries_2019.4.233/mac/mkl}
export MKL_INC="-m64 -I${MKL_DIR}/include"
export MKL_LIB="-L${MKL_DIR}/lib -Wl,-rpath,${MKL_DIR}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl"
#export MKL_DIR=${MKL_DIR:-/opt/intel/compilers_and_libraries_2019.4.233/mac/mkl}
#export MKL_INC="-m64 -I${MKL_DIR}/include"
#export MKL_LIB="-L${MKL_DIR}/lib -Wl,-rpath,${MKL_DIR}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl"
2 changes: 1 addition & 1 deletion stochastic_physics
Loading

0 comments on commit 3e46f5b

Please sign in to comment.