Skip to content

Commit

Permalink
Add ctest for ESMX washita_dlnd
Browse files Browse the repository at this point in the history
  • Loading branch information
danrosen25 committed Nov 20, 2024
1 parent 75f8bd7 commit 0d8a66f
Show file tree
Hide file tree
Showing 20 changed files with 77 additions and 215 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,15 @@ if ( ${PARFLOW_ENABLE_TOOLS} )
add_subdirectory (pftools)
endif ()

# Optionally build the NUOPC cap
# Optionally build the NUOPC cap and ESMX
option(PARFLOW_ENABLE_NUOPC "Enable building of the Parflow nuopc" "False")
if ( ${PARFLOW_ENABLE_NUOPC} )
option(PARFLOW_ENABLE_ESMX "Enable building of ESMX" "False")
if ( ${PARFLOW_ENABLE_NUOPC} OR ${PARFLOW_ENABLE_ESMX} )
add_subdirectory (pfnuopc)
if ( ${PARFLOW_ENABLE_ESMX} )
set(PARFLOW_ESMX "${CMAKE_BINARY_DIR}/esmx/esmx_parflow")
add_subdirectory(test/esmx)
endif ()
endif ()

#-----------------------------------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions cmake/modules/ParflowTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,20 @@ function (pf_add_py_parallel_test test_name topology_P topology_Q topology_R)
)

endfunction()

# Add parflow testing of a single ESMX file
function (pf_add_esmx_test test_name)

configure_file(fd.yaml ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(${test_name}.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
add_test(
NAME "esmx_${test_name}"
COMMAND ${PARFLOW_ESMX} "${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.yaml"
)
set_tests_properties(
"esmx_${test_name}"
PROPERTIES
ENVIRONMENT "PF_SRC=${PROJECT_SOURCE_DIR}"
)

endfunction()
18 changes: 18 additions & 0 deletions pfnuopc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ include_directories(parflow_nuopc include)
target_link_libraries(parflow_nuopc PUBLIC ESMF)
target_link_libraries(parflow_nuopc PUBLIC pfsimulator)

# configure fire behavior esmx executable
if (PARFLOW_ENABLE_ESMX)
if(ESMF_VERSION VERSION_LESS "8.5.0")
message(FATAL_ERROR "ESMX requires ESMF version 8.5.0 or greater")
endif (ESMF_VERSION VERSION_LESS "8.5.0")
include(ExternalProject)
ExternalProject_Add(esmx
BINARY_DIR ${CMAKE_BINARY_DIR}/esmx
SOURCE_DIR ${ESMF_ESMXDIR}
CMAKE_ARGS -DESMX_BUILD_FILE=${CMAKE_CURRENT_SOURCE_DIR}/esmxBuild.yaml
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
BUILD_ALWAYS TRUE
DEPENDS parflow_nuopc
EXCLUDE_FROM_ALL TRUE
)
endif (PARFLOW_ENABLE_ESMX)

### Install Library
install(TARGETS parflow_nuopc
EXPORT ParFlow
Expand Down
9 changes: 9 additions & 0 deletions pfnuopc/esmxBuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
application:
exe_name: esmx_parflow

components:
parflow:
build_type: none
cmake_config: ParFlow.cmake
libraries: parflow_nuopc
fort_module: parflow_nuopc.mod
3 changes: 3 additions & 0 deletions test/esmx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include(ParflowTest)

pf_add_esmx_test(washita_dlnd)
111 changes: 0 additions & 111 deletions test/esmx/INSTRUCTIONS.md

This file was deleted.

12 changes: 12 additions & 0 deletions test/esmx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# parflow/test/esmx

This directory contains tools for testing ESMX applications. Each test test
pairs a yaml file used to configure ESMX at runtime and a matching python file
used to configure ParFlow. The field dictionary file (fd.yaml) is shared for
all ESMX tests.

- washita_dlnd

### shared_resources

- fd.yaml
45 changes: 0 additions & 45 deletions test/esmx/pbs_template.sh

This file was deleted.

46 changes: 0 additions & 46 deletions test/esmx/slurm_template.sh

This file was deleted.

18 changes: 9 additions & 9 deletions test/esmx/Little_Washita.py → test/esmx/washita_dlnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@

script_path = get_absolute_path('.') + '/'
### current folder for py script
input_path = './PARFLOW_INPUTS/'
forcing_path = './PARFLOW_FORCING/NLDAS_LW/'
input_path = '$PF_SRC/test/input/esmx/'
#forcing_path = './'
clm_output_path = './'
pf_output_path = './'

domain_file = 'LW.pfsol'
subsurface_file = 'Indicator_LW_USGS_Bedrock.pfb'
slope_x_file = 'slopex_LW.pfb'
slope_y_file = 'slopey_LW.pfb'
initial_file = 'press.init.233.pfb'
subsurface_file = 'LW_Indicator_USGS_Bedrock.pfb'
slope_x_file = 'LW_slopex.pfb'
slope_y_file = 'LW_slopey.pfb'
initial_file = 'LW_press.init.233.pfb'

start_time = 0
stop_time = 192
Expand Down Expand Up @@ -64,9 +64,9 @@
cp( input_path + initial_file )
### initial file

cp( input_path + 'drv_clmin.dat', 'drv_clmin.dat' )
cp( input_path + 'drv_vegm.alluv.dat', 'drv_vegm.alluv.dat' )
cp( input_path + 'drv_vegp.dat', 'drv_vegp.dat' )
cp( input_path + 'LW_drv_clmin.dat', 'LW_drv_clmin.dat' )
cp( input_path + 'LW_drv_vegm.alluv.dat', 'LW_drv_vegm.alluv.dat' )
cp( input_path + 'LW_drv_vegp.dat', 'LW_drv_vegp.dat' )

#-----------------------------------------------------------------------------------------
# Setup timing info
Expand Down
4 changes: 2 additions & 2 deletions test/esmx/esmxRun.yaml → test/esmx/washita_dlnd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ GWR:
model: ParFlow
petList: [0-0]
attributes:
prep_filename: 'Little_Washita.py'
prep_filename: 'washita_dlnd.py'
filename: 'LW.pfidb'
initialize_import: 'FLD_INIT_FILLV'
initialize_export: 'FLD_INIT_ZERO'
check_import: 'FLD_CHECK_NEXTT'
coord_type: 'GRD_COORD_CLMVEGTF'
coord_filename: 'drv_vegm.alluv.dat'
coord_filename: 'LW_drv_vegm.alluv.dat'
output_directory: './GWR_CAP_OUTPUT'

LND:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0d8a66f

Please sign in to comment.