Skip to content

Commit

Permalink
[develop] Add Community Fire Behavior Model (#1139)
Browse files Browse the repository at this point in the history
This PR introduces the Community Fire Behavior Module (ufs-community/ufs-weather-model#2220) to the SRW App.

In addition, there are a number of general improvements to the UFS SRW code and workflow:
* The addition of the build_settings.yaml file that is placed in the exec directory
* Improve capability to use a different set of vertical levels
* Flexible configuration file name
* Additional options for retrieve_data.py
* Speedup of symbolic linking
* Various random improvements
---------

Co-authored-by: Dan Rosen <[email protected]>
Co-authored-by: Christina Holt <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent be863bc commit fae3a7c
Show file tree
Hide file tree
Showing 51 changed files with 1,288 additions and 213 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/python_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ jobs:
cache-downloads: true
cache-environment: true

- name: Checkout externals
run: |
./manage_externals/checkout_externals ufs-weather-model
- name: Lint the python code
run: |
micromamba activate srw_app
Expand All @@ -44,17 +40,22 @@ jobs:
pylint ush/set_fv3nml*.py
pylint ush/update_input_nml.py
- name: Checkout externals
run: |
./manage_externals/checkout_externals ufs-weather-model
- name: Run python unittests
run: |
# exclude test_retrieve_data that is tested in functional test
micromamba activate srw_app
export UNIT_TEST=True
export PYTHONPATH=$(pwd)/ush
python -m unittest -b tests/test_python/*.py
python -m unittest tests/test_python/*.py
- name: Run python functional tests
run: |
micromamba activate srw_app
export CI=true
export PYTHONPATH=${PWD}/ush
python3 -m unittest -b tests/test_python/test_retrieve_data.py
python3 -m unittest tests/test_python/test_retrieve_data.py
30 changes: 20 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ project(ufs-srweather-app VERSION 1.0 LANGUAGES C CXX Fortran)
find_package(MPI REQUIRED COMPONENTS C CXX Fortran)

# Set extended version info.
SET(SRWA_VERSION_MAJOR 1)
SET(SRWA_VERSION_MINOR 0)
SET(SRWA_VERSION_MAJOR 2)
SET(SRWA_VERSION_MINOR 2)
SET(SRWA_VERSION_PATCH 0)
SET(SRWA_VERSION_NOTE "-development")
SET(SRWA_VERSION ${SRWA_VERSION_MAJOR}.${SRWA_VERSION_MINOR}.${SRWA_VERSION_PATCH}${SRWA_VERSION_NOTE})

# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# A function used to create autotools-style 'yes/no' definitions.
# If a variable is set, it 'yes' is returned. Otherwise, 'no' is
# returned.
Expand Down Expand Up @@ -55,7 +63,7 @@ if(NOT DEFINED CMAKE_INSTALL_BINDIR)
endif()

#####
# Configure and print the ufs-srweather-app.settings file.
# Configure and print the build settings file.
#####

# Determine the configure date.
Expand Down Expand Up @@ -92,10 +100,12 @@ SET(host_vendor "${osname}")
SET(host_os "${osrel}")
SET(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}")
SET(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
SET(application "${APP}")
SET(machine "${BUILD_MACHINE}")

SET(CC_VERSION "${CMAKE_C_COMPILER}")

# Set values for .settings file.
# Set values for build settings file.
SET(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE}}")
Expand All @@ -107,27 +117,27 @@ is_enabled(BUILD_SHARED_LIBS enable_shared)
is_enabled(STATUS_PARALLEL HAS_PARALLEL)

# Generate file from template.
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ufs_srweather_app.settings.in"
"${CMAKE_CURRENT_BINARY_DIR}/ufs_srweather_app.settings"
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/sorc/build_settings_template.yaml"
"${CMAKE_CURRENT_BINARY_DIR}/build_settings.yaml"
@ONLY)

# Read in settings file, print out.
# Avoid using system-specific calls so that this
# might also work on Windows.
FILE(READ "${CMAKE_CURRENT_BINARY_DIR}/ufs_srweather_app.settings"
FILE(READ "${CMAKE_CURRENT_BINARY_DIR}/build_settings.yaml"
UFS-SRWEATHER-APP_SETTINGS)
MESSAGE(${UFS-SRWEATHER-APP_SETTINGS})

# Install ufs_srweather_app.settings file into same location
# Install build settings file into same location
# as the app.
INSTALL(FILES "${CMAKE_BINARY_DIR}/ufs_srweather_app.settings"
INSTALL(FILES "${CMAKE_BINARY_DIR}/build_settings.yaml"
DESTINATION ${CMAKE_INSTALL_BINDIR})

#####
# Create 'ufs_srweather_app_meta.h' include file.
#####
configure_file(
ufs_srweather_app_meta.h.in
sorc/ufs_srweather_app_meta.h.in
ufs_srweather_app_meta.h @ONLY)

FILE(COPY "${CMAKE_CURRENT_BINARY_DIR}/ufs_srweather_app_meta.h" DESTINATION include)
Expand Down
7 changes: 5 additions & 2 deletions devbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ OPTIONS
compiler to use; default depends on platform
(e.g. intel | gnu | cray | gccgfortran)
-a, --app=APPLICATION
weather model application to build; for example, ATMAQ for Online-CMAQ
(e.g. ATM | ATMAQ | ATMW | S2S | S2SW)
weather model application to build; supported SRW options are
ATM (default) Atmosphere only
ATMAQ Online-CMAQ (air quality)
ATMF UFS_FIRE (coupled Community Fire Behavior Model)
--ccpp="CCPP_SUITE1,CCPP_SUITE2..."
CCPP suites (CCPP_SUITES) to include in build; delimited with ','
--enable-options="OPTION1,OPTION2,..."
Expand Down Expand Up @@ -363,6 +365,7 @@ fi

# cmake settings
CMAKE_SETTINGS="\
-DBUILD_MACHINE=${MACHINE}\
-DCMAKE_BUILD_TYPE=${BUILD_TYPE}\
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}\
-DCMAKE_INSTALL_BINDIR=${BIN_DIR}\
Expand Down
2 changes: 1 addition & 1 deletion doc/UsersGuide/BuildingRunningTesting/DefaultVarsTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Table of Variables in ``config_defaults.yaml``
TEST_VX_FCST_INPUT_BASEDIR, FIXgsm, FIXaer, FIXlut, FIXorg, FIXsfc, FIXshp, FIXcrtm, FIXcrtmupp, EXTRN_MDL_DATA_STORES
* - Workflow
- WORKFLOW_ID, RELATIVE_LINK_FLAG, USE_CRON_TO_RELAUNCH, CRON_RELAUNCH_INTVL_MNTS, CRONTAB_LINE, LOAD_MODULES_RUN_TASK_FP, EXPT_BASEDIR, EXPT_SUBDIR, EXEC_SUBDIR,
EXPTDIR, DOT_OR_USCORE, EXPT_CONFIG_FN, CONSTANTS_FN, RGNL_GRID_NML_FN, FV3_NML_FN, FV3_NML_BASE_SUITE_FN, FV3_NML_YAML_CONFIG_FN, FV3_NML_BASE_ENS_FN,
EXPTDIR, DOT_OR_USCORE, CONSTANTS_FN, RGNL_GRID_NML_FN, FV3_NML_FN, FV3_NML_BASE_SUITE_FN, FV3_NML_YAML_CONFIG_FN, FV3_NML_BASE_ENS_FN,
FV3_EXEC_FN, DATA_TABLE_FN, DIAG_TABLE_FN, FIELD_TABLE_FN, DIAG_TABLE_TMPL_FN, FIELD_TABLE_TMPL_FN, MODEL_CONFIG_FN, NEMS_CONFIG_FN, AQM_RC_FN, AQM_RC_TMPL_FN,
FV3_NML_BASE_SUITE_FP, FV3_NML_YAML_CONFIG_FP, FV3_NML_BASE_ENS_FP, DATA_TABLE_TMPL_FP, DIAG_TABLE_TMPL_FP, FIELD_TABLE_TMPL_FP,
MODEL_CONFIG_TMPL_FP, NEMS_CONFIG_TMPL_FP, AQM_RC_TMPL_FP, DATA_TABLE_FP, FIELD_TABLE_FP, NEMS_CONFIG_FP, FV3_NML_FP,
Expand Down
Loading

0 comments on commit fae3a7c

Please sign in to comment.