diff --git a/CMakeLists.txt b/CMakeLists.txt index f18f3918..1fae185f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) project(canoe LANGUAGES CXX C Fortran ) + # search for _ROOT cmake_policy(SET CMP0074 NEW) @@ -27,11 +28,12 @@ endif() add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=${_ABI_OUTPUT}) # Set MacOS deployment target -set(CMAKE_OSX_DEPLOYMENT_TARGET "15.0") +set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0") string(ASCII 27 Esc) set(ColorReset "${Esc}[m") set(Green "${Esc}[32m") +set(Blue "${Esc}[34m") message(STATUS "") message(STATUS "${Green}==== ${PROJECT_NAME} configure begin ====${ColorReset}") @@ -54,12 +56,12 @@ foreach(_file ${_macro_files}) endforeach() ## 1. set up compiler flags ## -message(STATUS "${PROJECT_NAME}-1. Setting up project compiler flags ...") +message(STATUS "${Blue}${PROJECT_NAME}-1. Setting up project compiler flags ...${ColorReset}") message(STATUS "Include ${CMAKE_SOURCE_DIR}/cmake/compilers.cmake") include(${CMAKE_SOURCE_DIR}/cmake/compilers.cmake) ## 2. set up project specific configuration ## -message(STATUS "${PROJECT_NAME}-2. Setting up project parameters ...") +message(STATUS "${Blue}${PROJECT_NAME}-2. Setting up project parameters ...${ColorReset}") # load custom task message(STATUS "Load custom task = ${TASK}") @@ -80,17 +82,21 @@ message(STATUS "Include ${CMAKE_CURRENT_SOURCE_DIR}/cmake/parameters.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/parameters.cmake) ## 3. set up project system libraries ## -message(STATUS "${PROJECT_NAME}-3. Setting up system libraries") +message(STATUS "${Blue}${PROJECT_NAME}-3. Setting up system libraries ...${ColorReset}") +find_package(Torch REQUIRED) find_package(Eigen3 REQUIRED) -find_package(Cantera) -find_package(Torch) +find_package(Disort REQUIRED) +find_package(Harp REQUIRED) +find_package(Kintera REQUIRED) +find_package(Snap REQUIRED) + +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/fmt.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/gtest.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/yamlpp.cmake) -include(${CMAKE_SOURCE_DIR}/cmake/yamlpp.cmake) -include(${CMAKE_SOURCE_DIR}/cmake/gtest.cmake) include(${CMAKE_SOURCE_DIR}/cmake/athena.cmake) include(${CMAKE_SOURCE_DIR}/cmake/application.cmake) include(${CMAKE_SOURCE_DIR}/cmake/rfm.cmake) -include(${CMAKE_SOURCE_DIR}/cmake/disort.cmake) include(${CMAKE_SOURCE_DIR}/cmake/rrtmg.cmake) include(${CMAKE_SOURCE_DIR}/cmake/pvfmm.cmake) include(${CMAKE_SOURCE_DIR}/cmake/minichem.cmake) @@ -99,20 +105,20 @@ include(${CMAKE_SOURCE_DIR}/cmake/pybind11.cmake) include(${CMAKE_SOURCE_DIR}/cmake/c3m.cmake) ## 4. set up project configure file and library ## -message(STATUS "${PROJECT_NAME}-4. Setting up project libraries") -configure_file(${CMAKE_SOURCE_DIR}/configure.hpp.in configure.hpp @ONLY) +message(STATUS "${Blue}${PROJECT_NAME}-4. Setting up project libraries ...${ColorReset}") +configure_file(${CMAKE_SOURCE_DIR}/configure.h.in configure.h @ONLY) add_subdirectory(src) add_subdirectory(tools) add_subdirectory(data) ## 5. set up examples and tests -message(STATUS "${PROJECT_NAME}-5. Setting up unit tests") +message(STATUS "${Blue}${PROJECT_NAME}-5. Setting up unit tests ..${ColorReset}") add_subdirectory(examples) -add_subdirectory(tests) +#add_subdirectory(tests) ## 6. set up python binding ## -add_subdirectory(python) +#add_subdirectory(python) ## 7. add uninstall targets ## configure_file( diff --git a/cmake/athena.cmake b/cmake/athena.cmake index bfb79285..f63cf0cd 100644 --- a/cmake/athena.cmake +++ b/cmake/athena.cmake @@ -19,5 +19,5 @@ set(patch_command set(PACKAGE_NAME athenapp) set(REPO_URL "https://github.com/chengcli/athenapp") -set(REPO_TAG "6a612f4039ac08eacf92ce1644657fd0f340834f") +set(REPO_TAG "f9d3ae8bb84cac6954e6a224cb84bc917450e43d") add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "${patch_command}" ON) diff --git a/cmake/disort.cmake b/cmake/disort.cmake deleted file mode 100644 index 303b2a51..00000000 --- a/cmake/disort.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Fetch disort and build -include(FetchContent) -set(FETCHCONTENT_QUIET FALSE) - -set_if_empty(ACCOUNT $ENV{GH_ACCOUNT}) -set_if_empty(TOKEN $ENV{GH_TOKEN}) - -set(PACKAGE_NAME disort) -set(REPO_URL "https://${ACCOUNT}:${TOKEN}@github.com/zoeyzyhu/pydisort") -set(REPO_TAG "v0.8.0") -add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" OFF) diff --git a/cmake/fmt.cmake b/cmake/fmt.cmake new file mode 100644 index 00000000..044334b6 --- /dev/null +++ b/cmake/fmt.cmake @@ -0,0 +1,11 @@ +include(FetchContent) +set(FETCHCONTENT_QUIET TRUE) + +set(PACKAGE_NAME fmt) +set(REPO_URL "https://github.com/fmtlib/fmt") +set(REPO_TAG "11.1.2") + +add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" ON) +set(FMT_INCLUDE_DIR + "${CMAKE_CURRENT_BINARY_DIR}/_deps/${PACKAGE_NAME}-src/include" + CACHE PATH "fmt include directory") diff --git a/cmake/gtest.cmake b/cmake/gtest.cmake index d0e78680..f04656e9 100644 --- a/cmake/gtest.cmake +++ b/cmake/gtest.cmake @@ -7,3 +7,5 @@ set(REPO_TAG "v1.13.0") set(INSTALL_GTEST OFF) add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" ON) +include_directories(${gtest_SOURCE_DIR}/include + ${gtest_SOURCE_DIR}/googletest/include) diff --git a/cmake/macros/macro_setup_problem.cmake b/cmake/macros/macro_setup_problem.cmake index 90ca0a9a..5668cff0 100644 --- a/cmake/macros/macro_setup_problem.cmake +++ b/cmake/macros/macro_setup_problem.cmake @@ -19,16 +19,24 @@ macro(setup_problem namel) ${namel}.${buildl} PRIVATE ${CMAKE_BINARY_DIR} ${CANOE_INCLUDE_DIR} - SYSTEM ${CANTERA_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIR} + ${MPI_CXX_HEADER_DIR} + ${MPI_CXX_INCLUDE_PATH} + ${NETCDF_INCLUDES} + ${PNETCDF_INCLUDE_DIR} + SYSTEM + ${TORCH_API_INCLUDE_DIR} + SYSTEM + ${TORCH_INCLUDE_DIR} SYSTEM ${EIGEN3_INCLUDE_DIR} SYSTEM - ${MPI_CXX_HEADER_DIR} + ${DISORT_INCLUDE_DIR} SYSTEM - ${MPI_CXX_INCLUDE_PATH} + ${HARP_INCLUDE_DIR} SYSTEM - ${NETCDF_INCLUDES} + ${KINTERA_INCLUDE_DIR} SYSTEM - ${PNETCDF_INCLUDE_DIR}) + ${SNAP_INCLUDE_DIR}) endmacro() diff --git a/cmake/macros/macro_setup_test.cmake b/cmake/macros/macro_setup_test.cmake index 563a982f..7f351101 100644 --- a/cmake/macros/macro_setup_test.cmake +++ b/cmake/macros/macro_setup_test.cmake @@ -6,15 +6,14 @@ macro(setup_test namel) string(TOLOWER ${CMAKE_BUILD_TYPE} buildl) string(TOUPPER ${CMAKE_BUILD_TYPE} buildu) - add_executable(${namel}.${buildl} ${namel}.cpp globals.cpp) + add_executable(${namel}.${buildl} ${namel}.cpp) set_target_properties(${namel}.${buildl} PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_${buildu}}) target_include_directories( ${namel}.${buildl} - PRIVATE $<$:${PVFMM_SOURCE_DIR}/SCTL/include> - ${CMAKE_BINARY_DIR} + PRIVATE ${CMAKE_BINARY_DIR} ${CANOE_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR} ${MPI_CXX_INCLUDE_PATH} @@ -23,16 +22,12 @@ macro(setup_test namel) ${PNETCDF_INCLUDE_DIR} ${OpenMP_CXX_INCLUDE_DIR} ${FFTW_INCLUDE_DIRS} - SYSTEM ${CANTERA_INCLUDE_DIR} - SYSTEM ${TORCH_INCLUDE_DIR} - SYSTEM ${TORCH_API_INCLUDE_DIR}) - target_link_libraries( - ${namel}.${buildl} gtest_main $<$:pvfmmStatic> - ${CANOE_LIBRARY_${buildu}}) + target_link_libraries(${namel}.${buildl} gtest_main + ${CANOE_LIBRARY_${buildu}}) add_test(NAME ${namel}.${buildl} COMMAND ${namel}.${buildl}) endmacro() diff --git a/cmake/modules/FindCantera.cmake b/cmake/modules/FindCantera.cmake deleted file mode 100644 index fa791dd6..00000000 --- a/cmake/modules/FindCantera.cmake +++ /dev/null @@ -1,57 +0,0 @@ -# * Find Cantera Find the Cantera include and library -# -# Define the following variables -# -# CANTERA_INCLUDE_DIR - where to find cantera/kinetics.h CANTERA_LIBRARY - -# link library CANTERA_FOUND - True if Cantera found -# -# Normal usage would be -# -# find_package (Cantera REQUIRED) target_include_directories -# (${CANTERA_INCLUDE_DIR}) target_link_libraries (${CANTERA_LIBRARY}) - -find_path(CANTERA_INCLUDE_DIR cantera/kinetics.h HINTS $ENV{HOME}/opt/include - $ENV{CANTERA_DIR}) - -find_library( - CANTERA_LIBRARY - NAMES cantera - HINTS $ENV{HOME}/opt/lib) - -if(CANTERA_INCLUDE_DIR) - mark_as_advanced(CANTERA_LIBRARY) - mark_as_advanced(CANTERA_INCLUDE_DIR) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Cantera DEFAULT_MSG CANTERA_LIBRARY - CANTERA_INCLUDE_DIR) - - set(SOURCE_PATH "${CANTERA_INCLUDE_DIR}/cantera/ext/") - set(LINK_PATH "ext1") - if(UNIX) - execute_process( - COMMAND ln -sf ${SOURCE_PATH} ${LINK_PATH} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - RESULT_VARIABLE result) - elseif(WIN32) - execute_process( - COMMAND cmd.exe /c mklink /D ${LINK_PATH} ${SOURCE_PATH} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - RESULT_VARIABLE result) - else() - message( - FATAL_ERROR "Symbolic link creation is not supported on this platform.") - endif() - - if(result) - message(FATAL_ERROR "Failed to create symbolic link: ${LINK_PATH}") - else() - message(STATUS "Symbolic link created: ${LINK_PATH} -> ${SOURCE_PATH}") - endif() - include_directories(${CMAKE_CURRENT_BINARY_DIR}/ext1) -else() - message(STATUS "Not using Cantera library") - set(CANTERA_INCLUDE_DIR "") - set(CANTERA_LIBRARY "") - set(CANTERA_FOUND FALSE) -endif() diff --git a/cmake/modules/FindDisort.cmake b/cmake/modules/FindDisort.cmake new file mode 100644 index 00000000..89120ce1 --- /dev/null +++ b/cmake/modules/FindDisort.cmake @@ -0,0 +1,103 @@ +# Find the disort includes and library +# +# DISORT_INCLUDE_DIR - where to find disort.hpp +# +# DISORT_LIBRARY - Link these libraries when using DISORT +# +# DISORT_FOUND - True if DISORT found +# +# Normal usage would be: +# +# find_package(Disort REQUIRED) include_directories(${DISORT_INCLUDE_DIR}) +# target_link_libraries(${DISORT_LIBRARY}) + +include(FindPackageHandleStandardArgs) + +macro(__disort_determine_version) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c + "import pydisort; print(pydisort.__version__)" + OUTPUT_VARIABLE DISORT_PEP440_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result) + + if(result GREATER 0) + message(FATAL_ERROR "cannot determine PEP 440 version of Pydisort!") + endif() + + if(DISORT_PEP440_VERSION MATCHES "^[0-9]+\.[0-9]+(\.[0-9]+)?") + set(DISORT_VERSION ${CMAKE_MATCH_0}) + endif() + + unset(result) +endmacro() + +# Find Python +set(Python3_FIND_VIRTUALENV ONLY) +find_package(Python3 QUIET COMPONENTS Interpreter) +if(Python3_Interpreter_FOUND) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import pydisort; print(pydisort.__file__)" + OUTPUT_VARIABLE disort_init_file + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + + cmake_path(CONVERT ${disort_init_file} TO_CMAKE_PATH_LIST disort_init_file + NORMALIZE) + + cmake_path(REPLACE_FILENAME disort_init_file lib OUTPUT_VARIABLE + disort_lib_dir) + cmake_path(REPLACE_FILENAME disort_init_file disort OUTPUT_VARIABLE + disort_include_dir) + + unset(disort_init_file) +endif() + +# Step 1: Find header +find_path( + _DISORT_HEADER_DIR disort.hpp + HINTS ${disort_include_dir} + /opt/homebrew/include + /usr/include + DISORT_DIR/include + DISORT_INC + $ENV{DISORT_INC} + $ENV{DISORT_DIR}/include + $ENV{DISORT_ROOT}/include) + +# Step 2: Go one level up from the header location +get_filename_component(DISORT_INCLUDE_DIR ${_DISORT_HEADER_DIR} DIRECTORY) + +# Step 3: Save to cache +set(DISORT_INCLUDE_DIR + "${DISORT_INCLUDE_DIR}" + CACHE FILEPATH "Path to a file.") + +# Step 4: unset the internal temp variable +unset(_DISORT_HEADER_DIR CACHE) + +find_library( + DISORT_LIBRARY disort_release + HINTS ${disort_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + DISORT_DIR/lib + DISORT_LIB + $ENV{DISORT_LIB} + $ENV{DISORT_DIR}/lib + $ENV{DISORT_ROOT}/lib) + +set(disort_required_vars DISORT_LIBRARY DISORT_INCLUDE_DIR) +mark_as_advanced(${disort_required_vars}) + +if(DISORT_LIBRARY) + __disort_determine_version() +endif() + +find_package_handle_standard_args( + Disort + REQUIRED_VARS ${disort_required_vars} + VERSION_VAR DISORT_VERSION) + +unset(disort_lib_dir) +unset(disort_include_dir) +unset(disort_required_vars) diff --git a/cmake/modules/FindHarp.cmake b/cmake/modules/FindHarp.cmake new file mode 100644 index 00000000..14779c2a --- /dev/null +++ b/cmake/modules/FindHarp.cmake @@ -0,0 +1,107 @@ +# Find the harp includes and library +# +# HARP_INCLUDE_DIR - where to find element.hpp +# +# HARP_LIBRARY - Link these libraries when using HARP +# +# HARP_FOUND - True if harp found +# +# Normal usage would be: +# +# find_package(Harp REQUIRED) include_directories(${HARP_INCLUDE_DIR}) +# target_link_libraries(${HARP_LIBRARY}) + +include(FindPackageHandleStandardArgs) + +macro(__harp_determine_version) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import pyharp; print(pyharp.__version__)" + OUTPUT_VARIABLE HARP_PEP440_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result) + + if(result GREATER 0) + message(FATAL_ERROR "cannot determine PEP 440 version of Pyharp!") + endif() + + if(HARP_PEP440_VERSION MATCHES "^[0-9]+\.[0-9]+(\.[0-9]+)?") + set(HARP_VERSION ${CMAKE_MATCH_0}) + endif() + + unset(result) +endmacro() + +# Find Python +set(Python3_FIND_VIRTUALENV ONLY) +find_package(Python3 QUIET COMPONENTS Interpreter) +if(Python3_Interpreter_FOUND) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import pyharp; print(pyharp.__file__)" + OUTPUT_VARIABLE harp_init_file + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + + cmake_path(CONVERT ${harp_init_file} TO_CMAKE_PATH_LIST harp_init_file + NORMALIZE) + + cmake_path(REPLACE_FILENAME harp_init_file lib OUTPUT_VARIABLE harp_lib_dir) + cmake_path(REPLACE_FILENAME harp_init_file harp OUTPUT_VARIABLE + harp_include_dir) + + unset(harp_init_file) +endif() + +# Step 1: Find header +find_path( + _HARP_HEADER_DIR element.hpp + HINTS ${harp_include_dir} + /opt/homebrew/include + /usr/include + HARP_DIR/include + HARP_INC + $ENV{HARP_INC} + $ENV{HARP_DIR}/include + $ENV{HARP_ROOT}/include) + +# Step 2: Go one level up from the header location +get_filename_component(HARP_INCLUDE_DIR ${_HARP_HEADER_DIR} DIRECTORY) + +# Step 3: Save to cache +set(HARP_INCLUDE_DIR + "${HARP_INCLUDE_DIR}" + CACHE FILEPATH "Path to a file.") + +# Step 4: unset the internal temp variable +unset(_HARP_HEADER_DIR CACHE) + +find_library( + HARP_LIBRARY harp_release + HINTS ${harp_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + HARP_DIR/lib + HARP_LIB + $ENV{HARP_LIB} + $ENV{HARP_DIR}/lib + $ENV{HARP_ROOT}/lib) + +set(harp_required_vars HARP_LIBRARY HARP_INCLUDE_DIR) +mark_as_advanced(${harp_required_vars}) + +if(APPLE) + link_directories(${Python3_SITELIB}/pyharp/.dylibs) +else() + link_directories(${Python3_SITELIB}/pyharp.libs) +endif() + +if(HARP_LIBRARY) + __harp_determine_version() +endif() + +find_package_handle_standard_args( + Harp + REQUIRED_VARS ${harp_required_vars} + VERSION_VAR HARP_VERSION) + +unset(harp_lib_dir) +unset(harp_include_dir) +unset(harp_required_vars) diff --git a/cmake/modules/FindKintera.cmake b/cmake/modules/FindKintera.cmake new file mode 100644 index 00000000..18efb724 --- /dev/null +++ b/cmake/modules/FindKintera.cmake @@ -0,0 +1,136 @@ +# Find the kintera includes and library +# +# KINTERA_INCLUDE_DIR: Where to find reaction.hpp +# +# KINTERA_LIBRARY: Link these libraries when using KINTERA +# +# VAPORS_LIBRARY: Link these libraries when using KINTERA +# +# KINTERA_FOUND: True if kintera found +# +# Normal usage would be: +# +# find_package(Kintera REQUIRED) +# +# include_directories(${KINTERA_INCLUDE_DIR}) +# +# target_link_libraries(${KINTERA_LIBRARY} ${VAPORS_LIBRARY}) + +include(FindPackageHandleStandardArgs) + +macro(__kintera_determine_version) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c + "import kintera; print(kintera.__version__)" + OUTPUT_VARIABLE KINTERA_PEP440_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result) + + if(result GREATER 0) + message(FATAL_ERROR "cannot determine PEP 440 version of Kintera!") + endif() + + if(KINTERA_PEP440_VERSION MATCHES "^[0-9]+\.[0-9]+(\.[0-9]+)?") + set(KINTERA_VERSION ${CMAKE_MATCH_0}) + endif() + + unset(result) +endmacro() + +# Find Python +set(Python3_FIND_VIRTUALENV ONLY) +find_package(Python3 QUIET COMPONENTS Interpreter) +if(Python3_Interpreter_FOUND) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import kintera; print(kintera.__file__)" + OUTPUT_VARIABLE kintera_init_file + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + + cmake_path(CONVERT ${kintera_init_file} TO_CMAKE_PATH_LIST kintera_init_file + NORMALIZE) + + cmake_path(REPLACE_FILENAME kintera_init_file lib OUTPUT_VARIABLE + kintera_lib_dir) + cmake_path(REPLACE_FILENAME kintera_init_file kintera OUTPUT_VARIABLE + kintera_include_dir) + + unset(kintera_init_file) +endif() + +# Step 1: Find header +find_path( + _KINTERA_HEADER_DIR reaction.hpp + HINTS ${kintera_include_dir} + /opt/homebrew/include + /usr/include + KINTERA_DIR/include + KINTERA_INC + $ENV{KINTERA_INC} + $ENV{KINTERA_DIR}/include + $ENV{KINTERA_ROOT}/include) + +# Step 2: Go one level up from the header location +get_filename_component(KINTERA_INCLUDE_DIR ${_KINTERA_HEADER_DIR} DIRECTORY) + +# Step 3: Save to cache +set(KINTERA_INCLUDE_DIR + "${KINTERA_INCLUDE_DIR}" + CACHE FILEPATH "Path to a file.") + +# Step 4: unset the internal temp variable +unset(_KINTERA_HEADER_DIR CACHE) + +find_library( + KINTERA_LIBRARY kintera_release + HINTS ${kintera_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + KINTERA_DIR/lib + KINTERA_LIB + $ENV{KINTERA_LIB} + $ENV{KINTERA_DIR}/lib + $ENV{KINTERA_ROOT}/lib) + +find_library( + KINTERA_CUDA_LIBRARY kintera_cuda_release + HINTS ${kintera_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + KINTERA_DIR/lib + KINTERA_LIB + $ENV{KINTERA_LIB} + $ENV{KINTERA_DIR}/lib + $ENV{KINTERA_ROOT}/lib) + +find_library( + VAPORS_LIBRARY vapors_release + HINTS ${kintera_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + KINTERA_DIR/lib + KINTERA_LIB + $ENV{KINTERA_LIB} + $ENV{KINTERA_DIR}/lib + $ENV{KINTERA_ROOT}/lib) + +if(${CUDAToolKit_FOUND}) + set(kintera_required_vars VAPORS_LIBRARY KINTERA_LIBRARY KINTERA_CUDA_LIBRARY + KINTERA_INCLUDE_DIR) +else() + set(kintera_required_vars VAPORS_LIBRARY KINTERA_LIBRARY KINTERA_INCLUDE_DIR) +endif() + +mark_as_advanced(${kintera_required_vars}) + +if(KINTERA_LIBRARY) + __kintera_determine_version() +endif() + +find_package_handle_standard_args( + Kintera + REQUIRED_VARS ${kintera_required_vars} + VERSION_VAR KINTERA_VERSION) + +unset(kintera_lib_dir) +unset(kintera_include_dir) +unset(kintera_required_vars) diff --git a/cmake/modules/FindSnap.cmake b/cmake/modules/FindSnap.cmake new file mode 100644 index 00000000..e153d073 --- /dev/null +++ b/cmake/modules/FindSnap.cmake @@ -0,0 +1,134 @@ +# Find the snap includes and library +# +# SNAP_INCLUDE_DIR: Where to find snap.h +# +# SNAP_LIBRARY: Link these libraries when using SNAP +# +# BC_LIBRARY: Link these libraries when using SNAP +# +# SNAP_FOUND: True if snap found +# +# Normal usage would be: +# +# find_package(Snap REQUIRED) +# +# include_directories(${SNAP_INCLUDE_DIR}) +# +# target_link_libraries(${SNAP_LIBRARY} ${BC_LIBRARY}) + +include(FindPackageHandleStandardArgs) + +macro(__snap_determine_version) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import snapy; print(snapy.__version__)" + OUTPUT_VARIABLE SNAP_PEP440_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result) + + if(result GREATER 0) + message(FATAL_ERROR "cannot determine PEP 440 version of Snap!") + endif() + + if(SNAP_PEP440_VERSION MATCHES "^[0-9]+\.[0-9]+(\.[0-9]+)?") + set(SNAP_VERSION ${CMAKE_MATCH_0}) + endif() + + unset(result) +endmacro() + +# Find Python +set(Python3_FIND_VIRTUALENV ONLY) +find_package(Python3 QUIET COMPONENTS Interpreter) +if(Python3_Interpreter_FOUND) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import snapy; print(snapy.__file__)" + OUTPUT_VARIABLE snap_init_file + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + + cmake_path(CONVERT ${snap_init_file} TO_CMAKE_PATH_LIST snap_init_file + NORMALIZE) + + cmake_path(REPLACE_FILENAME snap_init_file lib OUTPUT_VARIABLE snap_lib_dir) + cmake_path(REPLACE_FILENAME snap_init_file snap OUTPUT_VARIABLE + snap_include_dir) + + unset(snap_init_file) +endif() + +# Step 1: Find header +find_path( + _SNAP_HEADER_DIR snap.h + HINTS ${snap_include_dir} + /opt/homebrew/include + /usr/include + SNAP_DIR/include + SNAP_INC + $ENV{SNAP_INC} + $ENV{SNAP_DIR}/include + $ENV{SNAP_ROOT}/include) + +# Step 2: Go one level up from the header location +get_filename_component(SNAP_INCLUDE_DIR ${_SNAP_HEADER_DIR} DIRECTORY) + +# Step 3: Save to cache +set(SNAP_INCLUDE_DIR + "${SNAP_INCLUDE_DIR}" + CACHE FILEPATH "Path to a file.") + +# Step 4: unset the internal temp variable +unset(_SNAP_HEADER_DIR CACHE) + +find_library( + SNAP_LIBRARY snap_release + HINTS ${snap_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + SNAP_DIR/lib + SNAP_LIB + $ENV{SNAP_LIB} + $ENV{SNAP_DIR}/lib + $ENV{SNAP_ROOT}/lib) + +find_library( + SNAP_CUDA_LIBRARY snap_cuda_release + HINTS ${snap_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + SNAP_DIR/lib + SNAP_LIB + $ENV{SNAP_LIB} + $ENV{SNAP_DIR}/lib + $ENV{SNAP_ROOT}/lib) + +find_library( + BC_LIBRARY bc_release + HINTS ${snap_lib_dir} + /opt/homebrew/lib + /usr/lib/x86_64-linux-gnu/ + SNAP_DIR/lib + SNAP_LIB + $ENV{SNAP_LIB} + $ENV{SNAP_DIR}/lib + $ENV{SNAP_ROOT}/lib) + +if(${CUDAToolKit_FOUND}) + set(snap_required_vars BC_LIBRARY SNAP_LIBRARY SNAP_CUDA_LIBRARY + SNAP_INCLUDE_DIR) +else() + set(snap_required_vars BC_LIBRARY SNAP_LIBRARY SNAP_INCLUDE_DIR) +endif() + +mark_as_advanced(${snap_required_vars}) + +if(SNAP_LIBRARY) + __snap_determine_version() +endif() + +find_package_handle_standard_args( + Snap + REQUIRED_VARS ${snap_required_vars} + VERSION_VAR SNAP_VERSION) + +unset(snap_lib_dir) +unset(snap_include_dir) +unset(snap_required_vars) diff --git a/cmake/parameters.cmake b/cmake/parameters.cmake index d18f0d48..f2f43205 100644 --- a/cmake/parameters.cmake +++ b/cmake/parameters.cmake @@ -2,19 +2,9 @@ list(APPEND CMAKE_PREFIX_PATH "/usr/include/mpich-x84_64" "/usr/lib64/mpich/") -# populate the default values -set_if_empty(NVAPOR 0) -set_if_empty(NCLOUD 0) -set_if_empty(NPRECIP 0) -set_if_empty(NPHASE_LEGACY 3) -set_if_empty(NCHEMISTRY 0) -set_if_empty(NTRACER 0) -set_if_empty(NTURBULENCE 0) -set_if_empty(NSTATIC 0) -set_if_empty(NINT_PARTICLE_DATA 0) -set_if_empty(NREAL_PARTICLE_DATA 0) - # dirty +set_if_empty(NMASS 0) +set_if_empty(NCHEM 0) set_if_empty(NBLOCKS 0) if(NOT AFFINE OR NOT DEFINED AFFINE) @@ -58,31 +48,6 @@ else() set(HYDROSTATIC_OPTION "HYDROSTATIC") endif() -if(NOT DISORT OR NOT DEFINED DISORT) - set(DISORT_OPTION "NOT_RT_DISORT") -else() - set(DISORT_OPTION "RT_DISORT") -endif() - -if(NOT RRTMG_SW OR NOT DEFINED RRTMG_SW) - set(RRTMG_SW_OPTION "NOT_RT_RRTMG_SW") -else() - set(RRTMG_SW_OPTION "RT_RRTMG_SW") -endif() - -if(NOT RRTMG_LW OR NOT DEFINED RRTMG_LW) - set(RRTMG_LW_OPTION "NOT_RT_RRTMG_LW") -else() - set(RRTMG_LW_OPTION "RT_RRTMG_LW") -endif() - -if(NOT PVFMM OR NOT DEFINED PVFMM) - set(PVFMM_OPTION "DISABLE_PVFMM") -else() - set(PVFMM_OPTION "ENABLE_PVFMM") - set(MPI ON) -endif() - if(NOT MPI OR NOT DEFINED MPI) set(MPI_OPTION "NOT_MPI_PARALLEL") else() @@ -93,27 +58,6 @@ else() REQUIRED) endif() -if(NOT GLOG OR NOT DEFINED GLOG) - set(GLOG_OPTION "DISABLE_GLOG") -else() - set(GLOG_OPTION "ENABLE_GLOG") - find_package(glog REQUIRED) - set(GLOG_LIBRARIES glog::glog) -endif() - -if(NOT PYTHON_BINDINGS OR NOT DEFINED PYTHON_BINDINGS) - set(PYTHON_BINDINGS_OPTION "NO_PYTHON_BINDINGS") -else() - if(NOT DEFINED PYTHON_VERSION) - find_package(Python3 3.8 REQUIRED COMPONENTS Interpreter Development.Module) - else() - set(Python3_FIND_STRATEGY VERSION) - find_package(Python3 ${PYTHON_VERSION} EXACT REQUIRED - COMPONENTS Interpreter Development.Module) - endif() - set(PYTHON_BINDINGS_OPTION "PYTHON_BINDINGS") -endif() - if(NOT NBLOCKS OR NOT DEFINED NBLOCKS) set(USE_NBLOCKS "NOT_USE_NBLOCKS") else() diff --git a/cmake/tomlpp.cmake b/cmake/tomlpp.cmake deleted file mode 100644 index a320fddd..00000000 --- a/cmake/tomlpp.cmake +++ /dev/null @@ -1,19 +0,0 @@ -include(FetchContent) - -set(FETCHCONTENT_QUIET FALSE) - -FetchContent_Declare( - tomlpp - DOWNLOAD_EXTRACT_TIMESTAMP TRUE - URL https://github.com/marzer/tomlplusplus/archive/refs/tags/v3.3.0.tar.gz) - -FetchContent_GetProperties(tomlpp) - -if(NOT tomlpp_POPULATED) - FetchContent_Populate(tomlpp) - add_subdirectory(${tomlpp_SOURCE_DIR} ${tomlpp_BINARY_DIR}) -endif() - -set(TOMLPP_INCLUDE_DIR - ${tomlpp_SOURCE_DIR}/include - CACHE PATH "include directory of toml++/toml.h") diff --git a/cmake/yamlpp.cmake b/cmake/yamlpp.cmake index 190d65aa..a91e65dc 100644 --- a/cmake/yamlpp.cmake +++ b/cmake/yamlpp.cmake @@ -11,4 +11,3 @@ set(REPO_TAG "0.8.0") add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" ON) include_directories(${yaml-cpp_SOURCE_DIR}/include) -set(YAML_CPP_LIBRARIES yaml-cpp) diff --git a/configure.h.in b/configure.h.in new file mode 100644 index 00000000..17d21355 --- /dev/null +++ b/configure.h.in @@ -0,0 +1,31 @@ +#pragma once + +enum { + NMASS = @NMASS@, // Number of mass variables in hydro + NCHEM = @NCHEM@, // Number of chemical variables in scalar + NBLOCKS = @NBLOCKS@, // Number of blocks in cubed sphere configuration +}; + +// Affine option (AFFINE or NOT_AFFINE) +#define @AFFINE_OPTION@ + +// Cubed Sphere option (CUBED_SPHERE or NOT_CUBED_SPHERE) +#define @CUBED_SPHERE_OPTION@ + +// NetCDF output (NETCDFOUTPUT or NO_NETCDFOUTPUT) +#define @NETCDF_OPTION@ + +// PNetCDF output (PNETCDFOUTPUT or NO_PNETCDFOUTPUT) +#define @PNETCDF_OPTION@ + +// FITS option (FITSOUTPUT or NOT_FITSOUTPUT) +#define @FITS_OPTION@ + +// HYDROSTATIC option (HYDROSTATIC or NOT_HYDROSTATIC) +#define @HYDROSTATIC_OPTION@ + +// MPI parallelization (MPI_PARALLEL or NOT_MPI_PARALLEL) +#define @MPI_OPTION@ + +// nblocks for exo3 option (USE_NBLOCKS or NOT_USE_NBLOCKS) +#define @USE_NBLOCKS@ diff --git a/configure.hpp.in b/configure.hpp.in deleted file mode 100644 index 61287efa..00000000 --- a/configure.hpp.in +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -enum { - // dirty cubesphere nblocks data - NBLOCKS = @NBLOCKS@, - - // thermodynamics data - NPHASE_LEGACY = @NPHASE_LEGACY@, - - // air-parcle data - NVAPOR = @NVAPOR@, - NCLOUD = @NCLOUD@, - NPRECIP = @NPRECIP@, - NCHEMISTRY = @NCHEMISTRY@, - NTRACER = @NTRACER@, - NTURBULENCE = @NTURBULENCE@, - - // n-body data - NINT_PARTICLE_DATA = @NINT_PARTICLE_DATA@, - NREAL_PARTICLE_DATA = @NREAL_PARTICLE_DATA@ -}; - -// Affine option (AFFINE or NOT_AFFINE) -#define @AFFINE_OPTION@ - -// Cubed Sphere option (CUBED_SPHERE or NOT_CUBED_SPHERE) -#define @CUBED_SPHERE_OPTION@ - -// NetCDF output (NETCDFOUTPUT or NO_NETCDFOUTPUT) -#define @NETCDF_OPTION@ - -// PNetCDF output (PNETCDFOUTPUT or NO_PNETCDFOUTPUT) -#define @PNETCDF_OPTION@ - -// FITS option (FITSOUTPUT or NOT_FITSOUTPUT) -#define @FITS_OPTION@ - -// HYDROSTATIC option (HYDROSTATIC or NOT_HYDROSTATIC) -#define @HYDROSTATIC_OPTION@ - -// MPI parallelization (MPI_PARALLEL or NOT_MPI_PARALLEL) -#define @MPI_OPTION@ - -// DISORT option (RT_DISORT or NOT_RT_DISORT) -#define @DISORT_OPTION@ - -// PVFMM option (ENABLE_PVFMM or DISABLE_PVFMM) -#define @PVFMM_OPTION@ - -// Google log option (ENABLE_GLOG or DISABLE_GLOG) -#define @GLOG_OPTION@ - -// python bindings (PYTHON_BINDINGS or NO_PYTHOND_BINDINGS) -#define @PYTHON_BINDINGS_OPTION@ - -// nblocks for exo3 option (USE_NBLOCKS or NOT_USE_NBLOCKS) -#define @USE_NBLOCKS@ - -//#define ENABLE_FIX - -// logger -#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_@LOGGER_LEVEL@ -#define LOG_TRACE(...) SPDLOG_LOGGER_TRACE(__VA_ARGS__) -#define LOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(__VA_ARGS__) -#define LOG_INFO(...) SPDLOG_LOGGER_INFO(__VA_ARGS__) -#define LOG_WARN(...) SPDLOG_LOGGER_WARN(__VA_ARGS__) -#define LOG_ERROR(...) SPDLOG_LOGGER_ERROR(__VA_ARGS__) -#define LOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(__VA_ARGS__) - -#ifdef __CUDACC__ - #define DISPATCH_MACRO __host__ __device__ -#else - #define DISPATCH_MACRO -#endif diff --git a/examples/2019-Li-snap/CMakeLists.txt b/examples/2019-Li-snap/CMakeLists.txt index ab0458b4..2c2aa1d1 100644 --- a/examples/2019-Li-snap/CMakeLists.txt +++ b/examples/2019-Li-snap/CMakeLists.txt @@ -5,14 +5,20 @@ # 1. Compile straka, robert and bryan setup_problem(straka) setup_problem(robert) -setup_problem(bryan) -setup_problem(jcrm) -# 2. Compile sedimentation -if (${NVAPOR} EQUAL 2 AND ${NCLOUD} EQUAL 4 AND ${NPHASE_LEGACY} EQUAL 3) - setup_problem(sedimentation) +if (${NMASS} EQUAL 1) + setup_problem(bryan) +endif() + +if (${NMASS} EQUAL 2) + setup_problem(jcrm) endif() +# 2. Compile sedimentation +#if (${NVAPOR} EQUAL 2 AND ${NCLOUD} EQUAL 4 AND ${NPHASE_LEGACY} EQUAL 3) +# setup_problem(sedimentation) +#endif() + # 4. Copy input files to run directory file(GLOB inputs *.inp *.yaml) foreach(input ${inputs}) diff --git a/examples/2019-Li-snap/earth-dry.yaml b/examples/2019-Li-snap/earth-dry.yaml index bf02baf6..b84e499e 100644 --- a/examples/2019-Li-snap/earth-dry.yaml +++ b/examples/2019-Li-snap/earth-dry.yaml @@ -1,14 +1,15 @@ - -phases: - - name: atm - thermo: ideal-moist - species: [atm] - kinetics: condensation - reactions: none +reference-state: + Tref: 0. + Pref: 1.e5 species: - - name: atm + - name: dry composition: {O: 0.42, N: 1.56, Ar: 0.01} - thermo: - model: constant-cp - cp0: 29.1 J/mol/K + cv_R: 2.5 + +geometry: + type: cartesian + +dynamics: + equation-of-state: + type: ideal-gas diff --git a/examples/2019-Li-snap/robert.cpp b/examples/2019-Li-snap/robert.cpp index 551e3e87..6d677e6a 100644 --- a/examples/2019-Li-snap/robert.cpp +++ b/examples/2019-Li-snap/robert.cpp @@ -25,10 +25,7 @@ // canoe #include - -// snap -#include -#include +#include // @sect3{Preamble} @@ -45,15 +42,21 @@ void MeshBlock::InitUserMeshBlockData(ParameterInput *pin) { // Set temperature and potential temperature. void MeshBlock::UserWorkBeforeOutput(ParameterInput *pin) { - auto pthermo = Thermodynamics::GetInstance(); auto &w = phydro->w; - Real gamma = peos->GetGamma(); + auto temp = get_temp(pimpl->peos, w); + auto pres = get_pres(w); + auto chi = (get_gammad() - 1.) / get_gammad(); + auto theta = temp * pow(p0 / pres, chi); + + auto temp_a = temp.accessor(); + auto theta_a = theta.accessor(); + for (int k = ks; k <= ke; ++k) for (int j = js; j <= je; ++j) for (int i = is; i <= ie; ++i) { - user_out_var(0, k, j, i) = pthermo->GetTemp(w.at(k, j, i)); - user_out_var(1, k, j, i) = potential_temp(pthermo, w.at(k, j, i), p0); + user_out_var(0, k, j, i) = temp_a[k][j][i]; + user_out_var(1, k, j, i) = theta_a[k][j][i]; } } @@ -67,13 +70,11 @@ void Mesh::InitUserMeshData(ParameterInput *pin) { // We do not need forcings other than gravity in this problem, // so we go directly to the initial condition. void MeshBlock::ProblemGenerator(ParameterInput *pin) { - auto pthermo = Thermodynamics::GetInstance(); - // Similar to @ref straka, read variables in the input file Real gamma = pin->GetReal("hydro", "gamma"); Real grav = -phydro->hsrc.GetG1(); Real Ts = pin->GetReal("problem", "Ts"); - Real Rd = pthermo->GetRd(); + Real Rd = kintera::constants::Rgas / kintera::species_weights[0]; Real cp = gamma / (gamma - 1.) * Rd; Real xc = pin->GetReal("problem", "xc"); diff --git a/examples/2019-Li-snap/robert2d.inp b/examples/2019-Li-snap/robert2d.inp index ce33a347..9625a448 100644 --- a/examples/2019-Li-snap/robert2d.inp +++ b/examples/2019-Li-snap/robert2d.inp @@ -58,7 +58,7 @@ grav_acc1 = -9.8 gamma = 1.4 # gamma = C_p/C_v -thermodynamics_config = earth-dry.yaml +config_file = earth-dry.yaml dT = 0.5 xc = 500. diff --git a/examples/2019-Li-snap/robert3d.inp b/examples/2019-Li-snap/robert3d.inp index 92e86a0a..92c27519 100644 --- a/examples/2019-Li-snap/robert3d.inp +++ b/examples/2019-Li-snap/robert3d.inp @@ -59,7 +59,7 @@ gamma = 1.4 # gamma = C_p/C_v implicit_flag = 1 -thermodynamics_config = earth-dry.yaml +config_file = earth-dry.yaml dT = 5. xc = 500. diff --git a/examples/2019-Li-snap/straka.cpp b/examples/2019-Li-snap/straka.cpp index 383ebf38..b28ef8b2 100644 --- a/examples/2019-Li-snap/straka.cpp +++ b/examples/2019-Li-snap/straka.cpp @@ -45,11 +45,8 @@ // class #include -// Finally, the Thermodynamics class works with thermodynamic aspects of the -// problem such as the temperature, potential temperature, condensation of -// vapor, etc. -#include -#include +// Finally, load the interface subroutines +#include // Functions in the math library are protected by a specific namespace because // math functions are usually concise in the names, such as min, @@ -89,21 +86,29 @@ void MeshBlock::InitUserMeshBlockData(ParameterInput *pin) { // managed by MeshBlock. As long as you have a pointer to a MeshBlock, you can // access all physics in the simulation. void MeshBlock::UserWorkBeforeOutput(ParameterInput *pin) { - auto pthermo = Thermodynamics::GetInstance(); auto &w = phydro->w; + auto temp = get_temp(pimpl->peos, w); + auto pres = get_pres(w); + auto chi = (get_gammad() - 1.) / get_gammad(); + auto theta = temp * pow(p0 / pres, chi); + // Loop over the grids. js,je,is,ie are members of the MeshBlock // class. They are integer values representing the start index and the end // index of the grids in each dimension. int k = ks; + + auto temp_a = temp.accessor(); + auto theta_a = theta.accessor(); + for (int j = js; j <= je; ++j) for (int i = is; i <= ie; ++i) { // user_out_var stores the actual data. // phydro is a pointer to the Hydro class, which has a member // w that stores density, pressure, and velocities at each // grid. - user_out_var(0, j, i) = pthermo->GetTemp(w.at(k, j, i)); - user_out_var(1, j, i) = potential_temp(pthermo, w.at(k, j, i), p0); + user_out_var(0, j, i) = temp_a[k][j][i]; + user_out_var(1, j, i) = theta_a[k][j][i]; } } @@ -129,9 +134,13 @@ void Diffusion(MeshBlock *pmb, Real const time, Real const dt, Real dx = pmb->pcoord->dx1f(pmb->is); Real dy = pmb->pcoord->dx2f(pmb->js); - // Similarly, we use pmb to find the pointer to the - // Thermodynamics class, pthermo. - auto pthermo = Thermodynamics::GetInstance(); + auto temp = get_temp(pmb->pimpl->peos, w); + auto pres = get_pres(w); + auto chi = (get_gammad() - 1.) / get_gammad(); + auto theta = temp * pow(p0 / pres, chi); + + auto temp_a = temp.accessor(); + auto theta_a = theta.accessor(); // Loop over the grids. int k = pmb->ks; @@ -140,16 +149,16 @@ void Diffusion(MeshBlock *pmb, Real const time, Real const dt, // Similar to what we have done in MeshBlock::UserWorkBeforeOutput, we use // the Thermodynamics class to calculate temperature and potential // temperature. - Real temp = pthermo->GetTemp(w.at(pmb->ks, j, i)); - Real theta = potential_temp(pthermo, w.at(pmb->ks, j, i), p0); + Real temp = temp_a[k][j][i]; + Real theta = theta_a[k][j][i]; // The thermal diffusion is applied to the potential temperature field, // which is not exactly correct. But this is the setting of the test // program. - Real theta_ip1_j = potential_temp(pthermo, w.at(k, j + 1, i), p0); - Real theta_im1_j = potential_temp(pthermo, w.at(k, j - 1, i), p0); - Real theta_i_jp1 = potential_temp(pthermo, w.at(k, j, i + 1), p0); - Real theta_i_jm1 = potential_temp(pthermo, w.at(k, j, i - 1), p0); + Real theta_ip1_j = theta_a[k][j + 1][i]; + Real theta_im1_j = theta_a[k][j - 1][i]; + Real theta_i_jp1 = theta_a[k][j][i + 1]; + Real theta_i_jm1 = theta_a[k][j][i - 1]; // Add viscous dissipation to the velocities. Now you encounter another // variable called u. u stands for `conserved @@ -191,14 +200,12 @@ void Diffusion(MeshBlock *pmb, Real const time, Real const dt, // first and then it instantiates all MeshBlocks inside it. Therefore, this // subroutine runs before any MeshBlock. void Mesh::InitUserMeshData(ParameterInput *pin) { - auto pthermo = Thermodynamics::GetInstance(); - // The program specific forcing parameters are set here. // They come from the input file, which is parsed by the ParameterInput class Real gamma = pin->GetReal("hydro", "gamma"); K = pin->GetReal("problem", "K"); p0 = pin->GetReal("problem", "p0"); - Rd = pthermo->GetRd(); + Rd = pin->GetReal("hydro", "Rd"); cp = gamma / (gamma - 1.) * Rd; // This line code enrolls the forcing function we wrote in diff --git a/examples/2019-Li-snap/straka.inp b/examples/2019-Li-snap/straka.inp index 67bf7840..cf1c4bfa 100644 --- a/examples/2019-Li-snap/straka.inp +++ b/examples/2019-Li-snap/straka.inp @@ -21,11 +21,6 @@ file_type = netcdf variable = uov dt = 300. - -file_type = netcdf -variable = diag -dt = 300. -