Skip to content

Commit

Permalink
Merge pull request ufs-community#72 from grantfirl/ufs-dev-PR10
Browse files Browse the repository at this point in the history
UFS-dev PR#10
  • Loading branch information
grantfirl committed Nov 8, 2022
2 parents d78efa1 + 50dc1c9 commit 35eb90e
Show file tree
Hide file tree
Showing 32 changed files with 2,857 additions and 1,800 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@
path = AQM
url = https://github.com/NOAA-EMC/AQM
branch = develop
[submodule "NOAHMP"]
path = NOAHMP-interface/noahmp
url = https://github.com/NOAA-EMC/noahmp
branch = develop
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/Modules)
###############################################################################

# Valid applications and choices
list(APPEND VALID_APPS ATM ATMAERO ATMAQ ATMW S2S S2SA S2SW S2SWA HAFS HAFSW HAFS-ALL NG-GODAS)
list(APPEND VALID_APPS ATM ATMAERO ATMAQ ATMW ATML LND S2S S2SA S2SW S2SWA S2SWAL HAFS HAFSW HAFS-ALL NG-GODAS)
set(APP NONE CACHE BOOL "Application Name")
if(NOT (APP IN_LIST VALID_APPS))
message(FATAL_ERROR "${APP} is not a valid application.\nValid Applications are: ${VALID_APPS}")
Expand All @@ -33,6 +33,7 @@ set(WW3 OFF CACHE BOOL "Enable WW3")
set(STOCH_PHYS OFF CACHE BOOL "Enable Stochastic Physics")
set(CMEPS OFF CACHE BOOL "Enable CMEPS")
set(CDEPS OFF CACHE BOOL "Enable CDEPS")
set(NOAHMP OFF CACHE BOOL "Enable NOAHMP")

# Configure selected application specific components
message("")
Expand All @@ -50,6 +51,7 @@ message("WW3 .............. ${WW3}")
message("STOCH_PHYS ....... ${STOCH_PHYS}")
message("CDEPS ............ ${CDEPS}")
message("CMEPS ............ ${CMEPS}")
message("NOAHMP ........... ${NOAHMP}")

###############################################################################
### Build Options
Expand Down Expand Up @@ -211,6 +213,13 @@ if(CDEPS)
add_subdirectory(CDEPS-interface)
endif()

###############################################################################
### Land Components [NOAHMP]
###############################################################################
if(NOAHMP)
add_subdirectory(NOAHMP-interface)
endif()

###############################################################################
### UFS Library
###############################################################################
Expand Down Expand Up @@ -283,6 +292,12 @@ if(CDEPS)
target_link_libraries(ufs PUBLIC cdeps::cdeps)
endif()

if(NOAHMP)
add_dependencies(ufs noahmp)
list(APPEND _ufs_defs_private FRONT_NOAHMP=lnd_comp_nuopc)
list(APPEND _ufs_libs_public noahmp)
endif()

target_compile_definitions(ufs PRIVATE "${_ufs_defs_private}")
target_link_libraries(ufs PUBLIC "${_ufs_libs_public}")

Expand Down
2 changes: 1 addition & 1 deletion FV3
83 changes: 83 additions & 0 deletions NOAHMP-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#------------------------------------------------------------------------------
# Add source files
# NUOPC cap
list(APPEND _noahmp_cap_files noahmp/drivers/nuopc/lnd_comp_kind.F90
noahmp/drivers/nuopc/lnd_comp_types.F90
noahmp/drivers/nuopc/lnd_comp_shr.F90
noahmp/drivers/nuopc/lnd_comp_io.F90
noahmp/drivers/nuopc/lnd_comp_domain.F90
noahmp/drivers/nuopc/lnd_comp_import_export.F90
noahmp/drivers/nuopc/lnd_comp_nuopc.F90
noahmp/drivers/nuopc/lnd_comp_driver.F90)

# CCPP interface
list(APPEND _noahmp_ccpp_files noahmp/drivers/ccpp/noahmpdrv.F90
noahmp/drivers/ccpp/sfc_diff.f
noahmp/drivers/ccpp/machine.F
noahmp/drivers/ccpp/noahmp_tables.f90
noahmp/drivers/ccpp/namelist_soilveg.f
noahmp/drivers/ccpp/set_soilveg.f
noahmp/drivers/ccpp/funcphys.f90
noahmp/drivers/ccpp/physcons.F90)

# NoahMP
list(APPEND _noahmp_files noahmp/src/module_sf_noahmplsm.f90
noahmp/src/module_sf_noahmp_glacier.f90)

#------------------------------------------------------------------------------
# Set CCPP flags for C/C++/Fortran preprocessor
add_definitions(-DCCPP)

#------------------------------------------------------------------------------
# Set MPI flags for C/C++/Fortran preprocessor
if(MPI)
add_definitions(-DMPI)
endif()

#------------------------------------------------------------------------------
# Set flag for 32bit dynamics build
if(32BIT)
message(STATUS "Compile CCPP slow physics with 64-bit precision, fast physics with 32-bit precision")
add_definitions(-DOVERLOAD_R4)
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set(CMAKE_Fortran_FLAGS_PHYSICS "-real-size 64 -no-prec-div -no-prec-sqrt")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS_PHYSICS "-fdefault-real-8 -fdefault-double-8")
endif()
set(CMAKE_Fortran_FLAGS_DYNAMICS "")
else()
message(STATUS "Compile CCPP physics with 64-bit precision")
remove_definitions(-DOVERLOAD_R8)
remove_definitions(-DOVERLOAD_R4)
set(CMAKE_Fortran_FLAGS_PHYSICS "")
set(CMAKE_Fortran_FLAGS_DYNAMICS "")
endif()

#------------------------------------------------------------------------------
# Add model-specific flags for C/C++/Fortran preprocessor
add_definitions(-DMOIST_CAPPA -DUSE_COND -DNEMS_GSM)
add_definitions(-DINTERNAL_FILE_NML)

#------------------------------------------------------------------------------
# NOAHMP
add_library(noahmp STATIC ${_noahmp_cap_files} ${_noahmp_ccpp_files} ${_noahmp_files})
set_target_properties(noahmp PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
target_include_directories(noahmp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>
$<INSTALL_INTERFACE:mod>)
target_link_libraries(noahmp PUBLIC esmf fms)

###############################################################################
### Install
###############################################################################

install(
TARGETS noahmp
EXPORT noahmp-config
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
COMPONENT Library)

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

install(EXPORT noahmp-config
DESTINATION lib/cmake)
1 change: 1 addition & 0 deletions NOAHMP-interface/noahmp
Submodule noahmp added at 34a52c
2 changes: 1 addition & 1 deletion WW3
Submodule WW3 updated 91 files
+1 −1 .github/workflows/gnu.yml
+1 −1 .github/workflows/intel.yml
+718 −42 docs/ww3_doxy_tmpl.md
+3 −3 manual/run/ww3_uprstr.tex
+2 −2 model/src/PDLIB/yowelementpool.F90
+2 −2 model/src/PDLIB/yowerr.F90
+10 −10 model/src/PDLIB/yowexchangeModule.F90
+4 −4 model/src/PDLIB/yowfunction.F90
+6 −6 model/src/PDLIB/yownodepool.F90
+9 −9 model/src/PDLIB/yowpdlibmain.F90
+6 −6 model/src/PDLIB/yowrankModule.F90
+3 −3 model/src/cmake/switches.json
+131 −94 model/src/constants.F90
+1 −1 model/src/ctest.F90
+1 −1 model/src/gx_outf.F90
+0 −3 model/src/gx_outp.F90
+33 −14 model/src/mod_constants.f90
+93 −36 model/src/mod_fileio.f90
+958 −354 model/src/mod_xnl4v5.f90
+4 −241 model/src/pdlib_field_vec.F90
+103 −46 model/src/w3adatmd.F90
+40 −0 model/src/w3agcmmd.F90
+44 −0 model/src/w3bullmd.F90
+43 −0 model/src/w3cspcmd.F90
+8 −49 model/src/w3fldsmd.F90
+32 −0 model/src/w3flx1md.F90
+34 −0 model/src/w3flx2md.F90
+38 −0 model/src/w3flx3md.F90
+43 −0 model/src/w3flx4md.F90
+54 −0 model/src/w3flx5md.F90
+2 −4 model/src/w3gdatmd.F90
+31 −137 model/src/w3gridmd.F90
+48 −0 model/src/w3idatmd.F90
+28 −0 model/src/w3igcmmd.F90
+90 −332 model/src/w3initmd.F90
+31 −4 model/src/w3iobcmd.F90
+166 −234 model/src/w3iogomd.F90
+1 −1 model/src/w3iogoncdmd.F90
+33 −176 model/src/w3iogrmd.F90
+51 −0 model/src/w3iopomd.F90
+46 −172 model/src/w3iorsmd.F90
+34 −0 model/src/w3iosfmd.F90
+35 −0 model/src/w3iotrmd.F90
+6 −6 model/src/w3meminfo.F90
+18 −113 model/src/w3parall.F90
+3 −3 model/src/w3partmd.F90
+198 −198 model/src/w3profsmd.F90
+302 −971 model/src/w3profsmd_pdlib.F90
+0 −7 model/src/w3psmcmd.F90
+49 −0 model/src/w3sbs1md.F90
+0 −10 model/src/w3sdb1md.F90
+8 −28 model/src/w3servmd.F90
+1 −1 model/src/w3sic3md.F90
+0 −7 model/src/w3snl1md.F90
+115 −130 model/src/w3snl4md.F90
+25 −0 model/src/w3src0md.F90
+51 −0 model/src/w3src1md.F90
+100 −0 model/src/w3src2md.F90
+2 −2 model/src/w3src3md.F90
+2 −2 model/src/w3srcemd.F90
+77 −0 model/src/w3str1md.F90
+39 −0 model/src/w3str2md.F90
+5 −0 model/src/w3strkmd.F90
+64 −0 model/src/w3swldmd.F90
+83 −81 model/src/w3tidemd.F90
+11 −106 model/src/w3triamd.F90
+89 −7 model/src/w3uno2md.F90
+4 −60 model/src/w3updtmd.F90
+110 −0 model/src/w3uqckmd.F90
+140 −596 model/src/w3wavemd.F90
+340 −49 model/src/w3wavset.F90
+46 −0 model/src/w3wdasmd.F90
+50 −110 model/src/w3wdatmd.F90
+4 −12 model/src/wminiomd.F90
+17 −42 model/src/wminitmd.F90
+2 −2 model/src/wmscrpmd.F90
+61 −58 model/src/wmwavemd.F90
+3 −1 model/src/ww3_gspl.F90
+0 −48 model/src/ww3_ounf.F90
+13 −7 model/src/ww3_ounp.F90
+1 −1 model/src/ww3_outf.F90
+16 −8 model/src/ww3_outp.F90
+5 −2 model/src/ww3_prtide.F90
+0 −174 model/src/ww3_shel.F90
+0 −33 model/src/ww3_strt.F90
+1 −1 model/src/ww3_trnc.F90
+1 −1 regtests/ww3_tnc1/input/switch
+1 −1 regtests/ww3_tp2.16/input/switch_MPI
+1 −1 regtests/ww3_tp2.16/input/switch_MPI_OMPH
+1 −1 regtests/ww3_tp2.16/input/ww3_ounf.nml
+1 −1 regtests/ww3_ts4/input_rg_multi/switch_MPI
28 changes: 19 additions & 9 deletions cmake/configure_apps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
###############################################################################
### Configure Application Components
###############################################################################
if(APP MATCHES "^(ATM|ATMW|ATMAQ)$")
if(APP MATCHES "^(ATM|ATMW|ATMAQ|ATML)$")
set(FMS ON CACHE BOOL "Enable FMS" FORCE)
set(FV3 ON CACHE BOOL "Enable FV3" FORCE)
set(STOCH_PHYS ON CACHE BOOL "Enable Stochastic Physics" FORCE)
Expand All @@ -23,6 +23,10 @@ if(APP MATCHES "^(ATM|ATMW|ATMAQ)$")
elseif(APP MATCHES "ATMAQ")
set(AQM ON CACHE BOOL "Enable AQM" FORCE)
message("Configuring UFS app in Atmosphere with Air Quality mode")
elseif(APP MATCHES "ATML")
set(CMEPS ON CACHE BOOL "Enable CMEPS" FORCE)
set(NOAHMP ON CACHE BOOL "Enable NOAHMP" FORCE)
message("Configuring UFS app in Atmosphere with Air Quality mode")
else()
message("Configuring UFS app in Atmosphere Only mode")
endif()
Expand All @@ -38,25 +42,24 @@ if(APP MATCHES "^(NG-GODAS)$")
message("Configuring UFS app in (CDEPS) Data Atmosphere mode")
endif()

if(APP MATCHES "^(S2S|S2SA|S2SW|S2SWA)$")
if(APP MATCHES "^(S2S|S2SA|S2SW|S2SWA|S2SWAL)$")
set(APP_MSG "Configuring UFS app in S2S")
set(CMEPS ON CACHE BOOL "Enable CMEPS" FORCE)
set(FMS ON CACHE BOOL "Enable FMS" FORCE)
set(FV3 ON CACHE BOOL "Enable FV3" FORCE)
set(MOM6 ON CACHE BOOL "Enable MOM6" FORCE)
set(CICE6 ON CACHE BOOL "Enable CICE6" FORCE)
set(STOCH_PHYS ON CACHE BOOL "Enable Stochastic Physics" FORCE)
if(APP MATCHES "^S2SW")
if(APP MATCHES "^(S2SW|S2SWA|S2SWAL)")
set(WW3 ON CACHE BOOL "Enable WAVEWATCH III" FORCE)
string(CONCAT APP_MSG ${APP_MSG} " with Waves")
endif()
if(APP MATCHES "A$")
if(APP MATCHES "^(S2SA|S2SWA)")
set(UFS_GOCART ON CACHE BOOL "Enable GOCART" FORCE)
if(WW3)
string(CONCAT APP_MSG ${APP_MSG} " and Aerosols")
else()
string(CONCAT APP_MSG ${APP_MSG} " with Aerosols")
endif()
string(CONCAT APP_MSG ${APP_MSG} " with Aerosols")
endif()
if(APP MATCHES "^S2SWAL")
set(NOAHMP ON CACHE BOOL "Enable NOAHMP" FORCE)
endif()
message("${APP_MSG} mode")
endif()
Expand Down Expand Up @@ -84,3 +87,10 @@ if(APP MATCHES "^(ATMAERO)$")
set(UFS_GOCART ON CACHE BOOL "Enable GOCART" FORCE)
message("Configuring UFS app in Atmosphere with Aerosols mode")
endif()

if(APP MATCHES "^(LND)$")
set(CMEPS ON CACHE BOOL "Enable CMEPS" FORCE)
set(CDEPS ON CACHE BOOL "Enable CDEPS" FORCE)
set(NOAHMP ON CACHE BOOL "Enable NOAHMP" FORCE)
set(FMS ON CACHE BOOL "Enable FMS" FORCE)
endif()
11 changes: 11 additions & 0 deletions driver/UFSDriver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ MODULE UFSDriver
#ifdef FRONT_NOAH
use FRONT_NOAH, only: NOAH_SS => SetServices
#endif
#ifdef FRONT_NOAHMP
use FRONT_NOAHMP, only: NOAHMP_SS => SetServices
#endif
#ifdef FRONT_LIS
use FRONT_LIS, only: LIS_SS => SetServices
#endif
Expand Down Expand Up @@ -447,6 +450,14 @@ subroutine SetModelServices(driver, rc)
found_comp = .true.
end if
#endif
#ifdef FRONT_NOAHMP
if (trim(model) == "noahmp") then
call NUOPC_DriverAddComp(driver, trim(prefix), NOAHMP_SS, &
petList=petList, comp=comp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
found_comp = .true.
end if
#endif
#ifdef FRONT_LIS
if (trim(model) == "lis") then
!TODO: Remove bail code and pass info and SetVM to DriverAddComp
Expand Down
4 changes: 2 additions & 2 deletions modulefiles/ufs_acorn.intel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ load(pathJoin("intel", intel_ver))
craype_ver=os.getenv("craype_ver") or "2.7.13"
load(pathJoin("craype", craype_ver))

cray_mpich_ver=os.getenv("cray_mpich_ver") or "8.1.7"
cray_mpich_ver=os.getenv("cray_mpich_ver") or "8.1.9"
load(pathJoin("cray-mpich", cray_mpich_ver))

cmake_ver=os.getenv("cmake_ver") or "3.20.2"
Expand All @@ -21,7 +21,7 @@ prepend_path("MODULEPATH", "/lfs/h1/emc/nceplibs/noscrub/hpc-stack/libs/hpc-stac

hpc_ver=os.getenv("hpc_ver") or "1.2.0"
hpc_intel_ver=os.getenv("hpc_intel_ver") or "19.1.3.304"
hpc_cray_mpich_ver=os.getenv("hpc_cray_mpich_ver") or "8.1.7"
hpc_cray_mpich_ver=os.getenv("hpc_cray_mpich_ver") or "8.1.9"
load(pathJoin("hpc", hpc_ver))
load(pathJoin("hpc-intel", hpc_intel_ver))
load(pathJoin("hpc-cray-mpich", hpc_cray_mpich_ver))
Expand Down
4 changes: 2 additions & 2 deletions modulefiles/ufs_acorn.intel_debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ load(pathJoin("intel", intel_ver))
craype_ver=os.getenv("craype_ver") or "2.7.13"
load(pathJoin("craype", craype_ver))

cray_mpich_ver=os.getenv("cray_mpich_ver") or "8.1.7"
cray_mpich_ver=os.getenv("cray_mpich_ver") or "8.1.9"
load(pathJoin("cray-mpich", cray_mpich_ver))

cmake_ver=os.getenv("cmake_ver") or "3.20.2"
Expand All @@ -21,7 +21,7 @@ prepend_path("MODULEPATH", "/lfs/h1/emc/nceplibs/noscrub/hpc-stack/libs/hpc-stac

hpc_ver=os.getenv("hpc_ver") or "1.2.0"
hpc_intel_ver=os.getenv("hpc_intel_ver") or "19.1.3.304"
hpc_cray_mpich_ver=os.getenv("hpc_cray_mpich_ver") or "8.1.7"
hpc_cray_mpich_ver=os.getenv("hpc_cray_mpich_ver") or "8.1.9"
load(pathJoin("hpc", hpc_ver))
load(pathJoin("hpc-intel", hpc_intel_ver))
load(pathJoin("hpc-cray-mpich", hpc_cray_mpich_ver))
Expand Down
Loading

0 comments on commit 35eb90e

Please sign in to comment.