Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeList changes for UFS dycore only build #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 39 additions & 32 deletions src/core_atmosphere/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,18 @@ set(ATMOSPHERE_CORE_INCLUDES
structs_and_variables.inc)


add_library(core_atmosphere ${ATMOSPHERE_CORE_SOURCES}
${ATMOSPHERE_CORE_PHYSICS_SOURCES}
${ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES}
${ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES}
${ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES}
${ATMOSPHERE_CORE_DYNAMICS_SOURCES})

if (${DO_PHYSICS})
add_library(core_atmosphere ${ATMOSPHERE_CORE_SOURCES}
${ATMOSPHERE_CORE_PHYSICS_SOURCES}
${ATMOSPHERE_CORE_PHYSICS_MMM_SOURCES}
${ATMOSPHERE_CORE_PHYSICS_WRF_SOURCES}
${ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES}
${ATMOSPHERE_CORE_DYNAMICS_SOURCES})
else ()
add_library(core_atmosphere ${ATMOSPHERE_CORE_SOURCES}
${ATMOSPHERE_CORE_DIAGNOSTIC_SOURCES}
${ATMOSPHERE_CORE_DYNAMICS_SOURCES})
endif ()
set(CORE_ATMOSPHERE_COMPILE_DEFINITIONS
mpas=1
MPAS_NATIVE_TIMERS
Expand All @@ -170,31 +175,33 @@ set_MPAS_DEBUG_flag(core_atmosphere)
mpas_core_target(CORE atmosphere TARGET core_atmosphere INCLUDES ${ATMOSPHERE_CORE_INCLUDES})

#Get physics_wrf tables from MPAS-Data
include(FetchContent)
if (${PROJECT_VERSION} VERSION_GREATER_EQUAL 7.0)
if (${DO_PHYSICS})
include(FetchContent)
if (${PROJECT_VERSION} VERSION_GREATER_EQUAL 7.0)
set(MPAS_DATA_GIT_TAG v${PROJECT_VERSION_MAJOR}.0)
else ()
else ()
set(MPAS_DATA_GIT_TAG master)
endif ()

FetchContent_Declare(mpas_data
GIT_REPOSITORY https://github.com/MPAS-Dev/MPAS-Data.git
GIT_TAG ${MPAS_DATA_GIT_TAG}
GIT_PROGRESS True
GIT_SHALLOW True)
FetchContent_Populate(mpas_data)
message(STATUS "MPAS-Data source dir: ${mpas_data_SOURCE_DIR}")
set(PHYSICS_WRF_DATA_DIR ${mpas_data_SOURCE_DIR}/atmosphere/physics_wrf/files)
file(GLOB PHYSICS_WRF_DATA RELATIVE ${PHYSICS_WRF_DATA_DIR} "${PHYSICS_WRF_DATA_DIR}/*")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere)
foreach (data_file IN LISTS PHYSICS_WRF_DATA)
endif ()

FetchContent_Declare(mpas_data
GIT_REPOSITORY https://github.com/MPAS-Dev/MPAS-Data.git
GIT_TAG ${MPAS_DATA_GIT_TAG}
GIT_PROGRESS True
GIT_SHALLOW True)
FetchContent_Populate(mpas_data)
message(STATUS "MPAS-Data source dir: ${mpas_data_SOURCE_DIR}")
set(PHYSICS_WRF_DATA_DIR ${mpas_data_SOURCE_DIR}/atmosphere/physics_wrf/files)
file(GLOB PHYSICS_WRF_DATA RELATIVE ${PHYSICS_WRF_DATA_DIR} "${PHYSICS_WRF_DATA_DIR}/*")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere)
foreach (data_file IN LISTS PHYSICS_WRF_DATA)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${PHYSICS_WRF_DATA_DIR}/${data_file}
${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere/${data_file})
endforeach ()
install(DIRECTORY ${PHYSICS_WRF_DATA_DIR}/ DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/core_atmosphere)

add_executable(mpas_atmosphere_build_tables ${ATMOSPHERE_CORE_UTILS_SOURCES})
target_link_libraries(mpas_atmosphere_build_tables PUBLIC core_atmosphere)
mpas_fortran_target(mpas_atmosphere_build_tables)
install(TARGETS mpas_atmosphere_build_tables EXPORT ${PROJECT_NAME}ExportsCore
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
${CMAKE_BINARY_DIR}/${PROJECT_NAME}/core_atmosphere/${data_file})
endforeach ()
install(DIRECTORY ${PHYSICS_WRF_DATA_DIR}/ DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/core_atmosphere)

add_executable(mpas_atmosphere_build_tables ${ATMOSPHERE_CORE_UTILS_SOURCES})
target_link_libraries(mpas_atmosphere_build_tables PUBLIC core_atmosphere)
mpas_fortran_target(mpas_atmosphere_build_tables)
install(TARGETS mpas_atmosphere_build_tables EXPORT ${PROJECT_NAME}ExportsCore
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
5 changes: 4 additions & 1 deletion src/core_atmosphere/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@
<var_array name="lbc_scalars" />

</stream>

#ifdef DO_MPASDA
<stream name="da_state"
type="input;output"
filename_template="mpasout.$Y-$M-$D_$h.$m.$s.nc"
Expand Down Expand Up @@ -1210,6 +1210,7 @@
<var name="tslb"/>
<var name="h_oml_initial"/>
</stream>
#endif
</streams>


Expand Down Expand Up @@ -3588,6 +3589,8 @@
<!-- **************************************************************************************** -->

#include "diagnostics/Registry_diagnostics.xml"
#ifdef DO_PHYSICS
#include "physics/Registry_noahmp.xml"
#endif

</registry>