Skip to content

Commit

Permalink
Merge feature/ufs_fire_cpl into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
danrosen25 committed Jun 20, 2024
2 parents a3d4733 + 3cb35b5 commit 961c289
Show file tree
Hide file tree
Showing 21 changed files with 1,155 additions and 11 deletions.
12 changes: 8 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "FV3"]
path = FV3
url = https://github.com/NOAA-EMC/fv3atm
branch = develop
url = https://github.com/esmf-org/fv3atm
branch = feature/ufs_fire_cpl
[submodule "WW3"]
path = WW3
url = https://github.com/NOAA-EMC/WW3
Expand All @@ -16,8 +16,8 @@
branch = develop
[submodule "CMEPS"]
path = CMEPS-interface/CMEPS
url = https://github.com/NOAA-EMC/CMEPS
branch = emc/develop
url = https://github.com/esmf-org/CMEPS
branch = feature/ufs_fire_cpl
[submodule "HYCOM"]
path = HYCOM-interface/HYCOM
url = https://github.com/NOAA-EMC/HYCOM-src
Expand Down Expand Up @@ -46,3 +46,7 @@
path = NOAHMP-interface/noahmp
url = https://github.com/NOAA-EMC/noahmp
branch = develop
[submodule "fire_behavior"]
path = fire_behavior
url = https://github.com/NCAR/fire_behavior
branch = develop
2 changes: 1 addition & 1 deletion CMEPS-interface/CMEPS
20 changes: 18 additions & 2 deletions 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 ATMWM ATML LND S2S S2SA S2SW S2SWA S2SWAL ATM_DS2S ATM_DS2S-PCICE HAFS HAFSW HAFS-MOM6 HAFS-MOM6W HAFS-ALL NG-GODAS)
list(APPEND VALID_APPS ATM ATMAERO ATMAQ ATMW ATMWM ATML ATMF LND S2S S2SA S2SW S2SWA S2SWAL ATM_DS2S ATM_DS2S-PCICE HAFS HAFSW HAFS-MOM6 HAFS-MOM6W 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 @@ -34,6 +34,7 @@ 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")
set(FIRE_BEHAVIOR OFF CACHE BOOL "Enable Fire Behavior")

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

###############################################################################
### Build Options
Expand Down Expand Up @@ -155,7 +157,7 @@ if(FMS)
elseif (APP MATCHES "^(S2S|S2SA|S2SW|S2SWA|S2SWAL|ATM_DS2S|ATM_DS2S-PCICE|NG-GODAS|HAFS-MOM6|HAFS-MOM6W)$")
add_library(fms ALIAS FMS::fms_r8)
endif()
if(APP MATCHES "^(ATM|ATMAERO|ATMAQ|ATMWM|ATMW|ATML|HAFS|HAFS-ALL)$")
if(APP MATCHES "^(ATM|ATMAERO|ATMAQ|ATMWM|ATMW|ATML|ATMF|HAFS|HAFS-ALL)$")
if(32BIT)
add_library(fms ALIAS FMS::fms_r4)
else()
Expand Down Expand Up @@ -260,6 +262,14 @@ if(NOAHMP)
add_subdirectory(NOAHMP-interface)
endif()

###############################################################################
### Fire Components [FIRE_BEHAVIOR]
###############################################################################
if(FIRE_BEHAVIOR)
set(NUOPC "ON" CACHE STRING "Build fire_behavior with NUOPC cap" FORCE)
add_subdirectory(fire_behavior)
endif()

###############################################################################
### UFS Library
###############################################################################
Expand Down Expand Up @@ -339,6 +349,12 @@ if(NOAHMP)
list(APPEND _ufs_libs_public noahmp)
endif()

if(FIRE_BEHAVIOR)
add_dependencies(ufs fire_behavior_nuopc)
list(APPEND _ufs_defs_private FRONT_FIRE_BEHAVIOR=fire_behavior_nuopc)
list(APPEND _ufs_libs_public fire_behavior_nuopc)
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
4 changes: 3 additions & 1 deletion 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|ATMWM|ATMAQ|ATML)$")
if(APP MATCHES "^(ATM|ATMW|ATMWM|ATMAQ|ATML|ATMF)$")
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 @@ -31,6 +31,8 @@ if(APP MATCHES "^(ATM|ATMW|ATMWM|ATMAQ|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")
elseif(APP MATCHES "ATMF")
set(FIRE_BEHAVIOR ON CACHE BOOL "Enable Fire Behavior" FORCE)
else()
message("Configuring UFS app in Atmosphere Only mode")
endif()
Expand Down
14 changes: 13 additions & 1 deletion driver/UFSDriver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MODULE UFSDriver
! UFS Driver component
! /|\
! / | \
! ATM/OCN/ICE/WAV/LND/IPM/HYD .. components
! ATM/OCN/ICE/WAV/LND/IPM/HYD/FIR .. components
! | | |
! | | (CICE, etc.)
! | |
Expand Down Expand Up @@ -81,6 +81,10 @@ MODULE UFSDriver
#endif
#ifdef FRONT_NOAHMP
use FRONT_NOAHMP, only: NOAHMP_SS => SetServices
#endif
! - Handle build time FIR options:
#ifdef FRONT_FIRE_BEHAVIOR
use FRONT_FIRE_BEHAVIOR, only: FIRE_BEHAVIOR_SS => SetServices
#endif
#ifdef FRONT_LIS
use FRONT_LIS, only: LIS_SS => SetServices
Expand Down Expand Up @@ -471,6 +475,14 @@ subroutine SetModelServices(driver, rc)
found_comp = .true.
end if
#endif
#ifdef FRONT_FIRE_BEHAVIOR
if (trim(model) == "fire_behavior") then
call NUOPC_DriverAddComp(driver, trim(prefix), FIRE_BEHAVIOR_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
1 change: 1 addition & 0 deletions fire_behavior
Submodule fire_behavior added at 05cad1
28 changes: 28 additions & 0 deletions tests/default_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
export OCN_tasks_cpl_dflt=20
export ICE_tasks_cpl_dflt=10
export WAV_tasks_cpl_dflt=20
export FBH_tasks_cpl_dflt=1

export THRD_cpl_thrd=2
export INPES_cpl_thrd=3
Expand Down Expand Up @@ -116,6 +117,7 @@
export med_omp_num_threads=1
export ocn_omp_num_threads=1
export wav_omp_num_threads=1
export fbh_omp_num_threads=1

if [[ ${MACHINE_ID} = wcoss2 || ${MACHINE_ID} = acorn ]]; then

Expand Down Expand Up @@ -497,6 +499,7 @@ export FV3=true
export S2S=false
export HAFS=false
export AQM=false
export FIRE_BEHAVIOR=false
export DATM_CDEPS=false
export DOCN_CDEPS=false
export DICE_CDEPS=false
Expand Down Expand Up @@ -1022,6 +1025,24 @@ export_ww3() {
export WW3_user_sets_restname="true"
}

export_fire_behavior() {
export fbh_model=fire_behavior
export FIRE_BEHAVIOR=true
export FIRE_NML=namelist.fire.IN
export CPLFIRE=false
export DT_FIRE=${DT_ATMOS}
export OUTPUT_FS="$(printf "%02d" $(( ${OUTPUT_FH}*3600 )))"
export fire_atm_feedback=1.0
export fire_lsm_zcoupling=false
export fire_lsm_zcoupling_ref=60.0
export fire_num_ignitions=1
export fire_print_msg=0
export fire_upwinding=9
export fire_viscosity=0.4
export fire_wind_height=5.0
}


# Defaults for the coupled 5-component
export_cmeps() {
export UFS_CONFIGURE=ufs.configure.s2swa_fast_esmf.IN
Expand Down Expand Up @@ -1065,6 +1086,7 @@ export FV3=true
export S2S=true
export HAFS=false
export AQM=false
export FIRE_BEHAVIOR=false
export DATM_CDEPS=false
export DOCN_CDEPS=false
export DICE_CDEPS=false
Expand Down Expand Up @@ -1106,6 +1128,7 @@ export THRD=${THRD_cpl_dflt}
export OCN_tasks=${OCN_tasks_cpl_dflt}
export ICE_tasks=${ICE_tasks_cpl_dflt}
export WAV_tasks=${WAV_tasks_cpl_dflt}
export FBH_tasks=${FBH_tasks_cpl_dflt}

# Set tiled file defaults
export_tiled
Expand Down Expand Up @@ -1251,6 +1274,7 @@ export_datm_cdeps ()
export S2S=false
export HAFS=false
export AQM=false
export FIRE_BEHAVIOR=false
export DATM_CDEPS=true
export DOCN_CDEPS=false
export CDEPS_INLINE=false
Expand Down Expand Up @@ -1328,6 +1352,7 @@ export_hafs_datm_cdeps ()
export S2S=false
export HAFS=true
export AQM=false
export FIRE_BEHAVIOR=false
export DATM_CDEPS=true
export DOCN_CDEPS=false
export CDEPS_INLINE=false
Expand All @@ -1347,6 +1372,7 @@ export_hafs_docn_cdeps ()
export S2S=false
export HAFS=true
export AQM=false
export FIRE_BEHAVIOR=false
export DOCN_CDEPS=true
export CDEPS_INLINE=false
export INPES=${INPES_dflt}
Expand All @@ -1366,6 +1392,7 @@ export_hafs_regional ()
export S2S=false
export HAFS=true
export AQM=false
export FIRE_BEHAVIOR=false
export DATM_CDEPS=false
export DOCN_CDEPS=false
export CDEPS_INLINE=false
Expand Down Expand Up @@ -1439,6 +1466,7 @@ export FV3=true
export S2S=false
export HAFS=true
export AQM=false
export FIRE_BEHAVIOR=false
export DATM_CDEPS=false
export DOCN_CDEPS=false
export CDEPS_INLINE=false
Expand Down
12 changes: 12 additions & 0 deletions tests/fv3_conf/regional_fire_run.IN
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rm -rf INPUT RESTART
mkdir INPUT RESTART

rsync -arv @[INPUTDATA_ROOT]/FIRE_BEHAVIOR_input_data/@[FIRE_NAME]/. .
rsync -arv @[INPUTDATA_ROOT]/FV3_fire_input_data/@[FIRE_NAME]/. .

rsync -arv @[INPUTDATA_ROOT]/FV3_regional_input_data/. .
rsync -arv @[INPUTDATA_ROOT]/FV3_fix .
ln -sf FV3_fix/* .
ln -sf FV3_fix/fix_co2_proj/* .

touch data_table
Loading

0 comments on commit 961c289

Please sign in to comment.