From c34849cbc20084c06a646747c45a56fb24b95586 Mon Sep 17 00:00:00 2001 From: landinjm Date: Wed, 10 Sep 2025 09:51:25 -0700 Subject: [PATCH 01/17] updating clang-tidy --- .clang-tidy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 66e965100..af9f78ee3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,6 +9,7 @@ Checks: > cppcoreguidelines-*, hicpp-*, misc-*, + -misc-include-cleaner, modernize-*, -modernize-use-trailing-return-type, mpi-*, @@ -31,9 +32,9 @@ CheckOptions: - key: readability-identifier-naming.ConstexprFunctionCase value: lower_case - key: readability-identifier-naming.EnumCase - value: CamelCase + value: UPPER_CASE - key: readability-identifier-naming.EnumConstantCase - value: CamelCase + value: UPPER_CASE - key: readability-identifier-naming.FunctionCase value: lower_case - key: readability-identifier-naming.GlobalConstantCase From cff85b2c46ca771c96b14aa34e57efd5b79f8f36 Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 29 Sep 2025 16:52:18 -0700 Subject: [PATCH 02/17] some cppcheck things --- include/prismspf/core/matrix_free_operator.h | 2 +- include/prismspf/field_input/read_binary.h | 15 +++++++-------- include/prismspf/nucleation/nucleation.h | 6 +++--- include/prismspf/solvers/linear_solver_base.h | 4 ++-- include/prismspf/utilities/element_volume.h | 2 +- src/utilities/element_volume.cc | 3 ++- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/prismspf/core/matrix_free_operator.h b/include/prismspf/core/matrix_free_operator.h index eb0e40b61..73cd96145 100644 --- a/include/prismspf/core/matrix_free_operator.h +++ b/include/prismspf/core/matrix_free_operator.h @@ -254,7 +254,7 @@ class MatrixFreeOperator : public MATRIX_FREE_OPERATOR_BASE /** * @brief The element volume container */ - const ElementVolume *element_volume_handler; + const ElementVolume *element_volume_handler = nullptr; /** * @brief PDE operator object for user defined PDEs. diff --git a/include/prismspf/field_input/read_binary.h b/include/prismspf/field_input/read_binary.h index 07eeb2ced..0d8ce8d9c 100644 --- a/include/prismspf/field_input/read_binary.h +++ b/include/prismspf/field_input/read_binary.h @@ -197,11 +197,13 @@ inline dealii::Vector ReadBinary::interpolate(const dealii::Point &point, const unsigned int n_pt_values) { - std::vector> indices(dim, - std::array { - {0u, 0u} - }); // lower and upper indices in - // each dimension + std::vector> indices(dim, + std::array { + {0u, 0u} + }); + // lower and upper + // indices in each + // dimension std::vector> weights( dim, std::array { @@ -210,9 +212,6 @@ ReadBinary::interpolate(const dealii::Point &point, for (unsigned int j = 0; j < dim; ++j) { indices[j][0] = (dealii::types::global_dof_index) std::floor(dNdx[j] * point[j]); - AssertThrow(indices[j][0] >= 0, - dealii::ExcMessage( - "negative index encountered in ReadBinary::interpolate")); AssertThrow(indices[j][0] < this->ic_file.n_data_points[j], dealii::ExcMessage( "index out of bounds encountered in ReadBinary::interpolate")); diff --git a/include/prismspf/nucleation/nucleation.h b/include/prismspf/nucleation/nucleation.h index 425c25090..2be21789e 100644 --- a/include/prismspf/nucleation/nucleation.h +++ b/include/prismspf/nucleation/nucleation.h @@ -261,7 +261,7 @@ NucleationHandler::gather_exclude_broadcast_nuclei( // Set up refs const NucleationParameters &nuc_params = user_inputs.get_nucleation_parameters(); const TemporalDiscretization &time_info = user_inputs.get_temporal_discretization(); - RNGEngine &rng = user_inputs.get_miscellaneous_parameters().rng; + RNGEngine &rng = user_inputs.get_miscellaneous_parameters().rng; // Gather new nuclei to root process std::vector> new_nuclei(new_nuclei_list.begin(), new_nuclei_list.end()); @@ -281,7 +281,7 @@ NucleationHandler::gather_exclude_broadcast_nuclei( while (!new_nuclei.empty()) { - Nucleus &nuc = new_nuclei.back(); + const Nucleus &nuc = new_nuclei.back(); bool valid = std::none_of(global_nuclei.begin(), global_nuclei.end(), @@ -397,4 +397,4 @@ NucleationHandler::mpi_broadcast_nuclei( MPI_Bcast(local_nuclei.data(), count, Nucleus::mpi_datatype(), 0, MPI_COMM_WORLD); } -PRISMS_PF_END_NAMESPACE \ No newline at end of file +PRISMS_PF_END_NAMESPACE diff --git a/include/prismspf/solvers/linear_solver_base.h b/include/prismspf/solvers/linear_solver_base.h index b8564180c..0286e2d0f 100644 --- a/include/prismspf/solvers/linear_solver_base.h +++ b/include/prismspf/solvers/linear_solver_base.h @@ -434,7 +434,7 @@ class LinearSolverBase /** * @brief Residual vector. */ - VectorType *residual; + VectorType *residual = nullptr; /** * @brief Mapping from global solution vectors to the local ones for the newton update. @@ -449,7 +449,7 @@ class LinearSolverBase /** * @brief Newton update vector. */ - VectorType *newton_update; + VectorType *newton_update = nullptr; /** * @brief Matrix-free operator for the residual side. diff --git a/include/prismspf/utilities/element_volume.h b/include/prismspf/utilities/element_volume.h index 44142de5c..4c62b3aa1 100644 --- a/include/prismspf/utilities/element_volume.h +++ b/include/prismspf/utilities/element_volume.h @@ -74,7 +74,7 @@ class ElementVolumeContainer /** * @brief Constructor. */ - explicit ElementVolumeContainer(MGInfo &mg_info); + explicit ElementVolumeContainer(const MGInfo &mg_info); /** * @brief Initialize the element volume container. diff --git a/src/utilities/element_volume.cc b/src/utilities/element_volume.cc index 0e359fe5c..10ebfa47e 100644 --- a/src/utilities/element_volume.cc +++ b/src/utilities/element_volume.cc @@ -93,7 +93,8 @@ ElementVolume::get_element_volume(unsigned cell) const }; template -ElementVolumeContainer::ElementVolumeContainer(MGInfo &mg_info) +ElementVolumeContainer::ElementVolumeContainer( + const MGInfo &mg_info) : element_volume() , multigrid_element_volume(0, 0) { From 200bc6228f55d5d5b0b45b9541f140d268f1ebfc Mon Sep 17 00:00:00 2001 From: landinjm Date: Thu, 2 Oct 2025 17:21:18 -0700 Subject: [PATCH 03/17] updating units tests and cmake stuff --- .clang-tidy | 4 +- .github/workflows/clang-tidy.yml | 3 +- .github/workflows/cppcheck.yml | 2 +- .gitignore | 1 + CMakeLists.txt | 177 +++--- applications/_CHAC_anisotropy/CMakeLists.txt | 25 - .../CMakeLists.txt | 25 - .../_CHAC_performance_test/CMakeLists.txt | 25 - .../CHiMaD_benchmark1a/CMakeLists.txt | 39 -- .../CHiMaD_benchmark1b/CMakeLists.txt | 39 -- .../CHiMaD_benchmark1c/CMakeLists.txt | 39 -- .../CHiMaD_benchmark2a/CMakeLists.txt | 39 -- .../CHiMaD_benchmark3a/CMakeLists.txt | 39 -- .../CHiMaD_benchmark6a/CMakeLists.txt | 39 -- .../CHiMaD_benchmark6b/CMakeLists.txt | 39 -- .../CHiMaD_benchmark7a/CMakeLists.txt | 39 -- .../_allen_cahn_conserved/CMakeLists.txt | 25 - .../CMakeLists.txt | 25 - applications/_anisotropy_facet/CMakeLists.txt | 25 - applications/_corrosion/CMakeLists.txt | 25 - .../_corrosion_microgalvanic/CMakeLists.txt | 25 - .../_dendritic_solidification/CMakeLists.txt | 25 - .../_fickian_diffusion/CMakeLists.txt | 25 - applications/_grainGrowth/CMakeLists.txt | 25 - .../_grainGrowth_dream3d/CMakeLists.txt | 25 - applications/_mechanics/CMakeLists.txt | 25 - .../_nucleation_preferential/CMakeLists.txt | 25 - cmake/macros/macro_define_library.cmake | 41 +- cmake/macros/macro_prisms_pf_autopilot.cmake | 2 - cmake/modules/FindPRISMS_PF_DEAL_II.cmake | 88 ++- cmake/prisms_pf_config.cmake.in | 3 +- cmake/setup_application.cmake | 15 - cmake/setup_cached_variables.cmake | 97 +--- cmake/setup_prisms_pf.cmake | 63 ++- cmake/templates.in | 4 +- cmake/write_config.cmake | 18 +- doc/doxygen/installation/installation.h | 2 - include/prismspf/config.h.in | 3 - include/prismspf/core/cell_marker_base.h | 4 +- include/prismspf/core/variable_container.h | 2 +- include/prismspf/field_input/read_binary.h | 411 +++++++++----- include/prismspf/nucleation/nucleation.h | 8 +- include/prismspf/solvers/solver_context.h | 4 +- .../load_initial_condition_parameters.h | 2 +- .../user_inputs/spatial_discretization.h | 11 +- include/prismspf/user_inputs/user_constants.h | 47 +- src/core/initial_conditions.cc | 2 +- src/core/matrix_free_operator.cc | 2 +- src/core/variable_container.cc | 8 +- src/solvers/concurrent_solver.cc | 4 +- src/user_inputs/input_file_reader.cc | 2 +- tests/unit_tests/.gitignore | 5 + tests/unit_tests/CMakeLists.txt | 181 +----- tests/unit_tests/core/CMakeLists.txt | 14 + tests/unit_tests/{ => core}/main.cc | 0 tests/unit_tests/field_input/CMakeLists.txt | 14 + tests/unit_tests/field_input/main.cc | 5 + tests/unit_tests/field_input/read_binary.cc | 529 +++++++++++++++--- tests/unit_tests/field_input/read_vtk.cc | 20 +- tests/unit_tests/user_inputs/CMakeLists.txt | 14 + tests/unit_tests/user_inputs/main.cc | 5 + tests/unit_tests/utilities/CMakeLists.txt | 14 + tests/unit_tests/utilities/main.cc | 5 + 63 files changed, 1105 insertions(+), 1393 deletions(-) delete mode 100644 applications/_CHAC_anisotropy/CMakeLists.txt delete mode 100644 applications/_CHAC_anisotropy_regularized/CMakeLists.txt delete mode 100644 applications/_CHAC_performance_test/CMakeLists.txt delete mode 100644 applications/_CHiMaD_benchmarks/CHiMaD_benchmark1a/CMakeLists.txt delete mode 100644 applications/_CHiMaD_benchmarks/CHiMaD_benchmark1b/CMakeLists.txt delete mode 100644 applications/_CHiMaD_benchmarks/CHiMaD_benchmark1c/CMakeLists.txt delete mode 100644 applications/_CHiMaD_benchmarks/CHiMaD_benchmark2a/CMakeLists.txt delete mode 100755 applications/_CHiMaD_benchmarks/CHiMaD_benchmark3a/CMakeLists.txt delete mode 100644 applications/_CHiMaD_benchmarks/CHiMaD_benchmark6a/CMakeLists.txt delete mode 100644 applications/_CHiMaD_benchmarks/CHiMaD_benchmark6b/CMakeLists.txt delete mode 100644 applications/_CHiMaD_benchmarks/CHiMaD_benchmark7a/CMakeLists.txt delete mode 100644 applications/_allen_cahn_conserved/CMakeLists.txt delete mode 100644 applications/_alloy_solidification_uniform/CMakeLists.txt delete mode 100644 applications/_anisotropy_facet/CMakeLists.txt delete mode 100644 applications/_corrosion/CMakeLists.txt delete mode 100644 applications/_corrosion_microgalvanic/CMakeLists.txt delete mode 100644 applications/_dendritic_solidification/CMakeLists.txt delete mode 100644 applications/_fickian_diffusion/CMakeLists.txt delete mode 100644 applications/_grainGrowth/CMakeLists.txt delete mode 100644 applications/_grainGrowth_dream3d/CMakeLists.txt delete mode 100644 applications/_mechanics/CMakeLists.txt delete mode 100644 applications/_nucleation_preferential/CMakeLists.txt create mode 100644 tests/unit_tests/.gitignore create mode 100644 tests/unit_tests/core/CMakeLists.txt rename tests/unit_tests/{ => core}/main.cc (100%) create mode 100644 tests/unit_tests/field_input/CMakeLists.txt create mode 100644 tests/unit_tests/field_input/main.cc create mode 100644 tests/unit_tests/user_inputs/CMakeLists.txt create mode 100644 tests/unit_tests/user_inputs/main.cc create mode 100644 tests/unit_tests/utilities/CMakeLists.txt create mode 100644 tests/unit_tests/utilities/main.cc diff --git a/.clang-tidy b/.clang-tidy index af9f78ee3..a2ced517b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -32,9 +32,9 @@ CheckOptions: - key: readability-identifier-naming.ConstexprFunctionCase value: lower_case - key: readability-identifier-naming.EnumCase - value: UPPER_CASE + value: CamelCase - key: readability-identifier-naming.EnumConstantCase - value: UPPER_CASE + value: CamelCase - key: readability-identifier-naming.FunctionCase value: lower_case - key: readability-identifier-naming.GlobalConstantCase diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 53d531f27..740e84a8f 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -51,5 +51,4 @@ jobs: - name: Run clang-tidy run: | - ./contrib/utilities/clang_tidy.sh -j$(nproc) -D REDUCED_TEMPLATES=ON - + ./contrib/utilities/clang_tidy.sh -j$(nproc) diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index ac28295f0..1380e3b05 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -49,5 +49,5 @@ jobs: - name: Run cppcheck run: | - ./contrib/utilities/cppcheck.sh -j$(nproc) -D REDUCED_TEMPLATES=ON + ./contrib/utilities/cppcheck.sh -j$(nproc) diff --git a/.gitignore b/.gitignore index a528afad2..1a33cc6e8 100644 --- a/.gitignore +++ b/.gitignore @@ -41,5 +41,6 @@ main-debug *.pvtu *.vtk *.log +*.bin output.txt error.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d24c1386..af9cec656 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,9 +73,6 @@ endforeach() message(STATUS "Using PRISMS_PF_WITH_ZLIB = '${PRISMS_PF_WITH_ZLIB}'") message(STATUS "Using PRISMS_PF_WITH_VTK = '${PRISMS_PF_WITH_VTK}'") -message(STATUS "Using PRISMS_PF_WITH_HDF5 = '${PRISMS_PF_WITH_HDF5}'") -message(STATUS "Using PRISMS_PF_WITH_SUNDIALS = '${PRISMS_PF_WITH_SUNDIALS}'") -message(STATUS "Using PRISMS_PF_WITH_CUDA = '${PRISMS_PF_WITH_CUDA}'") message(STATUS "Using PRISMS_PF_WITH_CALIPER = '${PRISMS_PF_WITH_CALIPER}'") # ========================================================= @@ -94,10 +91,6 @@ set(PRISMS_PF_SOURCE_DIR ${CMAKE_SOURCE_DIR}) if(ADDITIONAL_DEGREES) set(EXPAND_DEGREES "; 3; 4; 5; 6") endif() -if(NOT REDUCED_TEMPLATES) - set(EXPAND_DIMENSIONS "; 3") - set(EXPAND_NUMBERS "; double") -endif() configure_file( ${CMAKE_SOURCE_DIR}/include/prismspf/config.h.in @@ -216,29 +209,6 @@ add_custom_target( ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake ) -if(${FORCE_COLORED_OUTPUT}) - if( - CMAKE_CXX_COMPILER_ID MATCHES "Clang" - OR CMAKE_CXX_COMPILER MATCHES "AppleClang" - ) - string(APPEND DEAL_II_CXX_FLAGS_DEBUG " -fcolor-diagnostics") - string(APPEND DEAL_II_CXX_FLAGS_RELEASE " -fcolor-diagnostics") - elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - string(APPEND DEAL_II_CXX_FLAGS_DEBUG " -fdiagnostics-color=always") - string(APPEND DEAL_II_CXX_FLAGS_RELEASE " -fdiagnostics-color=always") - endif() -endif() - -# deal.II versions >=9.5 disable deprecation warnings in user code. Enable -# the warnings again by removing the flag that disables them. -string( - REPLACE - "-Wno-deprecated-declarations" - "" - DEAL_II_WARNING_FLAGS - "${DEAL_II_WARNING_FLAGS}" -) - # Set additional compiler flags set(PRISMS_PF_ADDITIONAL_CXX_FLAGS "" @@ -251,93 +221,102 @@ if(NOT PRISMS_PF_ADDITIONAL_CXX_FLAGS STREQUAL "") STATUS "Appending PRISMS_PF_ADDITIONAL_CXX_FLAGS: '${PRISMS_PF_ADDITIONAL_CXX_FLAGS}':" ) - string(APPEND DEAL_II_CXX_FLAGS_DEBUG " ${PRISMS_PF_ADDITIONAL_CXX_FLAGS}") - string( - APPEND - DEAL_II_CXX_FLAGS_RELEASE - " ${PRISMS_PF_ADDITIONAL_CXX_FLAGS}" - ) - message(STATUS " DEAL_II_WARNING_FLAGS: ${DEAL_II_WARNING_FLAGS}") - message(STATUS " DEAL_II_CXX_FLAGS_DEBUG: ${DEAL_II_CXX_FLAGS_DEBUG}") - message(STATUS " DEAL_II_CXX_FLAGS_RELEASE: ${DEAL_II_CXX_FLAGS_RELEASE}") + string(APPEND PRISMS_PF_CXX_FLAGS " ${PRISMS_PF_ADDITIONAL_CXX_FLAGS}") + message(STATUS " PRISMS_PF_WARNING_FLAGS: ${PRISMS_PF_WARNING_FLAGS}") + message(STATUS " PRISMS_PF_CXX_FLAGS: ${PRISMS_PF_CXX_FLAGS}") + message(STATUS " PRISMS_PF_CXX_FLAGS_DEBUG: ${PRISMS_PF_CXX_FLAGS_DEBUG}") + message(STATUS " PRISMS_PF_CXX_FLAGS_RELEASE: ${PRISMS_PF_CXX_FLAGS_RELEASE}") endif() -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - set(LIBRARY_NAME_DEBUG "prisms_pf_debug") - add_library(${LIBRARY_NAME_DEBUG} STATIC) - target_sources(${LIBRARY_NAME_DEBUG} PRIVATE ${PRISMS_PF_SOURCE_FILES}) - set_property( - TARGET ${LIBRARY_NAME_DEBUG} - PROPERTY OUTPUT_NAME prisms-pf-debug +foreach(_build ${PRISMS_PF_BUILD_TYPES}) + # Create a target for each build type. Note that the build types are + # mixed case (e.g., Debug) so we need to convert them to lowercase and + # uppercase for various uses. + string(TOLOWER ${_build} _build_lowercase) + string(TOUPPER ${_build} _build_uppercase) + set(_library "prisms_pf_${_build_lowercase}") + + # Add the library and set some properties + add_library(${_library} STATIC) + set_target_properties( + ${_target} + PROPERTIES + LINKER_LANGUAGE CXX + OUTPUT_NAME "prisms-pf-${_build_lowercase}" ) - target_link_libraries( - ${LIBRARY_NAME_DEBUG} - prisms_pf_core_debug - prisms_pf_solvers_debug - prisms_pf_user_inputs_debug - prisms_pf_utilities_debug + target_sources(${_library} PRIVATE ${PRISMS_PF_SOURCE_FILES}) + + # Collect the libraries to link against and the include directories + set(_library_dependencies + prisms_pf_core_${_build_lowercase} + prisms_pf_solvers_${_build_lowercase} + prisms_pf_user_inputs_${_build_lowercase} + prisms_pf_utilities_${_build_lowercase} ) - # Add explicit dependencies to ensure proper build order with Ninja - add_dependencies( - ${LIBRARY_NAME_DEBUG} - prisms_pf_core_debug - prisms_pf_solvers_debug - prisms_pf_user_inputs_debug - prisms_pf_utilities_debug + set(_include_directories + ${PRISMS_PF_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/include + ${CMAKE_BINARY_DIR}/src + include ) + + # Link the PRISMS-PF libraries + target_link_libraries(${_library} PRIVATE ${_library_dependencies}) + # Add explicit dependencies to ensure proper build order with Ninja + add_dependencies(${_library} ${_library_dependencies}) + + # Set the include directories target_include_directories( - ${LIBRARY_NAME_DEBUG} + ${_library} PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/src include ) + target_compile_options( + ${_library} + PRIVATE + $<$:${PRISMS_PF_WARNING_FLAGS} + ${PRISMS_PF_CXX_FLAGS} + ${PRISMS_PF_CXX_FLAGS_${_build_uppercase}}> + ) + target_link_options( + ${_library} + PRIVATE + $<$:${PRISMS_PF_LINKER_FLAGS} + ${PRISMS_PF_LINKER_FLAGS_${_build_uppercase}}> + ) + + # Add other dependencies, making sure they are public so that they + # propagate to targets that link against this library + + # VTK if(${VTK_BUILT_SEPARATELY}) - include_directories(SYSTEM ${VTK_INCLUDE_DIR}) - target_link_libraries(${LIBRARY_NAME_DEBUG} ${VTK_NEW_LIBRARIES}) + target_include_directories(${_library} SYSTEM PUBLIC ${VTK_INCLUDE_DIR}) + target_link_libraries(${_library} PUBLIC ${VTK_NEW_LIBRARIES}) endif() + + # caliper if(${PRISMS_PF_WITH_CALIPER}) - target_link_libraries(${LIBRARY_NAME_DEBUG} caliper) + target_link_libraries(${_library} PUBLIC caliper) endif() - deal_ii_setup_target(${LIBRARY_NAME_DEBUG} DEBUG) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - set(LIBRARY_NAME_RELEASE "prisms_pf_release") - add_library(${LIBRARY_NAME_RELEASE} STATIC) - target_sources(${LIBRARY_NAME_RELEASE} PRIVATE ${PRISMS_PF_SOURCE_FILES}) - set_property( - TARGET ${LIBRARY_NAME_RELEASE} - PROPERTY OUTPUT_NAME prisms-pf-release - ) + # deal.II target_link_libraries( - ${LIBRARY_NAME_RELEASE} - prisms_pf_core_release - prisms_pf_solvers_release - prisms_pf_user_inputs_release - prisms_pf_utilities_release - ) - # Add explicit dependencies to ensure proper build order with Ninja - add_dependencies( - ${LIBRARY_NAME_RELEASE} - prisms_pf_core_release - prisms_pf_solvers_release - prisms_pf_user_inputs_release - prisms_pf_utilities_release - ) - target_include_directories( - ${LIBRARY_NAME_RELEASE} - PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/src include + ${_library} + PUBLIC ${DEAL_II_TARGET_${_build_uppercase}} ) +endforeach() - if(${VTK_BUILT_SEPARATELY}) - include_directories(SYSTEM ${VTK_INCLUDE_DIR}) - target_link_libraries(${LIBRARY_NAME_RELEASE} ${VTK_NEW_LIBRARIES}) - endif() - if(${PRISMS_PF_WITH_CALIPER}) - target_link_libraries(${LIBRARY_NAME_RELEASE} caliper) - endif() +# Testing infrastructure +if(UNIT_TESTS) + enable_testing() + add_subdirectory(tests/unit_tests) - deal_ii_setup_target(${LIBRARY_NAME_RELEASE} RELEASE) + add_custom_target(run_tests + COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure + DEPENDS test_core test_field_input test_user_inputs test_utilities + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Run all tests" + ) endif() # Unwrap the compiler compile_commands.json after the build diff --git a/applications/_CHAC_anisotropy/CMakeLists.txt b/applications/_CHAC_anisotropy/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_CHAC_anisotropy/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_CHAC_anisotropy_regularized/CMakeLists.txt b/applications/_CHAC_anisotropy_regularized/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_CHAC_anisotropy_regularized/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_CHAC_performance_test/CMakeLists.txt b/applications/_CHAC_performance_test/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_CHAC_performance_test/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1a/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1a/CMakeLists.txt deleted file mode 100644 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1a/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1b/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1b/CMakeLists.txt deleted file mode 100644 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1b/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1c/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1c/CMakeLists.txt deleted file mode 100644 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark1c/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark2a/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark2a/CMakeLists.txt deleted file mode 100644 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark2a/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark3a/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark3a/CMakeLists.txt deleted file mode 100755 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark3a/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark6a/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark6a/CMakeLists.txt deleted file mode 100644 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark6a/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark6b/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark6b/CMakeLists.txt deleted file mode 100644 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark6b/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark7a/CMakeLists.txt b/applications/_CHiMaD_benchmarks/CHiMaD_benchmark7a/CMakeLists.txt deleted file mode 100644 index 4c61b3240..000000000 --- a/applications/_CHiMaD_benchmarks/CHiMaD_benchmark7a/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.8.0) - -include(${CMAKE_SOURCE_DIR}/../../../cmake/setup_application.cmake) - -project(myapp CXX) - -# Set location of files -include_directories(${CMAKE_SOURCE_DIR}/../../../include) -include_directories(${CMAKE_SOURCE_DIR}/../../../src) -include_directories(${CMAKE_SOURCE_DIR}) - -# Set the location of the main.cc file -set(TARGET_SRC "${CMAKE_SOURCE_DIR}/../../main.cc") - -# Set targets & link libraries for the build type -if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - add_executable(main_debug ${TARGET_SRC}) - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) - target_link_libraries( - main_debug - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-debug.a - ) -endif() - -if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - add_executable(main_release ${TARGET_SRC}) - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) - target_link_libraries( - main_release - ${CMAKE_SOURCE_DIR}/../../../libprisms-pf-release.a - ) -endif() diff --git a/applications/_allen_cahn_conserved/CMakeLists.txt b/applications/_allen_cahn_conserved/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_allen_cahn_conserved/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_alloy_solidification_uniform/CMakeLists.txt b/applications/_alloy_solidification_uniform/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_alloy_solidification_uniform/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_anisotropy_facet/CMakeLists.txt b/applications/_anisotropy_facet/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_anisotropy_facet/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_corrosion/CMakeLists.txt b/applications/_corrosion/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_corrosion/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_corrosion_microgalvanic/CMakeLists.txt b/applications/_corrosion_microgalvanic/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_corrosion_microgalvanic/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_dendritic_solidification/CMakeLists.txt b/applications/_dendritic_solidification/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_dendritic_solidification/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_fickian_diffusion/CMakeLists.txt b/applications/_fickian_diffusion/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_fickian_diffusion/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_grainGrowth/CMakeLists.txt b/applications/_grainGrowth/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_grainGrowth/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_grainGrowth_dream3d/CMakeLists.txt b/applications/_grainGrowth_dream3d/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_grainGrowth_dream3d/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_mechanics/CMakeLists.txt b/applications/_mechanics/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_mechanics/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/applications/_nucleation_preferential/CMakeLists.txt b/applications/_nucleation_preferential/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/applications/_nucleation_preferential/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/cmake/macros/macro_define_library.cmake b/cmake/macros/macro_define_library.cmake index 28a2c42d4..b86e6aa34 100644 --- a/cmake/macros/macro_define_library.cmake +++ b/cmake/macros/macro_define_library.cmake @@ -4,33 +4,58 @@ function(define_library _library) foreach(_build ${PRISMS_PF_BUILD_TYPES}) + # Create a target for each build type. Note that the build types are + # mixed case (e.g., Debug) so we need to convert them to lowercase and + # uppercase for various uses. string(TOLOWER ${_build} _build_lowercase) string(TOUPPER ${_build} _build_uppercase) set(_target "${_library}_${_build_lowercase}") + # Add the library and set some properties add_library(${_target} ${ARGN}) + set_target_properties(${_target} PROPERTIES LINKER_LANGUAGE CXX) - set_target_properties(${_target} PROPERTIES LINKER_LANGUAGE "CXX") - + # Set the include directories target_include_directories( ${_target} SYSTEM PUBLIC ${PRISMS_PF_INCLUDE_DIRS} + PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/src ) - target_include_directories( + target_compile_options( ${_target} - PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/src + PRIVATE + $<$:${PRISMS_PF_WARNING_FLAGS} ${PRISMS_PF_CXX_FLAGS} ${PRISMS_PF_CXX_FLAGS_${_build_uppercase}}> + ) + target_link_options( + ${_target} + PRIVATE + $<$:${PRISMS_PF_LINKER_FLAGS} ${PRISMS_PF_LINKER_FLAGS_${_build_uppercase}}> ) + # Add other dependencies, making sure they are public so that they + # propagate to targets that link against this library + + # VTK if(${VTK_BUILT_SEPARATELY}) - include_directories(SYSTEM ${VTK_INCLUDE_DIR}) - target_link_libraries(${_target} ${VTK_NEW_LIBRARIES}) + target_include_directories( + ${_target} + SYSTEM + PUBLIC ${VTK_INCLUDE_DIR} + ) + target_link_libraries(${_target} PUBLIC ${VTK_NEW_LIBRARIES}) endif() + + # caliper if(${PRISMS_PF_WITH_CALIPER}) - target_link_libraries(${_target} caliper) + target_link_libraries(${_target} PUBLIC caliper) endif() - deal_ii_setup_target(${_target} ${_build_uppercase}) + # deal.II + target_link_libraries( + ${_target} + PUBLIC ${DEAL_II_TARGET_${_build_uppercase}} + ) endforeach() endfunction() diff --git a/cmake/macros/macro_prisms_pf_autopilot.cmake b/cmake/macros/macro_prisms_pf_autopilot.cmake index 4779201ad..efbac4497 100644 --- a/cmake/macros/macro_prisms_pf_autopilot.cmake +++ b/cmake/macros/macro_prisms_pf_autopilot.cmake @@ -97,7 +97,6 @@ macro(prisms_pf_autopilot PRISMS_PF_CORE_DIR) # Set targets & link libraries for the build type if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - deal_ii_setup_target(main_debug DEBUG) target_link_libraries( main_debug ${PRISMS_PF_CORE_DIR}/libprisms-pf-debug.a @@ -114,7 +113,6 @@ macro(prisms_pf_autopilot PRISMS_PF_CORE_DIR) if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - deal_ii_setup_target(main_release RELEASE) target_link_libraries( main_release ${PRISMS_PF_CORE_DIR}/libprisms-pf-release.a diff --git a/cmake/modules/FindPRISMS_PF_DEAL_II.cmake b/cmake/modules/FindPRISMS_PF_DEAL_II.cmake index 0cf410882..ec4bf84bc 100644 --- a/cmake/modules/FindPRISMS_PF_DEAL_II.cmake +++ b/cmake/modules/FindPRISMS_PF_DEAL_II.cmake @@ -70,59 +70,41 @@ if(PRISMS_PF_WITH_ZLIB) endif() endif() -if(PRISMS_PF_AUTODETECTION AND DEAL_II_WITH_HDF5) - set(PRISMS_PF_WITH_HDF5 ON) -endif() -if(PRISMS_PF_WITH_HDF5) - if(DEAL_II_WITH_HDF5) - message(STATUS " Found deal.II installation with HDF5") - else() - message( - FATAL_ERROR - "deal.II installation with HDF5 not found. Disable PRISMS_PF_WITH_HDF5 or recompile deal.II with HDF5." - ) - endif() -endif() +macro(append_flags SOURCE_FLAGS DEST_FLAGS) + if(${SOURCE_FLAGS}) + separate_arguments(_temp_flags NATIVE_COMMAND "${${SOURCE_FLAGS}}") + foreach(flag IN LISTS _temp_flags) + list(APPEND ${DEST_FLAGS} "${flag}") + endforeach() + endif() +endmacro() -if(PRISMS_PF_AUTODETECTION AND DEAL_II_WITH_SUNDIALS) - set(PRISMS_PF_WITH_SUNDIALS ON) -endif() -if(PRISMS_PF_WITH_SUNDIALS) - if(DEAL_II_WITH_SUNDIALS) - message(STATUS " Found deal.II installation with SUNDIALS") - else() - message( - FATAL_ERROR - "deal.II installation with SUNDIALS not found. Disable PRISMS_PF_WITH_SUNDIALS or recompile deal.II with SUNDIALS." - ) - endif() -endif() +function(remove_std_flag variable_name) + # Get the current value + set(flags "${${variable_name}}") + + # Remove any -std=c++XX or -std=gnu++XX flags + string(REGEX REPLACE "-std=[^ ]+" "" flags "${flags}") + + # Clean up any extra spaces + string(REGEX REPLACE " +" " " flags "${flags}") + string(STRIP "${flags}" flags) + + # Set the modified value back to the parent scope + set(${variable_name} "${flags}" PARENT_SCOPE) +endfunction() -# To enable CUDA in PRISMS-PF, deal.II must be built with Kokkos -set(KOKKOS_CUDA_BACKEND - OFF - CACHE BOOL - "Whether the installed Kokkos version has a CUDA backend." -) -mark_as_advanced(KOKKOS_CUDA_BACKEND) -if(DEAL_II_WITH_KOKKOS) - find_package(Kokkos QUIET HINTS ${KOKKOS_DIR} $ENV{KOKKOS_DIR}) - if(Kokkos_FOUND AND Kokkos_DEVICES MATCHES "CUDA") - set(KOKKOS_CUDA_BACKEND ON) - endif() -endif() -if(PRISMS_PF_AUTODETECTION AND KOKKOS_CUDA_BACKEND) - set(PRISMS_PF_WITH_CUDA ON) -endif() -if(PRISMS_PF_WITH_CUDA) - if(KOKKOS_CUDA_BACKEND) - message(STATUS " Found Kokkos installation with CUDA") - else() - message( - FATAL_ERROR - "Kokkos installation with CUDA not found. Disable PRISMS_PF_WITH_CUDA or recompile deal.II with Kokkos that has a CUDA backend." - ) - endif() -endif() +# Grab relevant deal.II flags and put them into our own variables +append_flags(DEAL_II_CXX_FLAGS PRISMS_PF_CXX_FLAGS) +append_flags(DEAL_II_CXX_FLAGS_DEBUG PRISMS_PF_CXX_FLAGS_DEBUG) +append_flags(DEAL_II_CXX_FLAGS_RELEASE PRISMS_PF_CXX_FLAGS_RELEASE) + +# Remove and standard flags that deal.II might have because we want to be able +# to set our standard separately. +remove_std_flag(PRISMS_PF_CXX_FLAGS) +remove_std_flag(PRISMS_PF_CXX_FLAGS_DEBUG) +remove_std_flag(PRISMS_PF_CXX_FLAGS_RELEASE) -# Grab some compiler flags that would otherwise be provided by deal_ii_initialize_cached_variables() +append_flags(DEAL_II_LINKER_FLAGS PRISMS_PF_LINKER_FLAGS) +append_flags(DEAL_II_LINKER_FLAGS_DEBUG PRISMS_PF_LINKER_FLAGS_DEBUG) +append_flags(DEAL_II_LINKER_FLAGS_RELEASE PRISMS_PF_LINKER_FLAGS_RELEASE) diff --git a/cmake/prisms_pf_config.cmake.in b/cmake/prisms_pf_config.cmake.in index 66c20770c..354eceddd 100644 --- a/cmake/prisms_pf_config.cmake.in +++ b/cmake/prisms_pf_config.cmake.in @@ -1,7 +1,6 @@ # PRISMS-PF configuration variables +set(64BIT_INDICES @64BIT_INDICES@ CACHE BOOL "Whether 64-bit numbers are enabled for large simulations") set(PRISMS_PF_WITH_CALIPER @PRISMS_PF_WITH_CALIPER@ CACHE BOOL "Whether Caliper is enabled" FORCE) set(PRISMS_PF_WITH_VTK @PRISMS_PF_WITH_VTK@ CACHE BOOL "Whether VTK is enabled" FORCE) set(PRISMS_PF_WITH_ZLIB @PRISMS_PF_WITH_ZLIB@ CACHE BOOL "Whether zlib is enabled" FORCE) -set(PRISMS_PF_WITH_SUNDIALS @PRISMS_PF_WITH_SUNDIALS@ CACHE BOOL "Whether SUNDIALS is enabled" FORCE) -set(PRISMS_PF_WITH_CUDA @PRISMS_PF_WTIH_CUDA@ CACHE BOOL "Whether CUDA is enabled" FORCE) diff --git a/cmake/setup_application.cmake b/cmake/setup_application.cmake index 6612a351d..b389024c2 100644 --- a/cmake/setup_application.cmake +++ b/cmake/setup_application.cmake @@ -124,21 +124,6 @@ if(PRISMS_PF_WITH_ZLIB) endif() endif() -message(STATUS "Using PRISMS_PF_WITH_SUNDIALS = '${PRISMS_PF_WITH_SUNDIALS}'") -if(PRISMS_PF_WITH_SUNDIALS) - if(DEAL_II_WITH_SUNDIALS) - message(STATUS " Found deal.II installation with SUNDIALS") - else() - message( - FATAL_ERROR - "deal.II installation with SUNDIALS not found. Disable PRISMS_PF_WITH_SUNDIALS or recompile deal.II with SUNDIALS." - ) - endif() -endif() - -# Load deal.II cached variables -deal_ii_initialize_cached_variables() - # Caliper message(STATUS "Using PRISMS_PF_WITH_CALIPER = '${PRISMS_PF_WITH_CALIPER}'") if(PRISMS_PF_WITH_CALIPER) diff --git a/cmake/setup_cached_variables.cmake b/cmake/setup_cached_variables.cmake index 127165566..7cc4d377f 100644 --- a/cmake/setup_cached_variables.cmake +++ b/cmake/setup_cached_variables.cmake @@ -7,9 +7,12 @@ option(PRISMS_PF_AUTODETECTION "Autodetection of PRISMS-PF dependencies." ON) message(STATUS "PRISMS_PF_AUTODETECTION = ${PRISMS_PF_AUTODETECTION}") +option(UNIT_TESTS "Whether to build the unit tests or not." ON) +message(STATUS "UNIT_TESTS = ${UNIT_TESTS}") + option( 64BIT_INDICES - "Whether to compile PRISMS-PF with 64bit numbers for large simulations" + "Whether to compile PRISMS-PF with 64-bit numbers for large simulations" OFF ) message(STATUS "64BIT_INDICES = ${64BIT_INDICES}") @@ -21,22 +24,11 @@ option( ) message(STATUS "ADDITIONAL_OPTIMIZATIONS = ${ADDITIONAL_OPTIMIZATIONS}") -option( - REDUCED_TEMPLATES - "Wether the user wants to enable the reduced templates or not." - OFF -) -message(STATUS "REDUCED_TEMPLATES = ${REDUCED_TEMPLATES}") -mark_as_advanced(REDUCED_TEMPLATES) - option( ADDITIONAL_DEGREES "Wether the user wants to enable the compilation of additional element degrees or not." OFF ) -if(REDUCED_TEMPLATES) - set(ADDITIONAL_DEGREES OFF) -endif() message(STATUS "ADDITIONAL_DEGREES = ${ADDITIONAL_DEGREES}") option( @@ -88,84 +80,3 @@ if( else() set(PRISMS_PF_BUILD_RELEASE "OFF") endif() - -# Hide some cmake variables so we can inherit them from deal.II -set(PRISMS_PF_REMOVED_FLAGS - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_MINSIZEREL - CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_SHARED_LINKER_FLAGS - CMAKE_SHARED_LINKER_FLAGS_DEBUG - CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL - CMAKE_SHARED_LINKER_FLAGS_RELEASE - CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -) -foreach(_flag ${PRISMS_PF_REMOVED_FLAGS}) - set(${_flag} ${${_flag}} CACHE INTERNAL "" FORCE) -endforeach() - -# Cache some cmake variables of ours and mark them as advanced -set(PRISMS_PF_FLAGS - PRISMS_PF_CXX_FLAGS - PRISMS_PF_CXX_FLAGS_DEBUG - PRISMS_PF_CXX_FLAGS_RELEASE - PRISMS_PF_LINKER_FLAGS - PRISMS_PF_LINKER_FLAGS_DEBUG - PRISMS_PF_LINKER_FLAGS_RELEASE -) -foreach(_flag ${PRISMS_PF_FLAGS}) - set(${_flag} - "${${_flag}}" - CACHE STRING - "These user-supplied variables are appended to those inherited by deal.II" - ) - mark_as_advanced(${_flag}) -endforeach() - -# Set compiler flags into the respective PRISMS-PF variable -foreach(_flag CXX_FLAG CXX_FLAGS_DEBUG CXX_FLAGS_RELEASE) - if(NOT "${CMAKE_SHARED_${_flag}}" STREQUAL "") - message( - STATUS - "Prepending \${CMAKE_SHARED_${_flag}} to \${PRISMS_PF_${_flag}}" - ) - set(PRISMS_PF_${_flag} "${CMAKE_${_flag}} ${PRISMS_PF_${_flag}}") - endif() -endforeach() - -# Do the same for linker flags -foreach(_flag LINKER_FLAGS LINKER_FLAGS_DEBUG LINKER_FLAGS_RELEASE) - if(NOT "${CMAKE_SHARED_${_flag}}" STREQUAL "") - message( - STATUS - "Prepending \${CMAKE_SHARED_${_flag}} to \${PRISMS_PF_${_flag}}" - ) - set(PRISMS_PF_${_flag} "${CMAKE_${_flag}} ${PRISMS_PF_${_flag}}") - endif() -endforeach() - -# Store these flags into a SAVED variable so we can -# cross-reference with the deal.II ones that we inherit -# later. Also, set to empty string. -foreach(_flag ${PRISMS_PF_FLAGS}) - set(${_flag}_SAVED ${${_flag}}) - set(${_flag} "") -endforeach() - -# Also set the removed flags to empty -foreach(_flag ${PRISMS_PF_REMOVED_FLAGS}) - set(${_flag} "") -endforeach() - -# Read the environmental flags and add them to the saved variables -set(PRISMS_PF_CXX_FLAGS_SAVED "$ENV{CXXFLAGS} ${PRISMS_PF_CXX_FLAGS_SAVED}") -string(STRIP "${PRISMS_PF_CXX_FLAGS_SAVED}" PRISMS_PF_CXX_FLAGS_SAVED) -set(PRISMS_PF_LINKER_FLAGS_SAVED - "$ENV{LDFLAGS} ${PRISMS_PF_LINKER_FLAGS_SAVED}" -) -string(STRIP "${PRISMS_PF_LINKER_FLAGS_SAVED}" PRISMS_PF_LINKER_FLAGS_SAVED) -unset(ENV{CXXFLAGS}) -unset(ENV{LDFLAGS}) -unset(ENV{NVCCFLAGS}) diff --git a/cmake/setup_prisms_pf.cmake b/cmake/setup_prisms_pf.cmake index e05a6e994..c2ef90f92 100644 --- a/cmake/setup_prisms_pf.cmake +++ b/cmake/setup_prisms_pf.cmake @@ -66,25 +66,54 @@ option( ) option( - PRISMS_PF_WITH_HDF5 - "Whether the user wants to compile PRISMS-PF with deal.II's HDF5 dependency, or not." + PRISMS_PF_WITH_CALIPER + "Whether the user wants to compile PRISMS-PF with the profiling code Caliper, or not." OFF ) -option( - PRISMS_PF_WITH_SUNDIALS - "Whether the user wants to compile PRISMS-PF with deal.II's SUNDIALS dependency, or not." - OFF -) +# Set the compiler and linker flags +set(PRISMS_PF_WARNING_FLAGS "") +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC + set(PRISMS_PF_WARNING_FLAGS + -Wall -Wextra -Wpedantic + -Wconversion -Wsign-conversion + -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align + -Wunused -Woverloaded-virtual -Wnull-dereference + -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough + -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches + -Wlogical-op -Wuseless-cast + ) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Clang/AppleClang + set(PRISMS_PF_WARNING_FLAGS + -Wall -Wextra -Wpedantic + -Wconversion -Wsign-conversion + -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align + -Wunused -Woverloaded-virtual -Wnull-dereference + -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough + -Wdocumentation -Winconsistent-missing-destructor-override-attribute + -Wunreachable-code -Wmove -Wloop-analysis + -Wcomma -Wrange-loop-analysis + ) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") # Intel classic (icc/icpc) + set(PRISMS_PF_WARNING_FLAGS + -Wall -Wextra -Wcheck + -Wshadow -Wunused-variable -Wuninitialized + -Wremarks + ) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") # Newer Intel oneAPI compilers (icx/icpx) + set(PRISMS_PF_WARNING_FLAGS + -Wall -Wextra -Wpedantic + -Wconversion -Wsign-conversion + -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align + -Wunused -Woverloaded-virtual -Wnull-dereference + -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough + ) +endif() -option( - PRISMS_PF_WITH_CUDA - "Whether the user wants to compile PRISMS-PF with deal.II's CUDA dependency, or not." - OFF -) +set(PRISMS_PF_CXX_FLAGS "") +set(PRISMS_PF_CXX_FLAGS_DEBUG "") +set(PRISMS_PF_CXX_FLAGS_RELEASE "") -option( - PRISMS_PF_WITH_CALIPER - "Whether the user wants to compile PRISMS-PF with the profiling code Caliper, or not." - OFF -) +set(PRISMS_PF_LINKER_FLAGS "") +set(PRISMS_PF_LINKER_FLAGS_DEBUG "") +set(PRISMS_PF_LINKER_FLAGS_RELEASE "") diff --git a/cmake/templates.in b/cmake/templates.in index aa16a82ba..e9aff89da 100644 --- a/cmake/templates.in +++ b/cmake/templates.in @@ -2,10 +2,10 @@ // to process .inst.in files into .in files // Scalar types -REAL_SCALARS := { float@EXPAND_NUMBERS@ } +REAL_SCALARS := { float; double } // Space dimensions -SPACE_DIMENSIONS := { 1; 2@EXPAND_DIMENSIONS@ } +SPACE_DIMENSIONS := { 1; 2; 3@EXPAND_DIMENSIONS@ } // Element degrees ELEMENT_DEGREE := { 1; 2@EXPAND_DEGREES@ } diff --git a/cmake/write_config.cmake b/cmake/write_config.cmake index 75f2ef6cd..434982ec4 100644 --- a/cmake/write_config.cmake +++ b/cmake/write_config.cmake @@ -47,10 +47,15 @@ write_to_both("# " ) write_to_detailed("# -# CXX_FLAGS: ${DEAL_II_CXX_FLAGS} -# CXX_FLAGS_DEBUG: ${DEAL_II_CXX_FLAGS_DEBUG} -# CXX_FLAGS_RELEASE: ${DEAL_II_CXX_FLAGS_RELEASE} -# ADDITIONAL_CXX_FLAGS: ${PRISMS_PF_ADDITIONAL_CXX_FLAGS}\n" +# WARNING_FLAGS: ${PRISMS_PF_WARNING_FLAGS} +# CXX_FLAGS: ${PRISMS_PF_CXX_FLAGS} +# CXX_FLAGS_DEBUG: ${PRISMS_PF_CXX_FLAGS_DEBUG} +# CXX_FLAGS_RELEASE: ${PRISMS_PF_CXX_FLAGS_RELEASE} +# ADDITIONAL_CXX_FLAGS: ${PRISMS_PF_ADDITIONAL_CXX_FLAGS} +# +# LINKER_FLAGS: ${PRISMS_PF_LINKER_FLAGS} +# LINKER_FLAGS_DEBUG: ${PRISMS_PF_LINKER_FLAGS_DEBUG} +# LINKER_FLAGS_RELEASE: ${PRISMS_PF_LINKER_FLAGS_RELEASE}\n" ) write_to_both("# # DEAL_II_DIR: ${deal.II_DIR} @@ -60,15 +65,12 @@ write_to_both("# # # PRISMS_PF_WITH_ZLIB: ${PRISMS_PF_WITH_ZLIB} # PRISMS_PF_WITH_VTK: ${PRISMS_PF_WITH_VTK} -# PRISMS_PF_WITH_HDF5: ${PRISMS_PF_WITH_HDF5} -# PRISMS_PF_WITH_SUNDIALS: ${PRISMS_PF_WITH_SUNDIALS} # PRISMS_PF_WITH_CALIPER: ${PRISMS_PF_WITH_CALIPER} -# PRISMS_PF_WITH_CUDA: ${PRISMS_PF_WITH_CUDA} # +# UNIT_TESTS: ${UNIT_TESTS} # 64BIT_INDICES: ${64BIT_INDICES} # ADDITIONAL_OPTIMIZATIONS: ${ADDITIONAL_OPTIMIZATIONS} # ADDITIONAL_DEGREES: ${ADDITIONAL_DEGREES} -# REDUCED_TEMPLATES: ${REDUCED_TEMPLATES} # UNWRAP_COMPILER: ${UNWRAP_COMPILER} #" ) diff --git a/doc/doxygen/installation/installation.h b/doc/doxygen/installation/installation.h index 97e8fdf4f..74d36cc67 100644 --- a/doc/doxygen/installation/installation.h +++ b/doc/doxygen/installation/installation.h @@ -113,8 +113,6 @@ your machine. These include: - MPI (we recommend OpenMPI or MPICH) - p4est (for adaptive octree meshing) - VTK (for file I/O) **[optional]** -- HDF5 (for file I/O) **[optional]** -- SUNDIALS (for time integration & nonlinear solvers) **[optional]** - Caliper (for profiling) **[optional]** - deal.II (version 9.6 or higher) diff --git a/include/prismspf/config.h.in b/include/prismspf/config.h.in index 236fe6f35..914c673f1 100644 --- a/include/prismspf/config.h.in +++ b/include/prismspf/config.h.in @@ -6,10 +6,7 @@ // Optional features: #cmakedefine PRISMS_PF_WITH_ZLIB -#cmakedefine PRISMS_PF_WITH_HDF5 -#cmakedefine PRISMS_PF_WITH_SUNDIALS #cmakedefine PRISMS_PF_WITH_CALIPER -#cmakedefine PRISMS_PF_WTIH_CUDA // Flags for enabling and disabling certain features #cmakedefine ADDITIONAL_OPTIMIZATIONS diff --git a/include/prismspf/core/cell_marker_base.h b/include/prismspf/core/cell_marker_base.h index 977f20f76..dae98f98f 100644 --- a/include/prismspf/core/cell_marker_base.h +++ b/include/prismspf/core/cell_marker_base.h @@ -31,14 +31,14 @@ class CellMarkerBase */ virtual ~CellMarkerBase() = default; - virtual bool + [[nodiscard]] virtual bool flag([[maybe_unused]] const CellIterator &cell, [[maybe_unused]] const TemporalDiscretization &time_info) const { return this->flag(cell.center(), time_info); } - virtual bool + [[nodiscard]] virtual bool flag([[maybe_unused]] const dealii::Point &point, [[maybe_unused]] const TemporalDiscretization &time_info) const { diff --git a/include/prismspf/core/variable_container.h b/include/prismspf/core/variable_container.h index 22d1f565a..f072c5bdd 100644 --- a/include/prismspf/core/variable_container.h +++ b/include/prismspf/core/variable_container.h @@ -1061,7 +1061,7 @@ class VariableContainer eval_cell_diagonal(FEEvaluationType *feeval_ptr, DiagonalType *diagonal_ptr, unsigned int cell, - Types::Index global_var_index, + Types::Index global_variable_index, const std::function &, const SizeType &)> &func, diff --git a/include/prismspf/field_input/read_binary.h b/include/prismspf/field_input/read_binary.h index 0d8ce8d9c..590b46df1 100644 --- a/include/prismspf/field_input/read_binary.h +++ b/include/prismspf/field_input/read_binary.h @@ -13,13 +13,20 @@ #include +#include "prismspf/core/conditional_ostreams.h" + +#include #include #include +#include #include #include PRISMS_PF_BEGIN_NAMESPACE +/** + * @brief Class to read in a flat binary file and provide values at given points + */ template class ReadBinary : public ReadFieldBase { @@ -30,9 +37,6 @@ class ReadBinary : public ReadFieldBase ReadBinary(const InitialConditionFile &_ic_file, const SpatialDiscretization &_spatial_discretization); - void - check_size(const InitialConditionFile &ic_file); - /** * @brief Print the binary file to text for debugging */ @@ -47,42 +51,57 @@ class ReadBinary : public ReadFieldBase write_file(const std::vector &data, const InitialConditionFile &ic_file); /** - * @brief Get vector value for a given point + * @brief Get scalar value for a given point */ - dealii::Vector - get_vals(const std::array &multi_index, - const unsigned int n_values); + number + get_scalar_value(const dealii::Point &point, + const std::string &scalar_name) override; /** * @brief Get vector value for a given point */ dealii::Vector - interpolate(const dealii::Point &point, const unsigned int n_pt_values); + get_vector_value(const dealii::Point &point, + const std::string &vector_name) override; +private: /** - * @brief Get scalar value for a given point + * @brief Check the size of the binary file and make sure it matches the expected size + * (in bytes). */ - number - get_scalar_value(const dealii::Point &point, - const std::string &scalar_name) override; + void + check_file_size(); + + /** + * @brief Get vector value for a given index + */ + dealii::Vector + get_value(const dealii::types::global_dof_index index, const unsigned int n_components); /** * @brief Get vector value for a given point + * + * This function is necessary for binary files because we don't have a strict order of + * points that deal.II gives us in the initial condition function. For that reason, we + * have to interpolate the flat binary values assuming a rectangular grid with fixed + * spacing. Furthermore, we assume that the first point is the origin (0,0,0) and the + * last the furthest corner (increasing x, then y, and z). */ dealii::Vector - get_vector_value(const dealii::Point &point, - const std::string &vector_name) override; + interpolate(const dealii::Point &point, const unsigned int n_components); -private: /** - * @brief Number of points. + * @brief Number of grid points. + * + * We have to set the initial value to 1 so that when we multiply in the constructor + * we don't end up with zero. */ - dealii::types::global_dof_index n_values; + dealii::types::global_dof_index n_points = 1; /** - * @brief Vector of dNdx values for each dimension. + * @brief Number of values (n_points * n_components). */ - std::array dNdx; + dealii::types::global_dof_index n_values = 0; /** * @brief Data array to hold the read in values. @@ -96,57 +115,78 @@ inline ReadBinary::ReadBinary( const SpatialDiscretization &_spatial_discretization) : ReadFieldBase(_ic_file, _spatial_discretization) { - check_size(this->ic_file); - std::ifstream dataFile(this->ic_file.filename, std::ios::binary); - AssertThrow(dataFile, + // Make sure the dataset format is correct + AssertThrow(this->ic_file.dataset_format == DataFormatType::FlatBinary, + dealii::ExcMessage("Dataset format must be FlatBinary")); + + // Check that only one field is being read in + AssertThrow(this->ic_file.file_variable_names.size() == 1 && + this->ic_file.simulation_variable_names.size() == 1, + dealii::ExcMessage("Only one field can be read in from a binary file")); + + // Make sure we have a rectangular domain + AssertThrow(_spatial_discretization.get_type() == + SpatialDiscretization::TriangulationType::Rectangular, + dealii::ExcMessage( + "Only rectangular domains are supported for binary input files")); + + // Compute the total number of points in the binary file + for (unsigned int d : std::views::iota(0U, dim)) + { + n_points *= this->ic_file.n_data_points[d]; + } + + // Check that the binary matches an expected size + check_file_size(); + + // Read in the binary file + std::ifstream data_file(this->ic_file.filename, std::ios::binary); + AssertThrow(data_file, dealii::ExcMessage("Could not open binary file: " + this->ic_file.filename)); + + // Reserve space in the data vector data.reserve(n_values); - const unsigned int bufsize = sizeof(number); - char buf[bufsize]; - number numbuf; - for (dealii::types::global_dof_index j = 0; j < n_values; ++j) - { - dataFile.read(buf, bufsize); - memcpy(&numbuf, &buf, bufsize); - data.push_back(numbuf); - } - dataFile.close(); - for (unsigned int j = 0; j < dim; ++j) + + // Read in the data + for (dealii::types::global_dof_index i : std::views::iota(0U, n_values)) { - dNdx[j] = static_cast(this->ic_file.n_data_points[j] - 1) / - this->spatial_discretization.get_size()[j]; + std::array buffer; + data_file.read(buffer.data(), sizeof(number)); + data.push_back(std::bit_cast(buffer)); } + data_file.close(); } -// member functions called during construction that could belong to base or go elsewhere template inline void -ReadBinary::check_size(const InitialConditionFile &ic_file) +ReadBinary::check_file_size() { - std::uintmax_t file_size = std::filesystem::file_size(ic_file.filename); - // Calculate expected size: number of points * size of each point - n_values = 1; - for (unsigned int j = 0; j < dim; j++) - { - n_values *= static_cast(ic_file.n_data_points[j]); - } + // Grab the file size of the binary file in bytes + auto file_size = std::filesystem::file_size(this->ic_file.filename); + + // Compute the expected size of the binary file. This is simply the number of points + // mutliplied by the size of each point in bytes. + auto expected_size_scalar = static_cast(n_points * sizeof(number)); + auto expected_size_vector = static_cast(dim * expected_size_scalar); - std::uintmax_t expected_size = n_values * sizeof(number); // Make sure expected size is not zero - AssertThrow(expected_size != 0, - dealii::ExcMessage( - std::string("Expected input array size is zero, check that the ") + - std::string("number of data points in each used direction is set " - "correctly in the input file."))); + AssertThrow( + expected_size_scalar != 0 && expected_size_vector != 0, + dealii::ExcMessage( + "Expected input array size is zero, check that the number of data points " + "in each used direction is set correctly in the input file for your binary file. " + "You likely have the number of data points set to zero in all directions.")); // Make sure the size matches for either a scalar or vector - AssertThrow(((file_size == expected_size) || (file_size == dim * expected_size)), + AssertThrow(file_size == expected_size_scalar || file_size == expected_size_vector, dealii::ExcMessage( - std::string("Expected binary file size (") + - std::to_string(expected_size) + std::string(" bytes for scalar or ") + - std::to_string(3 * expected_size) + - std::string(" bytes for vector) does not match actual file size (") + - std::to_string(file_size) + std::string(" bytes)."))); + "Expected binary file size (" + std::to_string(expected_size_scalar) + + " bytes for scalar or " + std::to_string(expected_size_vector) + + " bytes for vector) does not match actual file size (" + + std::to_string(file_size) + " bytes).")); + + // Set the number of values + n_values = file_size == expected_size_scalar ? n_points : dim * n_points; } template @@ -154,104 +194,210 @@ inline void ReadBinary::write_file(const std::vector &data, const InitialConditionFile &ic_file) { - std::ofstream dataFile(ic_file.filename, std::ios::binary); - AssertThrow(dataFile, + // Try to open the file + std::ofstream data_file(ic_file.filename, std::ios::binary); + AssertThrow(data_file, dealii::ExcMessage("Could not open binary file: " + ic_file.filename)); - const unsigned int bufsize = sizeof(number); - char buf[bufsize]; - for (dealii::types::global_dof_index j = 0; j < data.size(); ++j) + + // Write the data + for (dealii::types::global_dof_index j : std::views::iota(0U, data.size())) { - memcpy(&buf, &data[j], bufsize); - dataFile.write(buf, bufsize); + auto buffer = std::bit_cast>(data[j]); + data_file.write(buffer.data(), sizeof(number)); } - dataFile.close(); + data_file.close(); } -// function to get values at specified index -// encapsulates the assumed storage order of the input data (fortran-style) template inline dealii::Vector -ReadBinary::get_vals( - const std::array &multi_index, - const unsigned int n_components) +ReadBinary::get_value(const dealii::types::global_dof_index index, + const unsigned int n_components) { + // Create vector to hold the value with the correct number of components dealii::Vector value(n_components); - // index of the scalar or first component of vector - dealii::types::global_dof_index flat_index = 0; - dealii::types::global_dof_index subspace_size = 1; - for (unsigned int j = 0; j < dim; ++j) - { - flat_index += multi_index[j] * subspace_size; - subspace_size *= this->ic_file.n_data_points[j]; - } - flat_index *= n_components; - for (unsigned int component = 0; component < n_components; ++component) + + // Check that the number of components matches what we expect from the number of values + Assert(n_values % n_components == 0, + dealii::ExcMessage("The number of components requested in the get_value call " + "does not match the number of values in the binary file.")); + + // Fill the value vector + for (unsigned int component : std::views::iota(0U, n_components)) { - value[component] = this->data[flat_index + component]; + Assert(((n_components * index) + component) < data.size(), + dealii::ExcMessage("Index out of bounds in ReadBinary::get_vals")); + value[component] = data[(n_components * index) + component]; } + return value; } template inline dealii::Vector ReadBinary::interpolate(const dealii::Point &point, - const unsigned int n_pt_values) + const unsigned int n_components) { - std::vector> indices(dim, - std::array { - {0u, 0u} - }); - // lower and upper - // indices in each - // dimension - std::vector> weights( - dim, - std::array { - {number(0.0), number(0.0)} - }); // lower and upper weights in each dimension - for (unsigned int j = 0; j < dim; ++j) + Assert(n_components == 1 || n_components == dim, + dealii::ExcMessage( + "Number of components for interpolation must be 1 (scalar) or dim (vector)")); + + // Create a vector to hold the interpolated value + dealii::Vector value(n_components); + + // Get the spatial discretization + const auto &spatial_discretization = this->spatial_discretization; + + // Compute the spacing in each direction + std::array spacing; + for (unsigned int d : std::views::iota(0U, dim)) { - indices[j][0] = (dealii::types::global_dof_index) std::floor(dNdx[j] * point[j]); - AssertThrow(indices[j][0] < this->ic_file.n_data_points[j], - dealii::ExcMessage( - "index out of bounds encountered in ReadBinary::interpolate")); - if (indices[j][0] == this->ic_file.n_data_points[j] - 1) + spacing[d] = spatial_discretization.get_size()[d] / + static_cast(this->ic_file.n_data_points[d]); + } + + // Compute the indices of the lower corner of the cell containing the point + std::array lower_indices; + for (unsigned int d : std::views::iota(0U, dim)) + { + lower_indices[d] = + static_cast(std::floor(point[d] / spacing[d])); + // Make sure we don't go out of bounds + if (lower_indices[d] >= this->ic_file.n_data_points[d] - 1) { - weights[j][0] = 1.0; - weights[j][1] = 0.0; - indices[j][1] = indices[j][0]; + lower_indices[d] = this->ic_file.n_data_points[d] - 2; } - else + } + + // Compute the weights for interpolation in each direction + std::array weights; + for (unsigned int d : std::views::iota(0U, dim)) + { + weights[d] = (point[d] - lower_indices[d] * spacing[d]) / spacing[d]; + } + + // Perform multilinear interpolation based on the dimension + if constexpr (dim == 1) + { + // Here is the map of the nodes in 1D: + // 0 — 1 + + // Grab the index of the lower left corner of the cell + auto lower_index = lower_indices[0]; + + // Get the indices of the two points in 1D + auto node_index_0 = lower_index; + auto node_index_1 = lower_index + 1; + + // Get the values at these points + auto value_0 = get_value(node_index_0, n_components); + auto value_1 = get_value(node_index_1, n_components); + + // Interpolate + for (unsigned int c : std::views::iota(0U, n_components)) { - indices[j][1] = indices[j][0] + 1; - // Calculate the fractional position between grid points - number pt_lower = static_cast(indices[j][0]) / dNdx[j]; - weights[j][1] = (point[j] - pt_lower) * dNdx[j]; // 1/dNdx[j] = grid spacing; - weights[j][0] = 1.0 - weights[j][1]; + value[c] = (1.0 - weights[0]) * value_0[c] + weights[0] * value_1[c]; } } - dealii::Vector pt_values(n_pt_values); - pt_values = 0.0; - // 1 << dim is 2^dim, i.e. number of corners of the cell - for (unsigned int k = 0; k < (1 << dim); ++k) + else if constexpr (dim == 2) { - std::array pt_indices; - number pt_wgt = 1.0; - for (unsigned int j = 0; j < dim; ++j) + // Here is the map of the nodes in 2D: + // 01 — 11 + // | | + // 00 — 10 + + // Grab the row length in the x-direction (0th direction) + auto row_length_0 = this->ic_file.n_data_points[0]; + + // Grab the index of the lower left corner of the cell + auto lower_index = lower_indices[0] + (lower_indices[1] * row_length_0); + + // Get the indices of the four points in 2D + auto node_index_00 = lower_index; + auto node_index_10 = lower_index + 1; + + auto node_index_01 = lower_index + row_length_0; + auto node_index_11 = lower_index + row_length_0 + 1; + + // Get the values at these points + auto value_00 = get_value(node_index_00, n_components); + auto value_10 = get_value(node_index_10, n_components); + + auto value_01 = get_value(node_index_01, n_components); + auto value_11 = get_value(node_index_11, n_components); + + // Interpolate + for (unsigned int c : std::views::iota(0U, n_components)) { - // bit j of k tells us whether to use lower (0) - // or upper (1) index/weight in dimension j - bool bit = (k >> j & 1); - pt_indices[j] = indices[j][bit]; - pt_wgt *= weights[j][bit]; + value[c] = (1.0 - weights[0]) * (1.0 - weights[1]) * value_00[c] + + weights[0] * (1.0 - weights[1]) * value_10[c] + + (1.0 - weights[0]) * weights[1] * value_01[c] + + weights[0] * weights[1] * value_11[c]; } - dealii::Vector values_temp = this->get_vals(pt_indices, n_pt_values); - for (unsigned int n_pt_index = 0; n_pt_index < n_pt_values; ++n_pt_index) + } + else if constexpr (dim == 3) + { + // Here is the map of the nodes in 3D: + // + // 011 ———— 111 + // / | / | + // / 001 / | + // 010 ——— 110 101 + // | / | / + // | / | / + // 000 ———— 100 + + // Grab the row length in the x-direction (0th direction) + auto row_length_0 = this->ic_file.n_data_points[0]; + // Grab the row length in the y-direction (1st direction) + auto row_length_1 = this->ic_file.n_data_points[1]; + + // Grab the index of the lower left corner of the cell + auto lower_index = lower_indices[0] + (lower_indices[1] * row_length_0) + + (lower_indices[2] * row_length_0 * row_length_1); + + // Get the indices of the eight points in 3D + auto node_index_000 = lower_index; + auto node_index_100 = lower_index + 1; + + auto node_index_010 = lower_index + row_length_0; + auto node_index_110 = lower_index + row_length_0 + 1; + + auto node_index_001 = lower_index + (row_length_0 * row_length_1); + auto node_index_101 = lower_index + (row_length_0 * row_length_1) + 1; + + auto node_index_011 = lower_index + (row_length_0 * row_length_1) + row_length_0; + auto node_index_111 = + lower_index + (row_length_0 * row_length_1) + row_length_0 + 1; + + // Get the values at these points + auto value_000 = get_value(node_index_000, n_components); + auto value_100 = get_value(node_index_100, n_components); + + auto value_010 = get_value(node_index_010, n_components); + auto value_110 = get_value(node_index_110, n_components); + + auto value_001 = get_value(node_index_001, n_components); + auto value_101 = get_value(node_index_101, n_components); + + auto value_011 = get_value(node_index_011, n_components); + auto value_111 = get_value(node_index_111, n_components); + + // Interpolate + for (unsigned int c : std::views::iota(0U, n_components)) { - pt_values[n_pt_index] += pt_wgt * values_temp[n_pt_index]; + value[c] = + (1.0 - weights[0]) * (1.0 - weights[1]) * (1.0 - weights[2]) * value_000[c] + + weights[0] * (1.0 - weights[1]) * (1.0 - weights[2]) * value_100[c] + + (1.0 - weights[0]) * weights[1] * (1.0 - weights[2]) * value_010[c] + + weights[0] * weights[1] * (1.0 - weights[2]) * value_110[c] + + (1.0 - weights[0]) * (1.0 - weights[1]) * weights[2] * value_001[c] + + weights[0] * (1.0 - weights[1]) * weights[2] * value_101[c] + + (1.0 - weights[0]) * weights[1] * weights[2] * value_011[c] + + weights[0] * weights[1] * weights[2] * value_111[c]; } } - return pt_values; + + return value; } template @@ -259,6 +405,10 @@ inline number ReadBinary::get_scalar_value(const dealii::Point &point, [[maybe_unused]] const std::string &scalar_name) { + Assert(n_values == n_points, + dealii::ExcMessage("The number of points should match the number of values in a " + "binary file for a scalar field. Make sure the file size is " + "correct and you are trying to access a scalar field.")); return interpolate(point, 1)[0]; } @@ -267,6 +417,12 @@ inline dealii::Vector ReadBinary::get_vector_value(const dealii::Point &point, [[maybe_unused]] const std::string &vector_name) { + Assert((n_values / dim) == n_points, + dealii::ExcMessage("The number of points should match the number of values " + "divided by the dimension in a binary file for a vector " + "field. Make sure the file size is correct and you are " + "trying to access a vector field.")); + return interpolate(point, dim); } @@ -274,10 +430,13 @@ template inline void ReadBinary::print_file() { - for (dealii::types::global_dof_index j = 0; j < n_values; ++j) + for (dealii::types::global_dof_index i : std::views::iota(0U, n_values)) { - ConditionalOStreams::pout_summary() << this->data[j] << "\n"; + Assert(i < data.size(), + dealii::ExcMessage("Index out of bounds in ReadBinary::print_file")); + ConditionalOStreams::pout_summary() << this->data.at(i) << "\n"; } + ConditionalOStreams::pout_summary() << std::flush; } PRISMS_PF_END_NAMESPACE diff --git a/include/prismspf/nucleation/nucleation.h b/include/prismspf/nucleation/nucleation.h index 2be21789e..c10d335b8 100644 --- a/include/prismspf/nucleation/nucleation.h +++ b/include/prismspf/nucleation/nucleation.h @@ -97,8 +97,8 @@ NucleationHandler::attempt_nucleation( const UserInputParameters &user_inputs = solver_context.get_user_inputs(); const NucleationParameters &nuc_params = user_inputs.get_nucleation_parameters(); const TemporalDiscretization &time_info = user_inputs.get_temporal_discretization(); - double delta_t = nuc_params.get_nucleation_period() * time_info.get_timestep(); - auto &rng = user_inputs.get_miscellaneous_parameters().rng; + const double delta_t = nuc_params.get_nucleation_period() * time_info.get_timestep(); + auto &rng = user_inputs.get_miscellaneous_parameters().rng; // Set up FEValues static const dealii::QGaussLobatto quadrature(degree + 1); @@ -261,7 +261,7 @@ NucleationHandler::gather_exclude_broadcast_nuclei( // Set up refs const NucleationParameters &nuc_params = user_inputs.get_nucleation_parameters(); const TemporalDiscretization &time_info = user_inputs.get_temporal_discretization(); - RNGEngine &rng = user_inputs.get_miscellaneous_parameters().rng; + RNGEngine &rng = user_inputs.get_miscellaneous_parameters().rng; // Gather new nuclei to root process std::vector> new_nuclei(new_nuclei_list.begin(), new_nuclei_list.end()); @@ -282,7 +282,7 @@ NucleationHandler::gather_exclude_broadcast_nuclei( while (!new_nuclei.empty()) { const Nucleus &nuc = new_nuclei.back(); - bool valid = + bool valid = std::none_of(global_nuclei.begin(), global_nuclei.end(), [&](const Nucleus &existing_nucleus) diff --git a/include/prismspf/solvers/solver_context.h b/include/prismspf/solvers/solver_context.h index 518313da9..249fb1813 100644 --- a/include/prismspf/solvers/solver_context.h +++ b/include/prismspf/solvers/solver_context.h @@ -61,8 +61,8 @@ class SolverContext , element_volume_container(&_element_volume_container) , mg_info(&_mg_info) , solution_handler(&_solution_handler) - , pde_operator(std::move(_pde_operator)) - , pde_operator_float(std::move(_pde_operator_float)) {}; + , pde_operator(_pde_operator) + , pde_operator_float(_pde_operator_float) {}; /** * @brief Destructor. diff --git a/include/prismspf/user_inputs/load_initial_condition_parameters.h b/include/prismspf/user_inputs/load_initial_condition_parameters.h index 17205709d..fda98e40b 100644 --- a/include/prismspf/user_inputs/load_initial_condition_parameters.h +++ b/include/prismspf/user_inputs/load_initial_condition_parameters.h @@ -100,7 +100,7 @@ struct LoadInitialConditionParameters { if (read_initial_conditions_from_file) { - ic_files.push_back(std::move(_ic_file)); + ic_files.push_back(_ic_file); } } diff --git a/include/prismspf/user_inputs/spatial_discretization.h b/include/prismspf/user_inputs/spatial_discretization.h index 78014fe30..13f555abe 100644 --- a/include/prismspf/user_inputs/spatial_discretization.h +++ b/include/prismspf/user_inputs/spatial_discretization.h @@ -142,7 +142,7 @@ class RectangularMesh : public Mesh Assert(_subdivisions.size() == dim, dealii::ExcMessage( "Subdivisions vector size must match the number of dimensions")); - subdivisions = std::move(_subdivisions); + subdivisions = _subdivisions; // If the x direction is greater than 0, we set the mesh as initialized. // TODO (landinjm): Check that the other directions are also greater than 0. @@ -626,6 +626,15 @@ struct SpatialDiscretization refinement_criteria.push_back(_refinement_criterion); } + /** + * @brief Get the triangulation type + */ + [[nodiscard]] TriangulationType + get_type() const + { + return type; + } + private: // Triangulation type TriangulationType type = TriangulationType::Rectangular; diff --git a/include/prismspf/user_inputs/user_constants.h b/include/prismspf/user_inputs/user_constants.h index 1b8c89d1c..1b0e45317 100644 --- a/include/prismspf/user_inputs/user_constants.h +++ b/include/prismspf/user_inputs/user_constants.h @@ -544,7 +544,7 @@ inline dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)> UserConstants::get_cij_matrix(const ElasticityModel &model, const std::vector &constants) const { - // Initialize tensor + // Initialize compliance tensor dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)> compliance; switch (dim) @@ -555,9 +555,11 @@ UserConstants::get_cij_matrix(const ElasticityModel &model, switch (model) { - // TODO (landinjm): Should we both fixing this for the other cases and just - // selecting the x index. It would allow the user to switch from 2D to 1D to - // 3D, but would produce unexpected behavior. + // For the 1D case, it make little sense to accept anything besides an + // isotropic elasticity tensor. One hiccup, is that if a user is debugging + // an application and switches to 1D, they will have to modify the + // elasticity constants to align with that. While more burdensome, there's + // less of a chance of producing spurious behavior. case Isotropic: { const double modulus = constants.at(0); @@ -575,15 +577,24 @@ UserConstants::get_cij_matrix(const ElasticityModel &model, } case 2: { + // The voigt indexing scheme for 2 dimensions const int xx_dir = 0; const int yy_dir = 1; const int xy_dir = 2; switch (model) { + // Like the 1D case, it is nonsensical to have transverse or orthotropic + // compliance tensors, so we throw an error. case Isotropic: { - // TODO (landinjm): Document this + // For isotropic compliance tensors, we can simplify the computation to + // two parameters: $\lambda$ and $\mu$, where $\mu$ is the shear + // modulus. In cartesian coordinates, + // $$$ + // c_{ijkl} = \lambda \delta_{ij} \delta_{kl} + \mu (\delta_{ik} + // \delta_{jl} + \delta_{il} \delta_{kj}) + // $$$ const double modulus = constants.at(0); const double poisson = constants.at(1); @@ -599,6 +610,12 @@ UserConstants::get_cij_matrix(const ElasticityModel &model, } case Anisotropic: { + // In the anisotropic case, every entry is specified (given the symmetry + // constraints). Also, ignore magic numbers because it is simpler to + // hardcode this. + + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) + compliance[xx_dir][xx_dir] = constants.at(0); compliance[yy_dir][yy_dir] = constants.at(1); compliance[xy_dir][xy_dir] = constants.at(2); @@ -608,6 +625,8 @@ UserConstants::get_cij_matrix(const ElasticityModel &model, constants.at(4); compliance[yy_dir][xy_dir] = compliance[xy_dir][yy_dir] = constants.at(5); + + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) break; } default: @@ -628,7 +647,13 @@ UserConstants::get_cij_matrix(const ElasticityModel &model, { case Isotropic: { - // TODO (landinjm): Document this + // For isotropic compliance tensors, we can simplify the computation to + // two parameters: $\lambda$ and $\mu$, where $\mu$ is the shear + // modulus. In cartesian coordinates, + // $$$ + // c_{ijkl} = \lambda \delta_{ij} \delta_{kl} + \mu (\delta_{ik} + // \delta_{jl} + \delta_{il} \delta_{kj}) + // $$$ const double modulus = constants.at(0); const double poisson = constants.at(1); @@ -647,6 +672,12 @@ UserConstants::get_cij_matrix(const ElasticityModel &model, } case Anisotropic: { + // In the anisotropic case, every entry is specified (given the symmetry + // constraints). Also, ignore magic numbers because it is simpler to + // hardcode this. + + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) + compliance[xx_dir][xx_dir] = constants[0]; compliance[yy_dir][yy_dir] = constants[1]; compliance[zz_dir][zz_dir] = constants[2]; @@ -668,10 +699,14 @@ UserConstants::get_cij_matrix(const ElasticityModel &model, compliance[yz_dir][xz_dir] = compliance[xz_dir][yz_dir] = constants[18]; compliance[yz_dir][xy_dir] = compliance[xy_dir][yz_dir] = constants[19]; compliance[xz_dir][xy_dir] = compliance[xy_dir][xz_dir] = constants[20]; + + // NOLINTEND(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) break; } case Transverse: + // TODO (landinjm): implement case Orthotropic: + // TODO (landinjm): implement default: AssertThrow(false, dealii::ExcMessage("Invalid elasticity model type")); } diff --git a/src/core/initial_conditions.cc b/src/core/initial_conditions.cc index f63716a82..7846c5263 100644 --- a/src/core/initial_conditions.cc +++ b/src/core/initial_conditions.cc @@ -57,7 +57,7 @@ ReadInitialCondition::ReadInitialCondition( const InitialConditionFile &ic_file, const SpatialDiscretization &spatial_discretization) : dealii::Function((_field_type == FieldType::Vector) ? dim : 1) - , field_name(std::move(_field_name)) + , field_name(_field_name) , field_type(_field_type) , reader(create_reader(ic_file, spatial_discretization)) {} diff --git a/src/core/matrix_free_operator.cc b/src/core/matrix_free_operator.cc index a78f22e8a..54425527e 100644 --- a/src/core/matrix_free_operator.cc +++ b/src/core/matrix_free_operator.cc @@ -44,7 +44,7 @@ MatrixFreeOperator::MatrixFreeOperator( bool _use_local_mapping) : MATRIX_FREE_OPERATOR_BASE() , attributes_list(_attributes_list) - , pde_operator(std::move(_pde_operator)) + , pde_operator(_pde_operator) , solve_block(_solve_block) , index(_index) , use_local_mapping(_use_local_mapping) diff --git a/src/core/variable_container.cc b/src/core/variable_container.cc index 738be2e87..213718c59 100644 --- a/src/core/variable_container.cc +++ b/src/core/variable_container.cc @@ -145,7 +145,7 @@ VariableContainer::eval_local_operator( for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell) { // Grab the element volume - SizeType element_volume = element_volume_handler->get_element_volume(cell); + const SizeType element_volume = element_volume_handler->get_element_volume(cell); // Initialize, read DOFs, and set evaulation flags for each variable reinit_and_eval(src, cell); @@ -175,7 +175,7 @@ VariableContainer::eval_local_operator( for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell) { // Grab the element volume - SizeType element_volume = element_volume_handler->get_element_volume(cell); + const SizeType element_volume = element_volume_handler->get_element_volume(cell); // Initialize, read DOFs, and set evaulation flags for each variable reinit_and_eval(src, cell); @@ -206,7 +206,7 @@ VariableContainer::eval_local_operator( for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell) { // Grab the element volume - SizeType element_volume = element_volume_handler->get_element_volume(cell); + const SizeType element_volume = element_volume_handler->get_element_volume(cell); // Initialize, read DOFs, and set evaulation flags for each variable reinit_and_eval(src, cell); @@ -1187,7 +1187,7 @@ VariableContainer::eval_cell_diagonal( using DiagonalValueType = typename DiagonalType::value_type; // Grab the element volume - SizeType element_volume = element_volume_handler->get_element_volume(cell); + const SizeType element_volume = element_volume_handler->get_element_volume(cell); // Helper function to submit the identity matrix auto submit_identity = [&](auto &feeval_ptr, unsigned int dof_index) diff --git a/src/solvers/concurrent_solver.cc b/src/solvers/concurrent_solver.cc index 2183d6546..634ad6568 100644 --- a/src/solvers/concurrent_solver.cc +++ b/src/solvers/concurrent_solver.cc @@ -71,7 +71,7 @@ ConcurrentSolver::init() // Skip if an invalid field type is found or the global_to_local_solution // already has an entry for this dependency index and dependency type if (field_type == Numbers::invalid_field_type || - global_to_local_solution[dependency_index * max_dependency_types + + global_to_local_solution[(dependency_index * max_dependency_types) + dependency_type] != Numbers::invalid_index) { dependency_type++; @@ -139,7 +139,7 @@ ConcurrentSolver::reinit() // Skip if an invalid field type is found or the global_to_local_solution // already has an entry for this dependency index and dependency type if (field_type == Numbers::invalid_field_type || - global_to_local_solution[dependency_index * max_dependency_types + + global_to_local_solution[(dependency_index * max_dependency_types) + dependency_type] != Numbers::invalid_index) { dependency_type++; diff --git a/src/user_inputs/input_file_reader.cc b/src/user_inputs/input_file_reader.cc index 250eb151d..d3081f116 100644 --- a/src/user_inputs/input_file_reader.cc +++ b/src/user_inputs/input_file_reader.cc @@ -27,7 +27,7 @@ PRISMS_PF_BEGIN_NAMESPACE InputFileReader::InputFileReader( std::string input_file_name, const std::map &_var_attributes) - : parameters_file_name(std::move(input_file_name)) + : parameters_file_name(input_file_name) , var_attributes(&_var_attributes) { model_constant_names = get_model_constant_names(); diff --git a/tests/unit_tests/.gitignore b/tests/unit_tests/.gitignore new file mode 100644 index 000000000..5ad35957f --- /dev/null +++ b/tests/unit_tests/.gitignore @@ -0,0 +1,5 @@ +# Some ignores for the unit test executables +test_core +test_field_input +test_user_inputs +test_utilities \ No newline at end of file diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index 0086a12d0..0debfd000 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -1,178 +1,9 @@ ## -# CMake for the PRISMS-PF unit tests -# Adapted from the ASPECT CMake file +# CMake for PRISMS-PF unit tests ## -cmake_minimum_required(VERSION 3.8.0) - -# ========================================================= -# Some basic bookkeeping -# ========================================================= - -# Check that a prior CMakeCache is not located in the build directory -if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt) - message( - FATAL_ERROR - "Detected the file:\n" - "${CMAKE_SOURCE_DIR}/CMakeCache.txt\n" - "in your source directory, which may be leftover from prior builds. " - "Please delete the file before running cmake again." - ) -endif() - -# Set the standard to C++20 -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# ========================================================= -# External libraries -# ========================================================= - -# Find deal.II installation -find_package(deal.II 9.6.0 QUIET HINTS ${DEAL_II_DIR} $ENV{DEAL_II_DIR}) -if(NOT ${deal.II_FOUND}) - message( - FATAL_ERROR - "\n*** Could not find a recent version of deal.II. ***\n" - "You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to cmake " - "or set an environment variable \"DEAL_II_DIR\" that contains a path to a " - "recent version of deal.II." - ) -endif() - -message( - STATUS - "Found deal.II version ${DEAL_II_PACKAGE_VERSION} at '${deal.II_DIR}'" -) - -set(DEALII_INSTALL_VALID ON) - -if(NOT DEAL_II_WITH_P4EST) - message(SEND_ERROR "\n**deal.II was built without support for p4est!\n") - set(DEALII_INSTALL_VALID OFF) -endif() - -if(NOT DEALII_INSTALL_VALID) - message( - FATAL_ERROR - "\nPRISMS-PF requires a deal.II installation with certain features enabled!\n" - ) -endif() - -deal_ii_initialize_cached_variables() - -project(prisms_pf_unit_tests) - -# Check that deal.II was built with vtk or we can find the package ourselves -set(VTK_BUILT_SEPARATELY - OFF - CACHE BOOL - "Whether the installed VTK library was built outside of deal.II." -) -if(NOT DEAL_II_WITH_VTK) - find_package(VTK QUIET HINTS ${VTK_DIR} $ENV{VTK_DIR}) - if(NOT VTK_FOUND) - message(SEND_ERROR "\n**deal.II was built without support for VTK!\n") - set(DEALII_INSTALL_VALID OFF) - endif() - set(VTK_VERSION "${VTK_VERSION}") - set(VTK_MAJOR_VERSION "${VTK_MAJOR_VERSION}") - set(VTK_MINOR_VERSION "${VTK_MINOR_VERSION}") - set(VTK_INCLUDE_DIR - ${VTK_PREFIX_PATH}/include/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION} - ) - # Filter the included libraries - set(_libraries) - foreach(_library ${VTK_LIBRARIES}) - if( - NOT ${_library} MATCHES "Python" - AND NOT ${_library} MATCHES "MPI4Py" - ) - get_target_property( - _configurations - ${_library} - IMPORTED_CONFIGURATIONS - ) - if(_configurations) - foreach(_configuration ${_configurations}) - get_target_property( - _imported_location - ${_library} - IMPORTED_LOCATION_${_configuration} - ) - list(APPEND _libraries ${_imported_location}) - endforeach() - endif() - endif() - endforeach() - set(VTK_NEW_LIBRARIES ${_libraries}) - set(VTK_BUILT_SEPARATELY ON) -endif() - -# Create compile_commands.json -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(FORCE_COLORED_OUTPUT - ON - CACHE BOOL - "Forces colored output when compiling with gcc and clang." -) - -# Setting up tests -message(STATUS "Setting up tests with CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}") - -enable_testing() - -add_custom_target(tests) - -# diff tool -find_program(DIFF_EXECUTABLE NAMES diff HINTS ${DIFF_DIR} PATH_SUFFIXES bin) -find_program( - NUMDIFF_EXECUTABLE - NAMES numdiff - HINTS ${NUMDIFF_DIR} - PATH_SUFFIXES bin -) - -mark_as_advanced(DIFF_EXECUTABLE NUMDIFF_EXECUTABLE) - -if("${TEST_DIFF}" STREQUAL "") - if(NOT NUMDIFF_EXECUTABLE MATCHES "-NOTFOUND") - set(TEST_DIFF ${NUMDIFF_EXECUTABLE}) - elseif(NOT DIFF_EXECUTABLE MATCHES "-NOTFOUND") - set(TEST_DIFF ${DIFF_EXECUTABLE}) - else() - message( - FATAL_ERROR - "Could not find diff or numdiff. One of those must be installed for running the testsuite./n" - "Please specify TEST_DIFF by hand." - ) - endif() -endif() - -# Set the name of the project and target: -set(TARGET "main") - -file(GLOB_RECURSE TEST_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc") - -# Set location of Catch -include_directories(${CMAKE_SOURCE_DIR}/../../contrib/catch/) - -# Set location of core library files -include_directories(${CMAKE_SOURCE_DIR}/../../include) - -# Declare all source files the target consists of: -set(TARGET_SRC main.cc ${TEST_SOURCES}) - -# Set targets & link libraries for the build type -add_executable(main ${TARGET_SRC}) -set_property(TARGET main PROPERTY OUTPUT_NAME main) -deal_ii_setup_target(main DEBUG) -target_link_libraries(main ${CMAKE_SOURCE_DIR}/../../libprisms-pf-debug.a) -if(${VTK_BUILT_SEPARATELY}) - include_directories(SYSTEM ${VTK_INCLUDE_DIR}) - target_link_libraries(main ${VTK_NEW_LIBRARIES}) -endif() - -# CTest -add_test(NAME PRISMS_PF_Testsuite COMMAND main) +# Add each test subdirectory +add_subdirectory(core) +add_subdirectory(field_input) +add_subdirectory(user_inputs) +add_subdirectory(utilities) diff --git a/tests/unit_tests/core/CMakeLists.txt b/tests/unit_tests/core/CMakeLists.txt new file mode 100644 index 000000000..82aed849e --- /dev/null +++ b/tests/unit_tests/core/CMakeLists.txt @@ -0,0 +1,14 @@ +file(GLOB TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cc") + +add_executable(test_core ${TEST_SOURCES}) + +target_link_libraries(test_core PRIVATE prisms_pf_debug) + +target_include_directories(test_core PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_test(NAME core COMMAND test_core) \ No newline at end of file diff --git a/tests/unit_tests/main.cc b/tests/unit_tests/core/main.cc similarity index 100% rename from tests/unit_tests/main.cc rename to tests/unit_tests/core/main.cc diff --git a/tests/unit_tests/field_input/CMakeLists.txt b/tests/unit_tests/field_input/CMakeLists.txt new file mode 100644 index 000000000..a7ab527b6 --- /dev/null +++ b/tests/unit_tests/field_input/CMakeLists.txt @@ -0,0 +1,14 @@ +file(GLOB TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cc") + +add_executable(test_field_input ${TEST_SOURCES}) + +target_link_libraries(test_field_input PRIVATE prisms_pf_debug) + +target_include_directories(test_field_input PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_test(NAME field_input COMMAND test_field_input) \ No newline at end of file diff --git a/tests/unit_tests/field_input/main.cc b/tests/unit_tests/field_input/main.cc new file mode 100644 index 000000000..649c944c5 --- /dev/null +++ b/tests/unit_tests/field_input/main.cc @@ -0,0 +1,5 @@ +// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan +// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 + +#define CATCH_CONFIG_MAIN +#include "catch.hpp" \ No newline at end of file diff --git a/tests/unit_tests/field_input/read_binary.cc b/tests/unit_tests/field_input/read_binary.cc index 1b91e948c..bddf3cd8d 100644 --- a/tests/unit_tests/field_input/read_binary.cc +++ b/tests/unit_tests/field_input/read_binary.cc @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan // SPDX-License-Identifier: GNU Lesser General Public Version 2.1 +#include + #include #include @@ -10,104 +12,457 @@ PRISMS_PF_BEGIN_NAMESPACE TEST_CASE("Read binary file") { - SECTION("Nonexistent file") + // Number of points in each direction for all tests + const unsigned int n_points_x = 11; + const unsigned int n_points_y = 4; + const unsigned int n_points_z = 3; + + // General InitialConditionFile structure that we modify for each test + InitialConditionFile file { + .filename = "", + .dataset_format = DataFormatType::FlatBinary, + .file_variable_names = {"n"}, + .simulation_variable_names = {"n"}, + .n_data_points = {n_points_x, n_points_y, n_points_z} + }; + + const double mesh_size = 10.0; + + // Some step sizes + const double dx = mesh_size / n_points_x; + const double dy = mesh_size / n_points_y; + const double dz = mesh_size / n_points_z; + + SECTION("1D Scalar field") { - InitialConditionFile file; - file.filename = "nonexistent.bin"; - SpatialDiscretization<2> spatial_discretization; - REQUIRE_THROWS(ReadBinary<2, double>(file, spatial_discretization)); + const unsigned int dim = 1; + + file.filename = "test_scalar_1D.bin"; + + // Create a simple spatial discretization + SpatialDiscretization spatial_discretization; + for (unsigned int i : std::views::iota(0U, dim)) + { + spatial_discretization.set_size(i, mesh_size); + } + spatial_discretization.postprocess_and_validate(); + + // Grab the number of points and fill out a data array to write to file + const unsigned int total_points = n_points_x; + std::vector data(total_points); + for (unsigned int i : std::views::iota(0U, total_points)) + { + data[i] = i; + } + ReadBinary::write_file(data, file); + + // Read the file + ReadBinary reader(file, spatial_discretization); + + // Check that the values are correct at each point and halfway between points + for (unsigned int i : std::views::iota(0U, n_points_x)) + { + const double x_coord = i * dx; + dealii::Point point(x_coord); + + // Evaluate at the grid point + REQUIRE(reader.get_scalar_value(point, "n") == + Approx(i).epsilon(Defaults::tolerance)); + + // Evaluate halfway between grid points (except at the last point) + if (i < n_points_x - 1) + { + point[0] += 0.5 * dx; + REQUIRE(reader.get_scalar_value(point, "n") == + Approx(i + 0.5).epsilon(Defaults::tolerance)); + } + } } - SECTION("1D read/write") + SECTION("1D Vector field") { - InitialConditionFile file; - std::vector data = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; - file.filename = "field_input/test_1D.bin"; - file.dataset_format = DataFormatType::FlatBinary; - file.n_data_points = {6, 0, 0}; - ReadBinary<1, double>::write_file(data, file); - SpatialDiscretization<1> spatial_discretization; - spatial_discretization.set_size(0, 5.0); - ReadBinary<1, double> reader(file, spatial_discretization); - // Check values at selected points - dealii::Point<1> point1(3.0); - REQUIRE(reader.get_scalar_value(point1, "n") - 3.0 < 1e-12); - dealii::Point<1> point2(2.5); - REQUIRE(reader.get_scalar_value(point2, "n") - 2.5 < 1e-12); + const unsigned int dim = 1; + + file.filename = "test_vector_1D.bin"; + + // Create a simple spatial discretization + SpatialDiscretization spatial_discretization; + for (unsigned int i : std::views::iota(0U, dim)) + { + spatial_discretization.set_size(i, mesh_size); + } + spatial_discretization.postprocess_and_validate(); + + // Grab the number of points and fill out a data array to write to file + const unsigned int total_points = n_points_x; + std::vector data(dim * total_points); + for (unsigned int i : std::views::iota(0U, total_points)) + { + for (unsigned int d : std::views::iota(0U, dim)) + { + data[(dim * i) + d] = i; + } + } + ReadBinary::write_file(data, file); + + // Read the file + ReadBinary reader(file, spatial_discretization); + + // Check that the values are correct at each point and halfway between points + for (unsigned int i : std::views::iota(0U, n_points_x)) + { + const double x_coord = i * dx; + + for (unsigned int d : std::views::iota(0U, dim)) + { + dealii::Point point(x_coord); + + // Evaluate at the grid point + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i).epsilon(Defaults::tolerance)); + + // Evaluate halfway between grid points (except at the last point) + if (i < n_points_x - 1) + { + point[0] += 0.5 * dx; + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + 0.5).epsilon(Defaults::tolerance)); + } + } + } } - SECTION("2D read/write") + SECTION("2D Scalar field") { - InitialConditionFile file; - std::vector data = - {0.0, 0.0, 0.0, 0.0, 0.0, 10.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0}; - file.filename = "field_input/test_2D.bin"; - file.dataset_format = DataFormatType::FlatBinary; - file.n_data_points = {4, 3, 0}; - ReadBinary<2, double>::write_file(data, file); - SpatialDiscretization<2> spatial_discretization; - spatial_discretization.set_size(0, 3.0); - spatial_discretization.set_size(1, 2.0); - ReadBinary<2, double> reader(file, spatial_discretization); - - // Check values at selected points - dealii::Point<2> point1 = {0.5, 0.5}; - REQUIRE(reader.get_scalar_value(point1, "n") - 2.5 < 1e-12); - dealii::Point<2> point2 = {3.0, 1.5}; - REQUIRE(reader.get_scalar_value(point2, "n") - 0.5 < 1e-12); + const unsigned int dim = 2; + + file.filename = "test_scalar_2D.bin"; + + // Create a simple spatial discretization + SpatialDiscretization spatial_discretization; + for (unsigned int i : std::views::iota(0U, dim)) + { + spatial_discretization.set_size(i, mesh_size); + } + spatial_discretization.postprocess_and_validate(); + + // Grab the number of points and fill out a data array to write to file + const unsigned int total_points = n_points_x * n_points_y; + std::vector data(total_points); + for (unsigned int i : std::views::iota(0U, total_points)) + { + data[i] = i; + } + ReadBinary::write_file(data, file); + + // Read the file + ReadBinary reader(file, spatial_discretization); + + // Check that the values are correct at each point and halfway between points + for (unsigned int i : std::views::iota(0U, n_points_x)) + { + const double x_coord = i * dx; + + for (unsigned int j : std::views::iota(0U, n_points_y)) + { + const double y_coord = j * dy; + + dealii::Point point(x_coord, y_coord); + + // Evaluate at the grid point + REQUIRE(reader.get_scalar_value(point, "n") == + Approx(i + (n_points_x * j)).epsilon(Defaults::tolerance)); + + // Evaluate halfway between grid points (except at the last point) + if ((i < n_points_x - 1) && (j < n_points_y - 1)) + { + // Halfway in x-direction + point[0] += 0.5 * dx; + REQUIRE(reader.get_scalar_value(point, "n") == + Approx(i + 0.5 + (n_points_x * j)).epsilon(Defaults::tolerance)); + + // Halfway in y-direction + point[0] -= 0.5 * dx; + point[1] += 0.5 * dy; + REQUIRE( + reader.get_scalar_value(point, "n") == + Approx(i + (n_points_x * (j + 0.5))).epsilon(Defaults::tolerance)); + + // Halfway in both directions + point[0] += 0.5 * dx; + REQUIRE(reader.get_scalar_value(point, "n") == + Approx(i + 0.5 + (n_points_x * (j + 0.5))) + .epsilon(Defaults::tolerance)); + } + } + } } - SECTION("3D read/write") + SECTION("2D Vector field") { - InitialConditionFile file; - std::vector data = {0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0}; - file.filename = "field_input/test_3D.bin"; - file.dataset_format = DataFormatType::FlatBinary; - file.n_data_points = {2, 2, 2}; - ReadBinary<3, double>::write_file(data, file); - SpatialDiscretization<3> spatial_discretization; - spatial_discretization.set_size(0, 1.0); - spatial_discretization.set_size(1, 1.0); - spatial_discretization.set_size(2, 1.0); - ReadBinary<3, double> reader(file, spatial_discretization); - - // Check values at selected points - dealii::Point<3> point1 = {0.5, 0.5, 0.2}; - REQUIRE(reader.get_scalar_value(point1, "n") - 0.9 < 1e-12); - dealii::Point<3> point2 = {1.0, 1.0, 0.0}; - REQUIRE(reader.get_scalar_value(point2, "n") - 3.0 < 1e-12); - dealii::Point<3> point3 = {0.0, 0.5, 1.0}; - REQUIRE(reader.get_scalar_value(point3, "n") - 2.5 < 1e-12); + const unsigned int dim = 2; + + file.filename = "test_vector_2D.bin"; + + // Create a simple spatial discretization + SpatialDiscretization spatial_discretization; + for (unsigned int i : std::views::iota(0U, dim)) + { + spatial_discretization.set_size(i, mesh_size); + } + spatial_discretization.postprocess_and_validate(); + + // Grab the number of points and fill out a data array to write to file + const unsigned int total_points = n_points_x * n_points_y; + std::vector data(dim * total_points); + for (unsigned int i : std::views::iota(0U, total_points)) + { + for (unsigned int d : std::views::iota(0U, dim)) + { + data[(dim * i) + d] = i; + } + } + ReadBinary::write_file(data, file); + + // Read the file + ReadBinary reader(file, spatial_discretization); + + // Check that the values are correct at each point and halfway between points + for (unsigned int i : std::views::iota(0U, n_points_x)) + { + const double x_coord = i * dx; + + for (unsigned int j : std::views::iota(0U, n_points_y)) + { + const double y_coord = j * dy; + + for (unsigned int d : std::views::iota(0U, dim)) + { + dealii::Point point(x_coord, y_coord); + + // Evaluate at the grid point + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + (n_points_x * j)).epsilon(Defaults::tolerance)); + + // Evaluate halfway between grid points (except at the last point) + if ((i < n_points_x - 1) && (j < n_points_y - 1)) + { + // Halfway in x-direction + point[0] += 0.5 * dx; + REQUIRE( + reader.get_vector_value(point, "n")[d] == + Approx(i + 0.5 + (n_points_x * j)).epsilon(Defaults::tolerance)); + + // Halfway in y-direction + point[0] -= 0.5 * dx; + point[1] += 0.5 * dy; + REQUIRE( + reader.get_vector_value(point, "n")[d] == + Approx(i + (n_points_x * (j + 0.5))).epsilon(Defaults::tolerance)); + + // Halfway in both directions + point[0] += 0.5 * dx; + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + 0.5 + (n_points_x * (j + 0.5))) + .epsilon(Defaults::tolerance)); + } + } + } + } } - SECTION("3D vector read/write") + SECTION("3D Scalar field") { - InitialConditionFile file; - std::vector data = {0.0, 10.0, 20.0, 0.0, 10.0, 20.0, 1.0, 11.0, - 21.0, 1.0, 11.0, 21.0, 2.0, 12.0, 22.0, 2.0, - 12.0, 22.0, 3.0, 13.0, 23.0, 3.0, 13.0, 23.0}; - file.filename = "field_input/test_3D_vec.bin"; - file.dataset_format = DataFormatType::FlatBinary; - file.n_data_points = {2, 2, 2}; - ReadBinary<3, double>::write_file(data, file); - SpatialDiscretization<3> spatial_discretization; - spatial_discretization.set_size(0, 1.0); - spatial_discretization.set_size(1, 1.0); - spatial_discretization.set_size(2, 1.0); - ReadBinary<3, double> reader(file, spatial_discretization); - - // Check values at selected points - dealii::Point<3> point1 = {0.5, 0.5, 0.2}; - REQUIRE(reader.get_vector_value(point1, "n")[2] - 20.9 < 1e-12); - dealii::Point<3> point2 = {0.0, 0.0, 0.0}; - REQUIRE(reader.get_vector_value(point2, "n")[1] - 10.0 < 1e-12); - dealii::Point<3> point3 = {0.0, 0.5, 1.0}; - REQUIRE(reader.get_vector_value(point3, "n")[0] - 2.5 < 1e-12); + const unsigned int dim = 3; + + file.filename = "test_scalar_3D.bin"; + + // Create a simple spatial discretization + SpatialDiscretization spatial_discretization; + for (unsigned int i : std::views::iota(0U, dim)) + { + spatial_discretization.set_size(i, mesh_size); + } + spatial_discretization.postprocess_and_validate(); + + // Grab the number of points and fill out a data array to write to file + const unsigned int total_points = n_points_x * n_points_y * n_points_z; + std::vector data(total_points); + for (unsigned int i : std::views::iota(0U, total_points)) + { + data[i] = i; + } + ReadBinary::write_file(data, file); + + // Read the file + ReadBinary reader(file, spatial_discretization); + + // Check that the values are correct at each point and halfway between points + for (unsigned int i : std::views::iota(0U, n_points_x)) + { + const double x_coord = i * dx; + + for (unsigned int j : std::views::iota(0U, n_points_y)) + { + const double y_coord = j * dy; + + for (unsigned int k : std::views::iota(0U, n_points_z)) + { + const double z_coord = k * dz; + + dealii::Point point(x_coord, y_coord, z_coord); + + // Evaluate at the grid point + REQUIRE(reader.get_scalar_value(point, "n") == + Approx(i + (n_points_x * j) + (n_points_x * n_points_y * k)) + .epsilon(Defaults::tolerance)); + + // Evaluate halfway between grid points (except at the last point) + if ((i < n_points_x - 1) && (j < n_points_y - 1) && (k < n_points_z - 1)) + { + // Halfway in x-direction + point[0] += 0.5 * dx; + REQUIRE( + reader.get_scalar_value(point, "n") == + Approx(i + 0.5 + (n_points_x * j) + (n_points_x * n_points_y * k)) + .epsilon(Defaults::tolerance)); + + // Halfway in y-direction + point[0] -= 0.5 * dx; + point[1] += 0.5 * dy; + REQUIRE( + reader.get_scalar_value(point, "n") == + Approx(i + (n_points_x * (j + 0.5)) + (n_points_x * n_points_y * k)) + .epsilon(Defaults::tolerance)); + + // Halfway in z-direction + point[1] -= 0.5 * dy; + point[2] += 0.5 * dz; + REQUIRE( + reader.get_scalar_value(point, "n") == + Approx(i + (n_points_x * j) + (n_points_x * n_points_y * (k + 0.5))) + .epsilon(Defaults::tolerance)); + + // Halfway in all directions + point[0] += 0.5 * dx; + point[1] += 0.5 * dy; + REQUIRE(reader.get_scalar_value(point, "n") == + Approx(i + 0.5 + (n_points_x * (j + 0.5)) + + (n_points_x * n_points_y * (k + 0.5))) + .epsilon(Defaults::tolerance)); + } + } + } + } } - SECTION("trigger warning for size mismatch") + SECTION("3D Vector field") { - InitialConditionFile file; - file.filename = "field_input/test_3D_vec.bin"; // from previous test - file.dataset_format = DataFormatType::FlatBinary; - file.n_data_points = {20, 2, 0}; - SpatialDiscretization<3> spatial_discretization; - REQUIRE_THROWS(ReadBinary<3, double>(file, spatial_discretization)); + const unsigned int dim = 3; + + file.filename = "test_vector_3D.bin"; + + // Create a simple spatial discretization + SpatialDiscretization spatial_discretization; + for (unsigned int i : std::views::iota(0U, dim)) + { + spatial_discretization.set_size(i, mesh_size); + } + spatial_discretization.postprocess_and_validate(); + + // Grab the number of points and fill out a data array to write to file + const unsigned int total_points = n_points_x * n_points_y * n_points_z; + std::vector data(dim * total_points); + for (unsigned int i : std::views::iota(0U, total_points)) + { + for (unsigned int d : std::views::iota(0U, dim)) + { + data[(dim * i) + d] = i; + } + } + ReadBinary::write_file(data, file); + + // Read the file + ReadBinary reader(file, spatial_discretization); + + // Check that the values are correct at each point and halfway between points + for (unsigned int i : std::views::iota(0U, n_points_x)) + { + const double x_coord = i * dx; + + for (unsigned int j : std::views::iota(0U, n_points_y)) + { + const double y_coord = j * dy; + + for (unsigned int k : std::views::iota(0U, n_points_z)) + { + const double z_coord = k * dz; + + for (unsigned int d : std::views::iota(0U, dim)) + { + dealii::Point point(x_coord, y_coord, z_coord); + + // Evaluate at the grid point + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + (n_points_x * j) + (n_points_x * n_points_y * k)) + .epsilon(Defaults::tolerance)); + + // Evaluate halfway between grid points (except at the last point) + if ((i < n_points_x - 1) && (j < n_points_y - 1) && + (k < n_points_z - 1)) + { + // Halfway in x-direction + point[0] += 0.5 * dx; + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + 0.5 + (n_points_x * j) + + (n_points_x * n_points_y * k)) + .epsilon(Defaults::tolerance)); + + // Halfway in y-direction + point[0] -= 0.5 * dx; + point[1] += 0.5 * dy; + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + (n_points_x * (j + 0.5)) + + (n_points_x * n_points_y * k)) + .epsilon(Defaults::tolerance)); + + // Halfway in z-direction + point[1] -= 0.5 * dy; + point[2] += 0.5 * dz; + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + (n_points_x * j) + + (n_points_x * n_points_y * (k + 0.5))) + .epsilon(Defaults::tolerance)); + + // Halfway in all directions + point[0] += 0.5 * dx; + point[1] += 0.5 * dy; + REQUIRE(reader.get_vector_value(point, "n")[d] == + Approx(i + 0.5 + (n_points_x * (j + 0.5)) + + (n_points_x * n_points_y * (k + 0.5))) + .epsilon(Defaults::tolerance)); + } + } + } + } + } + } + SECTION("Nonexistent file") + { + file.filename = "nonexistent.bin"; + + // Create a simple spatial discretization + SpatialDiscretization<1> spatial_discretization; + spatial_discretization.set_size(0, mesh_size); + spatial_discretization.postprocess_and_validate(); + + REQUIRE_THROWS(ReadBinary<1, double>(file, spatial_discretization)); + } + SECTION("Invalid mesh type") + { + file.filename = "invalid_mesh_type.bin"; + + // Create a simple spatial discretization + SpatialDiscretization<1> spatial_discretization; + spatial_discretization.set_radius(mesh_size); + spatial_discretization.postprocess_and_validate(); + + REQUIRE_THROWS(ReadBinary<1, double>(file, spatial_discretization)); } } diff --git a/tests/unit_tests/field_input/read_vtk.cc b/tests/unit_tests/field_input/read_vtk.cc index 948e1209e..bcbcbdada 100644 --- a/tests/unit_tests/field_input/read_vtk.cc +++ b/tests/unit_tests/field_input/read_vtk.cc @@ -1,10 +1,12 @@ // SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan // SPDX-License-Identifier: GNU Lesser General Public Version 2.1 -#include -#include +#ifdef PRISMS_PF_WITH_VTK -#include "catch.hpp" +# include +# include + +# include "catch.hpp" PRISMS_PF_BEGIN_NAMESPACE @@ -13,7 +15,7 @@ TEST_CASE("Read vtk file") SECTION("2D Scalar fields with quadrature degree 1") { InitialConditionFile file; - file.filename = "field_input/test_2D_1degree.vtk"; + file.filename = "test_2D_1degree.vtk"; file.dataset_format = DataFormatType::VTKUnstructuredGrid; SpatialDiscretization<2> spatial_discretization; ReadUnstructuredVTK<2, double> reader(file, spatial_discretization); @@ -36,7 +38,7 @@ TEST_CASE("Read vtk file") SECTION("2D Scalar fields with quadrature degree 2") { InitialConditionFile file; - file.filename = "field_input/test_2D_2degree.vtk"; + file.filename = "test_2D_2degree.vtk"; file.dataset_format = DataFormatType::VTKUnstructuredGrid; SpatialDiscretization<2> spatial_discretization; ReadUnstructuredVTK<2, double> reader(file, spatial_discretization); @@ -59,7 +61,7 @@ TEST_CASE("Read vtk file") SECTION("3D Scalar fields with quadrature degree 1") { InitialConditionFile file; - file.filename = "field_input/test_3D_1degree.vtk"; + file.filename = "test_3D_1degree.vtk"; file.dataset_format = DataFormatType::VTKUnstructuredGrid; SpatialDiscretization<3> spatial_discretization; ReadUnstructuredVTK<3, double> reader(file, spatial_discretization); @@ -93,11 +95,13 @@ TEST_CASE("Read vtk file") SECTION("Invalid cell type due to mismatched dimensions") { InitialConditionFile file; - file.filename = "field_input/test_2D_1degree.vtk"; + file.filename = "test_2D_1degree.vtk"; file.dataset_format = DataFormatType::VTKUnstructuredGrid; SpatialDiscretization<3> spatial_discretization; REQUIRE_THROWS(ReadUnstructuredVTK<3, double>(file, spatial_discretization)); } } -PRISMS_PF_END_NAMESPACE \ No newline at end of file +PRISMS_PF_END_NAMESPACE + +#endif \ No newline at end of file diff --git a/tests/unit_tests/user_inputs/CMakeLists.txt b/tests/unit_tests/user_inputs/CMakeLists.txt new file mode 100644 index 000000000..5a4501c1d --- /dev/null +++ b/tests/unit_tests/user_inputs/CMakeLists.txt @@ -0,0 +1,14 @@ +file(GLOB TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cc") + +add_executable(test_user_inputs ${TEST_SOURCES}) + +target_link_libraries(test_user_inputs PRIVATE prisms_pf_debug) + +target_include_directories(test_user_inputs PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_test(NAME user_inputs COMMAND test_user_inputs) \ No newline at end of file diff --git a/tests/unit_tests/user_inputs/main.cc b/tests/unit_tests/user_inputs/main.cc new file mode 100644 index 000000000..649c944c5 --- /dev/null +++ b/tests/unit_tests/user_inputs/main.cc @@ -0,0 +1,5 @@ +// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan +// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 + +#define CATCH_CONFIG_MAIN +#include "catch.hpp" \ No newline at end of file diff --git a/tests/unit_tests/utilities/CMakeLists.txt b/tests/unit_tests/utilities/CMakeLists.txt new file mode 100644 index 000000000..f7a48cf9e --- /dev/null +++ b/tests/unit_tests/utilities/CMakeLists.txt @@ -0,0 +1,14 @@ +file(GLOB TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cc") + +add_executable(test_utilities ${TEST_SOURCES}) + +target_link_libraries(test_utilities PRIVATE prisms_pf_debug) + +target_include_directories(test_utilities PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_test(NAME utilities COMMAND test_utilities) \ No newline at end of file diff --git a/tests/unit_tests/utilities/main.cc b/tests/unit_tests/utilities/main.cc new file mode 100644 index 000000000..649c944c5 --- /dev/null +++ b/tests/unit_tests/utilities/main.cc @@ -0,0 +1,5 @@ +// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan +// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 + +#define CATCH_CONFIG_MAIN +#include "catch.hpp" \ No newline at end of file From 9b462c0202718093febad80f043cd9ec154ec46c Mon Sep 17 00:00:00 2001 From: landinjm Date: Thu, 2 Oct 2025 23:42:41 -0700 Subject: [PATCH 04/17] some more cmake fixes --- .gitignore | 5 +- CMakeLists.txt | 38 +++- cmake/macros/macro_define_library.cmake | 15 +- ...macro_expand_template_instantiations.cmake | 19 +- cmake/macros/macro_prisms_pf_autopilot.cmake | 135 ++++-------- cmake/modules/FindPRISMS_PF_CALIPER.cmake | 4 +- cmake/modules/FindPRISMS_PF_DEAL_II.cmake | 18 +- cmake/prisms_pf-config.cmake.in | 55 +++++ cmake/prisms_pf_config.cmake.in | 6 - cmake/setup_application.cmake | 196 ++++-------------- cmake/setup_prisms_pf.cmake | 101 ++++++--- .../allen_cahn_explicit/CMakeLists.txt | 23 +- tests/unit_tests/core/CMakeLists.txt | 14 +- tests/unit_tests/field_input/CMakeLists.txt | 14 +- tests/unit_tests/user_inputs/CMakeLists.txt | 14 +- tests/unit_tests/utilities/CMakeLists.txt | 14 +- 16 files changed, 315 insertions(+), 356 deletions(-) create mode 100644 cmake/prisms_pf-config.cmake.in delete mode 100644 cmake/prisms_pf_config.cmake.in diff --git a/.gitignore b/.gitignore index 1a33cc6e8..c2e084bc5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,8 @@ CTest* # Config files include/prismspf/config.h -cmake/prisms_pf_config.cmake +cmake/prisms_pf-config.cmake +cmake/prisms_pf-targets.cmake cmake/templates compile_commands.json @@ -33,7 +34,7 @@ compile_commands.json *.a # Executables -main +main-release main-debug # Output files diff --git a/CMakeLists.txt b/CMakeLists.txt index af9cec656..0da0a6716 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,7 +225,10 @@ if(NOT PRISMS_PF_ADDITIONAL_CXX_FLAGS STREQUAL "") message(STATUS " PRISMS_PF_WARNING_FLAGS: ${PRISMS_PF_WARNING_FLAGS}") message(STATUS " PRISMS_PF_CXX_FLAGS: ${PRISMS_PF_CXX_FLAGS}") message(STATUS " PRISMS_PF_CXX_FLAGS_DEBUG: ${PRISMS_PF_CXX_FLAGS_DEBUG}") - message(STATUS " PRISMS_PF_CXX_FLAGS_RELEASE: ${PRISMS_PF_CXX_FLAGS_RELEASE}") + message( + STATUS + " PRISMS_PF_CXX_FLAGS_RELEASE: ${PRISMS_PF_CXX_FLAGS_RELEASE}" + ) endif() foreach(_build ${PRISMS_PF_BUILD_TYPES}) @@ -235,6 +238,7 @@ foreach(_build ${PRISMS_PF_BUILD_TYPES}) string(TOLOWER ${_build} _build_lowercase) string(TOUPPER ${_build} _build_uppercase) set(_library "prisms_pf_${_build_lowercase}") + list(APPEND PRISMS_PF_TARGETS ${_library}) # Add the library and set some properties add_library(${_library} STATIC) @@ -253,6 +257,7 @@ foreach(_build ${PRISMS_PF_BUILD_TYPES}) prisms_pf_user_inputs_${_build_lowercase} prisms_pf_utilities_${_build_lowercase} ) + list(APPEND PRISMS_PF_TARGETS ${_library_dependencies}) set(_include_directories ${PRISMS_PF_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/include @@ -261,27 +266,30 @@ foreach(_build ${PRISMS_PF_BUILD_TYPES}) ) # Link the PRISMS-PF libraries - target_link_libraries(${_library} PRIVATE ${_library_dependencies}) + target_link_libraries(${_library} PUBLIC ${_library_dependencies}) # Add explicit dependencies to ensure proper build order with Ninja add_dependencies(${_library} ${_library_dependencies}) # Set the include directories target_include_directories( ${_library} - PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/src include + PUBLIC ${CMAKE_BINARY_DIR}/include + PRIVATE ${CMAKE_BINARY_DIR}/src ) target_compile_options( ${_library} PRIVATE - $<$:${PRISMS_PF_WARNING_FLAGS} + $<$: + ${PRISMS_PF_WARNING_FLAGS} ${PRISMS_PF_CXX_FLAGS} ${PRISMS_PF_CXX_FLAGS_${_build_uppercase}}> ) target_link_options( ${_library} PRIVATE - $<$:${PRISMS_PF_LINKER_FLAGS} + $<$: + ${PRISMS_PF_LINKER_FLAGS} ${PRISMS_PF_LINKER_FLAGS_${_build_uppercase}}> ) @@ -311,7 +319,8 @@ if(UNIT_TESTS) enable_testing() add_subdirectory(tests/unit_tests) - add_custom_target(run_tests + add_custom_target( + run_tests COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure DEPENDS test_core test_field_input test_user_inputs test_utilities WORKING_DIRECTORY ${CMAKE_BINARY_DIR} @@ -336,10 +345,19 @@ endif() include(${CMAKE_SOURCE_DIR}/cmake/write_config.cmake) # Generate configuration file for applications -configure_file( - ${CMAKE_SOURCE_DIR}/cmake/prisms_pf_config.cmake.in - ${CMAKE_BINARY_DIR}/cmake/prisms_pf_config.cmake - @ONLY +include(CMakePackageConfigHelpers) +configure_package_config_file( + ${CMAKE_SOURCE_DIR}/cmake/prisms_pf-config.cmake.in + ${CMAKE_BINARY_DIR}/cmake/prisms_pf-config.cmake + INSTALL_DESTINATION ${CMAKE_BINARY_DIR}/cmake +) + +# Export targets +list(REMOVE_DUPLICATES PRISMS_PF_TARGETS) +export( + TARGETS ${PRISMS_PF_TARGETS} + FILE "${CMAKE_BINARY_DIR}/cmake/prisms_pf-targets.cmake" + NAMESPACE prisms_pf:: ) # Print the config diff --git a/cmake/macros/macro_define_library.cmake b/cmake/macros/macro_define_library.cmake index b86e6aa34..5b45ea729 100644 --- a/cmake/macros/macro_define_library.cmake +++ b/cmake/macros/macro_define_library.cmake @@ -26,12 +26,17 @@ function(define_library _library) target_compile_options( ${_target} PRIVATE - $<$:${PRISMS_PF_WARNING_FLAGS} ${PRISMS_PF_CXX_FLAGS} ${PRISMS_PF_CXX_FLAGS_${_build_uppercase}}> + $<$: + ${PRISMS_PF_WARNING_FLAGS} + ${PRISMS_PF_CXX_FLAGS} + ${PRISMS_PF_CXX_FLAGS_${_build_uppercase}}> ) target_link_options( ${_target} PRIVATE - $<$:${PRISMS_PF_LINKER_FLAGS} ${PRISMS_PF_LINKER_FLAGS_${_build_uppercase}}> + $<$: + ${PRISMS_PF_LINKER_FLAGS} + ${PRISMS_PF_LINKER_FLAGS_${_build_uppercase}}> ) # Add other dependencies, making sure they are public so that they @@ -42,20 +47,20 @@ function(define_library _library) target_include_directories( ${_target} SYSTEM - PUBLIC ${VTK_INCLUDE_DIR} + PRIVATE ${VTK_INCLUDE_DIR} ) target_link_libraries(${_target} PUBLIC ${VTK_NEW_LIBRARIES}) endif() # caliper if(${PRISMS_PF_WITH_CALIPER}) - target_link_libraries(${_target} PUBLIC caliper) + target_link_libraries(${_target} PRIVATE caliper) endif() # deal.II target_link_libraries( ${_target} - PUBLIC ${DEAL_II_TARGET_${_build_uppercase}} + PRIVATE ${DEAL_II_TARGET_${_build_uppercase}} ) endforeach() endfunction() diff --git a/cmake/macros/macro_expand_template_instantiations.cmake b/cmake/macros/macro_expand_template_instantiations.cmake index 6197d59c3..286ed8220 100644 --- a/cmake/macros/macro_expand_template_instantiations.cmake +++ b/cmake/macros/macro_expand_template_instantiations.cmake @@ -57,13 +57,18 @@ macro(expand_template_instantiations _target _inst_in_files) # in the right order add_custom_target(${_target}_inst ALL DEPENDS ${_inst_targets}) - # Add this target again to the different build types - foreach(_build ${PRISMS_PF_BUILD_TYPES}) - # The build types are uppercase so we need to - # convert them - string(TOLOWER ${_build} _build_lowercase) + # Add this target again to the different build types if the override is off. + if(NOT DEFINED BUILD_OVERRIDE) + foreach(_build ${PRISMS_PF_BUILD_TYPES}) + # The build types are uppercase so we need to + # convert them + string(TOLOWER ${_build} _build_lowercase) + # Add the target + add_dependencies(${_target}_${_build_lowercase} ${_target}_inst) + endforeach() + else() # Add the target - add_dependencies(${_target}_${_build_lowercase} ${_target}_inst) - endforeach() + add_dependencies(${_target} ${_target}_inst) + endif() endmacro() diff --git a/cmake/macros/macro_prisms_pf_autopilot.cmake b/cmake/macros/macro_prisms_pf_autopilot.cmake index efbac4497..08235e650 100644 --- a/cmake/macros/macro_prisms_pf_autopilot.cmake +++ b/cmake/macros/macro_prisms_pf_autopilot.cmake @@ -12,68 +12,6 @@ macro(prisms_pf_autopilot PRISMS_PF_CORE_DIR) # Enable compile commands export set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - include_directories(${CMAKE_BINARY_DIR}) - - # Set location of files - include_directories(${PRISMS_PF_CORE_DIR}/include) - include_directories(${PRISMS_PF_CORE_DIR}/src) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - - # Find Caliper if enabled - if(${PRISMS_PF_WITH_CALIPER}) - find_package(CALIPER REQUIRED) - include_directories(${CALIPER_INCLUDE_DIR}) - endif() - - # Check that deal.II was built with vtk or we can find the package ourselves - set(VTK_BUILT_SEPARATELY - OFF - CACHE BOOL - "Whether the installed VTK library was built outside of deal.II." - ) - if(NOT DEAL_II_WITH_VTK) - find_package(VTK QUIET HINTS ${VTK_DIR} $ENV{VTK_DIR}) - if(NOT VTK_FOUND) - message( - SEND_ERROR - "\n**deal.II was built without support for VTK!\n" - ) - set(DEALII_INSTALL_VALID OFF) - endif() - set(VTK_VERSION "${VTK_VERSION}") - set(VTK_MAJOR_VERSION "${VTK_MAJOR_VERSION}") - set(VTK_MINOR_VERSION "${VTK_MINOR_VERSION}") - set(VTK_INCLUDE_DIR - ${VTK_PREFIX_PATH}/include/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION} - ) - # Filter the included libraries - set(_libraries) - foreach(_library ${VTK_LIBRARIES}) - if( - NOT ${_library} MATCHES "Python" - AND NOT ${_library} MATCHES "MPI4Py" - ) - get_target_property( - _configurations - ${_library} - IMPORTED_CONFIGURATIONS - ) - if(_configurations) - foreach(_configuration ${_configurations}) - get_target_property( - _imported_location - ${_library} - IMPORTED_LOCATION_${_configuration} - ) - list(APPEND _libraries ${_imported_location}) - endforeach() - endif() - endif() - endforeach() - set(VTK_NEW_LIBRARIES ${_libraries}) - set(VTK_BUILT_SEPARATELY ON) - endif() - # Set the location of application source files # Check if an override is specified otherwise # proceed with defaults @@ -87,43 +25,54 @@ macro(prisms_pf_autopilot PRISMS_PF_CORE_DIR) set(TARGET_SRC ${TARGET_SRC_OVERRIDE}) endif() - foreach(_build ${PRISMS_PF_BUILD_TYPES}) + # Create the exectuables + foreach(_build ${APPLICATION_BUILD_TYPES}) string(TOLOWER ${_build} _build_lowercase) - add_executable(main_${_build_lowercase} ${TARGET_SRC}) - endforeach() + string(TOUPPER ${_build} _build_uppercase) - expand_template_instantiations(main "custom_pde.inst.in") + set(_target main-${_build_lowercase}) - # Set targets & link libraries for the build type - if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON") - set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug) - target_link_libraries( - main_debug - ${PRISMS_PF_CORE_DIR}/libprisms-pf-debug.a - ) + add_executable(${_target} ${TARGET_SRC}) - if(${VTK_BUILT_SEPARATELY}) - include_directories(SYSTEM ${VTK_INCLUDE_DIR}) - target_link_libraries(main_debug ${VTK_NEW_LIBRARIES}) - endif() - if(${PRISMS_PF_WITH_CALIPER}) - target_link_libraries(main_debug caliper) + if(TARGET prisms_pf::prisms_pf_${_build_lowercase}) + target_link_libraries( + ${_target} + PRIVATE prisms_pf::prisms_pf_${_build_lowercase} + ) + message( + STATUS + "Successfully linked ${_target} to prisms_pf_${_build_lowercase}" + ) + else() + message( + FATAL_ERROR + "Target prisms_pf_${_build_lowercase} does not exist! " + "Available build types: ${PRISMS_PF_BUILD_TYPES}" + ) endif() - endif() - if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON") - set_property(TARGET main_release PROPERTY OUTPUT_NAME main) - target_link_libraries( - main_release - ${PRISMS_PF_CORE_DIR}/libprisms-pf-release.a + target_include_directories( + ${_target} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) - if(${VTK_BUILT_SEPARATELY}) - include_directories(SYSTEM ${VTK_INCLUDE_DIR}) - target_link_libraries(main_release ${VTK_NEW_LIBRARIES}) - endif() - if(${PRISMS_PF_WITH_CALIPER}) - target_link_libraries(main_release caliper) - endif() - endif() + target_compile_options( + ${_target} + PRIVATE + $<$: + ${PRISMS_PF_WARNING_FLAGS} + ${PRISMS_PF_CXX_FLAGS} + ${PRISMS_PF_CXX_FLAGS_${_build_uppercase}}> + ) + target_link_options( + ${_target} + PRIVATE + $<$: + ${PRISMS_PF_LINKER_FLAGS} + ${PRISMS_PF_LINKER_FLAGS_${_build_uppercase}}> + ) + + set(BUILD_OVERRIDE "") + expand_template_instantiations(${_target} "custom_pde.inst.in") + endforeach() endmacro() diff --git a/cmake/modules/FindPRISMS_PF_CALIPER.cmake b/cmake/modules/FindPRISMS_PF_CALIPER.cmake index 0129e5044..ffd5359b6 100644 --- a/cmake/modules/FindPRISMS_PF_CALIPER.cmake +++ b/cmake/modules/FindPRISMS_PF_CALIPER.cmake @@ -3,13 +3,13 @@ # if(PRISMS_PF_AUTODETECTION) - find_package(CALIPER QUIET HINTS ${CALIPER_DIR} $ENV{CALIPER_DIR}) + find_package(Caliper QUIET HINTS ${CALIPER_DIR} $ENV{CALIPER_DIR}) if(${CALIPER_FOUND}) set(PRISMS_PF_WITH_CALIPER ON) endif() endif() if(PRISMS_PF_WITH_CALIPER) - find_package(CALIPER QUIET HINTS ${CALIPER_DIR} $ENV{CALIPER_DIR}) + find_package(Caliper QUIET HINTS ${CALIPER_DIR} $ENV{CALIPER_DIR}) message(STATUS "CALIPER_DIR: ${CALIPER_DIR}") if(${CALIPER_FOUND}) include_directories(${CALIPER_INCLUDE_DIR}) diff --git a/cmake/modules/FindPRISMS_PF_DEAL_II.cmake b/cmake/modules/FindPRISMS_PF_DEAL_II.cmake index ec4bf84bc..22f67163d 100644 --- a/cmake/modules/FindPRISMS_PF_DEAL_II.cmake +++ b/cmake/modules/FindPRISMS_PF_DEAL_II.cmake @@ -71,25 +71,25 @@ if(PRISMS_PF_WITH_ZLIB) endif() macro(append_flags SOURCE_FLAGS DEST_FLAGS) - if(${SOURCE_FLAGS}) - separate_arguments(_temp_flags NATIVE_COMMAND "${${SOURCE_FLAGS}}") - foreach(flag IN LISTS _temp_flags) - list(APPEND ${DEST_FLAGS} "${flag}") - endforeach() - endif() + if(${SOURCE_FLAGS}) + separate_arguments(_temp_flags NATIVE_COMMAND "${${SOURCE_FLAGS}}") + foreach(flag IN LISTS _temp_flags) + list(APPEND ${DEST_FLAGS} "${flag}") + endforeach() + endif() endmacro() function(remove_std_flag variable_name) # Get the current value set(flags "${${variable_name}}") - + # Remove any -std=c++XX or -std=gnu++XX flags string(REGEX REPLACE "-std=[^ ]+" "" flags "${flags}") - + # Clean up any extra spaces string(REGEX REPLACE " +" " " flags "${flags}") string(STRIP "${flags}" flags) - + # Set the modified value back to the parent scope set(${variable_name} "${flags}" PARENT_SCOPE) endfunction() diff --git a/cmake/prisms_pf-config.cmake.in b/cmake/prisms_pf-config.cmake.in new file mode 100644 index 000000000..12902ae66 --- /dev/null +++ b/cmake/prisms_pf-config.cmake.in @@ -0,0 +1,55 @@ +# prisms_pf-config.cmake + +@PACKAGE_INIT@ + +# Provide the location of the build tree +set(PRISMS_PF_CORE_DIR "@CMAKE_SOURCE_DIR@") +set(PRISMS_PF_BINARY_DIR "@CMAKE_BINARY_DIR@") + +# Build types +set(PRISMS_PF_BUILD_TYPES @PRISMS_PF_BUILD_TYPES@ CACHE STRING "List of PRISMS-PF build types") + +# Warning flags +set(PRISMS_PF_WARNING_FLAGS @PRISMS_PF_WARNING_FLAGS@) + +# Compiler flags +set(PRISMS_PF_CXX_FLAGS @PRISMS_PF_CXX_FLAGS@) +set(PRISMS_PF_CXX_FLAGS_DEBUG @PRISMS_PF_CXX_FLAGS_DEBUG@) +set(PRISMS_PF_CXX_FLAGS_RELEASE @PRISMS_PF_CXX_FLAGS_RELEASE@) + +# Linker flags +set(PRISMS_PF_LINKER_FLAGS @PRISMS_PF_LINKER_FLAGS@) +set(PRISMS_PF_LINKER_FLAGS_DEBUG @PRISMS_PF_LINKER_FLAGS_DEBUG@) +set(PRISMS_PF_LINKER_FLAGS_RELEASE @PRISMS_PF_LINKER_FLAGS_RELEASE@) + +# Dependencies +include(CMakeFindDependencyMacro) + +set(DEAL_II_DIR "@DEAL_II_DIR@") +find_dependency(deal.II REQUIRED HINTS ${DEAL_II_DIR}) + +if(@PRISMS_PF_WITH_CALIPER@) +set(CALIPER_DIR "@CALIPER_DIR@") +find_dependency(Caliper REQUIRED HINTS ${CALIPER_DIR}) +endif() + +if(@PRISMS_PF_WITH_VTK@) +set(VTK_DIR "@VTK_DIR@") +find_dependency(VTK REQUIRED HINTS ${VTK_DIR}) +endif() + +# Exported targets +include("${CMAKE_CURRENT_LIST_DIR}/prisms_pf-targets.cmake") + +# Whether the package was found +set(PRISMS_PF_FOUND TRUE) + +# Configuration options +set(64BIT_INDICES @64BIT_INDICES@ CACHE BOOL "Whether 64-bit numbers are enabled for large simulations") + +# Dependencies +set(PRISMS_PF_WITH_CALIPER @PRISMS_PF_WITH_CALIPER@ CACHE BOOL "Whether Caliper is enabled" FORCE) +set(PRISMS_PF_WITH_VTK @PRISMS_PF_WITH_VTK@ CACHE BOOL "Whether VTK is enabled" FORCE) +set(PRISMS_PF_WITH_ZLIB @PRISMS_PF_WITH_ZLIB@ CACHE BOOL "Whether zlib is enabled" FORCE) + +check_required_components(prisms_pf) diff --git a/cmake/prisms_pf_config.cmake.in b/cmake/prisms_pf_config.cmake.in deleted file mode 100644 index 354eceddd..000000000 --- a/cmake/prisms_pf_config.cmake.in +++ /dev/null @@ -1,6 +0,0 @@ -# PRISMS-PF configuration variables - -set(64BIT_INDICES @64BIT_INDICES@ CACHE BOOL "Whether 64-bit numbers are enabled for large simulations") -set(PRISMS_PF_WITH_CALIPER @PRISMS_PF_WITH_CALIPER@ CACHE BOOL "Whether Caliper is enabled" FORCE) -set(PRISMS_PF_WITH_VTK @PRISMS_PF_WITH_VTK@ CACHE BOOL "Whether VTK is enabled" FORCE) -set(PRISMS_PF_WITH_ZLIB @PRISMS_PF_WITH_ZLIB@ CACHE BOOL "Whether zlib is enabled" FORCE) diff --git a/cmake/setup_application.cmake b/cmake/setup_application.cmake index b389024c2..b02c019be 100644 --- a/cmake/setup_application.cmake +++ b/cmake/setup_application.cmake @@ -24,6 +24,13 @@ message(STATUS "") # Set the standard to C++20 set_cpp_standard(20) +# Make and ninja build options +if(CMAKE_GENERATOR MATCHES "Ninja") + set(_make_command "$ ninja") +else() + set(_make_command " $ make") +endif() + # Setup the build type (debug, release, debugrelease) if("${CMAKE_BUILD_TYPE}" STREQUAL "") set(CMAKE_BUILD_TYPE @@ -34,177 +41,52 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "") ) endif() -# Convert build type into the debug and release builds, which may or may -# not be built. -if( - "${CMAKE_BUILD_TYPE}" STREQUAL "Release" - OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" - OR "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease" -) - message( - STATUS - "Setting up PRISMS-PF application for ${CMAKE_BUILD_TYPE} mode." - ) -else() - message( - FATAL_ERROR - "CMAKE_BUILD_TYPE must either be 'Release', 'Debug', or 'DebugRelease', but is set to '${CMAKE_BUILD_TYPE}'." - ) -endif() - -if( - "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" - OR "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease" -) - set(PRISMS_PF_BUILD_DEBUG "ON") -else() - set(PRISMS_PF_BUILD_DEBUG "OFF") -endif() - -if( - "${CMAKE_BUILD_TYPE}" STREQUAL "Release" - OR "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease" -) - set(PRISMS_PF_BUILD_RELEASE "ON") -else() - set(PRISMS_PF_BUILD_RELEASE "OFF") -endif() - -# Find deal.II installation -find_package(deal.II 9.6.0 QUIET HINTS ${DEAL_II_DIR} $ENV{DEAL_II_DIR}) -if(NOT ${deal.II_FOUND}) - message( - FATAL_ERROR - "\n*** Could not find a recent version of deal.II. ***\n" - "You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to cmake " - "or set an environment variable \"DEAL_II_DIR\" that contains a path to a " - "recent version of deal.II." - ) -endif() - -message( - STATUS - "Found deal.II version ${DEAL_II_PACKAGE_VERSION} at '${deal.II_DIR}'" -) - -set(DEALII_INSTALL_VALID ON) - -if(NOT DEAL_II_WITH_LAPACK) - message(SEND_ERROR "\n**deal.II was built without support for lapack!\n") - set(DEALII_INSTALL_VALID OFF) -endif() - -if(NOT DEAL_II_WITH_P4EST) - message(SEND_ERROR "\n**deal.II was built without support for p4est!\n") - set(DEALII_INSTALL_VALID OFF) -endif() - -if(NOT DEAL_II_WITH_MPI) - message(SEND_ERROR "\n**deal.II was built without support for MPI!\n") - set(DEALII_INSTALL_VALID OFF) +# List of build types for the application +if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") + list(APPEND APPLICATION_BUILD_TYPES "Debug") endif() -if(NOT DEALII_INSTALL_VALID) - message( - FATAL_ERROR - "\nPRISMS-PF requires a deal.II installation with certain features enabled!\n" - ) +if("${CMAKE_BUILD_TYPE}" MATCHES "Release") + list(APPEND APPLICATION_BUILD_TYPES "Release") endif() -# Optional deal.II packages -message(STATUS "Using PRISMS_PF_WITH_ZLIB = '${PRISMS_PF_WITH_ZLIB}'") -if(PRISMS_PF_WITH_ZLIB) - if(DEAL_II_WITH_ZLIB) - message(STATUS " Found deal.II installation with zlib") - else() +# Check that the core library was compiled with those build types +foreach(BUILD_TYPE ${APPLICATION_BUILD_TYPES}) + if(NOT BUILD_TYPE IN_LIST PRISMS_PF_BUILD_TYPES) message( FATAL_ERROR - "deal.II installation with zlib not found. Disable PRISMS_PF_WITH_ZLIB or recompile deal.II with zlib." + "Build type '${BUILD_TYPE}' not found in PRISMS_PF_BUILD_TYPES" ) endif() -endif() +endforeach() -# Caliper -message(STATUS "Using PRISMS_PF_WITH_CALIPER = '${PRISMS_PF_WITH_CALIPER}'") -if(PRISMS_PF_WITH_CALIPER) - find_package(CALIPER) - if(${CALIPER_FOUND}) - include_directories(${CALIPER_INCLUDE_DIR}) - message(STATUS " Caliper found at ${CALIPER_DIR}") - else() - message( - FATAL_ERROR - "Caliper not found. Disable PRISMS_PF_WITH_CALIPER or specify a hint to your installation directory with CALIPER_DIR" +# For each of the build types as some targets that switch the type and compile +if("Debug" IN_LIST APPLICATION_BUILD_TYPES) + add_custom_target( + debug + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Configuring and compiling in DEBUG mode..." + ) + if("Release" IN_LIST APPLICATION_BUILD_TYPES) + add_custom_target( + debugrelease + COMMAND + ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Configuring and compiling in DEBUG + RELEASE mode..." ) endif() endif() - -# Make and ninja build options -if(CMAKE_GENERATOR MATCHES "Ninja") - set(_make_command "$ ninja") -else() - set(_make_command " $ make") -endif() - -# Debug and release targets -if(${DEAL_II_BUILD_TYPE} MATCHES "DebugRelease") +if("Release" IN_LIST APPLICATION_BUILD_TYPES) add_custom_target( release - COMMAND ${CMAKE_COMMAND} -D CMAKE_BUILD_TYPE=Release . - COMMAND ${CMAKE_COMMAND} -E echo "***" - COMMAND - ${CMAKE_COMMAND} -E echo - "*** Switched to Release mode. Now recompile with: ${_make_command}" - COMMAND ${CMAKE_COMMAND} -E echo "***" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - VERBATIM - COMMENT "switching to RELEASE mode..." - ) - - add_custom_target( - debug - COMMAND ${CMAKE_COMMAND} -D CMAKE_BUILD_TYPE=Debug . - COMMAND ${CMAKE_COMMAND} -E echo "***" - COMMAND - ${CMAKE_COMMAND} -E echo - "*** Switched to Debug mode. Now recompile with: ${_make_command}" - COMMAND ${CMAKE_COMMAND} -E echo "***" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - VERBATIM - COMMENT "switching to DEBUG mode..." - ) - - add_custom_target( - debugrelease - COMMAND ${CMAKE_COMMAND} -D CMAKE_BUILD_TYPE=DebugRelease . - COMMAND ${CMAKE_COMMAND} -E echo "***" COMMAND - ${CMAKE_COMMAND} -E echo - "*** Switched to Debug and Release mode. Now recompile with: ${_make_command}" - COMMAND ${CMAKE_COMMAND} -E echo "***" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - VERBATIM - COMMENT "switching to DEBUG/RELEASE mode..." + ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=DebugRelease ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Configuring and compiling in RELEASE mode..." ) endif() - -# Add distclean target to clean build -add_custom_target( - distclean - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean - COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles - COMMAND - ${CMAKE_COMMAND} -E remove CMakeCache.txt cmake_install.cmake Makefile - build.ninja rules.ninja .ninja_deps .ninja_log output.txt summary.log - *.vtk *.vtu *.pvtu - COMMENT "distclean invoked" -) - -# List of build types -if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") - list(APPEND PRISMS_PF_BUILD_TYPES "Debug") -endif() - -if("${CMAKE_BUILD_TYPE}" MATCHES "Release") - list(APPEND PRISMS_PF_BUILD_TYPES "Release") -endif() diff --git a/cmake/setup_prisms_pf.cmake b/cmake/setup_prisms_pf.cmake index c2ef90f92..ab6de0af2 100644 --- a/cmake/setup_prisms_pf.cmake +++ b/cmake/setup_prisms_pf.cmake @@ -73,40 +73,81 @@ option( # Set the compiler and linker flags set(PRISMS_PF_WARNING_FLAGS "") -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC - set(PRISMS_PF_WARNING_FLAGS - -Wall -Wextra -Wpedantic - -Wconversion -Wsign-conversion - -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align - -Wunused -Woverloaded-virtual -Wnull-dereference - -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough - -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches - -Wlogical-op -Wuseless-cast +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC + set(PRISMS_PF_WARNING_FLAGS + -Wall + -Wextra + -Wpedantic + -Wconversion + -Wsign-conversion + -Wshadow + -Wnon-virtual-dtor + -Wold-style-cast + -Wcast-align + -Wunused + -Woverloaded-virtual + -Wnull-dereference + -Wdouble-promotion + -Wformat=2 + -Wimplicit-fallthrough + -Wmisleading-indentation + -Wduplicated-cond + -Wduplicated-branches + -Wlogical-op + -Wuseless-cast ) -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Clang/AppleClang - set(PRISMS_PF_WARNING_FLAGS - -Wall -Wextra -Wpedantic - -Wconversion -Wsign-conversion - -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align - -Wunused -Woverloaded-virtual -Wnull-dereference - -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough - -Wdocumentation -Winconsistent-missing-destructor-override-attribute - -Wunreachable-code -Wmove -Wloop-analysis - -Wcomma -Wrange-loop-analysis +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Clang/AppleClang + set(PRISMS_PF_WARNING_FLAGS + -Wall + -Wextra + -Wpedantic + -Wconversion + -Wsign-conversion + -Wshadow + -Wnon-virtual-dtor + -Wold-style-cast + -Wcast-align + -Wunused + -Woverloaded-virtual + -Wnull-dereference + -Wdouble-promotion + -Wformat=2 + -Wimplicit-fallthrough + -Wdocumentation + -Winconsistent-missing-destructor-override-attribute + -Wunreachable-code + -Wmove + -Wloop-analysis + -Wcomma + -Wrange-loop-analysis ) -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") # Intel classic (icc/icpc) - set(PRISMS_PF_WARNING_FLAGS - -Wall -Wextra -Wcheck - -Wshadow -Wunused-variable -Wuninitialized +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") # Intel classic (icc/icpc) + set(PRISMS_PF_WARNING_FLAGS + -Wall + -Wextra + -Wcheck + -Wshadow + -Wunused-variable + -Wuninitialized -Wremarks ) -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") # Newer Intel oneAPI compilers (icx/icpx) - set(PRISMS_PF_WARNING_FLAGS - -Wall -Wextra -Wpedantic - -Wconversion -Wsign-conversion - -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align - -Wunused -Woverloaded-virtual -Wnull-dereference - -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") # Newer Intel oneAPI compilers (icx/icpx) + set(PRISMS_PF_WARNING_FLAGS + -Wall + -Wextra + -Wpedantic + -Wconversion + -Wsign-conversion + -Wshadow + -Wnon-virtual-dtor + -Wold-style-cast + -Wcast-align + -Wunused + -Woverloaded-virtual + -Wnull-dereference + -Wdouble-promotion + -Wformat=2 + -Wimplicit-fallthrough ) endif() diff --git a/tests/automatic_tests/allen_cahn_explicit/CMakeLists.txt b/tests/automatic_tests/allen_cahn_explicit/CMakeLists.txt index f040097bc..84d44ba09 100644 --- a/tests/automatic_tests/allen_cahn_explicit/CMakeLists.txt +++ b/tests/automatic_tests/allen_cahn_explicit/CMakeLists.txt @@ -5,21 +5,22 @@ cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) +# Create a project for the application +project(myapp CXX) + +# Get the core library's directory (3 levels up) get_filename_component( PRISMS_PF_CORE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../.. ABSOLUTE ) -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) +# Find the PRISMS-PF package +find_package(prisms_pf REQUIRED HINTS ${PRISMS_PF_CORE_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +endif() diff --git a/tests/unit_tests/core/CMakeLists.txt b/tests/unit_tests/core/CMakeLists.txt index 82aed849e..fdf1014b5 100644 --- a/tests/unit_tests/core/CMakeLists.txt +++ b/tests/unit_tests/core/CMakeLists.txt @@ -4,11 +4,13 @@ add_executable(test_core ${TEST_SOURCES}) target_link_libraries(test_core PRIVATE prisms_pf_debug) -target_include_directories(test_core PRIVATE - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/include - ${CMAKE_SOURCE_DIR}/contrib/catch - ${CMAKE_CURRENT_SOURCE_DIR} +target_include_directories( + test_core + PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} ) -add_test(NAME core COMMAND test_core) \ No newline at end of file +add_test(NAME core COMMAND test_core) diff --git a/tests/unit_tests/field_input/CMakeLists.txt b/tests/unit_tests/field_input/CMakeLists.txt index a7ab527b6..3e02c7261 100644 --- a/tests/unit_tests/field_input/CMakeLists.txt +++ b/tests/unit_tests/field_input/CMakeLists.txt @@ -4,11 +4,13 @@ add_executable(test_field_input ${TEST_SOURCES}) target_link_libraries(test_field_input PRIVATE prisms_pf_debug) -target_include_directories(test_field_input PRIVATE - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/include - ${CMAKE_SOURCE_DIR}/contrib/catch - ${CMAKE_CURRENT_SOURCE_DIR} +target_include_directories( + test_field_input + PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} ) -add_test(NAME field_input COMMAND test_field_input) \ No newline at end of file +add_test(NAME field_input COMMAND test_field_input) diff --git a/tests/unit_tests/user_inputs/CMakeLists.txt b/tests/unit_tests/user_inputs/CMakeLists.txt index 5a4501c1d..af3c05ec2 100644 --- a/tests/unit_tests/user_inputs/CMakeLists.txt +++ b/tests/unit_tests/user_inputs/CMakeLists.txt @@ -4,11 +4,13 @@ add_executable(test_user_inputs ${TEST_SOURCES}) target_link_libraries(test_user_inputs PRIVATE prisms_pf_debug) -target_include_directories(test_user_inputs PRIVATE - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/include - ${CMAKE_SOURCE_DIR}/contrib/catch - ${CMAKE_CURRENT_SOURCE_DIR} +target_include_directories( + test_user_inputs + PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} ) -add_test(NAME user_inputs COMMAND test_user_inputs) \ No newline at end of file +add_test(NAME user_inputs COMMAND test_user_inputs) diff --git a/tests/unit_tests/utilities/CMakeLists.txt b/tests/unit_tests/utilities/CMakeLists.txt index f7a48cf9e..856483ff8 100644 --- a/tests/unit_tests/utilities/CMakeLists.txt +++ b/tests/unit_tests/utilities/CMakeLists.txt @@ -4,11 +4,13 @@ add_executable(test_utilities ${TEST_SOURCES}) target_link_libraries(test_utilities PRIVATE prisms_pf_debug) -target_include_directories(test_utilities PRIVATE - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/include - ${CMAKE_SOURCE_DIR}/contrib/catch - ${CMAKE_CURRENT_SOURCE_DIR} +target_include_directories( + test_utilities + PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/contrib/catch + ${CMAKE_CURRENT_SOURCE_DIR} ) -add_test(NAME utilities COMMAND test_utilities) \ No newline at end of file +add_test(NAME utilities COMMAND test_utilities) From b8c32e865a853ba6fa5e3e824063405a9bf142db Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 6 Oct 2025 13:52:50 -0700 Subject: [PATCH 05/17] some more cmake stuff --- .gitignore | 4 + CMakeLists.txt | 111 +++++-- cmake/macros/macro_define_library.cmake | 1 - cmake/setup_cached_variables.cmake | 3 + cmake/write_config.cmake | 1 + .../allen_cahn_implicit/CMakeLists.txt | 25 -- .../allen_cahn_rk4/CMakeLists.txt | 25 -- .../automatic_tests/application_debug_test.py | 290 ------------------ tests/automatic_tests/blank/CMakeLists.txt | 25 -- .../cahn_hilliard_explicit/CMakeLists.txt | 25 -- .../cahn_hilliard_implicit/CMakeLists.txt | 25 -- .../CMakeLists.txt | 25 -- .../CMakeLists.txt | 25 -- .../CMakeLists.txt | 25 -- .../cavity_flow/CMakeLists.txt | 25 -- .../file_read_binary/CMakeLists.txt | 25 -- .../file_read_vtk/CMakeLists.txt | 25 -- tests/automatic_tests/fracture/CMakeLists.txt | 25 -- .../heat_equation_steady_state/CMakeLists.txt | 25 -- .../linear_solve_old_solution/CMakeLists.txt | 25 -- .../automatic_tests/mechanics/CMakeLists.txt | 25 -- .../precipitate_explicit/CMakeLists.txt | 25 -- .../solution_blocks/CMakeLists.txt | 25 -- .../taylor_green_vortex/CMakeLists.txt | 25 -- tests/regression_tests/CMakeLists.txt | 68 ++++ .../allen_cahn_explicit/CMakeLists.txt | 15 +- .../allen_cahn_explicit/ICs_and_BCs.cc | 0 .../allen_cahn_explicit/custom_pde.h | 0 .../allen_cahn_explicit/custom_pde.inst.in | 0 .../allen_cahn_explicit/equations.cc | 0 .../allen_cahn_explicit/gold_output.txt | 0 .../allen_cahn_explicit/main.cc | 0 .../allen_cahn_explicit/parameters.prm | 0 .../allen_cahn_implicit/CMakeLists.txt | 23 ++ .../allen_cahn_implicit/ICs_and_BCs.cc | 0 .../allen_cahn_implicit/custom_pde.h | 0 .../allen_cahn_implicit/custom_pde.inst.in | 0 .../allen_cahn_implicit/equations.cc | 0 .../allen_cahn_implicit/gold_output.txt | 0 .../allen_cahn_implicit/main.cc | 0 .../allen_cahn_implicit/parameters.prm | 0 .../allen_cahn_rk4/CMakeLists.txt | 23 ++ .../allen_cahn_rk4/ICs_and_BCs.cc | 0 .../allen_cahn_rk4/custom_pde.h | 0 .../allen_cahn_rk4/custom_pde.inst.in | 0 .../allen_cahn_rk4/equations.cc | 0 .../allen_cahn_rk4/main.cc | 0 .../allen_cahn_rk4/parameters.prm | 0 tests/regression_tests/blank/CMakeLists.txt | 23 ++ .../blank/ICs_and_BCs.cc | 0 .../blank/custom_pde.h | 0 .../blank/custom_pde.inst.in | 0 .../blank/equations.cc | 0 .../blank/main.cc | 0 .../blank/parameters.prm | 0 .../cahn_hilliard_explicit/CMakeLists.txt | 23 ++ .../cahn_hilliard_explicit/ICs_and_BCs.cc | 0 .../cahn_hilliard_explicit/custom_pde.h | 0 .../cahn_hilliard_explicit/custom_pde.inst.in | 0 .../cahn_hilliard_explicit/equations.cc | 0 .../cahn_hilliard_explicit/gold_output.txt | 0 .../cahn_hilliard_explicit/main.cc | 0 .../cahn_hilliard_explicit/parameters.prm | 0 .../cahn_hilliard_implicit/CMakeLists.txt | 23 ++ .../cahn_hilliard_implicit/ICs_and_BCs.cc | 0 .../cahn_hilliard_implicit/custom_pde.h | 0 .../cahn_hilliard_implicit/custom_pde.inst.in | 0 .../cahn_hilliard_implicit/equations.cc | 0 .../cahn_hilliard_implicit/gold_output.txt | 0 .../cahn_hilliard_implicit/main.cc | 0 .../cahn_hilliard_implicit/parameters.prm | 0 .../CMakeLists.txt | 23 ++ .../ICs_and_BCs.cc | 0 .../custom_pde.h | 0 .../custom_pde.inst.in | 0 .../equations.cc | 0 .../main.cc | 0 .../parameters.prm | 0 .../CMakeLists.txt | 23 ++ .../ICs_and_BCs.cc | 0 .../custom_pde.h | 0 .../custom_pde.inst.in | 0 .../equations.cc | 0 .../main.cc | 0 .../parameters.prm | 0 .../CMakeLists.txt | 23 ++ .../ICs_and_BCs.cc | 0 .../cahn_hilliard_semi_implicit/custom_pde.h | 0 .../custom_pde.inst.in | 0 .../cahn_hilliard_semi_implicit/equations.cc | 0 .../cahn_hilliard_semi_implicit/main.cc | 0 .../parameters.prm | 0 .../cavity_flow/CMakeLists.txt | 23 ++ .../cavity_flow/ICs_and_BCs.cc | 0 .../cavity_flow/custom_pde.h | 0 .../cavity_flow/custom_pde.inst.in | 0 .../cavity_flow/equations.cc | 0 .../cavity_flow/gold_output.txt | 0 .../cavity_flow/main.cc | 0 .../cavity_flow/parameters.prm | 0 .../file_read_binary/CMakeLists.txt | 23 ++ .../file_read_binary/ICs_and_BCs.cc | 0 .../file_read_binary/custom_pde.h | 0 .../file_read_binary/custom_pde.inst.in | 0 .../file_read_binary/equations.cc | 0 .../file_read_binary/main.cc | 0 .../file_read_binary/parameters.prm | 0 .../file_read_vtk/CMakeLists.txt | 23 ++ .../file_read_vtk/ICs_and_BCs.cc | 0 .../file_read_vtk/custom_pde.h | 0 .../file_read_vtk/custom_pde.inst.in | 0 .../file_read_vtk/equations.cc | 0 .../file_read_vtk/main.cc | 0 .../file_read_vtk/parameters.prm | 0 .../regression_tests/fracture/CMakeLists.txt | 23 ++ .../fracture/ICs_and_BCs.cc | 0 .../fracture/custom_pde.h | 0 .../fracture/custom_pde.inst.in | 0 .../fracture/equations.cc | 0 .../fracture/gold_output.txt | 0 .../fracture/main.cc | 0 .../fracture/parameters.prm | 0 .../heat_equation_steady_state/CMakeLists.txt | 23 ++ .../heat_equation_steady_state/ICs_and_BCs.cc | 0 .../heat_equation_steady_state/custom_pde.h | 0 .../custom_pde.inst.in | 0 .../heat_equation_steady_state/equations.cc | 0 .../gold_output.txt | 0 .../heat_equation_steady_state/main.cc | 0 .../heat_equation_steady_state/parameters.prm | 0 .../linear_solve_old_solution/CMakeLists.txt | 23 ++ .../linear_solve_old_solution/ICs_and_BCs.cc | 0 .../linear_solve_old_solution/custom_pde.h | 0 .../custom_pde.inst.in | 0 .../linear_solve_old_solution/equations.cc | 0 .../linear_solve_old_solution/gold_output.txt | 0 .../linear_solve_old_solution/main.cc | 0 .../linear_solve_old_solution/parameters.prm | 0 .../regression_tests/mechanics/CMakeLists.txt | 23 ++ .../mechanics/ICs_and_BCs.cc | 0 .../mechanics/custom_pde.h | 0 .../mechanics/custom_pde.inst.in | 0 .../mechanics/equations.cc | 0 .../mechanics/gold_output.txt | 0 .../mechanics/main.cc | 0 .../mechanics/parameters.prm | 0 .../precipitate_explicit/CMakeLists.txt | 23 ++ .../precipitate_explicit/ICs_and_BCs.cc | 0 .../precipitate_explicit/custom_pde.h | 0 .../precipitate_explicit/custom_pde.inst.in | 0 .../precipitate_explicit/equations.cc | 0 .../precipitate_explicit/gold_output.txt | 0 .../precipitate_explicit/main.cc | 0 .../precipitate_explicit/parameters.prm | 0 .../run_automatic_tests.py | 0 .../solution_blocks/CMakeLists.txt | 23 ++ .../solution_blocks/ICs_and_BCs.cc | 0 .../solution_blocks/custom_pde.h | 0 .../solution_blocks/custom_pde.inst.in | 0 .../solution_blocks/equations.cc | 0 .../solution_blocks/gold_output.txt | 0 .../solution_blocks/main.cc | 0 .../solution_blocks/parameters.prm | 0 .../taylor_green_vortex/CMakeLists.txt | 23 ++ .../taylor_green_vortex/ICs_and_BCs.cc | 0 .../taylor_green_vortex/custom_pde.h | 0 .../taylor_green_vortex/custom_pde.inst.in | 0 .../taylor_green_vortex/equations.cc | 0 .../taylor_green_vortex/main.cc | 0 .../taylor_green_vortex/parameters.prm | 0 .../test_results.txt | 0 tests/unit_tests/CMakeLists.txt | 4 + 172 files changed, 577 insertions(+), 784 deletions(-) delete mode 100644 tests/automatic_tests/allen_cahn_implicit/CMakeLists.txt delete mode 100644 tests/automatic_tests/allen_cahn_rk4/CMakeLists.txt delete mode 100644 tests/automatic_tests/application_debug_test.py delete mode 100644 tests/automatic_tests/blank/CMakeLists.txt delete mode 100644 tests/automatic_tests/cahn_hilliard_explicit/CMakeLists.txt delete mode 100644 tests/automatic_tests/cahn_hilliard_implicit/CMakeLists.txt delete mode 100644 tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt delete mode 100644 tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt delete mode 100644 tests/automatic_tests/cahn_hilliard_semi_implicit/CMakeLists.txt delete mode 100644 tests/automatic_tests/cavity_flow/CMakeLists.txt delete mode 100644 tests/automatic_tests/file_read_binary/CMakeLists.txt delete mode 100644 tests/automatic_tests/file_read_vtk/CMakeLists.txt delete mode 100644 tests/automatic_tests/fracture/CMakeLists.txt delete mode 100644 tests/automatic_tests/heat_equation_steady_state/CMakeLists.txt delete mode 100644 tests/automatic_tests/linear_solve_old_solution/CMakeLists.txt delete mode 100644 tests/automatic_tests/mechanics/CMakeLists.txt delete mode 100644 tests/automatic_tests/precipitate_explicit/CMakeLists.txt delete mode 100644 tests/automatic_tests/solution_blocks/CMakeLists.txt delete mode 100644 tests/automatic_tests/taylor_green_vortex/CMakeLists.txt create mode 100644 tests/regression_tests/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/CMakeLists.txt (60%) rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/main.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_explicit/parameters.prm (100%) create mode 100644 tests/regression_tests/allen_cahn_implicit/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/allen_cahn_implicit/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_implicit/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_implicit/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_implicit/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_implicit/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_implicit/main.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_implicit/parameters.prm (100%) create mode 100644 tests/regression_tests/allen_cahn_rk4/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/allen_cahn_rk4/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_rk4/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_rk4/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_rk4/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_rk4/main.cc (100%) rename tests/{automatic_tests => regression_tests}/allen_cahn_rk4/parameters.prm (100%) create mode 100644 tests/regression_tests/blank/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/blank/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/blank/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/blank/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/blank/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/blank/main.cc (100%) rename tests/{automatic_tests => regression_tests}/blank/parameters.prm (100%) create mode 100644 tests/regression_tests/cahn_hilliard_explicit/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/cahn_hilliard_explicit/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_explicit/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_explicit/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_explicit/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_explicit/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_explicit/main.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_explicit/parameters.prm (100%) create mode 100644 tests/regression_tests/cahn_hilliard_implicit/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/cahn_hilliard_implicit/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_implicit/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_implicit/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_implicit/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_implicit/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_implicit/main.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_implicit/parameters.prm (100%) create mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_linearly_stabilized_splitting/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_linearly_stabilized_splitting/main.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_linearly_stabilized_splitting/parameters.prm (100%) create mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm (100%) create mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/cahn_hilliard_semi_implicit/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_semi_implicit/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_semi_implicit/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_semi_implicit/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_semi_implicit/main.cc (100%) rename tests/{automatic_tests => regression_tests}/cahn_hilliard_semi_implicit/parameters.prm (100%) create mode 100644 tests/regression_tests/cavity_flow/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/cavity_flow/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/cavity_flow/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/cavity_flow/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/cavity_flow/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/cavity_flow/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/cavity_flow/main.cc (100%) rename tests/{automatic_tests => regression_tests}/cavity_flow/parameters.prm (100%) create mode 100644 tests/regression_tests/file_read_binary/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/file_read_binary/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/file_read_binary/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/file_read_binary/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/file_read_binary/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/file_read_binary/main.cc (100%) rename tests/{automatic_tests => regression_tests}/file_read_binary/parameters.prm (100%) create mode 100644 tests/regression_tests/file_read_vtk/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/file_read_vtk/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/file_read_vtk/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/file_read_vtk/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/file_read_vtk/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/file_read_vtk/main.cc (100%) rename tests/{automatic_tests => regression_tests}/file_read_vtk/parameters.prm (100%) create mode 100644 tests/regression_tests/fracture/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/fracture/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/fracture/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/fracture/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/fracture/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/fracture/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/fracture/main.cc (100%) rename tests/{automatic_tests => regression_tests}/fracture/parameters.prm (100%) create mode 100644 tests/regression_tests/heat_equation_steady_state/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/heat_equation_steady_state/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/heat_equation_steady_state/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/heat_equation_steady_state/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/heat_equation_steady_state/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/heat_equation_steady_state/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/heat_equation_steady_state/main.cc (100%) rename tests/{automatic_tests => regression_tests}/heat_equation_steady_state/parameters.prm (100%) create mode 100644 tests/regression_tests/linear_solve_old_solution/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/linear_solve_old_solution/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/linear_solve_old_solution/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/linear_solve_old_solution/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/linear_solve_old_solution/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/linear_solve_old_solution/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/linear_solve_old_solution/main.cc (100%) rename tests/{automatic_tests => regression_tests}/linear_solve_old_solution/parameters.prm (100%) create mode 100644 tests/regression_tests/mechanics/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/mechanics/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/mechanics/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/mechanics/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/mechanics/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/mechanics/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/mechanics/main.cc (100%) rename tests/{automatic_tests => regression_tests}/mechanics/parameters.prm (100%) create mode 100644 tests/regression_tests/precipitate_explicit/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/precipitate_explicit/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/precipitate_explicit/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/precipitate_explicit/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/precipitate_explicit/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/precipitate_explicit/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/precipitate_explicit/main.cc (100%) rename tests/{automatic_tests => regression_tests}/precipitate_explicit/parameters.prm (100%) rename tests/{automatic_tests => regression_tests}/run_automatic_tests.py (100%) create mode 100644 tests/regression_tests/solution_blocks/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/solution_blocks/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/solution_blocks/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/solution_blocks/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/solution_blocks/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/solution_blocks/gold_output.txt (100%) rename tests/{automatic_tests => regression_tests}/solution_blocks/main.cc (100%) rename tests/{automatic_tests => regression_tests}/solution_blocks/parameters.prm (100%) create mode 100644 tests/regression_tests/taylor_green_vortex/CMakeLists.txt rename tests/{automatic_tests => regression_tests}/taylor_green_vortex/ICs_and_BCs.cc (100%) rename tests/{automatic_tests => regression_tests}/taylor_green_vortex/custom_pde.h (100%) rename tests/{automatic_tests => regression_tests}/taylor_green_vortex/custom_pde.inst.in (100%) rename tests/{automatic_tests => regression_tests}/taylor_green_vortex/equations.cc (100%) rename tests/{automatic_tests => regression_tests}/taylor_green_vortex/main.cc (100%) rename tests/{automatic_tests => regression_tests}/taylor_green_vortex/parameters.prm (100%) rename tests/{automatic_tests => regression_tests}/test_results.txt (100%) diff --git a/.gitignore b/.gitignore index c2e084bc5..be9037359 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,10 @@ CTest* **expand_template_instantiations_exe **.inst +# The default install folder & files +install/ +install_manifest.txt + # Config files include/prismspf/config.h cmake/prisms_pf-config.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 0da0a6716..9daed4855 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ ## -# CMake for the PRISMS-PF -# Adapted from the ASPECT CMake file +# CMake for the PRISMS-PF core library ## # cmake config @@ -32,17 +31,6 @@ message(STATUS "") # Some basic bookkeeping # ========================================================= -# Check that a prior CMakeCache is not located in the build directory -if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt) - message( - FATAL_ERROR - "Detected the file:\n" - "${CMAKE_SOURCE_DIR}/CMakeCache.txt\n" - "in your source directory, which may be leftover from prior builds. " - "Please delete the file before running cmake again." - ) -endif() - # Grab git information prisms_pf_git_version() @@ -52,6 +40,16 @@ include(${CMAKE_SOURCE_DIR}/cmake/setup_cached_variables.cmake) # Declare the project project(prisms_pf CXX) +# Set the default install prefix if it was not set by the user +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX + "${CMAKE_BINARY_DIR}/install" + CACHE PATH + "Installation prefix" + FORCE + ) +endif() + # Include the PRISMS-PF setup include(${CMAKE_SOURCE_DIR}/cmake/setup_prisms_pf.cmake) @@ -113,8 +111,6 @@ add_subdirectory(src) get_property(PRISMS_PF_SOURCE_FILES GLOBAL PROPERTY PRISMS_PF_SOURCE_FILES) get_property(PRISMS_PF_HEADER_FILES GLOBAL PROPERTY PRISMS_PF_HEADER_FILES) -# Test stuff goes here - # Make and ninja build options if(CMAKE_GENERATOR MATCHES "Ninja") set(_make_command "$ ninja") @@ -258,12 +254,6 @@ foreach(_build ${PRISMS_PF_BUILD_TYPES}) prisms_pf_utilities_${_build_lowercase} ) list(APPEND PRISMS_PF_TARGETS ${_library_dependencies}) - set(_include_directories - ${PRISMS_PF_INCLUDE_DIRS} - ${CMAKE_BINARY_DIR}/include - ${CMAKE_BINARY_DIR}/src - include - ) # Link the PRISMS-PF libraries target_link_libraries(${_library} PUBLIC ${_library_dependencies}) @@ -273,7 +263,9 @@ foreach(_build ${PRISMS_PF_BUILD_TYPES}) # Set the include directories target_include_directories( ${_library} - PUBLIC ${CMAKE_BINARY_DIR}/include + PUBLIC + $ + $ PRIVATE ${CMAKE_BINARY_DIR}/src ) @@ -314,7 +306,48 @@ foreach(_build ${PRISMS_PF_BUILD_TYPES}) ) endforeach() -# Testing infrastructure +# ========================================================= +# Installation +# ========================================================= +include(GNUInstallDirs) + +# Install the libraries +install( + TARGETS ${PRISMS_PF_TARGETS} + EXPORT prisms_pf-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +# Install the headers +install( + DIRECTORY ${CMAKE_BINARY_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/prisms_pf + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" +) + +# Install the CMake config files +install( + EXPORT prisms_pf-targets + FILE prisms_pf-targets.cmake + NAMESPACE prisms_pf:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/prisms_pf +) + +install( + FILES ${CMAKE_BINARY_DIR}/cmake/prisms_pf-config.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/prisms_pf +) + +# ========================================================= +# Testing +# ========================================================= + +# Unit tests if(UNIT_TESTS) enable_testing() add_subdirectory(tests/unit_tests) @@ -328,19 +361,16 @@ if(UNIT_TESTS) ) endif() -# Unwrap the compiler compile_commands.json after the build -if(${UNWRAP_COMPILER} STREQUAL "ON") - add_custom_command( - TARGET ${LIBRARY_NAME_DEBUG} - POST_BUILD - COMMAND - /bin/bash - ${CMAKE_SOURCE_DIR}/contrib/utilities/unwrap_compile_commands.sh - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Unwrapping compiler for compile_commands.json" - ) +# Regression tests +if(REGRESSION_TESTS) + # Compile each of the regression tests and run the python script + add_subdirectory(tests/regression_tests) endif() +# ========================================================= +# Final steps +# ========================================================= + # Write config to file include(${CMAKE_SOURCE_DIR}/cmake/write_config.cmake) @@ -352,6 +382,19 @@ configure_package_config_file( INSTALL_DESTINATION ${CMAKE_BINARY_DIR}/cmake ) +# Unwrap the compiler compile_commands.json after the build +if(${UNWRAP_COMPILER} STREQUAL "ON") + add_custom_command( + TARGET ${LIBRARY_NAME_DEBUG} + POST_BUILD + COMMAND + /bin/bash + ${CMAKE_SOURCE_DIR}/contrib/utilities/unwrap_compile_commands.sh + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Unwrapping compiler for compile_commands.json" + ) +endif() + # Export targets list(REMOVE_DUPLICATES PRISMS_PF_TARGETS) export( diff --git a/cmake/macros/macro_define_library.cmake b/cmake/macros/macro_define_library.cmake index 5b45ea729..04d6baaa6 100644 --- a/cmake/macros/macro_define_library.cmake +++ b/cmake/macros/macro_define_library.cmake @@ -19,7 +19,6 @@ function(define_library _library) target_include_directories( ${_target} SYSTEM - PUBLIC ${PRISMS_PF_INCLUDE_DIRS} PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/src ) diff --git a/cmake/setup_cached_variables.cmake b/cmake/setup_cached_variables.cmake index 7cc4d377f..6327b7f95 100644 --- a/cmake/setup_cached_variables.cmake +++ b/cmake/setup_cached_variables.cmake @@ -10,6 +10,9 @@ message(STATUS "PRISMS_PF_AUTODETECTION = ${PRISMS_PF_AUTODETECTION}") option(UNIT_TESTS "Whether to build the unit tests or not." ON) message(STATUS "UNIT_TESTS = ${UNIT_TESTS}") +option(REGRESSION_TESTS "Whether to build the regression tests or not." ON) +message(STATUS "REGRESSION_TESTS = ${REGRESSION_TESTS}") + option( 64BIT_INDICES "Whether to compile PRISMS-PF with 64-bit numbers for large simulations" diff --git a/cmake/write_config.cmake b/cmake/write_config.cmake index 434982ec4..7849b55f6 100644 --- a/cmake/write_config.cmake +++ b/cmake/write_config.cmake @@ -68,6 +68,7 @@ write_to_both("# # PRISMS_PF_WITH_CALIPER: ${PRISMS_PF_WITH_CALIPER} # # UNIT_TESTS: ${UNIT_TESTS} +# REGRESSION_TESTS: ${REGRESSION_TESTS} # 64BIT_INDICES: ${64BIT_INDICES} # ADDITIONAL_OPTIMIZATIONS: ${ADDITIONAL_OPTIMIZATIONS} # ADDITIONAL_DEGREES: ${ADDITIONAL_DEGREES} diff --git a/tests/automatic_tests/allen_cahn_implicit/CMakeLists.txt b/tests/automatic_tests/allen_cahn_implicit/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/allen_cahn_implicit/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/allen_cahn_rk4/CMakeLists.txt b/tests/automatic_tests/allen_cahn_rk4/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/allen_cahn_rk4/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/application_debug_test.py b/tests/automatic_tests/application_debug_test.py deleted file mode 100644 index db1dfb359..000000000 --- a/tests/automatic_tests/application_debug_test.py +++ /dev/null @@ -1,290 +0,0 @@ -import os -import sys -import subprocess -import shutil -import glob -import argparse -from concurrent.futures import ProcessPoolExecutor - - -def does_filepath_exist(filepath): - """Function to check that a certain filepath exists - - Args: - filepath (string): The absolute filepath - - Raises: - FileNotFoundError: An error if the filepath does not exist - - Returns: - Bool: Whether the filepath exists - """ - if os.path.exists(filepath): - return True - else: - raise FileNotFoundError(f"{filepath} does not exist") - - -def get_application_path(app_name): - """Function that returns that absolute path for the specified application - - Args: - app_name (string): The application name - - Returns: - String: Absolute application path - """ - # Current directory - pwd = os.getcwd() - - # Check that we're in the automatic test directory - assert "automatic_tests" in pwd, "Current directory is not within 'automatic_tests'" - - # Application path - go up two directories from automatic_tests to get to the root - root_dir = os.path.dirname(os.path.dirname(pwd)) - app_path = os.path.join(root_dir, "applications", app_name) - - return app_path - - -def set_timestep(number, app_dir, new_parameter_file): - """Function that write create a copy of the of the parameters.prm file - in the given application directory and set the number of timesteps - - Args: - number (int): Number of timesteps - app_dir (string): Absolute filepath for application directory - new_parameter_file (string): Name of new parameters.prm - """ - # Absolute path of the parameters file - parameter_file_path = os.path.join(app_dir, "parameters.prm") - - # Check if the file exists, if not return early - if not os.path.exists(parameter_file_path): - print( - f"Warning: {parameter_file_path} does not exist, skipping parameter modification" - ) - return - - # Make a copy of the original parameters file - new_parameter_file_path = os.path.join(app_dir, new_parameter_file) - shutil.copy(parameter_file_path, new_parameter_file_path) - print(f"Copied {parameter_file_path} to {new_parameter_file_path}.") - - # Set the new number of timesteps, making sure to remove simulation end time if there - with open(new_parameter_file_path, "r") as file: - lines = file.readlines() - - set_n_timesteps = False - with open(new_parameter_file_path, "w") as file: - for line in lines: - if "set Number of time steps" in line and not set_n_timesteps: - file.write(f"set Number of time steps = {number}\n") - set_n_timesteps = True - elif "set Simulation end time" in line and not set_n_timesteps: - file.write(f"set Number of time steps = {number}\n") - set_n_timesteps = True - elif "set Simulation end time" in line and set_n_timesteps: - file.write("\n") - else: - file.write(line) - print( - f"Updated {new_parameter_file} in {app_dir} to set Number of time steps to {number}." - ) - - -def compile_and_run( - app_name, new_parameter_file, test_dir, n_threads=1, run_application=True -): - """Function that compile and runs the application in debug mode - - Args: - app_name (string): Application name - new_parameter_file (string): Parameter file - test_dir (string): Automatic test directory - n_threads (int): Number of threads to use - run_application (bool): Whether to run the application after compilation - - Returns: - String: Whether the application was able to succeed or not. The first return - is the application name and the second is success or failure - """ - try: - # Navigate to automatic_tests - os.chdir(test_dir) - - # Grab application path - app_dir = get_application_path(app_name) - - # Navigate to application directory - os.chdir(app_dir) - print(f"Currently in {os.getcwd()}") - - # Compile the application in debug mode - if os.path.exists("CMakeCache.txt"): - os.remove("CMakeCache.txt") - print(f"Compiling {app_dir}") - compile_result = subprocess.run( - ["cmake", ".", "-G", "Ninja"], check=True, capture_output=True, text=True - ) - make_result = subprocess.run( - ["ninja", "-j", str(n_threads)], check=True, capture_output=True, text=True - ) - - # Run the application if requested - if run_application: - print(f"Running {app_dir} with parameter file {new_parameter_file}") - run_result = subprocess.run( - [ - "mpirun", - "-n", - str(n_threads), - "./main-debug", - "-i", - new_parameter_file, - ], - check=True, - capture_output=True, - text=True, - ) - output = compile_result.stdout + make_result.stdout + run_result.stdout - else: - output = compile_result.stdout + make_result.stdout - - # Clean up - print(f"Cleaning up {app_dir}") - os.remove("CMakeCache.txt") - os.remove("main") - if os.path.exists("integratedFields.txt"): - os.remove("integratedFields.txt") - for solution_file in glob.glob("solution-*.vtu"): - os.remove(solution_file) - for restart_file in glob.glob("restart.*"): - os.remove(restart_file) - os.remove(new_parameter_file) - - # Return success - return ( - app_name, - "Success", - output, - ) - - except subprocess.CalledProcessError as exc: - error_output = exc.stderr if exc.stderr else str(exc) - return (app_name, f"Failed: {error_output}", "") - - except Exception as exc: - return (app_name, f"Failed: {str(exc)}", "") - - -def run_tests_in_parallel( - application_list, n_processes, n_threads, run_application=True -): - """Run each test in parallel - - Args: - application_list (list): A list of application names - n_processes (int): Number of processes to use - n_threads (int): Number of threads to use - run_application (bool): Whether to run the application after compilation - - Returns: - Dict: Dictionary that track the success/failure of each application - """ - # Parameter file name - new_parameter_file = "parameters_new.prm" - - # Grab currnet directory which should be the automatic test directory - test_dir = os.getcwd() - - # Update parameter file for one timestep - for app_name in application_list: - # Grab application path - app_dir = get_application_path(app_name) - - # Set timestep - set_timestep(1, app_dir, new_parameter_file) - - # Dictionary for results - results = {} - - # Run each task in parallel - with ProcessPoolExecutor(max_workers=n_processes) as executor: - futures = [ - executor.submit( - compile_and_run, - app_name, - new_parameter_file, - test_dir, - n_threads, - run_application, - ) - for app_name in application_list - ] - for future in futures: - app_name, status, output = future.result() - results[app_name] = (status, output) - - return results - - -# Initialize arg parser -parser = argparse.ArgumentParser() -parser.add_argument("-n", "--ntasks", type=int, default=1, help="Number of processes") -parser.add_argument( - "-j", - "--nthreads", - type=int, - default=1, - help="Number of threads for compiling & running tests", -) -parser.add_argument( - "--no-run", - action="store_true", - help="Only compile the applications without running them", -) -args = parser.parse_args() -n_processes = args.ntasks -n_threads = args.nthreads -run_application = not args.no_run - -print( - f"Running application debug tests with {n_processes} processes and {n_threads} threads." -) -if not run_application: - print("Only compiling applications, not running them.") - -# Application list -application_list = [ - "allen_cahn_explicit", - "cahn_hilliard_explicit", - "alloy_solidification", - "precipitate_evolution", - "coupled_allen_cahn_cahn_hilliard", - "eshelby_inclusion", -] - -# Run tests in parallel -results = run_tests_in_parallel( - application_list, n_processes, n_threads, run_application -) - -# Print the results -print("\n\nCompilation and Execution Results:") -passed_count = 0 - -for app_name, (status, output) in results.items(): - print(f"{app_name}: {status}") - if status == "Success": - passed_count += 1 - else: - print(f"Error details:\n{output}\n") - -print(f"\nTotal applications passed: {passed_count} out of {len(results)}") - -# Set exit code -if passed_count < len(results): - sys.exit(1) -else: - sys.exit(0) diff --git a/tests/automatic_tests/blank/CMakeLists.txt b/tests/automatic_tests/blank/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/blank/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/cahn_hilliard_explicit/CMakeLists.txt b/tests/automatic_tests/cahn_hilliard_explicit/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/cahn_hilliard_explicit/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/cahn_hilliard_implicit/CMakeLists.txt b/tests/automatic_tests/cahn_hilliard_implicit/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/cahn_hilliard_implicit/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt b/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt b/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/cahn_hilliard_semi_implicit/CMakeLists.txt b/tests/automatic_tests/cahn_hilliard_semi_implicit/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/cahn_hilliard_semi_implicit/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/cavity_flow/CMakeLists.txt b/tests/automatic_tests/cavity_flow/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/cavity_flow/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/file_read_binary/CMakeLists.txt b/tests/automatic_tests/file_read_binary/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/file_read_binary/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/file_read_vtk/CMakeLists.txt b/tests/automatic_tests/file_read_vtk/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/file_read_vtk/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/fracture/CMakeLists.txt b/tests/automatic_tests/fracture/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/fracture/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/heat_equation_steady_state/CMakeLists.txt b/tests/automatic_tests/heat_equation_steady_state/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/heat_equation_steady_state/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/linear_solve_old_solution/CMakeLists.txt b/tests/automatic_tests/linear_solve_old_solution/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/linear_solve_old_solution/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/mechanics/CMakeLists.txt b/tests/automatic_tests/mechanics/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/mechanics/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/precipitate_explicit/CMakeLists.txt b/tests/automatic_tests/precipitate_explicit/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/precipitate_explicit/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/solution_blocks/CMakeLists.txt b/tests/automatic_tests/solution_blocks/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/solution_blocks/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/automatic_tests/taylor_green_vortex/CMakeLists.txt b/tests/automatic_tests/taylor_green_vortex/CMakeLists.txt deleted file mode 100644 index f040097bc..000000000 --- a/tests/automatic_tests/taylor_green_vortex/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file -## - -cmake_minimum_required(VERSION 3.13.4) - -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - -# Create a project for the application -project(myapp CXX) - -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) diff --git a/tests/regression_tests/CMakeLists.txt b/tests/regression_tests/CMakeLists.txt new file mode 100644 index 000000000..9c3bebf40 --- /dev/null +++ b/tests/regression_tests/CMakeLists.txt @@ -0,0 +1,68 @@ +## +# CMake for PRISMS-PF regression tests +## + +message(STATUS "Setting up PRISMS-PF regression tests...") + +set(REGRESSION_TEST_APPS + allen_cahn_explicit + allen_cahn_implicit + allen_cahn_rk4 + blank + cahn_hilliard_explicit + cahn_hilliard_implicit + cavity_flow + file_read_binary + file_read_vtk + fracture + heat_equation_steady_state + linear_solve_old_solution + mechanics + precipitate_explicit + solution_blocks + taylor_green_vortex +) + +foreach(test_app ${REGRESSION_TEST_APPS}) + # Install the source files + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${test_app}/ + DESTINATION ${CMAKE_INSTALL_PREFIX}/tests/regression_tests/${test_app} + FILES_MATCHING + PATTERN "CMakeFiles*" EXCLUDE + PATTERN "*.in" + PATTERN "*.cc" + PATTERN "*.h" + PATTERN "*.prm" + PATTERN "CMakeLists.txt" + ) + + # Compile during installation + install( + CODE + " + message(STATUS \"Building regression test: ${test_app}\") + execute_process( + COMMAND ${CMAKE_COMMAND} + -DCMAKE_BUILD_TYPE=Release + -S ${CMAKE_INSTALL_PREFIX}/tests/regression_tests/${test_app}/ + WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/tests/regression_tests/${test_app} + RESULT_VARIABLE configure_result + ) + if(configure_result) + message(WARNING \"Failed to configure regression test: ${test_app}\") + else() + execute_process( + COMMAND ${CMAKE_COMMAND} --build . + WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/tests/regression_tests/${test_app} + RESULT_VARIABLE compile_result + ) + if(compile_result) + message(WARNING \"Failed to compile regression test: ${test_app}\") + endif() + endif() + " + ) +endforeach() + +message(STATUS "PRISMS-PF regression tests setup complete.") diff --git a/tests/automatic_tests/allen_cahn_explicit/CMakeLists.txt b/tests/regression_tests/allen_cahn_explicit/CMakeLists.txt similarity index 60% rename from tests/automatic_tests/allen_cahn_explicit/CMakeLists.txt rename to tests/regression_tests/allen_cahn_explicit/CMakeLists.txt index 84d44ba09..5f34be6c0 100644 --- a/tests/automatic_tests/allen_cahn_explicit/CMakeLists.txt +++ b/tests/regression_tests/allen_cahn_explicit/CMakeLists.txt @@ -1,6 +1,5 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) @@ -8,19 +7,17 @@ cmake_minimum_required(VERSION 3.13.4) # Create a project for the application project(myapp CXX) -# Get the core library's directory (3 levels up) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE -) - # Find the PRISMS-PF package -find_package(prisms_pf REQUIRED HINTS ${PRISMS_PF_CORE_DIR}) +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) if(PRISMS_PF_FOUND) # Include setup script include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) # Set up the application prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) endif() diff --git a/tests/automatic_tests/allen_cahn_explicit/ICs_and_BCs.cc b/tests/regression_tests/allen_cahn_explicit/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_explicit/ICs_and_BCs.cc rename to tests/regression_tests/allen_cahn_explicit/ICs_and_BCs.cc diff --git a/tests/automatic_tests/allen_cahn_explicit/custom_pde.h b/tests/regression_tests/allen_cahn_explicit/custom_pde.h similarity index 100% rename from tests/automatic_tests/allen_cahn_explicit/custom_pde.h rename to tests/regression_tests/allen_cahn_explicit/custom_pde.h diff --git a/tests/automatic_tests/allen_cahn_explicit/custom_pde.inst.in b/tests/regression_tests/allen_cahn_explicit/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/allen_cahn_explicit/custom_pde.inst.in rename to tests/regression_tests/allen_cahn_explicit/custom_pde.inst.in diff --git a/tests/automatic_tests/allen_cahn_explicit/equations.cc b/tests/regression_tests/allen_cahn_explicit/equations.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_explicit/equations.cc rename to tests/regression_tests/allen_cahn_explicit/equations.cc diff --git a/tests/automatic_tests/allen_cahn_explicit/gold_output.txt b/tests/regression_tests/allen_cahn_explicit/gold_output.txt similarity index 100% rename from tests/automatic_tests/allen_cahn_explicit/gold_output.txt rename to tests/regression_tests/allen_cahn_explicit/gold_output.txt diff --git a/tests/automatic_tests/allen_cahn_explicit/main.cc b/tests/regression_tests/allen_cahn_explicit/main.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_explicit/main.cc rename to tests/regression_tests/allen_cahn_explicit/main.cc diff --git a/tests/automatic_tests/allen_cahn_explicit/parameters.prm b/tests/regression_tests/allen_cahn_explicit/parameters.prm similarity index 100% rename from tests/automatic_tests/allen_cahn_explicit/parameters.prm rename to tests/regression_tests/allen_cahn_explicit/parameters.prm diff --git a/tests/regression_tests/allen_cahn_implicit/CMakeLists.txt b/tests/regression_tests/allen_cahn_implicit/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/allen_cahn_implicit/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/allen_cahn_implicit/ICs_and_BCs.cc b/tests/regression_tests/allen_cahn_implicit/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_implicit/ICs_and_BCs.cc rename to tests/regression_tests/allen_cahn_implicit/ICs_and_BCs.cc diff --git a/tests/automatic_tests/allen_cahn_implicit/custom_pde.h b/tests/regression_tests/allen_cahn_implicit/custom_pde.h similarity index 100% rename from tests/automatic_tests/allen_cahn_implicit/custom_pde.h rename to tests/regression_tests/allen_cahn_implicit/custom_pde.h diff --git a/tests/automatic_tests/allen_cahn_implicit/custom_pde.inst.in b/tests/regression_tests/allen_cahn_implicit/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/allen_cahn_implicit/custom_pde.inst.in rename to tests/regression_tests/allen_cahn_implicit/custom_pde.inst.in diff --git a/tests/automatic_tests/allen_cahn_implicit/equations.cc b/tests/regression_tests/allen_cahn_implicit/equations.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_implicit/equations.cc rename to tests/regression_tests/allen_cahn_implicit/equations.cc diff --git a/tests/automatic_tests/allen_cahn_implicit/gold_output.txt b/tests/regression_tests/allen_cahn_implicit/gold_output.txt similarity index 100% rename from tests/automatic_tests/allen_cahn_implicit/gold_output.txt rename to tests/regression_tests/allen_cahn_implicit/gold_output.txt diff --git a/tests/automatic_tests/allen_cahn_implicit/main.cc b/tests/regression_tests/allen_cahn_implicit/main.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_implicit/main.cc rename to tests/regression_tests/allen_cahn_implicit/main.cc diff --git a/tests/automatic_tests/allen_cahn_implicit/parameters.prm b/tests/regression_tests/allen_cahn_implicit/parameters.prm similarity index 100% rename from tests/automatic_tests/allen_cahn_implicit/parameters.prm rename to tests/regression_tests/allen_cahn_implicit/parameters.prm diff --git a/tests/regression_tests/allen_cahn_rk4/CMakeLists.txt b/tests/regression_tests/allen_cahn_rk4/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/allen_cahn_rk4/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/allen_cahn_rk4/ICs_and_BCs.cc b/tests/regression_tests/allen_cahn_rk4/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_rk4/ICs_and_BCs.cc rename to tests/regression_tests/allen_cahn_rk4/ICs_and_BCs.cc diff --git a/tests/automatic_tests/allen_cahn_rk4/custom_pde.h b/tests/regression_tests/allen_cahn_rk4/custom_pde.h similarity index 100% rename from tests/automatic_tests/allen_cahn_rk4/custom_pde.h rename to tests/regression_tests/allen_cahn_rk4/custom_pde.h diff --git a/tests/automatic_tests/allen_cahn_rk4/custom_pde.inst.in b/tests/regression_tests/allen_cahn_rk4/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/allen_cahn_rk4/custom_pde.inst.in rename to tests/regression_tests/allen_cahn_rk4/custom_pde.inst.in diff --git a/tests/automatic_tests/allen_cahn_rk4/equations.cc b/tests/regression_tests/allen_cahn_rk4/equations.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_rk4/equations.cc rename to tests/regression_tests/allen_cahn_rk4/equations.cc diff --git a/tests/automatic_tests/allen_cahn_rk4/main.cc b/tests/regression_tests/allen_cahn_rk4/main.cc similarity index 100% rename from tests/automatic_tests/allen_cahn_rk4/main.cc rename to tests/regression_tests/allen_cahn_rk4/main.cc diff --git a/tests/automatic_tests/allen_cahn_rk4/parameters.prm b/tests/regression_tests/allen_cahn_rk4/parameters.prm similarity index 100% rename from tests/automatic_tests/allen_cahn_rk4/parameters.prm rename to tests/regression_tests/allen_cahn_rk4/parameters.prm diff --git a/tests/regression_tests/blank/CMakeLists.txt b/tests/regression_tests/blank/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/blank/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/blank/ICs_and_BCs.cc b/tests/regression_tests/blank/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/blank/ICs_and_BCs.cc rename to tests/regression_tests/blank/ICs_and_BCs.cc diff --git a/tests/automatic_tests/blank/custom_pde.h b/tests/regression_tests/blank/custom_pde.h similarity index 100% rename from tests/automatic_tests/blank/custom_pde.h rename to tests/regression_tests/blank/custom_pde.h diff --git a/tests/automatic_tests/blank/custom_pde.inst.in b/tests/regression_tests/blank/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/blank/custom_pde.inst.in rename to tests/regression_tests/blank/custom_pde.inst.in diff --git a/tests/automatic_tests/blank/equations.cc b/tests/regression_tests/blank/equations.cc similarity index 100% rename from tests/automatic_tests/blank/equations.cc rename to tests/regression_tests/blank/equations.cc diff --git a/tests/automatic_tests/blank/main.cc b/tests/regression_tests/blank/main.cc similarity index 100% rename from tests/automatic_tests/blank/main.cc rename to tests/regression_tests/blank/main.cc diff --git a/tests/automatic_tests/blank/parameters.prm b/tests/regression_tests/blank/parameters.prm similarity index 100% rename from tests/automatic_tests/blank/parameters.prm rename to tests/regression_tests/blank/parameters.prm diff --git a/tests/regression_tests/cahn_hilliard_explicit/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_explicit/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/cahn_hilliard_explicit/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/cahn_hilliard_explicit/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_explicit/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_explicit/ICs_and_BCs.cc rename to tests/regression_tests/cahn_hilliard_explicit/ICs_and_BCs.cc diff --git a/tests/automatic_tests/cahn_hilliard_explicit/custom_pde.h b/tests/regression_tests/cahn_hilliard_explicit/custom_pde.h similarity index 100% rename from tests/automatic_tests/cahn_hilliard_explicit/custom_pde.h rename to tests/regression_tests/cahn_hilliard_explicit/custom_pde.h diff --git a/tests/automatic_tests/cahn_hilliard_explicit/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_explicit/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/cahn_hilliard_explicit/custom_pde.inst.in rename to tests/regression_tests/cahn_hilliard_explicit/custom_pde.inst.in diff --git a/tests/automatic_tests/cahn_hilliard_explicit/equations.cc b/tests/regression_tests/cahn_hilliard_explicit/equations.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_explicit/equations.cc rename to tests/regression_tests/cahn_hilliard_explicit/equations.cc diff --git a/tests/automatic_tests/cahn_hilliard_explicit/gold_output.txt b/tests/regression_tests/cahn_hilliard_explicit/gold_output.txt similarity index 100% rename from tests/automatic_tests/cahn_hilliard_explicit/gold_output.txt rename to tests/regression_tests/cahn_hilliard_explicit/gold_output.txt diff --git a/tests/automatic_tests/cahn_hilliard_explicit/main.cc b/tests/regression_tests/cahn_hilliard_explicit/main.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_explicit/main.cc rename to tests/regression_tests/cahn_hilliard_explicit/main.cc diff --git a/tests/automatic_tests/cahn_hilliard_explicit/parameters.prm b/tests/regression_tests/cahn_hilliard_explicit/parameters.prm similarity index 100% rename from tests/automatic_tests/cahn_hilliard_explicit/parameters.prm rename to tests/regression_tests/cahn_hilliard_explicit/parameters.prm diff --git a/tests/regression_tests/cahn_hilliard_implicit/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_implicit/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/cahn_hilliard_implicit/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/cahn_hilliard_implicit/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_implicit/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_implicit/ICs_and_BCs.cc rename to tests/regression_tests/cahn_hilliard_implicit/ICs_and_BCs.cc diff --git a/tests/automatic_tests/cahn_hilliard_implicit/custom_pde.h b/tests/regression_tests/cahn_hilliard_implicit/custom_pde.h similarity index 100% rename from tests/automatic_tests/cahn_hilliard_implicit/custom_pde.h rename to tests/regression_tests/cahn_hilliard_implicit/custom_pde.h diff --git a/tests/automatic_tests/cahn_hilliard_implicit/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_implicit/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/cahn_hilliard_implicit/custom_pde.inst.in rename to tests/regression_tests/cahn_hilliard_implicit/custom_pde.inst.in diff --git a/tests/automatic_tests/cahn_hilliard_implicit/equations.cc b/tests/regression_tests/cahn_hilliard_implicit/equations.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_implicit/equations.cc rename to tests/regression_tests/cahn_hilliard_implicit/equations.cc diff --git a/tests/automatic_tests/cahn_hilliard_implicit/gold_output.txt b/tests/regression_tests/cahn_hilliard_implicit/gold_output.txt similarity index 100% rename from tests/automatic_tests/cahn_hilliard_implicit/gold_output.txt rename to tests/regression_tests/cahn_hilliard_implicit/gold_output.txt diff --git a/tests/automatic_tests/cahn_hilliard_implicit/main.cc b/tests/regression_tests/cahn_hilliard_implicit/main.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_implicit/main.cc rename to tests/regression_tests/cahn_hilliard_implicit/main.cc diff --git a/tests/automatic_tests/cahn_hilliard_implicit/parameters.prm b/tests/regression_tests/cahn_hilliard_implicit/parameters.prm similarity index 100% rename from tests/automatic_tests/cahn_hilliard_implicit/parameters.prm rename to tests/regression_tests/cahn_hilliard_implicit/parameters.prm diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc rename to tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc diff --git a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h similarity index 100% rename from tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h rename to tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h diff --git a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in rename to tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in diff --git a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc rename to tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc diff --git a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc rename to tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc diff --git a/tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm similarity index 100% rename from tests/automatic_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm rename to tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc rename to tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc diff --git a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h similarity index 100% rename from tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h rename to tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h diff --git a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in rename to tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in diff --git a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc rename to tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc diff --git a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc rename to tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc diff --git a/tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm similarity index 100% rename from tests/automatic_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm rename to tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc rename to tests/regression_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc diff --git a/tests/automatic_tests/cahn_hilliard_semi_implicit/custom_pde.h b/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.h similarity index 100% rename from tests/automatic_tests/cahn_hilliard_semi_implicit/custom_pde.h rename to tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.h diff --git a/tests/automatic_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in rename to tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in diff --git a/tests/automatic_tests/cahn_hilliard_semi_implicit/equations.cc b/tests/regression_tests/cahn_hilliard_semi_implicit/equations.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_semi_implicit/equations.cc rename to tests/regression_tests/cahn_hilliard_semi_implicit/equations.cc diff --git a/tests/automatic_tests/cahn_hilliard_semi_implicit/main.cc b/tests/regression_tests/cahn_hilliard_semi_implicit/main.cc similarity index 100% rename from tests/automatic_tests/cahn_hilliard_semi_implicit/main.cc rename to tests/regression_tests/cahn_hilliard_semi_implicit/main.cc diff --git a/tests/automatic_tests/cahn_hilliard_semi_implicit/parameters.prm b/tests/regression_tests/cahn_hilliard_semi_implicit/parameters.prm similarity index 100% rename from tests/automatic_tests/cahn_hilliard_semi_implicit/parameters.prm rename to tests/regression_tests/cahn_hilliard_semi_implicit/parameters.prm diff --git a/tests/regression_tests/cavity_flow/CMakeLists.txt b/tests/regression_tests/cavity_flow/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/cavity_flow/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/cavity_flow/ICs_and_BCs.cc b/tests/regression_tests/cavity_flow/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/cavity_flow/ICs_and_BCs.cc rename to tests/regression_tests/cavity_flow/ICs_and_BCs.cc diff --git a/tests/automatic_tests/cavity_flow/custom_pde.h b/tests/regression_tests/cavity_flow/custom_pde.h similarity index 100% rename from tests/automatic_tests/cavity_flow/custom_pde.h rename to tests/regression_tests/cavity_flow/custom_pde.h diff --git a/tests/automatic_tests/cavity_flow/custom_pde.inst.in b/tests/regression_tests/cavity_flow/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/cavity_flow/custom_pde.inst.in rename to tests/regression_tests/cavity_flow/custom_pde.inst.in diff --git a/tests/automatic_tests/cavity_flow/equations.cc b/tests/regression_tests/cavity_flow/equations.cc similarity index 100% rename from tests/automatic_tests/cavity_flow/equations.cc rename to tests/regression_tests/cavity_flow/equations.cc diff --git a/tests/automatic_tests/cavity_flow/gold_output.txt b/tests/regression_tests/cavity_flow/gold_output.txt similarity index 100% rename from tests/automatic_tests/cavity_flow/gold_output.txt rename to tests/regression_tests/cavity_flow/gold_output.txt diff --git a/tests/automatic_tests/cavity_flow/main.cc b/tests/regression_tests/cavity_flow/main.cc similarity index 100% rename from tests/automatic_tests/cavity_flow/main.cc rename to tests/regression_tests/cavity_flow/main.cc diff --git a/tests/automatic_tests/cavity_flow/parameters.prm b/tests/regression_tests/cavity_flow/parameters.prm similarity index 100% rename from tests/automatic_tests/cavity_flow/parameters.prm rename to tests/regression_tests/cavity_flow/parameters.prm diff --git a/tests/regression_tests/file_read_binary/CMakeLists.txt b/tests/regression_tests/file_read_binary/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/file_read_binary/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/file_read_binary/ICs_and_BCs.cc b/tests/regression_tests/file_read_binary/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/file_read_binary/ICs_and_BCs.cc rename to tests/regression_tests/file_read_binary/ICs_and_BCs.cc diff --git a/tests/automatic_tests/file_read_binary/custom_pde.h b/tests/regression_tests/file_read_binary/custom_pde.h similarity index 100% rename from tests/automatic_tests/file_read_binary/custom_pde.h rename to tests/regression_tests/file_read_binary/custom_pde.h diff --git a/tests/automatic_tests/file_read_binary/custom_pde.inst.in b/tests/regression_tests/file_read_binary/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/file_read_binary/custom_pde.inst.in rename to tests/regression_tests/file_read_binary/custom_pde.inst.in diff --git a/tests/automatic_tests/file_read_binary/equations.cc b/tests/regression_tests/file_read_binary/equations.cc similarity index 100% rename from tests/automatic_tests/file_read_binary/equations.cc rename to tests/regression_tests/file_read_binary/equations.cc diff --git a/tests/automatic_tests/file_read_binary/main.cc b/tests/regression_tests/file_read_binary/main.cc similarity index 100% rename from tests/automatic_tests/file_read_binary/main.cc rename to tests/regression_tests/file_read_binary/main.cc diff --git a/tests/automatic_tests/file_read_binary/parameters.prm b/tests/regression_tests/file_read_binary/parameters.prm similarity index 100% rename from tests/automatic_tests/file_read_binary/parameters.prm rename to tests/regression_tests/file_read_binary/parameters.prm diff --git a/tests/regression_tests/file_read_vtk/CMakeLists.txt b/tests/regression_tests/file_read_vtk/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/file_read_vtk/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/file_read_vtk/ICs_and_BCs.cc b/tests/regression_tests/file_read_vtk/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/file_read_vtk/ICs_and_BCs.cc rename to tests/regression_tests/file_read_vtk/ICs_and_BCs.cc diff --git a/tests/automatic_tests/file_read_vtk/custom_pde.h b/tests/regression_tests/file_read_vtk/custom_pde.h similarity index 100% rename from tests/automatic_tests/file_read_vtk/custom_pde.h rename to tests/regression_tests/file_read_vtk/custom_pde.h diff --git a/tests/automatic_tests/file_read_vtk/custom_pde.inst.in b/tests/regression_tests/file_read_vtk/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/file_read_vtk/custom_pde.inst.in rename to tests/regression_tests/file_read_vtk/custom_pde.inst.in diff --git a/tests/automatic_tests/file_read_vtk/equations.cc b/tests/regression_tests/file_read_vtk/equations.cc similarity index 100% rename from tests/automatic_tests/file_read_vtk/equations.cc rename to tests/regression_tests/file_read_vtk/equations.cc diff --git a/tests/automatic_tests/file_read_vtk/main.cc b/tests/regression_tests/file_read_vtk/main.cc similarity index 100% rename from tests/automatic_tests/file_read_vtk/main.cc rename to tests/regression_tests/file_read_vtk/main.cc diff --git a/tests/automatic_tests/file_read_vtk/parameters.prm b/tests/regression_tests/file_read_vtk/parameters.prm similarity index 100% rename from tests/automatic_tests/file_read_vtk/parameters.prm rename to tests/regression_tests/file_read_vtk/parameters.prm diff --git a/tests/regression_tests/fracture/CMakeLists.txt b/tests/regression_tests/fracture/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/fracture/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/fracture/ICs_and_BCs.cc b/tests/regression_tests/fracture/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/fracture/ICs_and_BCs.cc rename to tests/regression_tests/fracture/ICs_and_BCs.cc diff --git a/tests/automatic_tests/fracture/custom_pde.h b/tests/regression_tests/fracture/custom_pde.h similarity index 100% rename from tests/automatic_tests/fracture/custom_pde.h rename to tests/regression_tests/fracture/custom_pde.h diff --git a/tests/automatic_tests/fracture/custom_pde.inst.in b/tests/regression_tests/fracture/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/fracture/custom_pde.inst.in rename to tests/regression_tests/fracture/custom_pde.inst.in diff --git a/tests/automatic_tests/fracture/equations.cc b/tests/regression_tests/fracture/equations.cc similarity index 100% rename from tests/automatic_tests/fracture/equations.cc rename to tests/regression_tests/fracture/equations.cc diff --git a/tests/automatic_tests/fracture/gold_output.txt b/tests/regression_tests/fracture/gold_output.txt similarity index 100% rename from tests/automatic_tests/fracture/gold_output.txt rename to tests/regression_tests/fracture/gold_output.txt diff --git a/tests/automatic_tests/fracture/main.cc b/tests/regression_tests/fracture/main.cc similarity index 100% rename from tests/automatic_tests/fracture/main.cc rename to tests/regression_tests/fracture/main.cc diff --git a/tests/automatic_tests/fracture/parameters.prm b/tests/regression_tests/fracture/parameters.prm similarity index 100% rename from tests/automatic_tests/fracture/parameters.prm rename to tests/regression_tests/fracture/parameters.prm diff --git a/tests/regression_tests/heat_equation_steady_state/CMakeLists.txt b/tests/regression_tests/heat_equation_steady_state/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/heat_equation_steady_state/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/heat_equation_steady_state/ICs_and_BCs.cc b/tests/regression_tests/heat_equation_steady_state/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/heat_equation_steady_state/ICs_and_BCs.cc rename to tests/regression_tests/heat_equation_steady_state/ICs_and_BCs.cc diff --git a/tests/automatic_tests/heat_equation_steady_state/custom_pde.h b/tests/regression_tests/heat_equation_steady_state/custom_pde.h similarity index 100% rename from tests/automatic_tests/heat_equation_steady_state/custom_pde.h rename to tests/regression_tests/heat_equation_steady_state/custom_pde.h diff --git a/tests/automatic_tests/heat_equation_steady_state/custom_pde.inst.in b/tests/regression_tests/heat_equation_steady_state/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/heat_equation_steady_state/custom_pde.inst.in rename to tests/regression_tests/heat_equation_steady_state/custom_pde.inst.in diff --git a/tests/automatic_tests/heat_equation_steady_state/equations.cc b/tests/regression_tests/heat_equation_steady_state/equations.cc similarity index 100% rename from tests/automatic_tests/heat_equation_steady_state/equations.cc rename to tests/regression_tests/heat_equation_steady_state/equations.cc diff --git a/tests/automatic_tests/heat_equation_steady_state/gold_output.txt b/tests/regression_tests/heat_equation_steady_state/gold_output.txt similarity index 100% rename from tests/automatic_tests/heat_equation_steady_state/gold_output.txt rename to tests/regression_tests/heat_equation_steady_state/gold_output.txt diff --git a/tests/automatic_tests/heat_equation_steady_state/main.cc b/tests/regression_tests/heat_equation_steady_state/main.cc similarity index 100% rename from tests/automatic_tests/heat_equation_steady_state/main.cc rename to tests/regression_tests/heat_equation_steady_state/main.cc diff --git a/tests/automatic_tests/heat_equation_steady_state/parameters.prm b/tests/regression_tests/heat_equation_steady_state/parameters.prm similarity index 100% rename from tests/automatic_tests/heat_equation_steady_state/parameters.prm rename to tests/regression_tests/heat_equation_steady_state/parameters.prm diff --git a/tests/regression_tests/linear_solve_old_solution/CMakeLists.txt b/tests/regression_tests/linear_solve_old_solution/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/linear_solve_old_solution/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/linear_solve_old_solution/ICs_and_BCs.cc b/tests/regression_tests/linear_solve_old_solution/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/linear_solve_old_solution/ICs_and_BCs.cc rename to tests/regression_tests/linear_solve_old_solution/ICs_and_BCs.cc diff --git a/tests/automatic_tests/linear_solve_old_solution/custom_pde.h b/tests/regression_tests/linear_solve_old_solution/custom_pde.h similarity index 100% rename from tests/automatic_tests/linear_solve_old_solution/custom_pde.h rename to tests/regression_tests/linear_solve_old_solution/custom_pde.h diff --git a/tests/automatic_tests/linear_solve_old_solution/custom_pde.inst.in b/tests/regression_tests/linear_solve_old_solution/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/linear_solve_old_solution/custom_pde.inst.in rename to tests/regression_tests/linear_solve_old_solution/custom_pde.inst.in diff --git a/tests/automatic_tests/linear_solve_old_solution/equations.cc b/tests/regression_tests/linear_solve_old_solution/equations.cc similarity index 100% rename from tests/automatic_tests/linear_solve_old_solution/equations.cc rename to tests/regression_tests/linear_solve_old_solution/equations.cc diff --git a/tests/automatic_tests/linear_solve_old_solution/gold_output.txt b/tests/regression_tests/linear_solve_old_solution/gold_output.txt similarity index 100% rename from tests/automatic_tests/linear_solve_old_solution/gold_output.txt rename to tests/regression_tests/linear_solve_old_solution/gold_output.txt diff --git a/tests/automatic_tests/linear_solve_old_solution/main.cc b/tests/regression_tests/linear_solve_old_solution/main.cc similarity index 100% rename from tests/automatic_tests/linear_solve_old_solution/main.cc rename to tests/regression_tests/linear_solve_old_solution/main.cc diff --git a/tests/automatic_tests/linear_solve_old_solution/parameters.prm b/tests/regression_tests/linear_solve_old_solution/parameters.prm similarity index 100% rename from tests/automatic_tests/linear_solve_old_solution/parameters.prm rename to tests/regression_tests/linear_solve_old_solution/parameters.prm diff --git a/tests/regression_tests/mechanics/CMakeLists.txt b/tests/regression_tests/mechanics/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/mechanics/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/mechanics/ICs_and_BCs.cc b/tests/regression_tests/mechanics/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/mechanics/ICs_and_BCs.cc rename to tests/regression_tests/mechanics/ICs_and_BCs.cc diff --git a/tests/automatic_tests/mechanics/custom_pde.h b/tests/regression_tests/mechanics/custom_pde.h similarity index 100% rename from tests/automatic_tests/mechanics/custom_pde.h rename to tests/regression_tests/mechanics/custom_pde.h diff --git a/tests/automatic_tests/mechanics/custom_pde.inst.in b/tests/regression_tests/mechanics/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/mechanics/custom_pde.inst.in rename to tests/regression_tests/mechanics/custom_pde.inst.in diff --git a/tests/automatic_tests/mechanics/equations.cc b/tests/regression_tests/mechanics/equations.cc similarity index 100% rename from tests/automatic_tests/mechanics/equations.cc rename to tests/regression_tests/mechanics/equations.cc diff --git a/tests/automatic_tests/mechanics/gold_output.txt b/tests/regression_tests/mechanics/gold_output.txt similarity index 100% rename from tests/automatic_tests/mechanics/gold_output.txt rename to tests/regression_tests/mechanics/gold_output.txt diff --git a/tests/automatic_tests/mechanics/main.cc b/tests/regression_tests/mechanics/main.cc similarity index 100% rename from tests/automatic_tests/mechanics/main.cc rename to tests/regression_tests/mechanics/main.cc diff --git a/tests/automatic_tests/mechanics/parameters.prm b/tests/regression_tests/mechanics/parameters.prm similarity index 100% rename from tests/automatic_tests/mechanics/parameters.prm rename to tests/regression_tests/mechanics/parameters.prm diff --git a/tests/regression_tests/precipitate_explicit/CMakeLists.txt b/tests/regression_tests/precipitate_explicit/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/precipitate_explicit/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/precipitate_explicit/ICs_and_BCs.cc b/tests/regression_tests/precipitate_explicit/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/precipitate_explicit/ICs_and_BCs.cc rename to tests/regression_tests/precipitate_explicit/ICs_and_BCs.cc diff --git a/tests/automatic_tests/precipitate_explicit/custom_pde.h b/tests/regression_tests/precipitate_explicit/custom_pde.h similarity index 100% rename from tests/automatic_tests/precipitate_explicit/custom_pde.h rename to tests/regression_tests/precipitate_explicit/custom_pde.h diff --git a/tests/automatic_tests/precipitate_explicit/custom_pde.inst.in b/tests/regression_tests/precipitate_explicit/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/precipitate_explicit/custom_pde.inst.in rename to tests/regression_tests/precipitate_explicit/custom_pde.inst.in diff --git a/tests/automatic_tests/precipitate_explicit/equations.cc b/tests/regression_tests/precipitate_explicit/equations.cc similarity index 100% rename from tests/automatic_tests/precipitate_explicit/equations.cc rename to tests/regression_tests/precipitate_explicit/equations.cc diff --git a/tests/automatic_tests/precipitate_explicit/gold_output.txt b/tests/regression_tests/precipitate_explicit/gold_output.txt similarity index 100% rename from tests/automatic_tests/precipitate_explicit/gold_output.txt rename to tests/regression_tests/precipitate_explicit/gold_output.txt diff --git a/tests/automatic_tests/precipitate_explicit/main.cc b/tests/regression_tests/precipitate_explicit/main.cc similarity index 100% rename from tests/automatic_tests/precipitate_explicit/main.cc rename to tests/regression_tests/precipitate_explicit/main.cc diff --git a/tests/automatic_tests/precipitate_explicit/parameters.prm b/tests/regression_tests/precipitate_explicit/parameters.prm similarity index 100% rename from tests/automatic_tests/precipitate_explicit/parameters.prm rename to tests/regression_tests/precipitate_explicit/parameters.prm diff --git a/tests/automatic_tests/run_automatic_tests.py b/tests/regression_tests/run_automatic_tests.py similarity index 100% rename from tests/automatic_tests/run_automatic_tests.py rename to tests/regression_tests/run_automatic_tests.py diff --git a/tests/regression_tests/solution_blocks/CMakeLists.txt b/tests/regression_tests/solution_blocks/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/solution_blocks/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/solution_blocks/ICs_and_BCs.cc b/tests/regression_tests/solution_blocks/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/solution_blocks/ICs_and_BCs.cc rename to tests/regression_tests/solution_blocks/ICs_and_BCs.cc diff --git a/tests/automatic_tests/solution_blocks/custom_pde.h b/tests/regression_tests/solution_blocks/custom_pde.h similarity index 100% rename from tests/automatic_tests/solution_blocks/custom_pde.h rename to tests/regression_tests/solution_blocks/custom_pde.h diff --git a/tests/automatic_tests/solution_blocks/custom_pde.inst.in b/tests/regression_tests/solution_blocks/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/solution_blocks/custom_pde.inst.in rename to tests/regression_tests/solution_blocks/custom_pde.inst.in diff --git a/tests/automatic_tests/solution_blocks/equations.cc b/tests/regression_tests/solution_blocks/equations.cc similarity index 100% rename from tests/automatic_tests/solution_blocks/equations.cc rename to tests/regression_tests/solution_blocks/equations.cc diff --git a/tests/automatic_tests/solution_blocks/gold_output.txt b/tests/regression_tests/solution_blocks/gold_output.txt similarity index 100% rename from tests/automatic_tests/solution_blocks/gold_output.txt rename to tests/regression_tests/solution_blocks/gold_output.txt diff --git a/tests/automatic_tests/solution_blocks/main.cc b/tests/regression_tests/solution_blocks/main.cc similarity index 100% rename from tests/automatic_tests/solution_blocks/main.cc rename to tests/regression_tests/solution_blocks/main.cc diff --git a/tests/automatic_tests/solution_blocks/parameters.prm b/tests/regression_tests/solution_blocks/parameters.prm similarity index 100% rename from tests/automatic_tests/solution_blocks/parameters.prm rename to tests/regression_tests/solution_blocks/parameters.prm diff --git a/tests/regression_tests/taylor_green_vortex/CMakeLists.txt b/tests/regression_tests/taylor_green_vortex/CMakeLists.txt new file mode 100644 index 000000000..5f34be6c0 --- /dev/null +++ b/tests/regression_tests/taylor_green_vortex/CMakeLists.txt @@ -0,0 +1,23 @@ +## +# CMake script for the PRISMS-PF applications +## + +cmake_minimum_required(VERSION 3.13.4) + +# Create a project for the application +project(myapp CXX) + +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/tests/automatic_tests/taylor_green_vortex/ICs_and_BCs.cc b/tests/regression_tests/taylor_green_vortex/ICs_and_BCs.cc similarity index 100% rename from tests/automatic_tests/taylor_green_vortex/ICs_and_BCs.cc rename to tests/regression_tests/taylor_green_vortex/ICs_and_BCs.cc diff --git a/tests/automatic_tests/taylor_green_vortex/custom_pde.h b/tests/regression_tests/taylor_green_vortex/custom_pde.h similarity index 100% rename from tests/automatic_tests/taylor_green_vortex/custom_pde.h rename to tests/regression_tests/taylor_green_vortex/custom_pde.h diff --git a/tests/automatic_tests/taylor_green_vortex/custom_pde.inst.in b/tests/regression_tests/taylor_green_vortex/custom_pde.inst.in similarity index 100% rename from tests/automatic_tests/taylor_green_vortex/custom_pde.inst.in rename to tests/regression_tests/taylor_green_vortex/custom_pde.inst.in diff --git a/tests/automatic_tests/taylor_green_vortex/equations.cc b/tests/regression_tests/taylor_green_vortex/equations.cc similarity index 100% rename from tests/automatic_tests/taylor_green_vortex/equations.cc rename to tests/regression_tests/taylor_green_vortex/equations.cc diff --git a/tests/automatic_tests/taylor_green_vortex/main.cc b/tests/regression_tests/taylor_green_vortex/main.cc similarity index 100% rename from tests/automatic_tests/taylor_green_vortex/main.cc rename to tests/regression_tests/taylor_green_vortex/main.cc diff --git a/tests/automatic_tests/taylor_green_vortex/parameters.prm b/tests/regression_tests/taylor_green_vortex/parameters.prm similarity index 100% rename from tests/automatic_tests/taylor_green_vortex/parameters.prm rename to tests/regression_tests/taylor_green_vortex/parameters.prm diff --git a/tests/automatic_tests/test_results.txt b/tests/regression_tests/test_results.txt similarity index 100% rename from tests/automatic_tests/test_results.txt rename to tests/regression_tests/test_results.txt diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index 0debfd000..02b2f5e1b 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -2,8 +2,12 @@ # CMake for PRISMS-PF unit tests ## +message(STATUS "Setting up PRISMS-PF unit tests...") + # Add each test subdirectory add_subdirectory(core) add_subdirectory(field_input) add_subdirectory(user_inputs) add_subdirectory(utilities) + +message(STATUS "PRISMS-PF unit tests setup complete.") From c78e8d8aa2f091ef3f3ec37010e9e25aed97bf18 Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 6 Oct 2025 18:00:34 -0700 Subject: [PATCH 06/17] updating regression tests --- .../blank}/CMakeLists.txt | 0 .../blank}/ICs_and_BCs.cc | 0 .../blank}/custom_pde.h | 0 .../blank}/custom_pde.inst.in | 0 .../blank}/equations.cc | 6 +- .../blank}/main.cc | 0 applications/blank/parameters.prm | 12 + tests/regression_tests/CMakeLists.txt | 28 +- .../allen_cahn_rk4/ICs_and_BCs.cc | 72 - .../allen_cahn_rk4/custom_pde.h | 136 -- .../allen_cahn_rk4/equations.cc | 148 -- .../allen_cahn_rk4/parameters.prm | 27 - .../CMakeLists.txt | 23 - .../ICs_and_BCs.cc | 75 - .../custom_pde.h | 136 -- .../custom_pde.inst.in | 4 - .../equations.cc | 133 -- .../main.cc | 263 ---- .../parameters.prm | 40 - .../CMakeLists.txt | 23 - .../ICs_and_BCs.cc | 75 - .../custom_pde.h | 136 -- .../custom_pde.inst.in | 4 - .../equations.cc | 140 -- .../main.cc | 263 ---- .../parameters.prm | 40 - .../CMakeLists.txt | 23 - .../ICs_and_BCs.cc | 75 - .../cahn_hilliard_semi_implicit/custom_pde.h | 136 -- .../custom_pde.inst.in | 4 - .../cahn_hilliard_semi_implicit/equations.cc | 128 -- .../cahn_hilliard_semi_implicit/main.cc | 263 ---- .../parameters.prm | 40 - .../file_read_binary/CMakeLists.txt | 23 - .../file_read_binary/custom_pde.h | 132 -- .../file_read_binary/custom_pde.inst.in | 4 - .../regression_tests/file_read_binary/main.cc | 258 ---- .../file_read_binary/parameters.prm | 22 - .../file_read_vtk/CMakeLists.txt | 23 - .../file_read_vtk/ICs_and_BCs.cc | 42 - .../file_read_vtk/custom_pde.inst.in | 4 - .../file_read_vtk/equations.cc | 62 - tests/regression_tests/file_read_vtk/main.cc | 263 ---- .../file_read_vtk/parameters.prm | 20 - tests/regression_tests/run.py | 363 +++++ tests/regression_tests/run_automatic_tests.py | 317 ---- .../taylor_green_vortex/CMakeLists.txt | 23 - .../taylor_green_vortex/ICs_and_BCs.cc | 82 -- .../taylor_green_vortex/custom_pde.h | 170 --- .../taylor_green_vortex/custom_pde.inst.in | 4 - .../taylor_green_vortex/equations.cc | 312 ---- .../taylor_green_vortex/main.cc | 263 ---- .../taylor_green_vortex/parameters.prm | 54 - tests/regression_tests/test_results.txt | 1290 ----------------- 54 files changed, 400 insertions(+), 5784 deletions(-) rename {tests/regression_tests/allen_cahn_rk4 => applications/blank}/CMakeLists.txt (100%) rename {tests/regression_tests/file_read_binary => applications/blank}/ICs_and_BCs.cc (100%) rename {tests/regression_tests/file_read_vtk => applications/blank}/custom_pde.h (100%) rename {tests/regression_tests/allen_cahn_rk4 => applications/blank}/custom_pde.inst.in (100%) rename {tests/regression_tests/file_read_binary => applications/blank}/equations.cc (95%) rename {tests/regression_tests/allen_cahn_rk4 => applications/blank}/main.cc (100%) create mode 100644 applications/blank/parameters.prm delete mode 100644 tests/regression_tests/allen_cahn_rk4/ICs_and_BCs.cc delete mode 100644 tests/regression_tests/allen_cahn_rk4/custom_pde.h delete mode 100644 tests/regression_tests/allen_cahn_rk4/equations.cc delete mode 100644 tests/regression_tests/allen_cahn_rk4/parameters.prm delete mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt delete mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc delete mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h delete mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in delete mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc delete mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc delete mode 100644 tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm delete mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt delete mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc delete mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h delete mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in delete mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc delete mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc delete mode 100644 tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm delete mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt delete mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc delete mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.h delete mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in delete mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/equations.cc delete mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/main.cc delete mode 100644 tests/regression_tests/cahn_hilliard_semi_implicit/parameters.prm delete mode 100644 tests/regression_tests/file_read_binary/CMakeLists.txt delete mode 100644 tests/regression_tests/file_read_binary/custom_pde.h delete mode 100644 tests/regression_tests/file_read_binary/custom_pde.inst.in delete mode 100644 tests/regression_tests/file_read_binary/main.cc delete mode 100644 tests/regression_tests/file_read_binary/parameters.prm delete mode 100644 tests/regression_tests/file_read_vtk/CMakeLists.txt delete mode 100644 tests/regression_tests/file_read_vtk/ICs_and_BCs.cc delete mode 100644 tests/regression_tests/file_read_vtk/custom_pde.inst.in delete mode 100644 tests/regression_tests/file_read_vtk/equations.cc delete mode 100644 tests/regression_tests/file_read_vtk/main.cc delete mode 100644 tests/regression_tests/file_read_vtk/parameters.prm create mode 100644 tests/regression_tests/run.py delete mode 100644 tests/regression_tests/run_automatic_tests.py delete mode 100644 tests/regression_tests/taylor_green_vortex/CMakeLists.txt delete mode 100644 tests/regression_tests/taylor_green_vortex/ICs_and_BCs.cc delete mode 100644 tests/regression_tests/taylor_green_vortex/custom_pde.h delete mode 100644 tests/regression_tests/taylor_green_vortex/custom_pde.inst.in delete mode 100644 tests/regression_tests/taylor_green_vortex/equations.cc delete mode 100644 tests/regression_tests/taylor_green_vortex/main.cc delete mode 100644 tests/regression_tests/taylor_green_vortex/parameters.prm delete mode 100644 tests/regression_tests/test_results.txt diff --git a/tests/regression_tests/allen_cahn_rk4/CMakeLists.txt b/applications/blank/CMakeLists.txt similarity index 100% rename from tests/regression_tests/allen_cahn_rk4/CMakeLists.txt rename to applications/blank/CMakeLists.txt diff --git a/tests/regression_tests/file_read_binary/ICs_and_BCs.cc b/applications/blank/ICs_and_BCs.cc similarity index 100% rename from tests/regression_tests/file_read_binary/ICs_and_BCs.cc rename to applications/blank/ICs_and_BCs.cc diff --git a/tests/regression_tests/file_read_vtk/custom_pde.h b/applications/blank/custom_pde.h similarity index 100% rename from tests/regression_tests/file_read_vtk/custom_pde.h rename to applications/blank/custom_pde.h diff --git a/tests/regression_tests/allen_cahn_rk4/custom_pde.inst.in b/applications/blank/custom_pde.inst.in similarity index 100% rename from tests/regression_tests/allen_cahn_rk4/custom_pde.inst.in rename to applications/blank/custom_pde.inst.in diff --git a/tests/regression_tests/file_read_binary/equations.cc b/applications/blank/equations.cc similarity index 95% rename from tests/regression_tests/file_read_binary/equations.cc rename to applications/blank/equations.cc index cf6619205..84097a296 100644 --- a/tests/regression_tests/file_read_binary/equations.cc +++ b/applications/blank/equations.cc @@ -13,11 +13,7 @@ PRISMS_PF_BEGIN_NAMESPACE void CustomAttributeLoader::load_variable_attributes() -{ - set_variable_name(0, "n"); - set_variable_type(0, Scalar); - set_variable_equation_type(0, Constant); -} +{} template void diff --git a/tests/regression_tests/allen_cahn_rk4/main.cc b/applications/blank/main.cc similarity index 100% rename from tests/regression_tests/allen_cahn_rk4/main.cc rename to applications/blank/main.cc diff --git a/applications/blank/parameters.prm b/applications/blank/parameters.prm new file mode 100644 index 000000000..6017392cb --- /dev/null +++ b/applications/blank/parameters.prm @@ -0,0 +1,12 @@ +set dim = 3 +set global refinement = 4 +set degree = 1 + +subsection Rectangular mesh + set x size = 100 + set y size = 100 + set z size = 100 + set x subdivisions = 1 + set y subdivisions = 1 + set z subdivisions = 1 +end diff --git a/tests/regression_tests/CMakeLists.txt b/tests/regression_tests/CMakeLists.txt index 9c3bebf40..3b61f2d73 100644 --- a/tests/regression_tests/CMakeLists.txt +++ b/tests/regression_tests/CMakeLists.txt @@ -4,25 +4,23 @@ message(STATUS "Setting up PRISMS-PF regression tests...") +# A list of the regression applications set(REGRESSION_TEST_APPS allen_cahn_explicit allen_cahn_implicit - allen_cahn_rk4 blank cahn_hilliard_explicit cahn_hilliard_implicit cavity_flow - file_read_binary - file_read_vtk fracture heat_equation_steady_state linear_solve_old_solution mechanics precipitate_explicit solution_blocks - taylor_green_vortex ) +# For each regression application install the source files, configure, and compile foreach(test_app ${REGRESSION_TEST_APPS}) # Install the source files install( @@ -35,6 +33,7 @@ foreach(test_app ${REGRESSION_TEST_APPS}) PATTERN "*.h" PATTERN "*.prm" PATTERN "CMakeLists.txt" + PATTERN "gold_output.txt" ) # Compile during installation @@ -65,4 +64,25 @@ foreach(test_app ${REGRESSION_TEST_APPS}) ) endforeach() +# Run the regressions apps +find_package(Python COMPONENTS Interpreter Development REQUIRED) + +if(NOT DEFINED N_THREADS) + set(N_THREADS 1) +endif() + +install(CODE " +execute_process( + COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run.py + -j ${N_THREADS} + ${REGRESSION_TEST_APPS} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE run_result +) +if(run_result) + message(FATAL_ERROR \"Regression tests failed\") +endif() +") + + message(STATUS "PRISMS-PF regression tests setup complete.") diff --git a/tests/regression_tests/allen_cahn_rk4/ICs_and_BCs.cc b/tests/regression_tests/allen_cahn_rk4/ICs_and_BCs.cc deleted file mode 100644 index 9790ba5ab..000000000 --- a/tests/regression_tests/allen_cahn_rk4/ICs_and_BCs.cc +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include - -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -template -void -CustomPDE::set_initial_condition( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{ - number center[12][3] = { - {0.1, 0.3, 0}, - {0.8, 0.7, 0}, - {0.5, 0.2, 0}, - {0.4, 0.4, 0}, - {0.3, 0.9, 0}, - {0.8, 0.1, 0}, - {0.9, 0.5, 0}, - {0.0, 0.1, 0}, - {0.1, 0.6, 0}, - {0.5, 0.6, 0}, - {1, 1, 0}, - {0.7, 0.95, 0} - }; - number rad[12] = {12, 14, 19, 16, 11, 12, 17, 15, 20, 10, 11, 14}; - number dist = 0.0; - for (unsigned int i = 0; i < 12; i++) - { - dist = 0.0; - for (unsigned int dir = 0; dir < dim; dir++) - { - dist += - (point[dir] - center[i][dir] * 100.0) * (point[dir] - center[i][dir] * 100.0); - } - dist = std::sqrt(dist); - - scalar_value += 0.5 * (1.0 - std::tanh((dist - rad[i]) / 1.5)); - } - scalar_value = std::min(scalar_value, static_cast(1.0)); -} - -template -void -CustomPDE::set_nonuniform_dirichlet( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &boundary_id, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/allen_cahn_rk4/custom_pde.h b/tests/regression_tests/allen_cahn_rk4/custom_pde.h deleted file mode 100644 index 54450cba3..000000000 --- a/tests/regression_tests/allen_cahn_rk4/custom_pde.h +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#pragma once - -#include -#include -#include -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -/** - * @brief This is a derived class of `VariableAttributeLoader` where the user implements - * their variable attributes and field declarations. - */ -class CustomAttributeLoader : public VariableAttributeLoader -{ -public: - /** - * @brief Destructor. - */ - ~CustomAttributeLoader() override = default; - - /** - * @brief User-implemented method where the variable attributes are set for all fields. - */ - void - load_variable_attributes() override; -}; - -/** - * @brief This is a derived class of `MatrixFreeOperator` where the user implements their - * PDEs. - * - * @tparam dim The number of dimensions in the problem. - * @tparam degree The polynomial degree of the shape functions. - * @tparam number Datatype to use. Either double or float. - */ -template -class CustomPDE : public PDEOperator -{ -public: - using ScalarValue = dealii::VectorizedArray; - using ScalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using ScalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using VectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray>; - using PDEOperator::get_user_inputs; - using PDEOperator::get_pf_tools; - using PDEOperator::get_timestep; - - /** - * @brief Constructor. - */ - explicit CustomPDE(const UserInputParameters &_user_inputs, - PhaseFieldTools &_pf_tools) - : PDEOperator(_user_inputs, _pf_tools) - {} - -private: - /** - * @brief User-implemented class for the initial conditions. - */ - void - set_initial_condition(const unsigned int &index, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for nonuniform boundary conditions. - */ - void - set_nonuniform_dirichlet(const unsigned int &index, - const unsigned int &boundary_id, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for the RHS of explicit equations. - */ - void - compute_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - /** - * @brief User-implemented class for the RHS of nonexplicit equations. - */ - void - compute_nonexplicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the LHS of nonexplicit equations. - */ - void - compute_nonexplicit_lhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the RHS of postprocessed explicit equations. - */ - void - compute_postprocess_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - number MnV = get_user_inputs().get_user_constants().get_model_constant_double("MnV"); - number KnV = get_user_inputs().get_user_constants().get_model_constant_double("KnV"); -}; - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/allen_cahn_rk4/equations.cc b/tests/regression_tests/allen_cahn_rk4/equations.cc deleted file mode 100644 index fbe73775a..000000000 --- a/tests/regression_tests/allen_cahn_rk4/equations.cc +++ /dev/null @@ -1,148 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -void -CustomAttributeLoader::load_variable_attributes() -{ - set_variable_name(0, "n"); - set_variable_type(0, Scalar); - set_variable_equation_type(0, ExplicitTimeDependent); - set_dependencies_value_term_rhs(0, "n, n_2, n_3, n_4"); - set_dependencies_gradient_term_rhs(0, "grad(n), grad(n_2), grad(n_3), grad(n_4)"); - set_solve_block(0, 1); - - set_variable_name(1, "n_2"); - set_variable_type(1, Scalar); - set_variable_equation_type(1, Auxiliary); - set_dependencies_value_term_rhs(1, "n"); - set_dependencies_gradient_term_rhs(1, "grad(n)"); - - set_variable_name(2, "n_3"); - set_variable_type(2, Scalar); - set_variable_equation_type(2, Auxiliary); - set_dependencies_value_term_rhs(2, "n, n_2"); - set_dependencies_gradient_term_rhs(2, "grad(n_2)"); - - set_variable_name(3, "n_4"); - set_variable_type(3, Scalar); - set_variable_equation_type(3, Auxiliary); - set_dependencies_value_term_rhs(3, "n, n_3"); - set_dependencies_gradient_term_rhs(3, "grad(n_3)"); -} - -template -void -CustomPDE::compute_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{ - if (solve_block == 1) - { - ScalarValue n = variable_list.template get_value(0); - ScalarGrad grad_n = variable_list.template get_gradient(0); - ScalarValue n_2 = variable_list.template get_value(1); - ScalarGrad grad_n_2 = variable_list.template get_gradient(1); - ScalarValue n_3 = variable_list.template get_value(2); - ScalarGrad grad_n_3 = variable_list.template get_gradient(2); - ScalarValue n_4 = variable_list.template get_value(3); - ScalarGrad grad_n_4 = variable_list.template get_gradient(3); - - ScalarValue k_1_bulk_energy = 4.0 * n * (n - 1.0) * (n - 0.5); - ScalarValue k_2_bulk_energy = 4.0 * n_2 * (n_2 - 1.0) * (n_2 - 0.5); - ScalarValue k_3_bulk_energy = 4.0 * n_3 * (n_3 - 1.0) * (n_3 - 0.5); - ScalarValue k_4_bulk_energy = 4.0 * n_4 * (n_4 - 1.0) * (n_4 - 0.5); - - ScalarValue eq_n = n - (get_timestep() * MnV / 6.0 * - (k_1_bulk_energy + 2.0 * k_2_bulk_energy + - 2.0 * k_3_bulk_energy + k_4_bulk_energy)); - ScalarGrad eq_grad_n = -get_timestep() * KnV * MnV / 6.0 * - (grad_n + 2.0 * grad_n_2 + 2.0 * grad_n_3 + grad_n_4); - - variable_list.set_value_term(0, eq_n); - variable_list.set_gradient_term(0, eq_grad_n); - } -} - -template -void -CustomPDE::compute_nonexplicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (solve_block == 0 && index == 1) - { - ScalarValue n = variable_list.template get_value(0); - ScalarGrad grad_n = variable_list.template get_gradient(0); - - ScalarValue bulk_energy = 4.0 * n * (n - 1.0) * (n - 0.5); - ScalarValue eq_n_2 = n - 0.5 * get_timestep() * MnV * bulk_energy; - ScalarGrad eq_grad_n_2 = -0.5 * get_timestep() * MnV * KnV * grad_n; - - variable_list.set_value_term(1, eq_n_2); - variable_list.set_gradient_term(1, eq_grad_n_2); - } - if (solve_block == 0 && index == 2) - { - ScalarValue n = variable_list.template get_value(0); - ScalarValue n_2 = variable_list.template get_value(1); - ScalarGrad grad_n_2 = variable_list.template get_gradient(1); - - ScalarValue bulk_energy = 4.0 * n_2 * (n_2 - 1.0) * (n_2 - 0.5); - ScalarValue eq_n_3 = n - 0.5 * get_timestep() * MnV * bulk_energy; - ScalarGrad eq_grad_n_3 = -0.5 * get_timestep() * MnV * KnV * grad_n_2; - - variable_list.set_value_term(2, eq_n_3); - variable_list.set_gradient_term(2, eq_grad_n_3); - } - if (solve_block == 0 && index == 3) - { - ScalarValue n = variable_list.template get_value(0); - ScalarValue n_3 = variable_list.template get_value(2); - ScalarGrad grad_n_3 = variable_list.template get_gradient(2); - - ScalarValue bulk_energy = 4.0 * n_3 * (n_3 - 1.0) * (n_3 - 0.5); - ScalarValue eq_n_3 = n - get_timestep() * MnV * bulk_energy; - ScalarGrad eq_grad_n_3 = -get_timestep() * MnV * KnV * grad_n_3; - - variable_list.set_value_term(3, eq_n_3); - variable_list.set_gradient_term(3, eq_grad_n_3); - } -} - -template -void -CustomPDE::compute_nonexplicit_lhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{} - -template -void -CustomPDE::compute_postprocess_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/allen_cahn_rk4/parameters.prm b/tests/regression_tests/allen_cahn_rk4/parameters.prm deleted file mode 100644 index a7aae5800..000000000 --- a/tests/regression_tests/allen_cahn_rk4/parameters.prm +++ /dev/null @@ -1,27 +0,0 @@ -set dim = 2 -set global refinement = 7 -set degree = 1 - -subsection Rectangular mesh - set x size = 50 - set y size = 50 - set z size = 50 - set x subdivisions = 1 - set y subdivisions = 1 - set z subdivisions = 1 -end -set time step = 2.5e-2 -set end time = 15 - -subsection output - set condition = EQUAL_SPACING - set number = 5 -end - -set boundary condition for n = Natural -set boundary condition for n_2 = Natural -set boundary condition for n_3 = Natural -set boundary condition for n_4 = Natural - -set Model constant MnV = 1.0, DOUBLE -set Model constant KnV = 2.0, DOUBLE diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt deleted file mode 100644 index 5f34be6c0..000000000 --- a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -## - -cmake_minimum_required(VERSION 3.13.4) - -# Create a project for the application -project(myapp CXX) - -# Find the PRISMS-PF package -find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) -if(PRISMS_PF_FOUND) - # Include setup script - include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - - # Set up the application - prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) -else() - message( - FATAL_ERROR - "PRISMS-PF package not found. Please make sure it is in path." - ) -endif() diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc deleted file mode 100644 index a7c6156f7..000000000 --- a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/ICs_and_BCs.cc +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include - -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -template -void -CustomPDE::set_initial_condition( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{ - if (index == 0) - { - double center[12][3] = { - {0.1, 0.3, 0}, - {0.8, 0.7, 0}, - {0.5, 0.2, 0}, - {0.4, 0.4, 0}, - {0.3, 0.9, 0}, - {0.8, 0.1, 0}, - {0.9, 0.5, 0}, - {0.0, 0.1, 0}, - {0.1, 0.6, 0}, - {0.5, 0.6, 0}, - {1, 1, 0}, - {0.7, 0.95, 0} - }; - double rad[12] = {12, 14, 19, 16, 11, 12, 17, 15, 20, 10, 11, 14}; - double dist = 0.0; - for (unsigned int i = 0; i < 12; i++) - { - dist = 0.0; - for (unsigned int dir = 0; dir < dim; dir++) - { - dist += (point[dir] - center[i][dir] * 100.0) * - (point[dir] - center[i][dir] * 100.0); - } - dist = std::sqrt(dist); - - scalar_value += 0.5 * (1.0 - std::tanh((dist - rad[i]) / 1.5)); - } - scalar_value = std::min(scalar_value, static_cast(1.0)); - } -} - -template -void -CustomPDE::set_nonuniform_dirichlet( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &boundary_id, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h deleted file mode 100644 index 2e3311115..000000000 --- a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.h +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#pragma once - -#include -#include -#include -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -/** - * @brief This is a derived class of `VariableAttributeLoader` where the user implements - * their variable attributes and field declarations. - */ -class CustomAttributeLoader : public VariableAttributeLoader -{ -public: - /** - * @brief Destructor. - */ - ~CustomAttributeLoader() override = default; - - /** - * @brief User-implemented method where the variable attributes are set for all fields. - */ - void - load_variable_attributes() override; -}; - -/** - * @brief This is a derived class of `matrixFreeOperator` where the user implements their - * PDEs. - * - * @tparam dim The number of dimensions in the problem. - * @tparam degree The polynomial degree of the shape functions. - * @tparam number Datatype to use. Either double or float. - */ -template -class CustomPDE : public PDEOperator -{ -public: - using ScalarValue = dealii::VectorizedArray; - using ScalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using ScalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using VectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray>; - using PDEOperator::get_user_inputs; - using PDEOperator::get_pf_tools; - using PDEOperator::get_timestep; - - /** - * @brief Constructor. - */ - explicit CustomPDE(const UserInputParameters &_user_inputs, - PhaseFieldTools &_pf_tools) - : PDEOperator(_user_inputs, _pf_tools) - {} - -private: - /** - * @brief User-implemented class for the initial conditions. - */ - void - set_initial_condition(const unsigned int &index, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for nonuniform boundary conditions. - */ - void - set_nonuniform_dirichlet(const unsigned int &index, - const unsigned int &boundary_id, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for the RHS of explicit equations. - */ - void - compute_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - /** - * @brief User-implemented class for the RHS of nonexplicit equations. - */ - void - compute_nonexplicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the LHS of nonexplicit equations. - */ - void - compute_nonexplicit_lhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the RHS of postprocessed explicit equations. - */ - void - compute_postprocess_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - number McV = get_user_inputs().get_user_constants().get_model_constant_double("McV"); - number KcV = get_user_inputs().get_user_constants().get_model_constant_double("KcV"); -}; - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in deleted file mode 100644 index f4be8016d..000000000 --- a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/custom_pde.inst.in +++ /dev/null @@ -1,4 +0,0 @@ -for ( dimension : SPACE_DIMENSIONS; degree : ELEMENT_DEGREE; number : REAL_SCALARS) - { - template class CustomPDE; - } diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc deleted file mode 100644 index ac3999e35..000000000 --- a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/equations.cc +++ /dev/null @@ -1,133 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -void -CustomAttributeLoader::load_variable_attributes() -{ - set_variable_name(0, "c"); - set_variable_type(0, Scalar); - set_variable_equation_type(0, ImplicitTimeDependent); - set_dependencies_value_term_rhs(0, "c, old_1(c)"); - set_dependencies_gradient_term_rhs(0, "grad(gamma), c, grad(c), grad(old_1(c))"); - set_dependencies_value_term_lhs(0, "change(c)"); - set_dependencies_gradient_term_lhs(0, "grad(change(c))"); - - set_variable_name(1, "gamma"); - set_variable_type(1, Scalar); - set_variable_equation_type(1, Auxiliary); - set_dependencies_value_term_rhs(1, ""); - set_dependencies_gradient_term_rhs(1, "grad(c)"); - - set_variable_name(2, "f_tot"); - set_variable_type(2, Scalar); - set_variable_equation_type(2, ExplicitTimeDependent); - set_is_postprocessed_field(2, true); - set_dependencies_value_term_rhs(2, "c, grad(c)"); -} - -template -void -CustomPDE::compute_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -template -void -CustomPDE::compute_nonexplicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 0) - { - ScalarValue c = variable_list.template get_value(0); - ScalarGrad grad_c = variable_list.template get_gradient(0); - ScalarValue old_c = variable_list.template get_value(0, OldOne); - ScalarGrad old_grad_c = variable_list.template get_gradient(0, OldOne); - ScalarGrad grad_gamma = variable_list.template get_gradient(1); - - ScalarValue eq_c = old_c - c; - ScalarGrad eq_grad_c = - McV * get_timestep() * - (grad_gamma - (12.0 * old_c * old_c - 12.0 * old_c) * old_grad_c - 2.0 * grad_c); - - variable_list.set_value_term(0, eq_c); - variable_list.set_gradient_term(0, eq_grad_c); - } - if (index == 1) - { - ScalarGrad cx = variable_list.template get_gradient(0); - - ScalarGrad eqx_gamma = -KcV * cx; - - variable_list.set_gradient_term(1, eqx_gamma); - } -} - -template -void -CustomPDE::compute_nonexplicit_lhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 0) - { - ScalarValue change_c = variable_list.template get_value(0, Change); - ScalarGrad change_grad_c = - variable_list.template get_gradient(0, Change); - - ScalarValue eq_c = change_c; - ScalarGrad eq_grad_c = McV * get_timestep() * 2.0 * change_grad_c; - - variable_list.set_value_term(0, eq_c, Change); - variable_list.set_gradient_term(0, eq_grad_c, Change); - } -} - -template -void -CustomPDE::compute_postprocess_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{ - ScalarValue c = variable_list.template get_value(0); - ScalarGrad cx = variable_list.template get_gradient(0); - - ScalarValue f_tot = 0.0; - ScalarValue f_chem = c * c * c * c - 2.0 * c * c * c + c * c; - ScalarValue f_grad = 0.0; - - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - f_grad += 0.5 * KcV * cx[i] * cx[j]; - } - } - f_tot = f_chem + f_grad; - variable_list.set_value_term(2, f_tot); -} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc deleted file mode 100644 index 9cd0b22fa..000000000 --- a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/main.cc +++ /dev/null @@ -1,263 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef PRISMS_PF_WITH_CALIPER -# include -# include -#endif - -int -main(int argc, char *argv[]) -{ - try - { - // Initialize MPI - dealii::Utilities::MPI::MPI_InitFinalize - mpi_init(argc, argv, dealii::numbers::invalid_unsigned_int); - - // Parse the command line options (if there are any) to get the name of the input - // file - prisms::ParseCMDOptions cli_options(argc, argv); - std::string parameters_filename = cli_options.get_parameters_filename(); - - // Caliper config manager initialization -#ifdef PRISMS_PF_WITH_CALIPER - cali::ConfigManager mgr; - mgr.add(cli_options.get_caliper_configuration().c_str()); - - // Check for configuration errors - if (mgr.error()) - { - std::cerr << "Caliper error: " << mgr.error_msg() << std::endl; - } - - // Start configured performance measurements, if any - mgr.start(); -#endif - - // Restrict deal.II console printing - dealii::deallog.depth_console(0); - - // Before fully parsing the parameter file, we need to know how many field - // variables there are and whether they are scalars or vectors, how many - // postprocessing variables there are, how many sets of elastic constants - // there are, and how many user-defined constants there are. - // - // This is done with the derived class of `VariableAttributeLoader`, - // `CustomAttributeLoader`. - prisms::CustomAttributeLoader attribute_loader; - attribute_loader.init_variable_attributes(); - std::map var_attributes = - attribute_loader.get_var_attributes(); - - // Load in parameters - prisms::InputFileReader input_file_reader(parameters_filename, var_attributes); - - // Run problem based on the number of dimensions and element degree - switch (input_file_reader.get_dim()) - { - case 1: - { - prisms::UserInputParameters<1> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<1> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 2: - { - prisms::UserInputParameters<2> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<2> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 3: - { - prisms::UserInputParameters<3> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<3> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - default: - throw std::runtime_error("Invalid number of dimensions"); - } - - // Caliper config manager closure -#ifdef PRISMS_PF_WITH_CALIPER - // Flush output before finalizing MPI - mgr.flush(); -#endif - } - - catch (std::exception &exc) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Exception on processing: " << '\n' - << exc.what() << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - catch (...) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Unknown exception!" << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm b/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm deleted file mode 100644 index df51863cf..000000000 --- a/tests/regression_tests/cahn_hilliard_linearly_stabilized_splitting/parameters.prm +++ /dev/null @@ -1,40 +0,0 @@ -set dim = 2 -set global refinement = 6 -set degree = 2 - -subsection Rectangular mesh - set x size = 50 - set y size = 50 - set z size = 50 - set x subdivisions = 1 - set y subdivisions = 1 - set z subdivisions = 1 -end -set time step = 1.0e-3 -set end time = 0.01 - -subsection output - set condition = EQUAL_SPACING - set number = 5 -end -set boundary condition for c = Natural -set boundary condition for gamma = Natural -set Model constant McV = 1.0, DOUBLE -set Model constant KcV = 1.5, DOUBLE - -subsection linear solver parameters: c - set tolerance type = AbsoluteResidual - set tolerance value = 1e-6 - set max iterations = 1000 - set preconditioner type = None -end - -subsection nonlinear solver parameters: c - set max iterations = 1000 - set step size = 0.1 -end - -subsection nonlinear solver parameters: gamma - set max iterations = 1000 - set step size = 0.1 -end diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt deleted file mode 100644 index 5f34be6c0..000000000 --- a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -## - -cmake_minimum_required(VERSION 3.13.4) - -# Create a project for the application -project(myapp CXX) - -# Find the PRISMS-PF package -find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) -if(PRISMS_PF_FOUND) - # Include setup script - include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - - # Set up the application - prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) -else() - message( - FATAL_ERROR - "PRISMS-PF package not found. Please make sure it is in path." - ) -endif() diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc deleted file mode 100644 index a7c6156f7..000000000 --- a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/ICs_and_BCs.cc +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include - -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -template -void -CustomPDE::set_initial_condition( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{ - if (index == 0) - { - double center[12][3] = { - {0.1, 0.3, 0}, - {0.8, 0.7, 0}, - {0.5, 0.2, 0}, - {0.4, 0.4, 0}, - {0.3, 0.9, 0}, - {0.8, 0.1, 0}, - {0.9, 0.5, 0}, - {0.0, 0.1, 0}, - {0.1, 0.6, 0}, - {0.5, 0.6, 0}, - {1, 1, 0}, - {0.7, 0.95, 0} - }; - double rad[12] = {12, 14, 19, 16, 11, 12, 17, 15, 20, 10, 11, 14}; - double dist = 0.0; - for (unsigned int i = 0; i < 12; i++) - { - dist = 0.0; - for (unsigned int dir = 0; dir < dim; dir++) - { - dist += (point[dir] - center[i][dir] * 100.0) * - (point[dir] - center[i][dir] * 100.0); - } - dist = std::sqrt(dist); - - scalar_value += 0.5 * (1.0 - std::tanh((dist - rad[i]) / 1.5)); - } - scalar_value = std::min(scalar_value, static_cast(1.0)); - } -} - -template -void -CustomPDE::set_nonuniform_dirichlet( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &boundary_id, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h deleted file mode 100644 index 2e3311115..000000000 --- a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.h +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#pragma once - -#include -#include -#include -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -/** - * @brief This is a derived class of `VariableAttributeLoader` where the user implements - * their variable attributes and field declarations. - */ -class CustomAttributeLoader : public VariableAttributeLoader -{ -public: - /** - * @brief Destructor. - */ - ~CustomAttributeLoader() override = default; - - /** - * @brief User-implemented method where the variable attributes are set for all fields. - */ - void - load_variable_attributes() override; -}; - -/** - * @brief This is a derived class of `matrixFreeOperator` where the user implements their - * PDEs. - * - * @tparam dim The number of dimensions in the problem. - * @tparam degree The polynomial degree of the shape functions. - * @tparam number Datatype to use. Either double or float. - */ -template -class CustomPDE : public PDEOperator -{ -public: - using ScalarValue = dealii::VectorizedArray; - using ScalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using ScalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using VectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray>; - using PDEOperator::get_user_inputs; - using PDEOperator::get_pf_tools; - using PDEOperator::get_timestep; - - /** - * @brief Constructor. - */ - explicit CustomPDE(const UserInputParameters &_user_inputs, - PhaseFieldTools &_pf_tools) - : PDEOperator(_user_inputs, _pf_tools) - {} - -private: - /** - * @brief User-implemented class for the initial conditions. - */ - void - set_initial_condition(const unsigned int &index, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for nonuniform boundary conditions. - */ - void - set_nonuniform_dirichlet(const unsigned int &index, - const unsigned int &boundary_id, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for the RHS of explicit equations. - */ - void - compute_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - /** - * @brief User-implemented class for the RHS of nonexplicit equations. - */ - void - compute_nonexplicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the LHS of nonexplicit equations. - */ - void - compute_nonexplicit_lhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the RHS of postprocessed explicit equations. - */ - void - compute_postprocess_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - number McV = get_user_inputs().get_user_constants().get_model_constant_double("McV"); - number KcV = get_user_inputs().get_user_constants().get_model_constant_double("KcV"); -}; - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in deleted file mode 100644 index f4be8016d..000000000 --- a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/custom_pde.inst.in +++ /dev/null @@ -1,4 +0,0 @@ -for ( dimension : SPACE_DIMENSIONS; degree : ELEMENT_DEGREE; number : REAL_SCALARS) - { - template class CustomPDE; - } diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc deleted file mode 100644 index 80962c2d7..000000000 --- a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/equations.cc +++ /dev/null @@ -1,140 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -void -CustomAttributeLoader::load_variable_attributes() -{ - set_variable_name(0, "c"); - set_variable_type(0, Scalar); - set_variable_equation_type(0, ImplicitTimeDependent); - set_dependencies_value_term_rhs(0, "c, old_1(c)"); - set_dependencies_gradient_term_rhs(0, "grad(gamma), c, grad(c), grad(old_1(c))"); - set_dependencies_value_term_lhs(0, "change(c)"); - set_dependencies_gradient_term_lhs(0, "change(c), grad(change(c)), c, grad(c)"); - - set_variable_name(1, "gamma"); - set_variable_type(1, Scalar); - set_variable_equation_type(1, Auxiliary); - set_dependencies_value_term_rhs(1, ""); - set_dependencies_gradient_term_rhs(1, "grad(c)"); - - set_variable_name(2, "f_tot"); - set_variable_type(2, Scalar); - set_variable_equation_type(2, ExplicitTimeDependent); - set_is_postprocessed_field(2, true); - set_dependencies_value_term_rhs(2, "c, grad(c)"); -} - -template -void -CustomPDE::compute_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -template -void -CustomPDE::compute_nonexplicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 0) - { - ScalarValue c = variable_list.template get_value(0); - ScalarGrad grad_c = variable_list.template get_gradient(0); - ScalarValue old_c = variable_list.template get_value(0, OldOne); - ScalarGrad old_grad_c = variable_list.template get_gradient(0, OldOne); - ScalarGrad grad_gamma = variable_list.template get_gradient(1); - - ScalarValue eq_c = old_c - c; - ScalarGrad eq_grad_c = - McV * get_timestep() * - (grad_gamma - (12.0 * c * c - 12.0 * c + 3.0) * grad_c + old_grad_c); - - variable_list.set_value_term(0, eq_c); - variable_list.set_gradient_term(0, eq_grad_c); - } - if (index == 1) - { - ScalarGrad cx = variable_list.template get_gradient(0); - - ScalarGrad eqx_gamma = -KcV * cx; - - variable_list.set_gradient_term(1, eqx_gamma); - } -} - -template -void -CustomPDE::compute_nonexplicit_lhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 0) - { - ScalarValue change_c = variable_list.template get_value(0, Change); - ScalarGrad change_grad_c = - variable_list.template get_gradient(0, Change); - ScalarValue c = variable_list.template get_value(0); - ScalarGrad grad_c = variable_list.template get_gradient(0); - - ScalarValue eq_c = change_c; - ScalarGrad eq_grad_c = - McV * get_timestep() * - ((12.0 * c * c + 24.0 * c * change_c + 12.0 * change_c * change_c - - 12.0 * (c + change_c) + 3.0) * - change_grad_c + - (12.0 * change_c * change_c + 24.0 * c * change_c - 12.0 * change_c) * grad_c); - - variable_list.set_value_term(0, eq_c, Change); - variable_list.set_gradient_term(0, eq_grad_c, Change); - } -} - -template -void -CustomPDE::compute_postprocess_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{ - ScalarValue c = variable_list.template get_value(0); - ScalarGrad cx = variable_list.template get_gradient(0); - - ScalarValue f_tot = 0.0; - ScalarValue f_chem = c * c * c * c - 2.0 * c * c * c + c * c; - ScalarValue f_grad = 0.0; - - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - f_grad += 0.5 * KcV * cx[i] * cx[j]; - } - } - f_tot = f_chem + f_grad; - variable_list.set_value_term(2, f_tot); -} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc deleted file mode 100644 index 9cd0b22fa..000000000 --- a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/main.cc +++ /dev/null @@ -1,263 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef PRISMS_PF_WITH_CALIPER -# include -# include -#endif - -int -main(int argc, char *argv[]) -{ - try - { - // Initialize MPI - dealii::Utilities::MPI::MPI_InitFinalize - mpi_init(argc, argv, dealii::numbers::invalid_unsigned_int); - - // Parse the command line options (if there are any) to get the name of the input - // file - prisms::ParseCMDOptions cli_options(argc, argv); - std::string parameters_filename = cli_options.get_parameters_filename(); - - // Caliper config manager initialization -#ifdef PRISMS_PF_WITH_CALIPER - cali::ConfigManager mgr; - mgr.add(cli_options.get_caliper_configuration().c_str()); - - // Check for configuration errors - if (mgr.error()) - { - std::cerr << "Caliper error: " << mgr.error_msg() << std::endl; - } - - // Start configured performance measurements, if any - mgr.start(); -#endif - - // Restrict deal.II console printing - dealii::deallog.depth_console(0); - - // Before fully parsing the parameter file, we need to know how many field - // variables there are and whether they are scalars or vectors, how many - // postprocessing variables there are, how many sets of elastic constants - // there are, and how many user-defined constants there are. - // - // This is done with the derived class of `VariableAttributeLoader`, - // `CustomAttributeLoader`. - prisms::CustomAttributeLoader attribute_loader; - attribute_loader.init_variable_attributes(); - std::map var_attributes = - attribute_loader.get_var_attributes(); - - // Load in parameters - prisms::InputFileReader input_file_reader(parameters_filename, var_attributes); - - // Run problem based on the number of dimensions and element degree - switch (input_file_reader.get_dim()) - { - case 1: - { - prisms::UserInputParameters<1> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<1> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 2: - { - prisms::UserInputParameters<2> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<2> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 3: - { - prisms::UserInputParameters<3> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<3> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - default: - throw std::runtime_error("Invalid number of dimensions"); - } - - // Caliper config manager closure -#ifdef PRISMS_PF_WITH_CALIPER - // Flush output before finalizing MPI - mgr.flush(); -#endif - } - - catch (std::exception &exc) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Exception on processing: " << '\n' - << exc.what() << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - catch (...) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Unknown exception!" << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm b/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm deleted file mode 100644 index df51863cf..000000000 --- a/tests/regression_tests/cahn_hilliard_nonlinearly_stabilized_splitting/parameters.prm +++ /dev/null @@ -1,40 +0,0 @@ -set dim = 2 -set global refinement = 6 -set degree = 2 - -subsection Rectangular mesh - set x size = 50 - set y size = 50 - set z size = 50 - set x subdivisions = 1 - set y subdivisions = 1 - set z subdivisions = 1 -end -set time step = 1.0e-3 -set end time = 0.01 - -subsection output - set condition = EQUAL_SPACING - set number = 5 -end -set boundary condition for c = Natural -set boundary condition for gamma = Natural -set Model constant McV = 1.0, DOUBLE -set Model constant KcV = 1.5, DOUBLE - -subsection linear solver parameters: c - set tolerance type = AbsoluteResidual - set tolerance value = 1e-6 - set max iterations = 1000 - set preconditioner type = None -end - -subsection nonlinear solver parameters: c - set max iterations = 1000 - set step size = 0.1 -end - -subsection nonlinear solver parameters: gamma - set max iterations = 1000 - set step size = 0.1 -end diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt b/tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt deleted file mode 100644 index 5f34be6c0..000000000 --- a/tests/regression_tests/cahn_hilliard_semi_implicit/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -## - -cmake_minimum_required(VERSION 3.13.4) - -# Create a project for the application -project(myapp CXX) - -# Find the PRISMS-PF package -find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) -if(PRISMS_PF_FOUND) - # Include setup script - include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - - # Set up the application - prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) -else() - message( - FATAL_ERROR - "PRISMS-PF package not found. Please make sure it is in path." - ) -endif() diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc b/tests/regression_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc deleted file mode 100644 index a7c6156f7..000000000 --- a/tests/regression_tests/cahn_hilliard_semi_implicit/ICs_and_BCs.cc +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include - -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -template -void -CustomPDE::set_initial_condition( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{ - if (index == 0) - { - double center[12][3] = { - {0.1, 0.3, 0}, - {0.8, 0.7, 0}, - {0.5, 0.2, 0}, - {0.4, 0.4, 0}, - {0.3, 0.9, 0}, - {0.8, 0.1, 0}, - {0.9, 0.5, 0}, - {0.0, 0.1, 0}, - {0.1, 0.6, 0}, - {0.5, 0.6, 0}, - {1, 1, 0}, - {0.7, 0.95, 0} - }; - double rad[12] = {12, 14, 19, 16, 11, 12, 17, 15, 20, 10, 11, 14}; - double dist = 0.0; - for (unsigned int i = 0; i < 12; i++) - { - dist = 0.0; - for (unsigned int dir = 0; dir < dim; dir++) - { - dist += (point[dir] - center[i][dir] * 100.0) * - (point[dir] - center[i][dir] * 100.0); - } - dist = std::sqrt(dist); - - scalar_value += 0.5 * (1.0 - std::tanh((dist - rad[i]) / 1.5)); - } - scalar_value = std::min(scalar_value, static_cast(1.0)); - } -} - -template -void -CustomPDE::set_nonuniform_dirichlet( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &boundary_id, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.h b/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.h deleted file mode 100644 index 2e3311115..000000000 --- a/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.h +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#pragma once - -#include -#include -#include -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -/** - * @brief This is a derived class of `VariableAttributeLoader` where the user implements - * their variable attributes and field declarations. - */ -class CustomAttributeLoader : public VariableAttributeLoader -{ -public: - /** - * @brief Destructor. - */ - ~CustomAttributeLoader() override = default; - - /** - * @brief User-implemented method where the variable attributes are set for all fields. - */ - void - load_variable_attributes() override; -}; - -/** - * @brief This is a derived class of `matrixFreeOperator` where the user implements their - * PDEs. - * - * @tparam dim The number of dimensions in the problem. - * @tparam degree The polynomial degree of the shape functions. - * @tparam number Datatype to use. Either double or float. - */ -template -class CustomPDE : public PDEOperator -{ -public: - using ScalarValue = dealii::VectorizedArray; - using ScalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using ScalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using VectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray>; - using PDEOperator::get_user_inputs; - using PDEOperator::get_pf_tools; - using PDEOperator::get_timestep; - - /** - * @brief Constructor. - */ - explicit CustomPDE(const UserInputParameters &_user_inputs, - PhaseFieldTools &_pf_tools) - : PDEOperator(_user_inputs, _pf_tools) - {} - -private: - /** - * @brief User-implemented class for the initial conditions. - */ - void - set_initial_condition(const unsigned int &index, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for nonuniform boundary conditions. - */ - void - set_nonuniform_dirichlet(const unsigned int &index, - const unsigned int &boundary_id, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for the RHS of explicit equations. - */ - void - compute_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - /** - * @brief User-implemented class for the RHS of nonexplicit equations. - */ - void - compute_nonexplicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the LHS of nonexplicit equations. - */ - void - compute_nonexplicit_lhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the RHS of postprocessed explicit equations. - */ - void - compute_postprocess_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - number McV = get_user_inputs().get_user_constants().get_model_constant_double("McV"); - number KcV = get_user_inputs().get_user_constants().get_model_constant_double("KcV"); -}; - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in b/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in deleted file mode 100644 index f4be8016d..000000000 --- a/tests/regression_tests/cahn_hilliard_semi_implicit/custom_pde.inst.in +++ /dev/null @@ -1,4 +0,0 @@ -for ( dimension : SPACE_DIMENSIONS; degree : ELEMENT_DEGREE; number : REAL_SCALARS) - { - template class CustomPDE; - } diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/equations.cc b/tests/regression_tests/cahn_hilliard_semi_implicit/equations.cc deleted file mode 100644 index 3e876d0e0..000000000 --- a/tests/regression_tests/cahn_hilliard_semi_implicit/equations.cc +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -void -CustomAttributeLoader::load_variable_attributes() -{ - set_variable_name(0, "c"); - set_variable_type(0, Scalar); - set_variable_equation_type(0, ImplicitTimeDependent); - set_dependencies_value_term_rhs(0, "c, old_1(c)"); - set_dependencies_gradient_term_rhs(0, "grad(gamma), c, grad(old_1(c))"); - set_dependencies_value_term_lhs(0, "change(c)"); - set_dependencies_gradient_term_lhs(0, ""); - - set_variable_name(1, "gamma"); - set_variable_type(1, Scalar); - set_variable_equation_type(1, Auxiliary); - set_dependencies_value_term_rhs(1, ""); - set_dependencies_gradient_term_rhs(1, "grad(c)"); - - set_variable_name(2, "f_tot"); - set_variable_type(2, Scalar); - set_variable_equation_type(2, ExplicitTimeDependent); - set_is_postprocessed_field(2, true); - set_dependencies_value_term_rhs(2, "c, grad(c)"); -} - -template -void -CustomPDE::compute_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -template -void -CustomPDE::compute_nonexplicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 0) - { - ScalarValue c = variable_list.template get_value(0); - ScalarValue old_c = variable_list.template get_value(0, OldOne); - ScalarGrad old_grad_c = variable_list.template get_gradient(0, OldOne); - ScalarGrad grad_gamma = variable_list.template get_gradient(1); - - ScalarValue eq_c = old_c - c; - ScalarGrad eq_grad_c = - McV * get_timestep() * - (grad_gamma - (12.0 * old_c * old_c - 12.0 * old_c + 2.0) * old_grad_c); - - variable_list.set_value_term(0, eq_c); - variable_list.set_gradient_term(0, eq_grad_c); - } - if (index == 1) - { - ScalarGrad cx = variable_list.template get_gradient(0); - - ScalarGrad eqx_gamma = -KcV * cx; - - variable_list.set_gradient_term(1, eqx_gamma); - } -} - -template -void -CustomPDE::compute_nonexplicit_lhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 0) - { - ScalarValue change_c = variable_list.template get_value(0, Change); - - ScalarValue eq_c = change_c; - - variable_list.set_value_term(0, eq_c, Change); - } -} - -template -void -CustomPDE::compute_postprocess_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{ - ScalarValue c = variable_list.template get_value(0); - ScalarGrad cx = variable_list.template get_gradient(0); - - ScalarValue f_tot = 0.0; - ScalarValue f_chem = c * c * c * c - 2.0 * c * c * c + c * c; - ScalarValue f_grad = 0.0; - - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - f_grad += 0.5 * KcV * cx[i] * cx[j]; - } - } - f_tot = f_chem + f_grad; - variable_list.set_value_term(2, f_tot); -} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/main.cc b/tests/regression_tests/cahn_hilliard_semi_implicit/main.cc deleted file mode 100644 index 9cd0b22fa..000000000 --- a/tests/regression_tests/cahn_hilliard_semi_implicit/main.cc +++ /dev/null @@ -1,263 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef PRISMS_PF_WITH_CALIPER -# include -# include -#endif - -int -main(int argc, char *argv[]) -{ - try - { - // Initialize MPI - dealii::Utilities::MPI::MPI_InitFinalize - mpi_init(argc, argv, dealii::numbers::invalid_unsigned_int); - - // Parse the command line options (if there are any) to get the name of the input - // file - prisms::ParseCMDOptions cli_options(argc, argv); - std::string parameters_filename = cli_options.get_parameters_filename(); - - // Caliper config manager initialization -#ifdef PRISMS_PF_WITH_CALIPER - cali::ConfigManager mgr; - mgr.add(cli_options.get_caliper_configuration().c_str()); - - // Check for configuration errors - if (mgr.error()) - { - std::cerr << "Caliper error: " << mgr.error_msg() << std::endl; - } - - // Start configured performance measurements, if any - mgr.start(); -#endif - - // Restrict deal.II console printing - dealii::deallog.depth_console(0); - - // Before fully parsing the parameter file, we need to know how many field - // variables there are and whether they are scalars or vectors, how many - // postprocessing variables there are, how many sets of elastic constants - // there are, and how many user-defined constants there are. - // - // This is done with the derived class of `VariableAttributeLoader`, - // `CustomAttributeLoader`. - prisms::CustomAttributeLoader attribute_loader; - attribute_loader.init_variable_attributes(); - std::map var_attributes = - attribute_loader.get_var_attributes(); - - // Load in parameters - prisms::InputFileReader input_file_reader(parameters_filename, var_attributes); - - // Run problem based on the number of dimensions and element degree - switch (input_file_reader.get_dim()) - { - case 1: - { - prisms::UserInputParameters<1> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<1> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 2: - { - prisms::UserInputParameters<2> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<2> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 3: - { - prisms::UserInputParameters<3> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<3> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - default: - throw std::runtime_error("Invalid number of dimensions"); - } - - // Caliper config manager closure -#ifdef PRISMS_PF_WITH_CALIPER - // Flush output before finalizing MPI - mgr.flush(); -#endif - } - - catch (std::exception &exc) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Exception on processing: " << '\n' - << exc.what() << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - catch (...) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Unknown exception!" << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/tests/regression_tests/cahn_hilliard_semi_implicit/parameters.prm b/tests/regression_tests/cahn_hilliard_semi_implicit/parameters.prm deleted file mode 100644 index df51863cf..000000000 --- a/tests/regression_tests/cahn_hilliard_semi_implicit/parameters.prm +++ /dev/null @@ -1,40 +0,0 @@ -set dim = 2 -set global refinement = 6 -set degree = 2 - -subsection Rectangular mesh - set x size = 50 - set y size = 50 - set z size = 50 - set x subdivisions = 1 - set y subdivisions = 1 - set z subdivisions = 1 -end -set time step = 1.0e-3 -set end time = 0.01 - -subsection output - set condition = EQUAL_SPACING - set number = 5 -end -set boundary condition for c = Natural -set boundary condition for gamma = Natural -set Model constant McV = 1.0, DOUBLE -set Model constant KcV = 1.5, DOUBLE - -subsection linear solver parameters: c - set tolerance type = AbsoluteResidual - set tolerance value = 1e-6 - set max iterations = 1000 - set preconditioner type = None -end - -subsection nonlinear solver parameters: c - set max iterations = 1000 - set step size = 0.1 -end - -subsection nonlinear solver parameters: gamma - set max iterations = 1000 - set step size = 0.1 -end diff --git a/tests/regression_tests/file_read_binary/CMakeLists.txt b/tests/regression_tests/file_read_binary/CMakeLists.txt deleted file mode 100644 index 5f34be6c0..000000000 --- a/tests/regression_tests/file_read_binary/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -## - -cmake_minimum_required(VERSION 3.13.4) - -# Create a project for the application -project(myapp CXX) - -# Find the PRISMS-PF package -find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) -if(PRISMS_PF_FOUND) - # Include setup script - include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - - # Set up the application - prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) -else() - message( - FATAL_ERROR - "PRISMS-PF package not found. Please make sure it is in path." - ) -endif() diff --git a/tests/regression_tests/file_read_binary/custom_pde.h b/tests/regression_tests/file_read_binary/custom_pde.h deleted file mode 100644 index c9daba43c..000000000 --- a/tests/regression_tests/file_read_binary/custom_pde.h +++ /dev/null @@ -1,132 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#pragma once - -#include -#include -#include - -#include - -#include - -#include -#include - -PRISMS_PF_BEGIN_NAMESPACE - -/** - * @brief This is a derived class of `VariableAttributeLoader` where the user implements - * their variable attributes and field declarations. - */ -class CustomAttributeLoader : public VariableAttributeLoader -{ -public: - /** - * @brief Destructor. - */ - ~CustomAttributeLoader() override = default; - - /** - * @brief User-implemented method where the variable attributes are set for all fields. - */ - void - load_variable_attributes() override; -}; - -/** - * @brief This is a derived class of `MatrixFreeOperator` where the user implements their - * PDEs. - * - * @tparam dim The number of dimensions in the problem. - * @tparam degree The polynomial degree of the shape functions. - * @tparam number Datatype to use. Either double or float. - */ -template -class CustomPDE : public PDEOperator -{ -public: - using ScalarValue = dealii::VectorizedArray; - using ScalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using ScalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using VectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray>; - using PDEOperator::get_user_inputs; - using PDEOperator::get_pf_tools; - using PDEOperator::get_timestep; - - /** - * @brief Constructor. - */ - explicit CustomPDE(const UserInputParameters &_user_inputs) - : PDEOperator(_user_inputs) - {} - -private: - /** - * @brief User-implemented class for the initial conditions. - */ - void - set_initial_condition(const unsigned int &index, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for nonuniform boundary conditions. - */ - void - set_nonuniform_dirichlet(const unsigned int &index, - const unsigned int &boundary_id, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for the RHS of explicit equations. - */ - void - compute_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - /** - * @brief User-implemented class for the RHS of nonexplicit equations. - */ - void - compute_nonexplicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the LHS of nonexplicit equations. - */ - void - compute_nonexplicit_lhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the RHS of postprocessed explicit equations. - */ - void - compute_postprocess_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; -}; - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/file_read_binary/custom_pde.inst.in b/tests/regression_tests/file_read_binary/custom_pde.inst.in deleted file mode 100644 index f4be8016d..000000000 --- a/tests/regression_tests/file_read_binary/custom_pde.inst.in +++ /dev/null @@ -1,4 +0,0 @@ -for ( dimension : SPACE_DIMENSIONS; degree : ELEMENT_DEGREE; number : REAL_SCALARS) - { - template class CustomPDE; - } diff --git a/tests/regression_tests/file_read_binary/main.cc b/tests/regression_tests/file_read_binary/main.cc deleted file mode 100644 index 9e7629d8a..000000000 --- a/tests/regression_tests/file_read_binary/main.cc +++ /dev/null @@ -1,258 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#ifdef PRISMS_PF_WITH_CALIPER -# include -# include -#endif - -int -main(int argc, char *argv[]) -{ - try - { - // Initialize MPI - dealii::Utilities::MPI::MPI_InitFinalize - mpi_init(argc, argv, dealii::numbers::invalid_unsigned_int); - - // for this test only: set up initial condition file (if not already present) - // if (!std::filesystem::exists("test_2D.bin")) - // { - prisms::InitialConditionFile file; - file.filename = "test_2D.bin"; - std::vector data = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0}; - prisms::ReadBinary<2, double>::write_file(data, file); - // } - // Parse the command line options (if there are any) to get the name of the input - // file - prisms::ParseCMDOptions cli_options(argc, argv); - std::string parameters_filename = cli_options.get_parameters_filename(); - - // Caliper config manager initialization -#ifdef PRISMS_PF_WITH_CALIPER - cali::ConfigManager mgr; - mgr.add(cli_options.get_caliper_configuration().c_str()); - - // Check for configuration errors - if (mgr.error()) - { - std::cerr << "Caliper error: " << mgr.error_msg() << std::endl; - } - - // Start configured performance measurements, if any - mgr.start(); -#endif - - // Restrict deal.II console printing - dealii::deallog.depth_console(0); - - // Before fully parsing the parameter file, we need to know how many field - // variables there are and whether they are scalars or vectors, how many - // postprocessing variables there are, how many sets of elastic constants - // there are, and how many user-defined constants there are. - // - // This is done with the derived class of `VariableAttributeLoader`, - // `CustomAttributeLoader`. - prisms::CustomAttributeLoader attribute_loader; - attribute_loader.init_variable_attributes(); - std::map var_attributes = - attribute_loader.get_var_attributes(); - - // Load in parameters - prisms::InputFileReader input_file_reader(parameters_filename, var_attributes); - - // Run problem based on the number of dimensions and element degree - switch (input_file_reader.get_dim()) - { - case 1: - { - prisms::UserInputParameters<1> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs); - - prisms::PDEProblem<1, 1, double> problem(user_inputs, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs); - - prisms::PDEProblem<1, 2, double> problem(user_inputs, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 2: - { - prisms::UserInputParameters<2> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs); - - prisms::PDEProblem<2, 1, double> problem(user_inputs, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs); - - prisms::PDEProblem<2, 2, double> problem(user_inputs, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 3: - { - prisms::UserInputParameters<3> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs); - - prisms::PDEProblem<3, 1, double> problem(user_inputs, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs); - - prisms::PDEProblem<3, 2, double> problem(user_inputs, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - default: - throw std::runtime_error("Invalid number of dimensions"); - } - - // Caliper config manager closure -#ifdef PRISMS_PF_WITH_CALIPER - // Flush output before finalizing MPI - mgr.flush(); -#endif - } - - catch (std::exception &exc) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Exception on processing: " << '\n' - << exc.what() << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - catch (...) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Unknown exception!" << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/tests/regression_tests/file_read_binary/parameters.prm b/tests/regression_tests/file_read_binary/parameters.prm deleted file mode 100644 index e5797ee39..000000000 --- a/tests/regression_tests/file_read_binary/parameters.prm +++ /dev/null @@ -1,22 +0,0 @@ -set dim = 2 -set global refinement = 3 -set degree = 2 - -subsection Rectangular mesh - set x size = 10 - set y size = 10 - set z size = 10 - set x subdivisions = 1 - set y subdivisions = 1 - set z subdivisions = 1 -end -set read initial conditions from file = true - -subsection initial condition file 1 - set file name = test_2D.bin - set dataset format = flat_binary - set file variable names = n - set simulation variable names = n - set data points in x direction = 9 - set data points in y direction = 9 -end diff --git a/tests/regression_tests/file_read_vtk/CMakeLists.txt b/tests/regression_tests/file_read_vtk/CMakeLists.txt deleted file mode 100644 index 5f34be6c0..000000000 --- a/tests/regression_tests/file_read_vtk/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -## - -cmake_minimum_required(VERSION 3.13.4) - -# Create a project for the application -project(myapp CXX) - -# Find the PRISMS-PF package -find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) -if(PRISMS_PF_FOUND) - # Include setup script - include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - - # Set up the application - prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) -else() - message( - FATAL_ERROR - "PRISMS-PF package not found. Please make sure it is in path." - ) -endif() diff --git a/tests/regression_tests/file_read_vtk/ICs_and_BCs.cc b/tests/regression_tests/file_read_vtk/ICs_and_BCs.cc deleted file mode 100644 index 8a71b9787..000000000 --- a/tests/regression_tests/file_read_vtk/ICs_and_BCs.cc +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include - -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -template -void -CustomPDE::set_initial_condition( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -template -void -CustomPDE::set_nonuniform_dirichlet( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &boundary_id, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/file_read_vtk/custom_pde.inst.in b/tests/regression_tests/file_read_vtk/custom_pde.inst.in deleted file mode 100644 index f4be8016d..000000000 --- a/tests/regression_tests/file_read_vtk/custom_pde.inst.in +++ /dev/null @@ -1,4 +0,0 @@ -for ( dimension : SPACE_DIMENSIONS; degree : ELEMENT_DEGREE; number : REAL_SCALARS) - { - template class CustomPDE; - } diff --git a/tests/regression_tests/file_read_vtk/equations.cc b/tests/regression_tests/file_read_vtk/equations.cc deleted file mode 100644 index cf6619205..000000000 --- a/tests/regression_tests/file_read_vtk/equations.cc +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -void -CustomAttributeLoader::load_variable_attributes() -{ - set_variable_name(0, "n"); - set_variable_type(0, Scalar); - set_variable_equation_type(0, Constant); -} - -template -void -CustomPDE::compute_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -template -void -CustomPDE::compute_nonexplicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{} - -template -void -CustomPDE::compute_nonexplicit_lhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{} - -template -void -CustomPDE::compute_postprocess_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/file_read_vtk/main.cc b/tests/regression_tests/file_read_vtk/main.cc deleted file mode 100644 index 9cd0b22fa..000000000 --- a/tests/regression_tests/file_read_vtk/main.cc +++ /dev/null @@ -1,263 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef PRISMS_PF_WITH_CALIPER -# include -# include -#endif - -int -main(int argc, char *argv[]) -{ - try - { - // Initialize MPI - dealii::Utilities::MPI::MPI_InitFinalize - mpi_init(argc, argv, dealii::numbers::invalid_unsigned_int); - - // Parse the command line options (if there are any) to get the name of the input - // file - prisms::ParseCMDOptions cli_options(argc, argv); - std::string parameters_filename = cli_options.get_parameters_filename(); - - // Caliper config manager initialization -#ifdef PRISMS_PF_WITH_CALIPER - cali::ConfigManager mgr; - mgr.add(cli_options.get_caliper_configuration().c_str()); - - // Check for configuration errors - if (mgr.error()) - { - std::cerr << "Caliper error: " << mgr.error_msg() << std::endl; - } - - // Start configured performance measurements, if any - mgr.start(); -#endif - - // Restrict deal.II console printing - dealii::deallog.depth_console(0); - - // Before fully parsing the parameter file, we need to know how many field - // variables there are and whether they are scalars or vectors, how many - // postprocessing variables there are, how many sets of elastic constants - // there are, and how many user-defined constants there are. - // - // This is done with the derived class of `VariableAttributeLoader`, - // `CustomAttributeLoader`. - prisms::CustomAttributeLoader attribute_loader; - attribute_loader.init_variable_attributes(); - std::map var_attributes = - attribute_loader.get_var_attributes(); - - // Load in parameters - prisms::InputFileReader input_file_reader(parameters_filename, var_attributes); - - // Run problem based on the number of dimensions and element degree - switch (input_file_reader.get_dim()) - { - case 1: - { - prisms::UserInputParameters<1> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<1> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 2: - { - prisms::UserInputParameters<2> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<2> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 3: - { - prisms::UserInputParameters<3> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<3> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - default: - throw std::runtime_error("Invalid number of dimensions"); - } - - // Caliper config manager closure -#ifdef PRISMS_PF_WITH_CALIPER - // Flush output before finalizing MPI - mgr.flush(); -#endif - } - - catch (std::exception &exc) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Exception on processing: " << '\n' - << exc.what() << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - catch (...) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Unknown exception!" << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/tests/regression_tests/file_read_vtk/parameters.prm b/tests/regression_tests/file_read_vtk/parameters.prm deleted file mode 100644 index e42ac5f1e..000000000 --- a/tests/regression_tests/file_read_vtk/parameters.prm +++ /dev/null @@ -1,20 +0,0 @@ -set dim = 2 -set global refinement = 4 -set degree = 1 - -subsection Rectangular mesh - set x size = 10 - set y size = 10 - set z size = 10 - set x subdivisions = 1 - set y subdivisions = 1 - set z subdivisions = 1 -end -set read initial conditions from file = true - -subsection initial condition file 1 - set file name = test_2D_1degree.vtk - set dataset format = vtk_unstructured_grid - set file variable names = n - set simulation variable names = n -end diff --git a/tests/regression_tests/run.py b/tests/regression_tests/run.py new file mode 100644 index 000000000..854bdb040 --- /dev/null +++ b/tests/regression_tests/run.py @@ -0,0 +1,363 @@ +import argparse +import subprocess +import datetime +import os +import sys +import time +from dataclasses import dataclass, field +from typing import Dict +import numpy as np +import re + +# Executable name. For now we will use release mode +executable_name = "main-release" + +# Tolerance +tolerance = 1e-12 + +# Mapping from the application name to the absolute directory path +app_map = {} + +# Global counters for ran regression tests and passed regressions tests +passed_counter = 0 +ran_counter = 0 + + +class bcolors: + HEADER = "\033[95m" + OKBLUE = "\033[94m" + OKCYAN = "\033[96m" + OKGREEN = "\033[92m" + WARNING = "\033[93m" + FAIL = "\033[91m" + ENDC = "\033[0m" + BOLD = "\033[1m" + UNDERLINE = "\033[4m" + + +def pprint(message, type="None"): + assert isinstance(message, str), "The message must be a string" + assert isinstance(type, str), "The message type must be a string" + + new_message = message + if type == "Warning": + new_message = bcolors.WARNING + message + bcolors.ENDC + elif type == "Info": + new_message = bcolors.OKBLUE + message + bcolors.ENDC + elif type == "Good": + new_message = bcolors.OKGREEN + message + bcolors.ENDC + elif type == "Error": + new_message = bcolors.FAIL + message + bcolors.ENDC + + print(new_message) + + +def grab_cpu_information(): + # Get the CPU information + cpu_info_raw = subprocess.check_output("lscpu", shell=True).decode() + + # Split into lines + cpu_info_lines = cpu_info_raw.splitlines() + + # Create dict to store parsed info + cpu_info = {} + + for line in cpu_info_lines: + if ":" in line: + key, value = line.split(":", 1) + cpu_info[key.strip()] = value.strip() + + # Grab relevant fields + architecture = cpu_info.get("Architecture") + cpu_model = cpu_info.get("Model name") + cpu_cores = cpu_info.get("CPU(s)") + cpu_max_freq = cpu_info.get("CPU max MHz") + cpu_min_freq = cpu_info.get("CPU min MHz") + hypervisor = cpu_info.get("Hypervisor vendor") + + return architecture, cpu_model, cpu_cores, cpu_max_freq, cpu_min_freq, hypervisor + + +def regression_directory_valid(regression_dir: str, applications: list = None): + if len(regression_dir) == 0: + pprint(f"Regression directory `{regression_dir}` is empty", "Error") + sys.exit(1) + + abs_path = regression_dir + if not os.path.isabs(regression_dir): + abs_path = os.path.abspath(regression_dir) + + if not os.path.exists(abs_path): + pprint(f"Regression directory `{regression_dir}` does not exist", "Error") + sys.exit(1) + + if applications is not None: + for app in applications: + app_path = os.path.join(abs_path, app) + if not os.path.exists(app_path): + pprint( + f"Regression application directory `{app}` does not exist", "Error" + ) + sys.exit(1) + + executable_path = os.path.join(app_path, executable_name) + if not os.path.exists(executable_path): + pprint( + f"Regression application directory `{app}` does not have a release executable `{executable_name}`", + "Error", + ) + sys.exit(1) + + # Add the folder to the global mapping from app name to directory + app_map[app] = app_path + + +@dataclass +class SimulationData: + # Global metadata + n_dofs: int = 0 + n_variables: int = 0 + + # Time-dependent fields + iterations: np.ndarray = field(default_factory=lambda: np.array([])) + field_l2_norm: Dict[int, np.ndarray] = field(default_factory=dict) + field_integrated_value: Dict[int, np.ndarray] = field(default_factory=dict) + + def add_iteration(self, iteration: int): + self.iterations = np.append(self.iterations, iteration) + + def add_values( + self, + index: int, + l2_norm: float, + integrated_value: float, + ): + if index not in self.field_l2_norm: + self.field_l2_norm[index] = np.array([], dtype=float) + if index not in self.field_integrated_value: + self.field_integrated_value[index] = np.array([], dtype=float) + + self.field_l2_norm[index] = np.append(self.field_l2_norm[index], l2_norm) + self.field_integrated_value[index] = np.append( + self.field_integrated_value[index], integrated_value + ) + + def print(self): + print(f"dofs: {self.n_dofs}") + print(f"variables: {self.n_variables}") + print(f"iterations: {self.iterations}") + for key, value in self.field_l2_norm.items(): + print(f"Index {key} l2-norm: {value}") + for key, value in self.field_integrated_value.items(): + print(f"Index {key} integrated value: {value}") + + def __post_init__(self): + if not self.field_l2_norm: + self.field_l2_norm = {0: np.array([])} + if not self.field_integrated_value: + self.field_integrated_value = {0: np.array([])} + + def __eq__(self, value): + if not isinstance(value, SimulationData): + return False + + if self.n_dofs != value.n_dofs: + pprint(f"DoFs not equal ({self.n_dofs} != {value.n_dofs})", "Error") + return False + if self.n_variables != value.n_variables: + pprint( + f"Number of variables not equal ({self.n_variables} != {value.n_variables})", + "Error", + ) + return False + + if self.iterations.size != value.iterations.size or np.all( + self.iterations != value.iterations + ): + pprint( + f"Iterations are not equal ({self.iterations} != {value.iterations})", + "Error", + ) + # TODO: Enable this after re-running gold benchmarks + # return False + + for index in range(self.n_variables): + if self.field_l2_norm[index].size != value.field_l2_norm[ + index + ].size or not np.allclose( + self.field_l2_norm[index], value.field_l2_norm[index], rtol=tolerance + ): + pprint( + f"For index {index} l2-norms are not close using relative tolerance {tolerance}\n{self.field_l2_norm[index]} != {value.field_l2_norm[index]}", + "Error", + ) + return False + + if self.field_integrated_value[index].size != value.field_integrated_value[ + index + ].size or not np.allclose( + self.field_integrated_value[index], + value.field_integrated_value[index], + rtol=tolerance, + ): + pprint( + f"For index {index} integrated values are not close using relative tolerance {tolerance}\n{self.field_integrated_value[index]} != {value.field_integrated_value[index]}", + "Error", + ) + return False + + return True + + +def parse_output(file: str): + data = SimulationData() + + with open(file, "r") as f: + for line in f: + line = line.strip() + + if "number of degrees of freedom:" in line.lower(): + match = re.search( + r"number of degrees of freedom:\s*(\d+)", line, re.IGNORECASE + ) + if match: + data.n_dofs = int(match.group(1)) + + elif "number of variables:" in line.lower(): + match = re.search(r"number of variables:\s*(\d+)", line, re.IGNORECASE) + if match: + data.n_variables = int(match.group(1)) + + elif "iteration:" in line.lower(): + match = re.search(r"iteration:\s*(\d+)", line, re.IGNORECASE) + if match: + iteration = int(match.group(1)) + data.add_iteration(iteration) + + # Now that we've found an iteration and know the number of + # variables, we can add a few lines to find the l2-norms + # and integrated values + for index in range(data.n_variables): + try: + next_line = next(f).strip() + pattern = re.compile( + r"Solution\s+index\s+(\d+)\s+l2-norm:\s*([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+integrated\s+value:\s*((?:[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?\s*)+)", + re.IGNORECASE, + ) + match = pattern.search(next_line) + if match: + index = int(match.group(1)) + l2_norm = float(match.group(2)) + integrated_values = [ + float(x) for x in match.group(3).split() + ] + + data.add_values(index, l2_norm, integrated_values) + except StopIteration: + # End of file reached + break + + return data + + +def run_application(application: str, n_threads: int, new_reference: bool = False): + pprint(f"Running {application}...", "Info") + + global ran_counter + ran_counter += 1 + + pwd = os.getcwd() + app_dir = app_map[application] + + os.chdir(app_dir) + + start_time = time.time() + + run_result = subprocess.run( + ["mpirun", "-n", f"{n_threads}", f"{executable_name}"], + capture_output=True, + text=True, + ) + + end_time = time.time() + + passed = False + if run_result.returncode == 0: + with open("output.txt", "w") as f: + f.write(run_result.stdout) + + if new_reference: + with open("gold_output.txt", "w") as f: + f.write(run_result.stdout) + + new_data = parse_output("output.txt") + reference_data = parse_output("gold_output.txt") + + passed = new_data == reference_data + else: + print(run_result.stderr) + + os.chdir(pwd) + + if passed: + pprint(f"passed in {end_time - start_time :.2f} seconds!", "Good") + + global passed_counter + passed_counter += 1 + else: + pprint("failed!", "Error") + + +# Initialize the argument parser and add some command line parameters +parser = argparse.ArgumentParser() +parser.add_argument( + "-j", + "--nthreads", + type=int, + default=1, + help="Number of threads for compiling & running tests", +) +parser.add_argument( + "-d", + "--dir", + type=str, + default="install/tests/regression_tests", + help="The directory where the regression tests are located", +) +parser.add_argument("applications", nargs="+", help="List of applications to process") +args = parser.parse_args() +n_threads = args.nthreads +apps = args.applications +dir = args.dir + +# Grab cpu information +architecture, cpu_model, cpu_cores, cpu_max_freq, cpu_min_freq, hypervisor = ( + grab_cpu_information() +) + +# Grab the date +date = datetime.datetime.now() + +# Check that the applications exist and are compiled given the regression directory +regression_directory_valid(dir, apps) + +print(90 * "=") +pprint(f"Running regression tests with {n_threads} threads per process.", "Info") +print(f"Date: {date}") +print(f"Regression Directory: {dir}") +pprint(f"Applications: {apps}", "Info") +print(90 * "-") +print(f"Machine Info") +print(f" CPU arch: {architecture}") +print(f" CPU model: {cpu_model}") +print(f" CPU cores: {cpu_cores}") +print(f" CPU min/max freq (MHz): {cpu_min_freq} / {cpu_max_freq}") +print(f" Hypervisor: {hypervisor}") +print(90 * "-") + +for app in apps: + run_application(app, n_threads) +if passed_counter != ran_counter: + sys.exit(1) + +print(90 * "=") diff --git a/tests/regression_tests/run_automatic_tests.py b/tests/regression_tests/run_automatic_tests.py deleted file mode 100644 index a8f647f65..000000000 --- a/tests/regression_tests/run_automatic_tests.py +++ /dev/null @@ -1,317 +0,0 @@ -import subprocess -import shutil -import glob -import os -import datetime -import time -import sys -import argparse -from concurrent.futures import ProcessPoolExecutor, as_completed -import re - - -def remove_file(file): - """Remove a file if it exists - - Args: - file (string): Path to file - """ - if os.path.exists(file): - os.remove(file) - - -def write_to_file(file, text): - """Write text to file - - Args: - file (string): Path to file - text (string): Text to write in file - """ - with open(file, "a") as text_file: - text_file.write(text) - - -def grab_cpu_information(): - # Get the CPU information - cpu_info_raw = subprocess.check_output("lscpu", shell=True).decode() - - # Split into lines - cpu_info_lines = cpu_info_raw.splitlines() - - # Create dict to store parsed info - cpu_info = {} - - for line in cpu_info_lines: - if ":" in line: - key, value = line.split(":", 1) - cpu_info[key.strip()] = value.strip() - - # Grab relevant fields - architecture = cpu_info.get("Architecture") - cpu_model = cpu_info.get("Model name") - cpu_cores = cpu_info.get("CPU(s)") - cpu_max_freq = cpu_info.get("CPU max MHz") - cpu_min_freq = cpu_info.get("CPU min MHz") - hypervisor = cpu_info.get("Hypervisor vendor") - - return architecture, cpu_model, cpu_cores, cpu_max_freq, cpu_min_freq, hypervisor - - -def compile_and_run_simulation(application_path, n_threads=1): - # Navigate to test application directory - os.chdir(application_path) - - # Remove old files - remove_file("main") - remove_file("main-debug") - remove_file("CMakeCache.txt") - for solution_file in glob.glob("solution-*.vtu"): - os.remove(solution_file) - for solution_file in glob.glob("solution-*.pvtu"): - os.remove(solution_file) - - # Compile application - try: - subprocess.run( - ["cmake", ".", "-G", "Ninja"], - stdout=subprocess.DEVNULL, - stderr=subprocess.PIPE, - check=True, - ) - subprocess.run( - ["ninja", "-j", f"{n_threads}"], - stdout=subprocess.DEVNULL, - stderr=subprocess.PIPE, - check=True, - ) - print("Compiling complete.") - except subprocess.CalledProcessError as e: - # Print the error stream if there's a compilation error - print( - f"Compilation failed with error:\n{e.stderr.decode('utf-8')}", - file=sys.stderr, - ) - sys.exit(1) - - # Print successful compilation to screen - print(f"Running the regression test for {application_path}...") - sys.stdout.flush() - - # Run application with timer - start = time.time() - with open("output.txt", "w") as outfile: - try: - subprocess.run( - ["mpirun", "-n", f"{n_threads}", "./main"], - stdout=outfile, - stderr=subprocess.PIPE, - check=True, - ) - except subprocess.CalledProcessError as e: - # Print the error stream if the application fails - print( - f"Application execution failed with error:\n{e.stderr.decode('utf-8')}", - file=sys.stderr, - ) - sys.exit(1) - - end = time.time() - print(f"Application completed in {end - start:.2f} seconds.") - - return end - start - - -def run_regression_test(application, new_gold_standard, test_dir, n_threads=1): - # Move to the application directory - application_path = os.path.join(test_dir, application) - - # Run the simulation and move the results to the test directory - test_time = compile_and_run_simulation(application_path, n_threads) - - # Compare the result against the gold standard, if it exists - tolerance = 1e-9 - if new_gold_standard: - shutil.move("output.txt", "gold_output.txt") - test_passed = True - else: - - def extract_l2_norms(filename): - """Extracts the l2-norm values from a given file.""" - - # TODO: This is slightly hacky, since it only grabs the final iteration outputs - norms = {} - with open(filename, "r") as file: - for line in file: - match = re.search( - r"^\s+Solution index (\d+) l2-norm: ([0-9.]+).+", line - ) - if match: - index, norm_value = int(match.group(1)), float(match.group(2)) - norms[index] = norm_value - return norms - - # Read values from gold standard and test output - gold_norms = extract_l2_norms("gold_output.txt") - test_norms = extract_l2_norms("output.txt") - - test_passed = True - for index in gold_norms: - if index in test_norms: - rel_diff = abs( - (gold_norms[index] - test_norms[index]) - / (gold_norms[index] + 1e-12) - ) - if rel_diff >= tolerance: - test_passed = False - print( - f"Test failed for Solution index {index}: " - f"gold={gold_norms[index]}, test={test_norms[index]}, rel_diff={rel_diff}" - ) - - # Determine test result - test_result = ( - "New Gold Standard" - if test_passed and new_gold_standard - else "Pass" - if test_passed - else "Fail" - ) - - # Print the results to the screen - print( - f"Regression Test: {application}\n" - f"Result: {test_result}\n" - f"Time taken: {test_time}\n" - ) - sys.stdout.flush() - - # Write the results to a file - test_result_file = os.path.join(test_dir, "test_results.txt") - write_to_file( - test_result_file, - f"Application: {application}\nResult: {test_result}\nTime: {test_time}\n \n", - ) - - return test_passed, test_time - - -def run_regression_tests_in_parallel( - application_list, gold_standard_list, test_dir, n_processes=None, n_threads=1 -): - regression_test_counter = 0 - regression_tests_passed = 0 - - with ProcessPoolExecutor(max_workers=n_processes) as executor: - futures = [ - executor.submit( - run_regression_test, application, gold_standard, test_dir, n_threads - ) - for application, gold_standard in zip(application_list, gold_standard_list) - ] - - for future in as_completed(futures): - test_passed, test_time = future.result() - regression_tests_passed += int(test_passed) - regression_test_counter += 1 - - return regression_tests_passed, regression_test_counter - - -# Initialize arg parser -parser = argparse.ArgumentParser() -parser.add_argument("-n", "--ntasks", type=int, default=1, help="Number of processes") -parser.add_argument( - "-j", - "--nthreads", - type=int, - default=1, - help="Number of threads for compiling & running tests", -) -args = parser.parse_args() -n_processes = args.ntasks -n_threads = args.nthreads - -print( - f"Running automatic tests with {n_processes} processes and {n_threads} threads per process." -) - -# Grab current directory and the path to the test results file -pwd = os.path.dirname(os.path.realpath(__file__)) -test_result_file = os.path.join(pwd, "test_results.txt") - -# Grab current date -now = datetime.datetime.now() - -# List of applications -applicationList = [ - "allen_cahn_explicit", - "allen_cahn_implicit", - "cahn_hilliard_explicit", - "cahn_hilliard_implicit", - "heat_equation_steady_state", - "mechanics", - "precipitate_explicit", - "fracture", - "solution_blocks", - "linear_solve_old_solution", - "cavity_flow", -] -getNewGoldStandardList = [ - False, - False, - False, - False, - False, - False, - False, - False, - False, - False, - False, -] - -# Grab cpu information -architecture, cpu_model, cpu_cores, cpu_max_freq, cpu_min_freq, hypervisor = ( - grab_cpu_information() -) - -# Write to test results file -write_to_file( - test_result_file, - "--------------------------------------------------------- \n" - "Regression test on " + now.strftime("%Y-%m-%d %H:%M") + "\n" - f"Architecture: {architecture}\n" - f"Model name: {cpu_model}\n" - f"CPU(s): {cpu_cores}\n" - f"CPU max/min MHz: {cpu_max_freq}, {cpu_min_freq}\n" - f"Hypervisor vendor: {hypervisor}\n" - f"Number of processes: {n_processes}\n" - f"Number of threads: {n_threads}\n" - "--------------------------------------------------------- \n", -) - -# Run tests in parallel -start_parallel = time.time() -regression_tests_passed, regression_test_counter = run_regression_tests_in_parallel( - applicationList, getNewGoldStandardList, pwd, n_processes, n_threads -) -end_parallel = time.time() -print(f"Total time spend on regressions tests: {end_parallel - start_parallel}") - - -os.chdir(pwd) -# Output the overall test results -write_to_file( - test_result_file, - f"Tests Passed: {regression_tests_passed}/{regression_test_counter}\n" - "--------------------------------------------------------- \n", -) - -# Print overall results -print(f"Regression Tests Passed: {regression_tests_passed}/{regression_test_counter}\n") - -# Set exit code -if regression_tests_passed < regression_test_counter: - sys.exit(1) -else: - sys.exit(0) diff --git a/tests/regression_tests/taylor_green_vortex/CMakeLists.txt b/tests/regression_tests/taylor_green_vortex/CMakeLists.txt deleted file mode 100644 index 5f34be6c0..000000000 --- a/tests/regression_tests/taylor_green_vortex/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -## - -cmake_minimum_required(VERSION 3.13.4) - -# Create a project for the application -project(myapp CXX) - -# Find the PRISMS-PF package -find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) -if(PRISMS_PF_FOUND) - # Include setup script - include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - - # Set up the application - prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) -else() - message( - FATAL_ERROR - "PRISMS-PF package not found. Please make sure it is in path." - ) -endif() diff --git a/tests/regression_tests/taylor_green_vortex/ICs_and_BCs.cc b/tests/regression_tests/taylor_green_vortex/ICs_and_BCs.cc deleted file mode 100644 index 0e0673d50..000000000 --- a/tests/regression_tests/taylor_green_vortex/ICs_and_BCs.cc +++ /dev/null @@ -1,82 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include - -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -template -void -CustomPDE::set_initial_condition( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{ - if constexpr (dim == 2) - { - const double x = point[0]; - const double y = point[1]; - - if (index == 0 || index == 1) - { - if (component == 0) - { - vector_component_value = std::sin(x) * std::cos(y); - } - if (component == 1) - { - vector_component_value = -std::cos(x) * std::sin(y); - } - } - } - else if constexpr (dim == 3) - { - const double x = point[0]; - const double y = point[1]; - const double z = point[2]; - - if (index == 0 || index == 1) - { - if (component == 0) - { - vector_component_value = std::sin(x) * std::cos(y) * std::cos(z); - } - if (component == 1) - { - vector_component_value = -std::cos(x) * std::sin(y) * std::cos(z); - } - if (component == 2) - { - vector_component_value = 0; - } - } - } -} - -template -void -CustomPDE::set_nonuniform_dirichlet( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &boundary_id, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/taylor_green_vortex/custom_pde.h b/tests/regression_tests/taylor_green_vortex/custom_pde.h deleted file mode 100644 index 514911962..000000000 --- a/tests/regression_tests/taylor_green_vortex/custom_pde.h +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#pragma once - -#include -#include -#include -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -/** - * @brief This is a derived class of `VariableAttributeLoader` where the user implements - * their variable attributes and field declarations. - */ -class CustomAttributeLoader : public VariableAttributeLoader -{ -public: - /** - * @brief Destructor. - */ - ~CustomAttributeLoader() override = default; - - /** - * @brief User-implemented method where the variable attributes are set for all fields. - */ - void - load_variable_attributes() override; -}; - -/** - * @brief This is a derived class of `MatrixFreeOperator` where the user implements their - * PDEs. - * - * @tparam dim The number of dimensions in the problem. - * @tparam degree The polynomial degree of the shape functions. - * @tparam number Datatype to use. Either double or float. - */ -template -class CustomPDE : public PDEOperator -{ -public: - using ScalarValue = dealii::VectorizedArray; - using ScalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using ScalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using VectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray>; - using PDEOperator::get_user_inputs; - using PDEOperator::get_pf_tools; - using PDEOperator::get_timestep; - - /** - * @brief Constructor. - */ - explicit CustomPDE(const UserInputParameters &_user_inputs, - PhaseFieldTools &_pf_tools) - : PDEOperator(_user_inputs, _pf_tools) - {} - -private: - /** - * @brief User-implemented class for the initial conditions. - */ - void - set_initial_condition(const unsigned int &index, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for nonuniform boundary conditions. - */ - void - set_nonuniform_dirichlet(const unsigned int &index, - const unsigned int &boundary_id, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for the RHS of explicit equations. - */ - void - compute_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - /** - * @brief User-implemented class for the RHS of nonexplicit equations. - */ - void - compute_nonexplicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the LHS of nonexplicit equations. - */ - void - compute_nonexplicit_lhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the RHS of postprocessed explicit equations. - */ - void - compute_postprocess_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - const number _rho = 10.0; - const number _mu = 0.00625; - - const ScalarValue rho = _rho; - const ScalarValue mu = _mu; - - const ScalarValue total_domain_size = dealii::Utilities::fixed_power<3>( - get_user_inputs().get_spatial_discretization().get_size()[0]); - - const ScalarValue nu = mu / rho; - const ScalarValue dt = get_timestep(); - - // Values for stabilization term - const ScalarValue size_modifier = std::sqrt(4.0 / M_PI) / degree; - const ScalarValue time_contribution = - dealii::Utilities::fixed_power<2>(1.0 / get_timestep()); - - /** - * @brief Compute the stabilization paramters - */ - ScalarValue - compute_stabilization_parameter(const VectorValue &velocity, - const ScalarValue &element_volume) const - { - // Norm of the local velocity - ScalarValue u_l2norm = 1.0e-12 + velocity.norm_square(); - - // Stabilization parameter - ScalarValue h = std::sqrt(element_volume) * size_modifier; - - ScalarValue stabilization_parameter = - 1.0 / std::sqrt(time_contribution + 4.0 * u_l2norm / h / h + - 9.0 * dealii::Utilities::fixed_power<2>(4.0 * nu / h / h)); - - return stabilization_parameter; - } -}; - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/taylor_green_vortex/custom_pde.inst.in b/tests/regression_tests/taylor_green_vortex/custom_pde.inst.in deleted file mode 100644 index f4be8016d..000000000 --- a/tests/regression_tests/taylor_green_vortex/custom_pde.inst.in +++ /dev/null @@ -1,4 +0,0 @@ -for ( dimension : SPACE_DIMENSIONS; degree : ELEMENT_DEGREE; number : REAL_SCALARS) - { - template class CustomPDE; - } diff --git a/tests/regression_tests/taylor_green_vortex/equations.cc b/tests/regression_tests/taylor_green_vortex/equations.cc deleted file mode 100644 index 2ac8f0bca..000000000 --- a/tests/regression_tests/taylor_green_vortex/equations.cc +++ /dev/null @@ -1,312 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -void -CustomAttributeLoader::load_variable_attributes() -{ - set_variable_name(0, "u"); - set_variable_type(0, Vector); - set_variable_equation_type(0, ImplicitTimeDependent); - - set_dependencies_value_term_rhs(0, "u, u_star, grad(p)"); - set_dependencies_gradient_term_rhs( - 0, - "u, u_star, grad(p), old_1(u), grad(u), grad(u_star), lap(u), lap(u_star)"); - set_dependencies_value_term_lhs(0, "change(u)"); - set_dependencies_gradient_term_lhs( - 0, - "change(u), old_1(u), grad(change(u)), lap(change(u))"); - set_solve_block(0, 1); - - set_variable_name(1, "u_star"); - set_variable_type(1, Vector); - set_variable_equation_type(1, ImplicitTimeDependent); - - set_dependencies_value_term_rhs(1, "u_star, u, grad(u), div(u)"); - set_dependencies_gradient_term_rhs(1, "u_star, u, grad(u), grad(u_star), lap(u_star)"); - set_dependencies_value_term_lhs(1, "change(u_star)"); - set_dependencies_gradient_term_lhs( - 1, - "change(u_star), u, grad(change(u_star)), lap(change(u_star))"); - set_solve_block(1, 0); - - set_variable_name(2, "p"); - set_variable_type(2, Scalar); - set_variable_equation_type(2, TimeIndependent); - - set_dependencies_value_term_rhs(2, "div(u_star)"); - set_dependencies_gradient_term_rhs(2, "grad(p), u_star, u, grad(u), lap(u_star)"); - set_dependencies_value_term_lhs(2, ""); - set_dependencies_gradient_term_lhs(2, "grad(change(p))"); - set_solve_block(2, 0); - - set_variable_name(3, "kinetic_energy"); - set_variable_type(3, Scalar); - set_variable_equation_type(3, ExplicitTimeDependent); - set_is_postprocessed_field(3, true); - - set_dependencies_value_term_rhs(3, "u"); - set_dependencies_gradient_term_rhs(3, ""); - set_solve_block(3, 0); - - set_variable_name(4, "enstrophy"); - set_variable_type(4, Scalar); - set_variable_equation_type(4, ExplicitTimeDependent); - set_is_postprocessed_field(4, true); - - set_dependencies_value_term_rhs(4, "curl(u)"); - set_dependencies_gradient_term_rhs(4, ""); - set_solve_block(4, 0); -} - -template -void -CustomPDE::compute_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -template -void -CustomPDE::compute_nonexplicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 1 && solve_block == 0) - { - VectorValue u = variable_list.template get_value(0); - VectorGrad grad_u = variable_list.template get_gradient(0); - ScalarValue div_u = variable_list.template get_divergence(0); - VectorValue u_star = variable_list.template get_value(1); - VectorGrad grad_u_star = variable_list.template get_gradient(1); - VectorValue lap_u_star = variable_list.template get_laplacian(1); - - ScalarValue stabilization_parameter = - compute_stabilization_parameter(u, element_volume); - - VectorValue advection_term; - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - advection_term[i] += u[j] * grad_u[i][j]; - } - } - // Add the skew-symmetric contribution - advection_term += 0.5 * div_u * u; - - // Calculate the residual - ScalarGrad residual = (u - u_star) - (dt * advection_term) + (dt * nu * lap_u_star); - - // Compute the SUPG term which is the dot product of the the velocity and the - // gradient of the shape function. The shape function is not directly accessible in - // PRISMS-PF, so we create a dummy VectorGrad and fill in the diagonal to achieve - // the same result. - VectorGrad supg_term; - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - supg_term[i][j] = residual[i] * u[j]; - } - } - supg_term *= stabilization_parameter; - - VectorValue eq_u = u - u_star - (dt * advection_term); - VectorGrad eq_grad_u = (-dt * grad_u_star * nu) + supg_term; - - variable_list.set_value_term(1, eq_u); - variable_list.set_gradient_term(1, eq_grad_u); - } - if (index == 2 && solve_block == 0) - { - VectorValue u = variable_list.template get_value(0); - VectorGrad grad_u = variable_list.template get_gradient(0); - VectorValue lap_u_star = variable_list.template get_laplacian(1); - VectorValue u_star = variable_list.template get_value(1); - ScalarValue div_u_star = variable_list.template get_divergence(1); - ScalarGrad grad_p = variable_list.template get_gradient(2); - - ScalarValue stabilization_parameter = - compute_stabilization_parameter(u_star, element_volume); - - ScalarValue eq_p = -div_u_star / (dt + stabilization_parameter); - ScalarGrad eq_grad_p = -grad_p; - - VectorValue advection_term; - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - advection_term[i] += u[j] * grad_u[i][j]; - } - } - // Add the skew-symmetric contribution - advection_term += 0.5 * div_u_star * u_star; - - // Calculate the residual - ScalarGrad residual = ((u_star - u) / dt) + advection_term - (nu * lap_u_star); - - // Add the residual to the poisson solve - eq_grad_p -= residual * stabilization_parameter / (dt + stabilization_parameter); - - variable_list.set_value_term(2, eq_p); - variable_list.set_gradient_term(2, eq_grad_p); - } - if (index == 0 && solve_block == 1) - { - VectorValue u = variable_list.template get_value(0); - VectorValue u_old_1 = variable_list.template get_value(0, OldOne); - VectorValue u_star = variable_list.template get_value(1); - ScalarGrad grad_p = variable_list.template get_gradient(2); - VectorGrad grad_u_star = variable_list.template get_gradient(1); - VectorValue lap_u_star = variable_list.template get_laplacian(1); - VectorGrad grad_u = variable_list.template get_gradient(0); - VectorValue lap_u = variable_list.template get_laplacian(0); - - ScalarValue stabilization_parameter = - compute_stabilization_parameter(u_old_1, element_volume); - - // Calculate the residual - ScalarGrad residual = u_star - u - (dt * nu * (lap_u_star - lap_u)) - (dt * grad_p); - - // Compute the SUPG term which is the dot product of the the velocity and the - // gradient of the shape function. The shape function is not directly accessible in - // PRISMS-PF, so we create a dummy VectorGrad and fill in the diagonal to achieve - // the same result. - VectorGrad eq_grad_u; - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - eq_grad_u[i][j] = residual[i] * u_old_1[j]; - } - } - eq_grad_u *= stabilization_parameter; - - eq_grad_u += dt * nu * (grad_u_star - grad_u); - - VectorValue eq_u = u_star - u - (dt * grad_p); - - variable_list.set_value_term(0, eq_u); - variable_list.set_gradient_term(0, eq_grad_u); - } -} - -template -void -CustomPDE::compute_nonexplicit_lhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{ - if (index == 1 && solve_block == 0) - { - VectorValue u = variable_list.template get_value(0); - VectorValue change_u_star = - variable_list.template get_value(1, Change); - VectorGrad change_grad_u_star = - variable_list.template get_gradient(1, Change); - VectorValue change_lap_u_star = - variable_list.template get_laplacian(1, Change); - - ScalarValue stabilization_parameter = - compute_stabilization_parameter(u, element_volume); - - // Compute the SUPG term which is the dot product of the the velocity and the - // gradient of the shape function. The shape function is not directly accessible in - // PRISMS-PF, so we create a dummy VectorGrad and fill in the diagonal to achieve - // the same result. - VectorGrad eq_change_grad_u_star; - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - eq_change_grad_u_star[i][j] = - (change_u_star[i] - dt * nu * change_lap_u_star[i]) * u[j]; - } - } - eq_change_grad_u_star *= stabilization_parameter; - - eq_change_grad_u_star += dt * nu * change_grad_u_star; - - variable_list.set_value_term(1, change_u_star, Change); - variable_list.set_gradient_term(1, eq_change_grad_u_star, Change); - } - if (index == 2 && solve_block == 0) - { - ScalarGrad change_grad_p = - variable_list.template get_gradient(2, Change); - - variable_list.set_gradient_term(2, change_grad_p, Change); - } - if (index == 0 && solve_block == 1) - { - VectorValue u_old_1 = variable_list.template get_value(0, OldOne); - VectorValue change_u = variable_list.template get_value(0, Change); - VectorGrad grad_u = variable_list.template get_gradient(0, Change); - VectorValue lap_u = variable_list.template get_laplacian(0, Change); - - ScalarValue stabilization_parameter = - compute_stabilization_parameter(u_old_1, element_volume); - - // Compute the SUPG term which is the dot product of the the velocity and the - // gradient of the shape function. The shape function is not directly accessible in - // PRISMS-PF, so we create a dummy VectorGrad and fill in the diagonal to achieve - // the same result. - VectorGrad eq_change_grad_u; - for (unsigned int i = 0; i < dim; i++) - { - for (unsigned int j = 0; j < dim; j++) - { - eq_change_grad_u[i][j] = (change_u[i] - dt * nu * lap_u[i]) * u_old_1[j]; - } - } - eq_change_grad_u *= stabilization_parameter; - - eq_change_grad_u += dt * nu * grad_u; - - variable_list.set_value_term(0, change_u, Change); - variable_list.set_gradient_term(0, eq_change_grad_u, Change); - } -} - -template -void -CustomPDE::compute_postprocess_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{ - VectorValue u = variable_list.template get_value(0); - auto curl_u = variable_list.template get_vector_curl< - dealii::Tensor<1, (dim == 2 ? 1 : dim), dealii::VectorizedArray>>(0); - - ScalarValue kinetic_energy_density = u * u / (2.0 * total_domain_size); - ScalarValue enstrophy_density = curl_u * curl_u / (2.0 * total_domain_size); - - variable_list.set_value_term(3, kinetic_energy_density); - variable_list.set_value_term(4, enstrophy_density); -} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/taylor_green_vortex/main.cc b/tests/regression_tests/taylor_green_vortex/main.cc deleted file mode 100644 index 9cd0b22fa..000000000 --- a/tests/regression_tests/taylor_green_vortex/main.cc +++ /dev/null @@ -1,263 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef PRISMS_PF_WITH_CALIPER -# include -# include -#endif - -int -main(int argc, char *argv[]) -{ - try - { - // Initialize MPI - dealii::Utilities::MPI::MPI_InitFinalize - mpi_init(argc, argv, dealii::numbers::invalid_unsigned_int); - - // Parse the command line options (if there are any) to get the name of the input - // file - prisms::ParseCMDOptions cli_options(argc, argv); - std::string parameters_filename = cli_options.get_parameters_filename(); - - // Caliper config manager initialization -#ifdef PRISMS_PF_WITH_CALIPER - cali::ConfigManager mgr; - mgr.add(cli_options.get_caliper_configuration().c_str()); - - // Check for configuration errors - if (mgr.error()) - { - std::cerr << "Caliper error: " << mgr.error_msg() << std::endl; - } - - // Start configured performance measurements, if any - mgr.start(); -#endif - - // Restrict deal.II console printing - dealii::deallog.depth_console(0); - - // Before fully parsing the parameter file, we need to know how many field - // variables there are and whether they are scalars or vectors, how many - // postprocessing variables there are, how many sets of elastic constants - // there are, and how many user-defined constants there are. - // - // This is done with the derived class of `VariableAttributeLoader`, - // `CustomAttributeLoader`. - prisms::CustomAttributeLoader attribute_loader; - attribute_loader.init_variable_attributes(); - std::map var_attributes = - attribute_loader.get_var_attributes(); - - // Load in parameters - prisms::InputFileReader input_file_reader(parameters_filename, var_attributes); - - // Run problem based on the number of dimensions and element degree - switch (input_file_reader.get_dim()) - { - case 1: - { - prisms::UserInputParameters<1> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<1> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 2: - { - prisms::UserInputParameters<2> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<2> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 3: - { - prisms::UserInputParameters<3> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<3> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - default: - throw std::runtime_error("Invalid number of dimensions"); - } - - // Caliper config manager closure -#ifdef PRISMS_PF_WITH_CALIPER - // Flush output before finalizing MPI - mgr.flush(); -#endif - } - - catch (std::exception &exc) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Exception on processing: " << '\n' - << exc.what() << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - catch (...) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Unknown exception!" << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/tests/regression_tests/taylor_green_vortex/parameters.prm b/tests/regression_tests/taylor_green_vortex/parameters.prm deleted file mode 100644 index 071a3084c..000000000 --- a/tests/regression_tests/taylor_green_vortex/parameters.prm +++ /dev/null @@ -1,54 +0,0 @@ -set dim = 3 -set global refinement = 5 -set degree = 2 - -subsection Rectangular mesh - set x size = 6.28318530718 - set y size = 6.28318530718 - set z size = 6.28318530718 -end -set time step = 1.0e-3 -set end time = 10 - -subsection output - set condition = EQUAL_SPACING - set number = 100 -end - -set boundary condition for u, x component = Periodic -set boundary condition for u, y component = Periodic -set boundary condition for u, z component = Periodic -set boundary condition for u_star, x component = Periodic -set boundary condition for u_star, y component = Periodic -set boundary condition for u_star, z component = Periodic -set boundary condition for p = Periodic - -subsection pinning point for p - set value = 0.0 - set x = 3.14159265359 - set y = 3.14159265359 - set z = 3.14159265359 -end - -subsection linear solver parameters: u - set tolerance type = AbsoluteResidual - set tolerance value = 1.0e-8 - set max iterations = 1000 - set preconditioner type = None -end -subsection linear solver parameters: u_star - set tolerance type = AbsoluteResidual - set tolerance value = 1.0e-8 - set max iterations = 1000 - set preconditioner type = None -end -subsection linear solver parameters: p - set tolerance type = AbsoluteResidual - set tolerance value = 1.0e-8 - set max iterations = 1000 - set preconditioner type = GMG - set smoothing range = 20 - set smoother degree = 5 - set eigenvalue cg iterations = 20 - set min mg level = 1 -end diff --git a/tests/regression_tests/test_results.txt b/tests/regression_tests/test_results.txt deleted file mode 100644 index 7aac59a80..000000000 --- a/tests/regression_tests/test_results.txt +++ /dev/null @@ -1,1290 +0,0 @@ ---------------------------------------------------------- -Regression test on 2025-02-14 16:06 -Architecture: x86_64 -Model name: AMD Ryzen 7 7745HX with Radeon Graphics -CPU(s): 16 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: New Gold Standard -Time: 26.58109426498413 - -Application: allen_cahn_implicit -Result: New Gold Standard -Time: 402.71794414520264 - -Application: cahn_hilliard_explicit -Result: New Gold Standard -Time: 224.86245203018188 - -Application: heat_equation_steady_state -Result: New Gold Standard -Time: 0.27942633628845215 - -Application: poisson -Result: New Gold Standard -Time: 0.3027811050415039 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-02-21 20:12 -Architecture: x86_64 -Model name: AMD Ryzen 7 7745HX with Radeon Graphics -CPU(s): 16 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 23.359163284301758 - -Application: allen_cahn_implicit -Result: Pass -Time: 369.40516090393066 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 219.22998905181885 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.17120790481567383 - -Application: poisson -Result: Pass -Time: 0.2895970344543457 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-03-13 11:28 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: 4701.0000, 0.0000 -Hypervisor vendor: Windows Subsystem for Linux -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 3.972020387649536 - -Application: allen_cahn_implicit -Result: Pass -Time: 46.3747022151947 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 30.518799304962158 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.3217480182647705 - -Application: poisson -Result: Pass -Time: 0.39566564559936523 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-03-17 10:08 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: 4701.0000, 0.0000 -Hypervisor vendor: Windows Subsystem for Linux -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 5.4006125926971436 - -Application: allen_cahn_implicit -Result: Pass -Time: 45.25198030471802 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 30.47153377532959 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.3563358783721924 - -Application: poisson -Result: Pass -Time: 0.37386178970336914 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-03-17 14:46 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: 4701.0000, 0.0000 -Hypervisor vendor: Windows Subsystem for Linux -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: New Gold Standard -Time: 0.7263472080230713 - -Application: allen_cahn_implicit -Result: New Gold Standard -Time: 4.478261470794678 - -Application: cahn_hilliard_explicit -Result: New Gold Standard -Time: 4.714993715286255 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.2875378131866455 - -Application: poisson -Result: Pass -Time: 0.3625800609588623 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-03-21 15:49 -Architecture: x86_64 -Model name: AMD Ryzen 7 7745HX with Radeon Graphics -CPU(s): 16 -CPU max/min MHz: 5151.0000, 400.0000 -Hypervisor vendor: None -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.721419334411621 - -Application: allen_cahn_implicit -Result: Pass -Time: 52.398792028427124 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 39.09044885635376 - -Application: heat_equation_steady_state -Result: Pass -Time: 1.7112903594970703 - -Application: poisson -Result: Pass -Time: 1.8527178764343262 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-03-28 12:00 -Architecture: x86_64 -Model name: AMD Ryzen 7 7745HX with Radeon Graphics -CPU(s): 16 -CPU max/min MHz: 5151.0000, 400.0000 -Hypervisor vendor: None -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 7.588613510131836 - -Application: allen_cahn_implicit -Result: Pass -Time: 78.88656759262085 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 60.95834493637085 - -Application: heat_equation_steady_state -Result: Pass -Time: 2.639742374420166 - -Application: poisson -Result: Pass -Time: 2.9604971408843994 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-13 14:09 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.319905519485474 - -Application: allen_cahn_implicit -Result: Pass -Time: 53.759140968322754 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 47.853049755096436 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.22674107551574707 - -Application: poisson -Result: Pass -Time: 0.4876258373260498 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-13 17:12 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.036636829376221 - -Application: allen_cahn_implicit -Result: Pass -Time: 54.22470808029175 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 48.46760320663452 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.15922236442565918 - -Application: poisson -Result: Pass -Time: 0.46365857124328613 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-13 18:36 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-13 19:01 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.1883156299591064 - -Application: allen_cahn_implicit -Result: Pass -Time: 56.839879751205444 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 46.63813829421997 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.3151421546936035 - -Application: poisson -Result: Pass -Time: 0.4034230709075928 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-13 19:30 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.5571815967559814 - -Application: allen_cahn_implicit -Result: Pass -Time: 51.91458177566528 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 48.695746660232544 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.2611706256866455 - -Application: poisson -Result: Pass -Time: 0.5701308250427246 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-13 21:00 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.3914124965667725 - -Application: allen_cahn_implicit -Result: Pass -Time: 58.088316679000854 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 50.12295365333557 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.3110361099243164 - -Application: poisson -Result: Pass -Time: 0.5130798816680908 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-16 12:41 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: New Gold Standard -Time: 3.831264019012451 - -Application: allen_cahn_implicit -Result: New Gold Standard -Time: 52.06869387626648 - -Application: cahn_hilliard_explicit -Result: New Gold Standard -Time: 46.07658815383911 - -Application: heat_equation_steady_state -Result: New Gold Standard -Time: 0.22696900367736816 - -Application: mechanics -Result: New Gold Standard -Time: 0.48543739318847656 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-16 21:04 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.019607305526733 - -Application: allen_cahn_implicit -Result: Pass -Time: 52.359814405441284 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 46.00213265419006 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.27887558937072754 - -Application: mechanics -Result: Pass -Time: 0.6130084991455078 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-19 18:27 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.115371227264404 - -Application: allen_cahn_implicit -Result: Pass -Time: 53.3667778968811 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 49.071430921554565 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.2152843475341797 - -Application: mechanics -Result: Pass -Time: 0.6011435985565186 - -Tests Passed: 5/5 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-04-19 18:50 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.115733861923218 - -Application: allen_cahn_implicit -Result: Pass -Time: 54.00785994529724 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 48.64355134963989 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.17542243003845215 - -Application: mechanics -Result: Pass -Time: 0.575364351272583 - -Application: precipitate_explicit -Result: New Gold Standard -Time: 28.4163658618927 - -Tests Passed: 6/6 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-05-06 12:47 -Architecture: x86_64 -Model name: AMD Ryzen 7 7745HX with Radeon Graphics -CPU(s): 16 -CPU max/min MHz: 5151.0000, 400.0000 -Hypervisor vendor: None -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.049431562423706 - -Application: allen_cahn_implicit -Result: Pass -Time: 52.97643852233887 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 45.56632471084595 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.23443603515625 - -Application: mechanics -Result: Pass -Time: 0.4436485767364502 - -Application: precipitate_explicit -Result: Pass -Time: 20.687397718429565 - -Tests Passed: 6/6 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-05-28 16:05 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.004091739654541 - -Application: allen_cahn_implicit -Result: Pass -Time: 51.41572642326355 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 47.95650863647461 - -Application: cahn_hilliard_implicit -Result: New Gold Standard -Time: 19.919652700424194 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.32610630989074707 - -Application: mechanics -Result: Pass -Time: 0.5887899398803711 - -Application: precipitate_explicit -Result: Pass -Time: 24.264893293380737 - -Application: fracture -Result: Pass -Time: 3.282435894012451 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-07 13:49 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 5.879849910736084 - -Application: allen_cahn_implicit -Result: Pass -Time: 84.99442720413208 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 61.65227484703064 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 27.099815368652344 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.9226744174957275 - -Application: mechanics -Result: Pass -Time: 1.2077271938323975 - -Application: precipitate_explicit -Result: Pass -Time: 42.73172116279602 - -Application: fracture -Result: Pass -Time: 27.5274875164032 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-07 13:59 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 2.4921212196350098 - -Application: allen_cahn_implicit -Result: Pass -Time: 24.19684100151062 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 25.481157064437866 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 8.40138292312622 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.8572678565979004 - -Application: mechanics -Result: Pass -Time: 1.0323622226715088 - -Application: precipitate_explicit -Result: Pass -Time: 29.302205324172974 - -Application: fracture -Result: Pass -Time: 18.079655647277832 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-07 14:01 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 1.1365385055541992 - -Application: allen_cahn_implicit -Result: Pass -Time: 6.791369199752808 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 6.1840856075286865 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 2.470177412033081 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.7280435562133789 - -Application: mechanics -Result: Pass -Time: 0.7129154205322266 - -Application: precipitate_explicit -Result: Pass -Time: 6.21803092956543 - -Application: fracture -Result: Pass -Time: 4.132859230041504 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-07 15:38 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 1.4718873500823975 - -Application: allen_cahn_implicit -Result: Pass -Time: 6.980400800704956 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 6.293954133987427 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 2.366309881210327 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.7573883533477783 - -Application: mechanics -Result: Pass -Time: 0.7730660438537598 - -Application: precipitate_explicit -Result: Pass -Time: 6.099502325057983 - -Application: fracture -Result: Pass -Time: 4.163867712020874 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-20 22:06 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 5.227436304092407 - -Application: allen_cahn_implicit -Result: Pass -Time: 81.54533076286316 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 54.580665588378906 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 22.439528703689575 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.9309360980987549 - -Application: mechanics -Result: Pass -Time: 1.1958563327789307 - -Application: precipitate_explicit -Result: Pass -Time: 38.833229780197144 - -Application: fracture -Result: Pass -Time: 27.78476047515869 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-20 23:24 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 5.513706207275391 - -Application: allen_cahn_implicit -Result: Pass -Time: 82.91847848892212 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 54.63985848426819 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 22.696436882019043 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.9793477058410645 - -Application: mechanics -Result: Pass -Time: 1.1761322021484375 - -Application: precipitate_explicit -Result: Pass -Time: 40.86536264419556 - -Application: fracture -Result: Pass -Time: 28.91895627975464 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-20 23:31 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 2 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 2.278022289276123 - -Application: allen_cahn_implicit -Result: Pass -Time: 24.12848711013794 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 23.8550021648407 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 8.04165768623352 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.8694839477539062 - -Application: mechanics -Result: Pass -Time: 1.0262584686279297 - -Application: precipitate_explicit -Result: Pass -Time: 29.45197820663452 - -Application: fracture -Result: Pass -Time: 20.35979413986206 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-20 23:34 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 4 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 0.3065648078918457 - -Application: allen_cahn_implicit -Result: Pass -Time: 7.07660174369812 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 6.042186975479126 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 2.2579565048217773 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.7281239032745361 - -Application: mechanics -Result: Pass -Time: 0.7594962120056152 - -Application: precipitate_explicit -Result: Pass -Time: 6.649372100830078 - -Application: fracture -Result: Pass -Time: 4.618305206298828 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-20 23:35 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 8 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 1.244854211807251 - -Application: allen_cahn_implicit -Result: Pass -Time: 6.314155340194702 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 5.567429065704346 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 1.3880691528320312 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.7264490127563477 - -Application: mechanics -Result: Pass -Time: 0.8526778221130371 - -Application: precipitate_explicit -Result: Pass -Time: 5.44537615776062 - -Application: fracture -Result: Pass -Time: 4.454085350036621 - -Tests Passed: 8/8 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-07-28 23:04 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 1.983210563659668 - -Application: allen_cahn_implicit -Result: Pass -Time: 22.81018352508545 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 10.711738109588623 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 2.691553831100464 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.3885493278503418 - -Application: mechanics -Result: Pass -Time: 0.4998478889465332 - -Application: precipitate_explicit -Result: Pass -Time: 6.246465682983398 - -Application: fracture -Result: Pass -Time: 5.943583965301514 - -Tests Passed: 8/8 ---------------------------------------------------------- -Regression test on 2025-07-28 23:46 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 4 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 0.8656556606292725 - -Application: allen_cahn_implicit -Result: Pass -Time: 6.842243432998657 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 2.63828182220459 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 1.5442440509796143 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.3873107433319092 - -Application: mechanics -Result: Pass -Time: 0.43381214141845703 - -Application: precipitate_explicit -Result: Pass -Time: 2.8163516521453857 - -Application: fracture -Result: Pass -Time: 2.2483696937561035 - -Tests Passed: 8/8 ---------------------------------------------------------- -Application: fracture -Result: Pass -Time: 5.524836778640747 - ---------------------------------------------------------- -Regression test on 2025-08-06 12:20 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 1.9235553741455078 - -Application: allen_cahn_implicit -Result: New Gold Standard -Time: 21.58185315132141 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 11.028154850006104 - -Application: cahn_hilliard_implicit -Result: New Gold Standard -Time: 2.215787649154663 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.4040379524230957 - -Application: mechanics -Result: Pass -Time: 0.5115482807159424 - -Application: precipitate_explicit -Result: Pass -Time: 7.6789939403533936 - -Application: fracture -Result: Pass -Time: 4.470328330993652 - -Application: solution_blocks -Result: New Gold Standard -Time: 0.34969186782836914 - -Application: linear_solve_old_solution -Result: New Gold Standard -Time: 0.36141276359558105 - -Tests Passed: 10/10 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-08-06 12:49 -Architecture: x86_64 -Model name: AMD Ryzen 9 7900X 12-Core Processor -CPU(s): 24 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 1.924391508102417 - -Application: allen_cahn_implicit -Result: Pass -Time: 20.732794761657715 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 10.661015033721924 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 2.1884281635284424 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.3844313621520996 - -Application: mechanics -Result: Pass -Time: 0.5071010589599609 - -Application: precipitate_explicit -Result: Pass -Time: 7.405323505401611 - -Application: fracture -Result: Pass -Time: 6.121920347213745 - -Application: solution_blocks -Result: Pass -Time: 0.34284305572509766 - -Application: linear_solve_old_solution -Result: Pass -Time: 0.35759425163269043 - -Application: cavity_flow -Result: Pass -Time: 36.64751100540161 - -Tests Passed: 11/11 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-08-15 12:08 -Architecture: x86_64 -Model name: AMD Ryzen 7 7745HX with Radeon Graphics -CPU(s): 16 -CPU max/min MHz: 5151.0000, 400.0000 -Hypervisor vendor: None -Number of processes: 1 -Number of threads: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 4.646788597106934 - -Application: allen_cahn_implicit -Result: Pass -Time: 35.337499141693115 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 20.272907733917236 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 5.155086517333984 - -Application: heat_equation_steady_state -Result: Pass -Time: 2.3318967819213867 - -Application: mechanics -Result: Pass -Time: 2.4502627849578857 - -Application: precipitate_explicit -Result: Pass -Time: 10.743233680725098 - -Application: fracture -Result: Pass -Time: 8.710550308227539 - -Application: solution_blocks -Result: Pass -Time: 2.283773183822632 - -Application: linear_solve_old_solution -Result: Pass -Time: 2.2894933223724365 - -Application: cavity_flow -Result: New Gold Standard -Time: 60.52648162841797 - -Tests Passed: 11/11 ---------------------------------------------------------- ---------------------------------------------------------- -Regression test on 2025-09-11 14:04 -Architecture: x86_64 -Model name: AMD Ryzen 7 5800X 8-Core Processor -CPU(s): 16 -CPU max/min MHz: None, None -Hypervisor vendor: Microsoft -Number of processes: 1 -Number of threads: 1 ---------------------------------------------------------- -Application: allen_cahn_explicit -Result: Pass -Time: 5.107484817504883 - -Application: allen_cahn_implicit -Result: Pass -Time: 66.47570490837097 - -Application: cahn_hilliard_explicit -Result: Pass -Time: 45.553224325180054 - -Application: cahn_hilliard_implicit -Result: Pass -Time: 6.571847438812256 - -Application: heat_equation_steady_state -Result: Pass -Time: 0.6505775451660156 - -Application: mechanics -Result: Pass -Time: 0.914060115814209 - -Application: precipitate_explicit -Result: Pass -Time: 20.088241577148438 - -Application: fracture -Result: Pass -Time: 14.574650049209595 - -Application: solution_blocks -Result: Pass -Time: 0.49363112449645996 - -Application: linear_solve_old_solution -Result: Pass -Time: 0.47952985763549805 - -Application: cavity_flow -Result: Pass -Time: 178.90050959587097 - -Tests Passed: 11/11 ---------------------------------------------------------- From 8c2833dd6e693ac043ceb0acac0eb35e1ef91376 Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 6 Oct 2025 18:43:38 -0700 Subject: [PATCH 07/17] updating regression tests --- .github/pull_request_template.md | 1 - .github/workflows/linux.yml | 32 +-- cmake/setup_cached_variables.cmake | 4 +- tests/regression_tests/CMakeLists.txt | 1 - .../allen_cahn_explicit/gold_output.txt | 56 +++- .../allen_cahn_implicit/gold_output.txt | 57 ++-- tests/regression_tests/blank/CMakeLists.txt | 23 -- tests/regression_tests/blank/ICs_and_BCs.cc | 42 --- tests/regression_tests/blank/custom_pde.h | 133 --------- .../regression_tests/blank/custom_pde.inst.in | 4 - tests/regression_tests/blank/equations.cc | 58 ---- tests/regression_tests/blank/main.cc | 263 ------------------ tests/regression_tests/blank/parameters.prm | 12 - .../cahn_hilliard_explicit/gold_output.txt | 55 +++- .../cahn_hilliard_implicit/gold_output.txt | 77 +++-- .../regression_tests/fracture/gold_output.txt | 73 +++-- .../gold_output.txt | 72 +++-- .../linear_solve_old_solution/gold_output.txt | 57 ++-- .../mechanics/gold_output.txt | 69 +++-- .../precipitate_explicit/gold_output.txt | 75 +++-- tests/regression_tests/run.py | 5 +- .../solution_blocks/gold_output.txt | 66 ++--- 22 files changed, 412 insertions(+), 823 deletions(-) delete mode 100644 tests/regression_tests/blank/CMakeLists.txt delete mode 100644 tests/regression_tests/blank/ICs_and_BCs.cc delete mode 100644 tests/regression_tests/blank/custom_pde.h delete mode 100644 tests/regression_tests/blank/custom_pde.inst.in delete mode 100644 tests/regression_tests/blank/equations.cc delete mode 100644 tests/regression_tests/blank/main.cc delete mode 100644 tests/regression_tests/blank/parameters.prm diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c0349dbd2..f005dc236 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,6 +5,5 @@ Miscellaneous items that may need to be done when making a PR: - [ ] Documentation related to this PR is up to date (Doxygen format) - [ ] Unit test(s) - [ ] Code is properly formatted -- [ ] Application update script is up to date - [ ] PR labels are applied - [ ] Issues are linked \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e885a7386..82f023f5b 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -40,7 +40,7 @@ jobs: - name: Compile PRISMS-PF run: | - cmake -G Ninja . + cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON . ninja -j $(nproc) - name: Run PRISMS-PF unit tests @@ -48,10 +48,7 @@ jobs: export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - cd tests/unit_tests - cmake -G Ninja . - ninja -j $(nproc) - ctest + ninja run_tests - name: Run PRISMS-PF automatic tests in serial timeout-minutes: 30 @@ -59,8 +56,7 @@ jobs: export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - cd tests/automatic_tests - python3 run_automatic_tests.py + ninja install - name: Run PRISMS-PF automatic tests in parallel timeout-minutes: 30 @@ -68,8 +64,9 @@ jobs: export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - cd tests/automatic_tests - python3 run_automatic_tests.py -j 2 + cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON -D N_THREADS=2. + ninja install + linux-optimizations: runs-on: [ubuntu-22.04] timeout-minutes: 120 @@ -84,7 +81,7 @@ jobs: - name: Compile PRISMS-PF run: | - cmake -G Ninja -D ADDITIONAL_OPTIMIZATIONS=ON . + cmake -G Ninja -D ADDITIONAL_OPTIMIZATIONS=ON -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON . ninja -j $(nproc) - name: Run PRISMS-PF unit tests @@ -92,10 +89,7 @@ jobs: export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - cd tests/unit_tests - cmake -G Ninja . - ninja -j $(nproc) - ctest + ninja run_tests - name: Run PRISMS-PF automatic tests in serial timeout-minutes: 30 @@ -103,8 +97,7 @@ jobs: export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - cd tests/automatic_tests - python3 run_automatic_tests.py + ninja install - name: Run PRISMS-PF automatic tests in parallel timeout-minutes: 30 @@ -112,8 +105,5 @@ jobs: export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - cd tests/automatic_tests - python3 run_automatic_tests.py -j 2 - - - + cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON -D N_THREADS=2. + ninja install diff --git a/cmake/setup_cached_variables.cmake b/cmake/setup_cached_variables.cmake index 6327b7f95..dd5e789f5 100644 --- a/cmake/setup_cached_variables.cmake +++ b/cmake/setup_cached_variables.cmake @@ -7,10 +7,10 @@ option(PRISMS_PF_AUTODETECTION "Autodetection of PRISMS-PF dependencies." ON) message(STATUS "PRISMS_PF_AUTODETECTION = ${PRISMS_PF_AUTODETECTION}") -option(UNIT_TESTS "Whether to build the unit tests or not." ON) +option(UNIT_TESTS "Whether to build the unit tests or not." OFF) message(STATUS "UNIT_TESTS = ${UNIT_TESTS}") -option(REGRESSION_TESTS "Whether to build the regression tests or not." ON) +option(REGRESSION_TESTS "Whether to build the regression tests or not." OFF) message(STATUS "REGRESSION_TESTS = ${REGRESSION_TESTS}") option( diff --git a/tests/regression_tests/CMakeLists.txt b/tests/regression_tests/CMakeLists.txt index 3b61f2d73..eb7afe326 100644 --- a/tests/regression_tests/CMakeLists.txt +++ b/tests/regression_tests/CMakeLists.txt @@ -8,7 +8,6 @@ message(STATUS "Setting up PRISMS-PF regression tests...") set(REGRESSION_TEST_APPS allen_cahn_explicit allen_cahn_implicit - blank cahn_hilliard_explicit cahn_hilliard_implicit cavity_flow diff --git a/tests/regression_tests/allen_cahn_explicit/gold_output.txt b/tests/regression_tests/allen_cahn_explicit/gold_output.txt index 505d74283..9ab437540 100644 --- a/tests/regression_tests/allen_cahn_explicit/gold_output.txt +++ b/tests/regression_tests/allen_cahn_explicit/gold_output.txt @@ -1,28 +1,35 @@ Using the input parameter file: parameters.prm Number of constants: 2 Number of variables: 3 -================================================ - MGInfo -================================================ - There are no fields with multigrid enabled - -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... creating DoFHandlers... number of degrees of freedom: 49923 creating constraints... -initializing matrix-free objects... initializing solution set... initializing invm... initializing element volumes... -initializing solvers... -solving auxiliary variables in 0th timestep... -solving linear time-independent variables in 0th timestep... -solving self-nonlinear time-independent variables in 0th timestep... -solving postprocessed variables in 0th timestep... +Initializing solvers for solve block 0 ... + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist +initializing grid refiner... grid refinment disabled... +solving 0th timestep for solve block 0 ... + solving auxiliary variables... + solving linear time-independent variables... + solving self-nonlinear time-independent variables... + solving co-nonlinear time-independent variables... + solving postprocessed variables... outputting initial condition... +Iteration: 0 + Solution index 0 l2-norm: 114.242 integrated value: 2009.13 + Solution index 1 l2-norm: 16.5855 integrated value: 103.667 + Solution index 2 l2-norm: 12.263 integrated value: 59.1081 + Iteration: 300 Solution index 0 l2-norm: 115.028 integrated value: 2053.66 @@ -49,5 +56,26 @@ Iteration: 1500 Solution index 1 l2-norm: 7.56697 integrated value: 52.7594 Solution index 2 l2-norm: 3.45866 integrated value: 18.5769 -Serial: Initialization - 0.214507s (0.214507s/call, 1 calls) -Serial: Solve Increment - 3.19164s (0.00212776s/call, 1500 calls) +Serial: Auxiliary solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Create FESystem - 0.000392989s (0.000392989s/call, 1 calls) +Serial: Create constraints - 0.00100919s (0.00100919s/call, 1 calls) +Serial: Explicit solver - 1.07195s (0.000714632s/call, 1500 calls) +Serial: Generate mesh - 0.0167786s (0.0167786s/call, 1 calls) +Serial: Initialization - 0.104306s (0.104306s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 0.00255504s (1.70336e-06s/call, 1500 calls) +Serial: Nonexplicit co-nonlinear solver - 0.00245408s (1.63496e-06s/call, 1501 calls) +Serial: Nonexplicit linear solver - 0.00253009s (1.6856e-06s/call, 1501 calls) +Serial: Nonexplicit self-nonlinear solver - 0.00250517s (1.669e-06s/call, 1501 calls) +Serial: Output - 0.197991s (0.0329985s/call, 6 calls) +Serial: Postprocess solver - 0.00487735s (0.000812891s/call, 6 calls) +Serial: Solve Increment - 1.12335s (0.0007489s/call, 1500 calls) +Serial: Solver initialization - 0.0373791s (0.0373791s/call, 1 calls) +Serial: Update ghosts - 0.00641015s (4.25358e-06s/call, 1507 calls) +Serial: Update time-dependent constraints - 0.00288391s (1.92261e-06s/call, 1500 calls) +Serial: Zero ghosts - 0.00504951s (3.35293e-06s/call, 1506 calls) +Serial: compute element volumes - 0.00100325s (0.00100325s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.00429083s (0.00429083s/call, 1 calls) +Serial: reinitialize element volumes - 4.749e-06s (4.749e-06s/call, 1 calls) +Serial: reinitialize invm - 0.000165032s (0.000165032s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.00678768s (0.00678768s/call, 1 calls) +Serial: reinitialize solution set - 0.000124664s (0.000124664s/call, 1 calls) diff --git a/tests/regression_tests/allen_cahn_implicit/gold_output.txt b/tests/regression_tests/allen_cahn_implicit/gold_output.txt index 1dbf6d3d2..3f0ca5773 100644 --- a/tests/regression_tests/allen_cahn_implicit/gold_output.txt +++ b/tests/regression_tests/allen_cahn_implicit/gold_output.txt @@ -1,7 +1,7 @@ Using the input parameter file: parameters.prm Number of constants: 2 Number of variables: 3 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... @@ -11,18 +11,11 @@ creating constraints... initializing solution set... initializing invm... initializing element volumes... -initializing solvers for solve block 0 ... - trying to initialize concurrent constant solvers... +Initializing solvers for solve block 0 ... no fields for this solver exist - trying to initialize concurrent explicit solvers... no fields for this solver exist - trying to initialize concurrent explicit postprocess solvers... - trying to initialize sequential auxiliary solvers... no fields for this solver exist - trying to initialize sequential linear solvers... - trying to initialize sequential self-nonlinear solvers... no fields for this solver exist - trying to initialize sequential co-nonlinear solvers... no fields for this solver exist initializing grid refiner... grid refinment disabled... solving 0th timestep for solve block 0 ... @@ -63,26 +56,26 @@ Iteration: 1500 Solution index 1 l2-norm: 8.01927 integrated value: 59.4971 Solution index 2 l2-norm: 3.65367 integrated value: 20.8619 -Serial: Auxiliary solver - 1.013e-06s (1.013e-06s/call, 1 calls) -Serial: Create FESystem - 0.000761437s (0.000761437s/call, 1 calls) -Serial: Create constraints - 0.00184284s (0.00184284s/call, 1 calls) -Serial: Explicit solver - 0.00114601s (7.64006e-07s/call, 1500 calls) -Serial: Generate mesh - 0.0270085s (0.0270085s/call, 1 calls) -Serial: Initialization - 0.148184s (0.148184s/call, 1 calls) -Serial: Nonexplicit auxiliary solver - 0.000942623s (6.28415e-07s/call, 1500 calls) -Serial: Nonexplicit co-nonlinear solver - 0.000919675s (6.12708e-07s/call, 1501 calls) -Serial: Nonexplicit linear solver - 22.6266s (0.0150744s/call, 1501 calls) -Serial: Nonexplicit self-nonlinear solver - 0.00136661s (9.10465e-07s/call, 1501 calls) -Serial: Output - 0.332823s (0.0554706s/call, 6 calls) -Serial: Postprocess solver - 0.00533428s (0.000889046s/call, 6 calls) -Serial: Solve Increment - 22.6469s (0.0150979s/call, 1500 calls) -Serial: Solver initialization - 0.0516131s (0.0516131s/call, 1 calls) -Serial: Update ghosts - 0.00148658s (9.86451e-07s/call, 1507 calls) -Serial: Update time-dependent constraints - 0.000690486s (4.60324e-07s/call, 1500 calls) -Serial: Zero ghosts - 0.00178156s (1.18219e-06s/call, 1507 calls) -Serial: compute element volumes - 0.00128648s (0.00128648s/call, 1 calls) -Serial: reinitialize DoFHandlers - 0.00490693s (0.00490693s/call, 1 calls) -Serial: reinitialize element volumes - 1.6751e-05s (1.6751e-05s/call, 1 calls) -Serial: reinitialize invm - 0.000170327s (0.000170327s/call, 1 calls) -Serial: reinitialize matrix-free objects - 0.0112252s (0.0112252s/call, 1 calls) -Serial: reinitialize solution set - 0.000112542s (0.000112542s/call, 1 calls) +Serial: Auxiliary solver - 2.374e-06s (2.374e-06s/call, 1 calls) +Serial: Create FESystem - 0.000447604s (0.000447604s/call, 1 calls) +Serial: Create constraints - 0.000977132s (0.000977132s/call, 1 calls) +Serial: Explicit solver - 0.00326028s (2.17352e-06s/call, 1500 calls) +Serial: Generate mesh - 0.0150286s (0.0150286s/call, 1 calls) +Serial: Initialization - 0.0992222s (0.0992222s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 0.00326975s (2.17983e-06s/call, 1500 calls) +Serial: Nonexplicit co-nonlinear solver - 0.00282334s (1.88097e-06s/call, 1501 calls) +Serial: Nonexplicit linear solver - 17.3688s (0.0115715s/call, 1501 calls) +Serial: Nonexplicit self-nonlinear solver - 0.00282453s (1.88176e-06s/call, 1501 calls) +Serial: Output - 0.223142s (0.0371904s/call, 6 calls) +Serial: Postprocess solver - 0.00476812s (0.000794686s/call, 6 calls) +Serial: Solve Increment - 17.4292s (0.0116195s/call, 1500 calls) +Serial: Solver initialization - 0.0353703s (0.0353703s/call, 1 calls) +Serial: Update ghosts - 0.00761522s (5.05323e-06s/call, 1507 calls) +Serial: Update time-dependent constraints - 0.00327925s (2.18617e-06s/call, 1500 calls) +Serial: Zero ghosts - 0.00471706s (3.1301e-06s/call, 1507 calls) +Serial: compute element volumes - 0.00104481s (0.00104481s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.00320447s (0.00320447s/call, 1 calls) +Serial: reinitialize element volumes - 4.749e-06s (4.749e-06s/call, 1 calls) +Serial: reinitialize invm - 0.000166219s (0.000166219s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.00515517s (0.00515517s/call, 1 calls) +Serial: reinitialize solution set - 9.6169e-05s (9.6169e-05s/call, 1 calls) diff --git a/tests/regression_tests/blank/CMakeLists.txt b/tests/regression_tests/blank/CMakeLists.txt deleted file mode 100644 index 5f34be6c0..000000000 --- a/tests/regression_tests/blank/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -## -# CMake script for the PRISMS-PF applications -## - -cmake_minimum_required(VERSION 3.13.4) - -# Create a project for the application -project(myapp CXX) - -# Find the PRISMS-PF package -find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) -if(PRISMS_PF_FOUND) - # Include setup script - include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - - # Set up the application - prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) -else() - message( - FATAL_ERROR - "PRISMS-PF package not found. Please make sure it is in path." - ) -endif() diff --git a/tests/regression_tests/blank/ICs_and_BCs.cc b/tests/regression_tests/blank/ICs_and_BCs.cc deleted file mode 100644 index 8a71b9787..000000000 --- a/tests/regression_tests/blank/ICs_and_BCs.cc +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include - -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -template -void -CustomPDE::set_initial_condition( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -template -void -CustomPDE::set_nonuniform_dirichlet( - [[maybe_unused]] const unsigned int &index, - [[maybe_unused]] const unsigned int &boundary_id, - [[maybe_unused]] const unsigned int &component, - [[maybe_unused]] const dealii::Point &point, - [[maybe_unused]] number &scalar_value, - [[maybe_unused]] number &vector_component_value) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/blank/custom_pde.h b/tests/regression_tests/blank/custom_pde.h deleted file mode 100644 index 4a1be6579..000000000 --- a/tests/regression_tests/blank/custom_pde.h +++ /dev/null @@ -1,133 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#pragma once - -#include -#include -#include -#include - -#include - -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -/** - * @brief This is a derived class of `VariableAttributeLoader` where the user implements - * their variable attributes and field declarations. - */ -class CustomAttributeLoader : public VariableAttributeLoader -{ -public: - /** - * @brief Destructor. - */ - ~CustomAttributeLoader() override = default; - - /** - * @brief User-implemented method where the variable attributes are set for all fields. - */ - void - load_variable_attributes() override; -}; - -/** - * @brief This is a derived class of `MatrixFreeOperator` where the user implements their - * PDEs. - * - * @tparam dim The number of dimensions in the problem. - * @tparam degree The polynomial degree of the shape functions. - * @tparam number Datatype to use. Either double or float. - */ -template -class CustomPDE : public PDEOperator -{ -public: - using ScalarValue = dealii::VectorizedArray; - using ScalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using ScalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray>; - using VectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray>; - using VectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray>; - using PDEOperator::get_user_inputs; - using PDEOperator::get_pf_tools; - using PDEOperator::get_timestep; - - /** - * @brief Constructor. - */ - explicit CustomPDE(const UserInputParameters &_user_inputs, - PhaseFieldTools &_pf_tools) - : PDEOperator(_user_inputs, _pf_tools) - {} - -private: - /** - * @brief User-implemented class for the initial conditions. - */ - void - set_initial_condition(const unsigned int &index, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for nonuniform boundary conditions. - */ - void - set_nonuniform_dirichlet(const unsigned int &index, - const unsigned int &boundary_id, - const unsigned int &component, - const dealii::Point &point, - number &scalar_value, - number &vector_component_value) const override; - - /** - * @brief User-implemented class for the RHS of explicit equations. - */ - void - compute_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; - - /** - * @brief User-implemented class for the RHS of nonexplicit equations. - */ - void - compute_nonexplicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the LHS of nonexplicit equations. - */ - void - compute_nonexplicit_lhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block, - Types::Index index = Numbers::invalid_index) const override; - - /** - * @brief User-implemented class for the RHS of postprocessed explicit equations. - */ - void - compute_postprocess_explicit_rhs( - VariableContainer &variable_list, - const dealii::Point> &q_point_loc, - const dealii::VectorizedArray &element_volume, - Types::Index solve_block) const override; -}; - -PRISMS_PF_END_NAMESPACE \ No newline at end of file diff --git a/tests/regression_tests/blank/custom_pde.inst.in b/tests/regression_tests/blank/custom_pde.inst.in deleted file mode 100644 index f4be8016d..000000000 --- a/tests/regression_tests/blank/custom_pde.inst.in +++ /dev/null @@ -1,4 +0,0 @@ -for ( dimension : SPACE_DIMENSIONS; degree : ELEMENT_DEGREE; number : REAL_SCALARS) - { - template class CustomPDE; - } diff --git a/tests/regression_tests/blank/equations.cc b/tests/regression_tests/blank/equations.cc deleted file mode 100644 index 84097a296..000000000 --- a/tests/regression_tests/blank/equations.cc +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include - -#include - -PRISMS_PF_BEGIN_NAMESPACE - -void -CustomAttributeLoader::load_variable_attributes() -{} - -template -void -CustomPDE::compute_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -template -void -CustomPDE::compute_nonexplicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{} - -template -void -CustomPDE::compute_nonexplicit_lhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block, - [[maybe_unused]] Types::Index index) const -{} - -template -void -CustomPDE::compute_postprocess_explicit_rhs( - [[maybe_unused]] VariableContainer &variable_list, - [[maybe_unused]] const dealii::Point> &q_point_loc, - [[maybe_unused]] const dealii::VectorizedArray &element_volume, - [[maybe_unused]] Types::Index solve_block) const -{} - -#include "custom_pde.inst" - -PRISMS_PF_END_NAMESPACE diff --git a/tests/regression_tests/blank/main.cc b/tests/regression_tests/blank/main.cc deleted file mode 100644 index 9cd0b22fa..000000000 --- a/tests/regression_tests/blank/main.cc +++ /dev/null @@ -1,263 +0,0 @@ -// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan -// SPDX-License-Identifier: GNU Lesser General Public Version 2.1 - -#include "custom_pde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef PRISMS_PF_WITH_CALIPER -# include -# include -#endif - -int -main(int argc, char *argv[]) -{ - try - { - // Initialize MPI - dealii::Utilities::MPI::MPI_InitFinalize - mpi_init(argc, argv, dealii::numbers::invalid_unsigned_int); - - // Parse the command line options (if there are any) to get the name of the input - // file - prisms::ParseCMDOptions cli_options(argc, argv); - std::string parameters_filename = cli_options.get_parameters_filename(); - - // Caliper config manager initialization -#ifdef PRISMS_PF_WITH_CALIPER - cali::ConfigManager mgr; - mgr.add(cli_options.get_caliper_configuration().c_str()); - - // Check for configuration errors - if (mgr.error()) - { - std::cerr << "Caliper error: " << mgr.error_msg() << std::endl; - } - - // Start configured performance measurements, if any - mgr.start(); -#endif - - // Restrict deal.II console printing - dealii::deallog.depth_console(0); - - // Before fully parsing the parameter file, we need to know how many field - // variables there are and whether they are scalars or vectors, how many - // postprocessing variables there are, how many sets of elastic constants - // there are, and how many user-defined constants there are. - // - // This is done with the derived class of `VariableAttributeLoader`, - // `CustomAttributeLoader`. - prisms::CustomAttributeLoader attribute_loader; - attribute_loader.init_variable_attributes(); - std::map var_attributes = - attribute_loader.get_var_attributes(); - - // Load in parameters - prisms::InputFileReader input_file_reader(parameters_filename, var_attributes); - - // Run problem based on the number of dimensions and element degree - switch (input_file_reader.get_dim()) - { - case 1: - { - prisms::UserInputParameters<1> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<1> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<1, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 2: - { - prisms::UserInputParameters<2> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<2> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<2, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - case 3: - { - prisms::UserInputParameters<3> user_inputs( - input_file_reader, - input_file_reader.get_parameter_handler()); - prisms::PhaseFieldTools<3> pf_tools; - switch (user_inputs.get_spatial_discretization().get_degree()) - { - case 1: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 1, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - case 2: - { - std::shared_ptr> pde_operator = - std::make_shared>(user_inputs, - pf_tools); - std::shared_ptr> - pde_operator_float = - std::make_shared>(user_inputs, - pf_tools); - - prisms::PDEProblem<3, 2, double> problem(user_inputs, - pf_tools, - pde_operator, - pde_operator_float); - problem.run(); - break; - } - default: - throw std::runtime_error("Invalid element degree"); - } - break; - } - default: - throw std::runtime_error("Invalid number of dimensions"); - } - - // Caliper config manager closure -#ifdef PRISMS_PF_WITH_CALIPER - // Flush output before finalizing MPI - mgr.flush(); -#endif - } - - catch (std::exception &exc) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Exception on processing: " << '\n' - << exc.what() << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - catch (...) - { - std::cerr << '\n' - << '\n' - << "----------------------------------------------------" << '\n'; - std::cerr << "Unknown exception!" << '\n' - << "Aborting!" << '\n' - << "----------------------------------------------------" << '\n'; - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/tests/regression_tests/blank/parameters.prm b/tests/regression_tests/blank/parameters.prm deleted file mode 100644 index 6017392cb..000000000 --- a/tests/regression_tests/blank/parameters.prm +++ /dev/null @@ -1,12 +0,0 @@ -set dim = 3 -set global refinement = 4 -set degree = 1 - -subsection Rectangular mesh - set x size = 100 - set y size = 100 - set z size = 100 - set x subdivisions = 1 - set y subdivisions = 1 - set z subdivisions = 1 -end diff --git a/tests/regression_tests/cahn_hilliard_explicit/gold_output.txt b/tests/regression_tests/cahn_hilliard_explicit/gold_output.txt index 7e8d73d8e..398f9f776 100644 --- a/tests/regression_tests/cahn_hilliard_explicit/gold_output.txt +++ b/tests/regression_tests/cahn_hilliard_explicit/gold_output.txt @@ -1,28 +1,34 @@ Using the input parameter file: parameters.prm Number of constants: 2 Number of variables: 3 -================================================ - MGInfo -================================================ - There are no fields with multigrid enabled - -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... creating DoFHandlers... number of degrees of freedom: 49923 creating constraints... -initializing matrix-free objects... initializing solution set... initializing invm... initializing element volumes... -initializing solvers... -solving auxiliary variables in 0th timestep... -solving linear time-independent variables in 0th timestep... -solving self-nonlinear time-independent variables in 0th timestep... -solving postprocessed variables in 0th timestep... +Initializing solvers for solve block 0 ... + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist +initializing grid refiner... grid refinment disabled... +solving 0th timestep for solve block 0 ... + solving auxiliary variables... + solving linear time-independent variables... + solving self-nonlinear time-independent variables... + solving co-nonlinear time-independent variables... + solving postprocessed variables... outputting initial condition... +Iteration: 0 + Solution index 0 l2-norm: 114.242 integrated value: 2009.14 + Solution index 1 l2-norm: 55.0484 integrated value: 17.4527 + Solution index 2 l2-norm: 10.5593 integrated value: 47.4855 + Iteration: 3000 Solution index 0 l2-norm: 113.821 integrated value: 2009.14 @@ -49,5 +55,26 @@ Iteration: 15000 Solution index 1 l2-norm: 5.50841 integrated value: -25.1225 Solution index 2 l2-norm: 4.14517 integrated value: 27.0822 -Serial: Initialization - 0.0924677s (0.0924677s/call, 1 calls) -Serial: Solve Increment - 45.246s (0.0030164s/call, 15000 calls) +Serial: Auxiliary solver - 0.000321755s (0.000321755s/call, 1 calls) +Serial: Create FESystem - 0.000422674s (0.000422674s/call, 1 calls) +Serial: Create constraints - 0.00033244s (0.00033244s/call, 1 calls) +Serial: Explicit solver - 5.91095s (0.000394064s/call, 15000 calls) +Serial: Generate mesh - 0.00520387s (0.00520387s/call, 1 calls) +Serial: Initialization - 0.050817s (0.050817s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 4.51257s (0.000300838s/call, 15000 calls) +Serial: Nonexplicit co-nonlinear solver - 0.0247833s (1.65211e-06s/call, 15001 calls) +Serial: Nonexplicit linear solver - 0.0250292s (1.6685e-06s/call, 15001 calls) +Serial: Nonexplicit self-nonlinear solver - 0.0250055s (1.66692e-06s/call, 15001 calls) +Serial: Output - 0.155152s (0.0258587s/call, 6 calls) +Serial: Postprocess solver - 0.0016064s (0.000267733s/call, 6 calls) +Serial: Solve Increment - 10.8776s (0.000725171s/call, 15000 calls) +Serial: Solver initialization - 0.0110691s (0.0110691s/call, 1 calls) +Serial: Update ghosts - 0.126347s (4.21046e-06s/call, 30008 calls) +Serial: Update time-dependent constraints - 0.0289994s (1.93329e-06s/call, 15000 calls) +Serial: Zero ghosts - 0.0880052s (2.93282e-06s/call, 30007 calls) +Serial: compute element volumes - 0.000629261s (0.000629261s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.0024375s (0.0024375s/call, 1 calls) +Serial: reinitialize element volumes - 3.562e-06s (3.562e-06s/call, 1 calls) +Serial: reinitialize invm - 8.9047e-05s (8.9047e-05s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.00291597s (0.00291597s/call, 1 calls) +Serial: reinitialize solution set - 0.000154347s (0.000154347s/call, 1 calls) diff --git a/tests/regression_tests/cahn_hilliard_implicit/gold_output.txt b/tests/regression_tests/cahn_hilliard_implicit/gold_output.txt index c9c34c0da..9b78c15b1 100644 --- a/tests/regression_tests/cahn_hilliard_implicit/gold_output.txt +++ b/tests/regression_tests/cahn_hilliard_implicit/gold_output.txt @@ -1,7 +1,7 @@ Using the input parameter file: parameters.prm Number of constants: 2 Number of variables: 3 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... @@ -11,19 +11,12 @@ creating constraints... initializing solution set... initializing invm... initializing element volumes... -initializing solvers for solve block 0 ... - trying to initialize concurrent constant solvers... +Initializing solvers for solve block 0 ... no fields for this solver exist - trying to initialize concurrent explicit solvers... no fields for this solver exist - trying to initialize concurrent explicit postprocess solvers... - trying to initialize sequential auxiliary solvers... no fields for this solver exist - trying to initialize sequential linear solvers... no fields for this solver exist - trying to initialize sequential self-nonlinear solvers... no fields for this solver exist - trying to initialize sequential co-nonlinear solvers... initializing grid refiner... grid refinment disabled... solving 0th timestep for solve block 0 ... solving auxiliary variables... @@ -40,49 +33,49 @@ Iteration: 0 Iteration: 2 Solution index 0 l2-norm: 114.236 integrated value: 2009.14 - Solution index 1 l2-norm: 37.5223 integrated value: -2.11584e-15 - Solution index 2 l2-norm: 9.73982 integrated value: 44.9844 + Solution index 1 l2-norm: 37.5222 integrated value: 3.44169e-15 + Solution index 2 l2-norm: 9.73981 integrated value: 44.9844 Iteration: 4 Solution index 0 l2-norm: 114.232 integrated value: 2009.14 - Solution index 1 l2-norm: 32.498 integrated value: 1.81565e-14 - Solution index 2 l2-norm: 9.38962 integrated value: 44.0013 + Solution index 1 l2-norm: 32.4979 integrated value: -1.88738e-14 + Solution index 2 l2-norm: 9.38961 integrated value: 44.0012 Iteration: 6 Solution index 0 l2-norm: 114.228 integrated value: 2009.14 - Solution index 1 l2-norm: 30.2033 integrated value: -3.65166e-15 - Solution index 2 l2-norm: 9.14455 integrated value: 43.3646 + Solution index 1 l2-norm: 30.2031 integrated value: -1.78746e-14 + Solution index 2 l2-norm: 9.14453 integrated value: 43.3646 Iteration: 8 Solution index 0 l2-norm: 114.225 integrated value: 2009.14 - Solution index 1 l2-norm: 28.8077 integrated value: 6.33136e-15 - Solution index 2 l2-norm: 8.94998 integrated value: 42.8774 + Solution index 1 l2-norm: 28.8074 integrated value: 1.11022e-15 + Solution index 2 l2-norm: 8.94996 integrated value: 42.8773 Iteration: 10 Solution index 0 l2-norm: 114.222 integrated value: 2009.14 - Solution index 1 l2-norm: 27.8123 integrated value: -8.87548e-15 - Solution index 2 l2-norm: 8.78787 integrated value: 42.4773 + Solution index 1 l2-norm: 27.812 integrated value: -2.14273e-14 + Solution index 2 l2-norm: 8.78784 integrated value: 42.4772 -Serial: Auxiliary solver - 8.35e-07s (8.35e-07s/call, 1 calls) -Serial: Create FESystem - 0.000854593s (0.000854593s/call, 1 calls) -Serial: Create constraints - 0.00050462s (0.00050462s/call, 1 calls) -Serial: Explicit solver - 1.7697e-05s (1.7697e-06s/call, 10 calls) -Serial: Generate mesh - 0.00728955s (0.00728955s/call, 1 calls) -Serial: Initialization - 0.0603501s (0.0603501s/call, 1 calls) -Serial: Nonexplicit auxiliary solver - 1.2744e-05s (1.2744e-06s/call, 10 calls) -Serial: Nonexplicit co-nonlinear solver - 1.66515s (0.151377s/call, 11 calls) -Serial: Nonexplicit linear solver - 1.0471e-05s (9.51909e-07s/call, 11 calls) -Serial: Nonexplicit self-nonlinear solver - 1.324e-05s (1.20364e-06s/call, 11 calls) -Serial: Output - 0.176053s (0.0293422s/call, 6 calls) -Serial: Postprocess solver - 0.00164329s (0.000273881s/call, 6 calls) -Serial: Solve Increment - 1.66631s (0.166631s/call, 10 calls) -Serial: Solver initialization - 0.0146612s (0.0146612s/call, 1 calls) -Serial: Update ghosts - 0.000593931s (6.39323e-07s/call, 929 calls) -Serial: Update time-dependent constraints - 5.538e-06s (5.538e-07s/call, 10 calls) -Serial: Zero ghosts - 0.000411175s (8.89989e-07s/call, 462 calls) -Serial: compute element volumes - 0.000573s (0.000573s/call, 1 calls) -Serial: reinitialize DoFHandlers - 0.0022079s (0.0022079s/call, 1 calls) -Serial: reinitialize element volumes - 1.6863e-05s (1.6863e-05s/call, 1 calls) -Serial: reinitialize invm - 0.000113843s (0.000113843s/call, 1 calls) -Serial: reinitialize matrix-free objects - 0.00613522s (0.00613522s/call, 1 calls) -Serial: reinitialize solution set - 0.000246959s (0.000246959s/call, 1 calls) +Serial: Auxiliary solver - 2.374e-06s (2.374e-06s/call, 1 calls) +Serial: Create FESystem - 0.00043336s (0.00043336s/call, 1 calls) +Serial: Create constraints - 0.00036331s (0.00036331s/call, 1 calls) +Serial: Explicit solver - 2.3747e-05s (2.3747e-06s/call, 10 calls) +Serial: Generate mesh - 0.00523713s (0.00523713s/call, 1 calls) +Serial: Initialization - 0.0493389s (0.0493389s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 2.1371e-05s (2.1371e-06s/call, 10 calls) +Serial: Nonexplicit co-nonlinear solver - 3.49037s (0.317306s/call, 11 calls) +Serial: Nonexplicit linear solver - 2.3743e-05s (2.15845e-06s/call, 11 calls) +Serial: Nonexplicit self-nonlinear solver - 2.3747e-05s (2.15882e-06s/call, 11 calls) +Serial: Output - 0.161s (0.0268333s/call, 6 calls) +Serial: Postprocess solver - 0.00165627s (0.000276045s/call, 6 calls) +Serial: Solve Increment - 3.49186s (0.349186s/call, 10 calls) +Serial: Solver initialization - 0.0110121s (0.0110121s/call, 1 calls) +Serial: Update ghosts - 0.0113802s (5.17515e-06s/call, 2199 calls) +Serial: Update time-dependent constraints - 2.2559e-05s (2.2559e-06s/call, 10 calls) +Serial: Zero ghosts - 0.00267973s (2.44278e-06s/call, 1097 calls) +Serial: compute element volumes - 0.000422674s (0.000422674s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.00220123s (0.00220123s/call, 1 calls) +Serial: reinitialize element volumes - 4.749e-06s (4.749e-06s/call, 1 calls) +Serial: reinitialize invm - 7.2425e-05s (7.2425e-05s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.00258473s (0.00258473s/call, 1 calls) +Serial: reinitialize solution set - 0.000176906s (0.000176906s/call, 1 calls) diff --git a/tests/regression_tests/fracture/gold_output.txt b/tests/regression_tests/fracture/gold_output.txt index df9788887..0fdf1e9ef 100644 --- a/tests/regression_tests/fracture/gold_output.txt +++ b/tests/regression_tests/fracture/gold_output.txt @@ -1,8 +1,7 @@ Using the input parameter file: parameters.prm -Using the caliper configuration: runtime-report,mem.highwatermark Number of constants: 7 Number of variables: 12 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... @@ -18,25 +17,42 @@ creating multigrid constraints at level 4... creating multigrid constraints at level 5... creating multigrid constraints at level 6... creating multigrid constraints at level 7... -initializing matrix-free objects... -initializing multgrid matrix-free object at level 0... -initializing multgrid matrix-free object at level 1... -initializing multgrid matrix-free object at level 2... -initializing multgrid matrix-free object at level 3... -initializing multgrid matrix-free object at level 4... -initializing multgrid matrix-free object at level 5... -initializing multgrid matrix-free object at level 6... -initializing multgrid matrix-free object at level 7... initializing solution set... initializing invm... initializing element volumes... -initializing solvers... -solving auxiliary variables in 0th timestep... -solving linear time-independent variables in 0th timestep... -solving self-nonlinear time-independent variables in 0th timestep... -solving co-nonlinear time-independent variables in 0th timestep... -solving postprocessed variables in 0th timestep... +initializing multgrid element volumes at level 0... +initializing multgrid element volumes at level 1... +initializing multgrid element volumes at level 2... +initializing multgrid element volumes at level 3... +initializing multgrid element volumes at level 4... +initializing multgrid element volumes at level 5... +initializing multgrid element volumes at level 6... +initializing multgrid element volumes at level 7... +Initializing solvers for solve block 0 ... + no fields for this solver exist + no fields for this solver exist +initializing grid refiner... grid refinment disabled... +solving 0th timestep for solve block 0 ... + solving auxiliary variables... + solving linear time-independent variables... + solving self-nonlinear time-independent variables... + solving co-nonlinear time-independent variables... + solving postprocessed variables... outputting initial condition... +Iteration: 0 + Solution index 0 l2-norm: 5.09902 integrated value: 1.52588e-05 + Solution index 1 l2-norm: 0.485669 integrated value: 3.13599e-05 1.92903e-07 + Solution index 2 l2-norm: 30525.2 integrated value: -0.298384 + Solution index 3 l2-norm: 129 integrated value: 0.01 + Solution index 4 l2-norm: 129 integrated value: 0.01 + Solution index 5 l2-norm: 37127.4 integrated value: 0.232412 + Solution index 6 l2-norm: 19196.7 integrated value: 1.3735 + Solution index 7 l2-norm: 6300 integrated value: -0.000335898 + Solution index 8 l2-norm: 30775.1 integrated value: 2.21036 + Solution index 9 l2-norm: 23.6644 integrated value: 0.000493726 + Solution index 10 l2-norm: 36793.7 integrated value: 0.156453 + Solution index 11 l2-norm: 1913.88 integrated value: 0.0759589 + Iteration: 6 Solution index 0 l2-norm: 5.11949 integrated value: 2.11511e-05 @@ -108,3 +124,26 @@ Iteration: 30 Solution index 10 l2-norm: 21191 integrated value: 0.0962369 Solution index 11 l2-norm: 1876.81 integrated value: 0.0763903 +Serial: Auxiliary solver - 0.00139981s (0.00139981s/call, 1 calls) +Serial: Create FESystem - 0.000707624s (0.000707624s/call, 1 calls) +Serial: Create constraints - 0.0153825s (0.0153825s/call, 1 calls) +Serial: Explicit solver - 0.0367323s (0.00122441s/call, 30 calls) +Serial: Generate mesh - 0.07651s (0.07651s/call, 1 calls) +Serial: Initialization - 0.431268s (0.431268s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 0.0402633s (0.00134211s/call, 30 calls) +Serial: Nonexplicit co-nonlinear solver - 5.9365e-05s (1.915e-06s/call, 31 calls) +Serial: Nonexplicit linear solver - 2.30333s (0.0743009s/call, 31 calls) +Serial: Nonexplicit self-nonlinear solver - 6.5305e-05s (2.10661e-06s/call, 31 calls) +Serial: Output - 0.491327s (0.0818878s/call, 6 calls) +Serial: Postprocess solver - 0.0191771s (0.00319618s/call, 6 calls) +Serial: Solve Increment - 2.59074s (0.086358s/call, 30 calls) +Serial: Solver initialization - 0.082146s (0.082146s/call, 1 calls) +Serial: Update ghosts - 0.00196614s (1.986e-05s/call, 99 calls) +Serial: Update time-dependent constraints - 0.301618s (0.0100539s/call, 30 calls) +Serial: Zero ghosts - 0.000523592s (5.34278e-06s/call, 98 calls) +Serial: compute element volumes - 0.00226059s (0.00226059s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.0334767s (0.0334767s/call, 1 calls) +Serial: reinitialize element volumes - 2.3746e-05s (2.3746e-05s/call, 1 calls) +Serial: reinitialize invm - 0.000125853s (0.000125853s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.0253248s (0.0253248s/call, 1 calls) +Serial: reinitialize solution set - 0.000548527s (0.000548527s/call, 1 calls) diff --git a/tests/regression_tests/heat_equation_steady_state/gold_output.txt b/tests/regression_tests/heat_equation_steady_state/gold_output.txt index cfa81b73d..cded550d0 100644 --- a/tests/regression_tests/heat_equation_steady_state/gold_output.txt +++ b/tests/regression_tests/heat_equation_steady_state/gold_output.txt @@ -1,42 +1,64 @@ Using the input parameter file: parameters.prm Number of constants: 0 Number of variables: 3 -================================================ - MGInfo -================================================ - Global min = 0 and max = 5 - LHS dependency fields: - Index 0 Type Change Min 0 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... creating DoFHandlers... number of degrees of freedom: 12675 - with multigrid levels: 29829 + with multigrid levels: 18393 creating constraints... -creating multigrid constraints... -initializing matrix-free objects... -initializing multgrid matrix-free object at level 0... -initializing multgrid matrix-free object at level 1... -initializing multgrid matrix-free object at level 2... -initializing multgrid matrix-free object at level 3... -initializing multgrid matrix-free object at level 4... -initializing multgrid matrix-free object at level 5... +creating multigrid constraints at level 0... +creating multigrid constraints at level 1... +creating multigrid constraints at level 2... +creating multigrid constraints at level 3... +creating multigrid constraints at level 4... +creating multigrid constraints at level 5... initializing solution set... initializing invm... initializing element volumes... -initializing solvers... -solving auxiliary variables in 0th timestep... -solving linear time-independent variables in 0th timestep... -solving self-nonlinear time-independent variables in 0th timestep... -solving postprocessed variables in 0th timestep... +initializing multgrid element volumes at level 0... +initializing multgrid element volumes at level 1... +initializing multgrid element volumes at level 2... +initializing multgrid element volumes at level 3... +initializing multgrid element volumes at level 4... +initializing multgrid element volumes at level 5... +Initializing solvers for solve block 0 ... + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist +initializing grid refiner... grid refinment disabled... +solving 0th timestep for solve block 0 ... + solving auxiliary variables... + solving linear time-independent variables... + solving self-nonlinear time-independent variables... + solving co-nonlinear time-independent variables... + solving postprocessed variables... outputting initial condition... - -Iteration: 1 +Iteration: 0 Solution index 0 l2-norm: 8.26236 integrated value: 0.212207 Solution index 1 l2-norm: 110.016 integrated value: 3.07008 Solution index 2 l2-norm: 2.60707e-14 integrated value: 4.37998e-16 -Serial: Initialization - 0.108282s (0.108282s/call, 1 calls) -Serial: Solve Increment - 0.00293078s (0.00293078s/call, 1 calls) + +Serial: Auxiliary solver - 2.374e-06s (2.374e-06s/call, 1 calls) +Serial: Create FESystem - 0.000407238s (0.000407238s/call, 1 calls) +Serial: Create constraints - 0.00218222s (0.00218222s/call, 1 calls) +Serial: Generate mesh - 0.00691473s (0.00691473s/call, 1 calls) +Serial: Initialization - 0.0502018s (0.0502018s/call, 1 calls) +Serial: Nonexplicit co-nonlinear solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Nonexplicit linear solver - 0.00580818s (0.00580818s/call, 1 calls) +Serial: Nonexplicit self-nonlinear solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Output - 0.0203049s (0.0203049s/call, 1 calls) +Serial: Postprocess solver - 0.000118728s (0.000118728s/call, 1 calls) +Serial: Solver initialization - 0.00474438s (0.00474438s/call, 1 calls) +Serial: Update ghosts - 2.4933e-05s (8.311e-06s/call, 3 calls) +Serial: Zero ghosts - 4.75e-06s (2.375e-06s/call, 2 calls) +Serial: compute element volumes - 0.0006815s (0.0006815s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.00513737s (0.00513737s/call, 1 calls) +Serial: reinitialize element volumes - 1.6622e-05s (1.6622e-05s/call, 1 calls) +Serial: reinitialize invm - 4.1555e-05s (4.1555e-05s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.00334813s (0.00334813s/call, 1 calls) +Serial: reinitialize solution set - 0.000245768s (0.000245768s/call, 1 calls) diff --git a/tests/regression_tests/linear_solve_old_solution/gold_output.txt b/tests/regression_tests/linear_solve_old_solution/gold_output.txt index fda6664f9..aaa15ad7d 100644 --- a/tests/regression_tests/linear_solve_old_solution/gold_output.txt +++ b/tests/regression_tests/linear_solve_old_solution/gold_output.txt @@ -1,7 +1,7 @@ Using the input parameter file: parameters.prm Number of constants: 0 Number of variables: 2 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... @@ -18,18 +18,11 @@ initializing element volumes... initializing multgrid element volumes at level 0... initializing multgrid element volumes at level 1... initializing multgrid element volumes at level 2... -initializing solvers for solve block 0 ... - trying to initialize concurrent constant solvers... +Initializing solvers for solve block 0 ... no fields for this solver exist - trying to initialize concurrent explicit solvers... no fields for this solver exist - trying to initialize concurrent explicit postprocess solvers... - trying to initialize sequential auxiliary solvers... no fields for this solver exist - trying to initialize sequential linear solvers... - trying to initialize sequential self-nonlinear solvers... no fields for this solver exist - trying to initialize sequential co-nonlinear solvers... no fields for this solver exist initializing grid refiner... grid refinment disabled... solving 0th timestep for solve block 0 ... @@ -48,26 +41,26 @@ Iteration: 1 Solution index 0 l2-norm: 3.06186 integrated value: 5000 Solution index 1 l2-norm: 2.23607 integrated value: 1250 -Serial: Auxiliary solver - 7.62e-07s (7.62e-07s/call, 1 calls) -Serial: Create FESystem - 0.000771072s (0.000771072s/call, 1 calls) -Serial: Create constraints - 0.00107135s (0.00107135s/call, 1 calls) -Serial: Explicit solver - 1.027e-06s (1.027e-06s/call, 1 calls) -Serial: Generate mesh - 0.00144655s (0.00144655s/call, 1 calls) -Serial: Initialization - 0.0259009s (0.0259009s/call, 1 calls) -Serial: Nonexplicit auxiliary solver - 8.89e-07s (8.89e-07s/call, 1 calls) -Serial: Nonexplicit co-nonlinear solver - 1.524e-06s (7.62e-07s/call, 2 calls) -Serial: Nonexplicit linear solver - 0.000477025s (0.000238513s/call, 2 calls) -Serial: Nonexplicit self-nonlinear solver - 1.683e-06s (8.415e-07s/call, 2 calls) -Serial: Output - 0.0123392s (0.00616959s/call, 2 calls) -Serial: Postprocess solver - 5.7328e-05s (2.8664e-05s/call, 2 calls) -Serial: Solve Increment - 0.000497521s (0.000497521s/call, 1 calls) -Serial: Solver initialization - 0.0011875s (0.0011875s/call, 1 calls) -Serial: Update ghosts - 3.302e-06s (8.255e-07s/call, 4 calls) -Serial: Update time-dependent constraints - 6.46e-07s (6.46e-07s/call, 1 calls) -Serial: Zero ghosts - 3.894e-06s (9.735e-07s/call, 4 calls) -Serial: compute element volumes - 0.000279253s (0.000279253s/call, 1 calls) -Serial: reinitialize DoFHandlers - 0.00173238s (0.00173238s/call, 1 calls) -Serial: reinitialize element volumes - 3.4653e-05s (3.4653e-05s/call, 1 calls) -Serial: reinitialize invm - 3.7965e-05s (3.7965e-05s/call, 1 calls) -Serial: reinitialize matrix-free objects - 0.0118873s (0.0118873s/call, 1 calls) -Serial: reinitialize solution set - 0.000106096s (0.000106096s/call, 1 calls) +Serial: Auxiliary solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Create FESystem - 0.000427422s (0.000427422s/call, 1 calls) +Serial: Create constraints - 0.00077767s (0.00077767s/call, 1 calls) +Serial: Explicit solver - 2.374e-06s (2.374e-06s/call, 1 calls) +Serial: Generate mesh - 0.00192577s (0.00192577s/call, 1 calls) +Serial: Initialization - 0.0265951s (0.0265951s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Nonexplicit co-nonlinear solver - 2.374e-06s (1.187e-06s/call, 2 calls) +Serial: Nonexplicit linear solver - 0.000720681s (0.00036034s/call, 2 calls) +Serial: Nonexplicit self-nonlinear solver - 2.375e-06s (1.1875e-06s/call, 2 calls) +Serial: Output - 0.0241137s (0.0120568s/call, 2 calls) +Serial: Postprocess solver - 6.0551e-05s (3.02755e-05s/call, 2 calls) +Serial: Solve Increment - 0.000780044s (0.000780044s/call, 1 calls) +Serial: Solver initialization - 0.00147935s (0.00147935s/call, 1 calls) +Serial: Update ghosts - 1.7809e-05s (4.45225e-06s/call, 4 calls) +Serial: Update time-dependent constraints - 2.374e-06s (2.374e-06s/call, 1 calls) +Serial: Zero ghosts - 7.123e-06s (1.78075e-06s/call, 4 calls) +Serial: compute element volumes - 0.00018759s (0.00018759s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.00227483s (0.00227483s/call, 1 calls) +Serial: reinitialize element volumes - 2.1371e-05s (2.1371e-05s/call, 1 calls) +Serial: reinitialize invm - 0.000112792s (0.000112792s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.00175005s (0.00175005s/call, 1 calls) +Serial: reinitialize solution set - 0.000124664s (0.000124664s/call, 1 calls) diff --git a/tests/regression_tests/mechanics/gold_output.txt b/tests/regression_tests/mechanics/gold_output.txt index d2cd4f921..3e7c158e2 100644 --- a/tests/regression_tests/mechanics/gold_output.txt +++ b/tests/regression_tests/mechanics/gold_output.txt @@ -1,39 +1,60 @@ Using the input parameter file: parameters.prm Number of constants: 1 Number of variables: 1 -================================================ - MGInfo -================================================ - Global min = 0 and max = 4 - LHS dependency fields: - Index 0 Type Change Min 0 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... creating DoFHandlers... number of degrees of freedom: 14739 - with multigrid levels: 32145 + with multigrid levels: 32121 creating constraints... -creating multigrid constraints... -initializing matrix-free objects... -initializing multgrid matrix-free object at level 0... -initializing multgrid matrix-free object at level 1... -initializing multgrid matrix-free object at level 2... -initializing multgrid matrix-free object at level 3... -initializing multgrid matrix-free object at level 4... +creating multigrid constraints at level 1... +creating multigrid constraints at level 2... +creating multigrid constraints at level 3... +creating multigrid constraints at level 4... initializing solution set... initializing invm... initializing element volumes... -initializing solvers... -solving auxiliary variables in 0th timestep... -solving linear time-independent variables in 0th timestep... -solving self-nonlinear time-independent variables in 0th timestep... -solving postprocessed variables in 0th timestep... +initializing multgrid element volumes at level 1... +initializing multgrid element volumes at level 2... +initializing multgrid element volumes at level 3... +initializing multgrid element volumes at level 4... +Initializing solvers for solve block 0 ... + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist +initializing grid refiner... grid refinment disabled... +solving 0th timestep for solve block 0 ... + solving auxiliary variables... + solving linear time-independent variables... + solving self-nonlinear time-independent variables... + solving co-nonlinear time-independent variables... + solving postprocessed variables... outputting initial condition... +Iteration: 0 + Solution index 0 l2-norm: 41.9487 integrated value: -500000 -1.34155e-10 -1.81899e-11 -Iteration: 1 - Solution index 0 l2-norm: 41.9487 integrated value: -500000 -1.27518e-10 5.63907e-11 -Serial: Initialization - 0.346098s (0.346098s/call, 1 calls) -Serial: Solve Increment - 0.00289086s (0.00289086s/call, 1 calls) +Serial: Auxiliary solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Create FESystem - 0.00058177s (0.00058177s/call, 1 calls) +Serial: Create constraints - 0.00576784s (0.00576784s/call, 1 calls) +Serial: Generate mesh - 0.0270369s (0.0270369s/call, 1 calls) +Serial: Initialization - 0.12368s (0.12368s/call, 1 calls) +Serial: Nonexplicit co-nonlinear solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Nonexplicit linear solver - 0.0475069s (0.0475069s/call, 1 calls) +Serial: Nonexplicit self-nonlinear solver - 2.375e-06s (2.375e-06s/call, 1 calls) +Serial: Output - 0.0243073s (0.0243073s/call, 1 calls) +Serial: Postprocess solver - 2.375e-06s (2.375e-06s/call, 1 calls) +Serial: Solver initialization - 0.0064256s (0.0064256s/call, 1 calls) +Serial: Update ghosts - 6.6488e-05s (3.3244e-05s/call, 2 calls) +Serial: Zero ghosts - 2.375e-06s (2.375e-06s/call, 1 calls) +Serial: compute element volumes - 0.00112436s (0.00112436s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.00448557s (0.00448557s/call, 1 calls) +Serial: reinitialize element volumes - 1.306e-05s (1.306e-05s/call, 1 calls) +Serial: reinitialize invm - 4.749e-06s (4.749e-06s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.00604092s (0.00604092s/call, 1 calls) +Serial: reinitialize solution set - 8.0735e-05s (8.0735e-05s/call, 1 calls) diff --git a/tests/regression_tests/precipitate_explicit/gold_output.txt b/tests/regression_tests/precipitate_explicit/gold_output.txt index 7a632c771..174e80116 100644 --- a/tests/regression_tests/precipitate_explicit/gold_output.txt +++ b/tests/regression_tests/precipitate_explicit/gold_output.txt @@ -1,7 +1,7 @@ Using the input parameter file: parameters.prm Number of constants: 21 Number of variables: 6 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... @@ -15,29 +15,43 @@ creating multigrid constraints at level 2... creating multigrid constraints at level 3... creating multigrid constraints at level 4... creating multigrid constraints at level 5... -initializing matrix-free objects... -initializing multgrid matrix-free object at level 0... -initializing multgrid matrix-free object at level 1... -initializing multgrid matrix-free object at level 2... -initializing multgrid matrix-free object at level 3... -initializing multgrid matrix-free object at level 4... -initializing multgrid matrix-free object at level 5... initializing solution set... initializing invm... initializing element volumes... -initializing solvers... -solving auxiliary variables in 0th timestep... -solving linear time-independent variables in 0th timestep... -solving self-nonlinear time-independent variables in 0th timestep... -solving postprocessed variables in 0th timestep... +initializing multgrid element volumes at level 0... +initializing multgrid element volumes at level 1... +initializing multgrid element volumes at level 2... +initializing multgrid element volumes at level 3... +initializing multgrid element volumes at level 4... +initializing multgrid element volumes at level 5... +Initializing solvers for solve block 0 ... + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist + no fields for this solver exist +initializing grid refiner... grid refinment disabled... +solving 0th timestep for solve block 0 ... + solving auxiliary variables... + solving linear time-independent variables... + solving self-nonlinear time-independent variables... + solving co-nonlinear time-independent variables... + solving postprocessed variables... outputting initial condition... +Iteration: 0 + Solution index 0 l2-norm: 7.72 integrated value: 64 + Solution index 1 l2-norm: 27.8326 integrated value: 40.1673 + Solution index 2 l2-norm: 19.6806 integrated value: 20.0837 + Solution index 3 l2-norm: 19.6806 integrated value: 20.0837 + Solution index 4 l2-norm: 3.42424 integrated value: -0.73956 0.73956 + Solution index 5 l2-norm: 357.19 integrated value: -2961.1 + Iteration: 10 Solution index 0 l2-norm: 7.74656 integrated value: 64 Solution index 1 l2-norm: 27.2076 integrated value: 39.1555 Solution index 2 l2-norm: 19.2362 integrated value: 19.5736 Solution index 3 l2-norm: 19.2356 integrated value: 19.5725 - Solution index 4 l2-norm: 3.32301 integrated value: -0.713794 0.712972 + Solution index 4 l2-norm: 3.32301 integrated value: -0.713791 0.712968 Solution index 5 l2-norm: 357.284 integrated value: -2961.81 Iteration: 20 @@ -45,7 +59,7 @@ Iteration: 20 Solution index 1 l2-norm: 26.6332 integrated value: 38.1392 Solution index 2 l2-norm: 18.8276 integrated value: 19.0613 Solution index 3 l2-norm: 18.8264 integrated value: 19.0591 - Solution index 4 l2-norm: 3.22758 integrated value: -0.689256 0.687678 + Solution index 4 l2-norm: 3.22758 integrated value: -0.689252 0.687675 Solution index 5 l2-norm: 357.349 integrated value: -2962.27 Iteration: 30 @@ -53,7 +67,7 @@ Iteration: 30 Solution index 1 l2-norm: 26.091 integrated value: 37.1381 Solution index 2 l2-norm: 18.4419 integrated value: 18.5568 Solution index 3 l2-norm: 18.4401 integrated value: 18.5536 - Solution index 4 l2-norm: 3.13715 integrated value: -0.66595 0.6637 + Solution index 4 l2-norm: 3.13715 integrated value: -0.665947 0.663696 Solution index 5 l2-norm: 357.403 integrated value: -2962.63 Iteration: 40 @@ -61,7 +75,7 @@ Iteration: 40 Solution index 1 l2-norm: 25.5745 integrated value: 36.1616 Solution index 2 l2-norm: 18.0745 integrated value: 18.065 Solution index 3 l2-norm: 18.0721 integrated value: 18.0608 - Solution index 4 l2-norm: 3.05131 integrated value: -0.643846 0.641 + Solution index 4 l2-norm: 3.05131 integrated value: -0.643843 0.640997 Solution index 5 l2-norm: 357.45 integrated value: -2962.94 Iteration: 50 @@ -69,8 +83,29 @@ Iteration: 50 Solution index 1 l2-norm: 25.0805 integrated value: 35.2155 Solution index 2 l2-norm: 17.7228 integrated value: 17.5884 Solution index 3 l2-norm: 17.72 integrated value: 17.5833 - Solution index 4 l2-norm: 2.96978 integrated value: -0.622903 0.619528 + Solution index 4 l2-norm: 2.96978 integrated value: -0.6229 0.619525 Solution index 5 l2-norm: 357.491 integrated value: -2963.21 -Serial: Initialization - 1.40914s (1.40914s/call, 1 calls) -Serial: Solve Increment - 27.0655s (0.54131s/call, 50 calls) +Serial: Auxiliary solver - 1.187e-06s (1.187e-06s/call, 1 calls) +Serial: Create FESystem - 0.00060433s (0.00060433s/call, 1 calls) +Serial: Create constraints - 0.00936414s (0.00936414s/call, 1 calls) +Serial: Explicit solver - 0.167577s (0.00335155s/call, 50 calls) +Serial: Generate mesh - 0.032597s (0.032597s/call, 1 calls) +Serial: Initialization - 0.387976s (0.387976s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 9.7359e-05s (1.94718e-06s/call, 50 calls) +Serial: Nonexplicit co-nonlinear solver - 9.2611e-05s (1.8159e-06s/call, 51 calls) +Serial: Nonexplicit linear solver - 3.86509s (0.0757861s/call, 51 calls) +Serial: Nonexplicit self-nonlinear solver - 0.000111599s (2.18822e-06s/call, 51 calls) +Serial: Output - 0.343993s (0.0573322s/call, 6 calls) +Serial: Postprocess solver - 0.0122789s (0.00204649s/call, 6 calls) +Serial: Solve Increment - 3.94719s (0.0789438s/call, 50 calls) +Serial: Solver initialization - 0.142352s (0.142352s/call, 1 calls) +Serial: Update ghosts - 0.00499967s (4.62932e-05s/call, 108 calls) +Serial: Update time-dependent constraints - 0.000105665s (2.1133e-06s/call, 50 calls) +Serial: Zero ghosts - 0.00051528s (4.8157e-06s/call, 107 calls) +Serial: compute element volumes - 0.0019614s (0.0019614s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.0249829s (0.0249829s/call, 1 calls) +Serial: reinitialize element volumes - 1.6622e-05s (1.6622e-05s/call, 1 calls) +Serial: reinitialize invm - 0.000151973s (0.000151973s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.018321s (0.018321s/call, 1 calls) +Serial: reinitialize solution set - 0.0010092s (0.0010092s/call, 1 calls) diff --git a/tests/regression_tests/run.py b/tests/regression_tests/run.py index 854bdb040..27a9f2cf0 100644 --- a/tests/regression_tests/run.py +++ b/tests/regression_tests/run.py @@ -13,7 +13,7 @@ executable_name = "main-release" # Tolerance -tolerance = 1e-12 +tolerance = 1e-10 # Mapping from the application name to the absolute directory path app_map = {} @@ -178,8 +178,7 @@ def __eq__(self, value): f"Iterations are not equal ({self.iterations} != {value.iterations})", "Error", ) - # TODO: Enable this after re-running gold benchmarks - # return False + return False for index in range(self.n_variables): if self.field_l2_norm[index].size != value.field_l2_norm[ diff --git a/tests/regression_tests/solution_blocks/gold_output.txt b/tests/regression_tests/solution_blocks/gold_output.txt index d200a5a43..a7ee0be3d 100644 --- a/tests/regression_tests/solution_blocks/gold_output.txt +++ b/tests/regression_tests/solution_blocks/gold_output.txt @@ -1,7 +1,7 @@ Using the input parameter file: parameters.prm Number of constants: 0 Number of variables: 2 -number of processes: 1 +number of processes: 2 vectorization over 2 doubles = 128 bits (SSE2) creating FESystem... creating triangulation... @@ -11,33 +11,19 @@ creating constraints... initializing solution set... initializing invm... initializing element volumes... -initializing solvers for solve block 0 ... - trying to initialize concurrent constant solvers... +Initializing solvers for solve block 0 ... no fields for this solver exist - trying to initialize concurrent explicit solvers... - trying to initialize concurrent explicit postprocess solvers... no fields for this solver exist - trying to initialize sequential auxiliary solvers... no fields for this solver exist - trying to initialize sequential linear solvers... no fields for this solver exist - trying to initialize sequential self-nonlinear solvers... no fields for this solver exist - trying to initialize sequential co-nonlinear solvers... no fields for this solver exist -initializing solvers for solve block 1 ... - trying to initialize concurrent constant solvers... +Initializing solvers for solve block 1 ... no fields for this solver exist - trying to initialize concurrent explicit solvers... - trying to initialize concurrent explicit postprocess solvers... no fields for this solver exist - trying to initialize sequential auxiliary solvers... no fields for this solver exist - trying to initialize sequential linear solvers... no fields for this solver exist - trying to initialize sequential self-nonlinear solvers... no fields for this solver exist - trying to initialize sequential co-nonlinear solvers... no fields for this solver exist initializing grid refiner... grid refinment disabled... solving 0th timestep for solve block 0 ... @@ -62,26 +48,26 @@ Iteration: 1 Solution index 0 l2-norm: 2 integrated value: 10000 Solution index 1 l2-norm: 0 integrated value: 0 -Serial: Auxiliary solver - 1.319e-06s (6.595e-07s/call, 2 calls) -Serial: Create FESystem - 0.000780017s (0.000780017s/call, 1 calls) -Serial: Create constraints - 8.5285e-05s (8.5285e-05s/call, 1 calls) -Serial: Explicit solver - 5.4544e-05s (2.7272e-05s/call, 2 calls) -Serial: Generate mesh - 0.000455482s (0.000455482s/call, 1 calls) -Serial: Initialization - 0.0254776s (0.0254776s/call, 1 calls) -Serial: Nonexplicit auxiliary solver - 1.404e-06s (7.02e-07s/call, 2 calls) -Serial: Nonexplicit co-nonlinear solver - 2.744e-06s (6.86e-07s/call, 4 calls) -Serial: Nonexplicit linear solver - 2.809e-06s (7.0225e-07s/call, 4 calls) -Serial: Nonexplicit self-nonlinear solver - 2.628e-06s (6.57e-07s/call, 4 calls) -Serial: Output - 0.0243123s (0.0121561s/call, 2 calls) -Serial: Postprocess solver - 2.35e-06s (5.875e-07s/call, 4 calls) -Serial: Solve Increment - 8.1371e-05s (8.1371e-05s/call, 1 calls) -Serial: Solver initialization - 0.000559727s (0.000559727s/call, 1 calls) -Serial: Update ghosts - 3.744e-06s (1.248e-06s/call, 3 calls) -Serial: Update time-dependent constraints - 6.27e-07s (6.27e-07s/call, 1 calls) -Serial: Zero ghosts - 3.021e-06s (1.5105e-06s/call, 2 calls) -Serial: compute element volumes - 0.000152945s (0.000152945s/call, 1 calls) -Serial: reinitialize DoFHandlers - 0.000663648s (0.000663648s/call, 1 calls) -Serial: reinitialize element volumes - 1.0914e-05s (1.0914e-05s/call, 1 calls) -Serial: reinitialize invm - 3.9281e-05s (3.9281e-05s/call, 1 calls) -Serial: reinitialize matrix-free objects - 0.00336296s (0.00336296s/call, 1 calls) -Serial: reinitialize solution set - 5.2864e-05s (5.2864e-05s/call, 1 calls) +Serial: Auxiliary solver - 2.374e-06s (1.187e-06s/call, 2 calls) +Serial: Create FESystem - 0.000379931s (0.000379931s/call, 1 calls) +Serial: Create constraints - 8.1923e-05s (8.1923e-05s/call, 1 calls) +Serial: Explicit solver - 7.9547e-05s (3.97735e-05s/call, 2 calls) +Serial: Generate mesh - 0.00065182s (0.00065182s/call, 1 calls) +Serial: Initialization - 0.0205614s (0.0205614s/call, 1 calls) +Serial: Nonexplicit auxiliary solver - 2.374e-06s (1.187e-06s/call, 2 calls) +Serial: Nonexplicit co-nonlinear solver - 1.0685e-05s (2.67125e-06s/call, 4 calls) +Serial: Nonexplicit linear solver - 5.936e-06s (1.484e-06s/call, 4 calls) +Serial: Nonexplicit self-nonlinear solver - 5.936e-06s (1.484e-06s/call, 4 calls) +Serial: Output - 0.0245115s (0.0122558s/call, 2 calls) +Serial: Postprocess solver - 5.937e-06s (1.48425e-06s/call, 4 calls) +Serial: Solve Increment - 0.000157909s (0.000157909s/call, 1 calls) +Serial: Solver initialization - 0.000661318s (0.000661318s/call, 1 calls) +Serial: Update ghosts - 4.749e-06s (1.583e-06s/call, 3 calls) +Serial: Update time-dependent constraints - 2.374e-06s (2.374e-06s/call, 1 calls) +Serial: Zero ghosts - 2.374e-06s (1.187e-06s/call, 2 calls) +Serial: compute element volumes - 0.00019709s (0.00019709s/call, 1 calls) +Serial: reinitialize DoFHandlers - 0.000728994s (0.000728994s/call, 1 calls) +Serial: reinitialize element volumes - 3.561e-06s (3.561e-06s/call, 1 calls) +Serial: reinitialize invm - 2.7308e-05s (2.7308e-05s/call, 1 calls) +Serial: reinitialize matrix-free objects - 0.000354998s (0.000354998s/call, 1 calls) +Serial: reinitialize solution set - 5.2241e-05s (5.2241e-05s/call, 1 calls) From 9abbfdb2fc9db4d9ed66453996252750d0213840 Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 6 Oct 2025 18:53:38 -0700 Subject: [PATCH 08/17] updating workflows and compile all applications target --- .github/workflows/compile_applications.yml | 7 +- .github/workflows/linux.yml | 4 ++ CMakeLists.txt | 6 ++ applications/CMakeLists.txt | 64 +++++++++++++++++++ .../CMakeLists.txt | 30 ++++----- .../allen_cahn_explicit/CMakeLists.txt | 30 ++++----- .../alloy_solidification/CMakeLists.txt | 30 ++++----- .../cahn_hilliard_explicit/CMakeLists.txt | 30 ++++----- .../CMakeLists.txt | 30 ++++----- applications/eshelby_inclusion/CMakeLists.txt | 30 ++++----- applications/nucleation/CMakeLists.txt | 30 ++++----- .../precipitate_evolution/CMakeLists.txt | 30 ++++----- .../spinodal_decomposition/CMakeLists.txt | 30 ++++----- cmake/setup_cached_variables.cmake | 3 + cmake/write_config.cmake | 1 + 15 files changed, 207 insertions(+), 148 deletions(-) create mode 100644 applications/CMakeLists.txt diff --git a/.github/workflows/compile_applications.yml b/.github/workflows/compile_applications.yml index dcd763939..cea8692fa 100644 --- a/.github/workflows/compile_applications.yml +++ b/.github/workflows/compile_applications.yml @@ -39,16 +39,15 @@ jobs: - name: Compile PRISMS-PF run: | - cmake -G Ninja . + cmake -G Ninja -D BUILD_APPLICATIONS=ON . ninja -j $(nproc) - - name: Compile PRISMS-PF applications timeout-minutes: 30 run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + export PRISMS_PF_DIR=$PWD/install - cd tests/automatic_tests - python3 application_debug_test.py --no-run + ninja -j $(nproc) install diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 82f023f5b..133a9a0d5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -55,6 +55,7 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + export PRISMS_PF_DIR=$PWD/install ninja install @@ -63,6 +64,7 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + export PRISMS_PF_DIR=$PWD/install cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON -D N_THREADS=2. ninja install @@ -96,6 +98,7 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + export PRISMS_PF_DIR=$PWD/install ninja install @@ -104,6 +107,7 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + export PRISMS_PF_DIR=$PWD/install cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON -D N_THREADS=2. ninja install diff --git a/CMakeLists.txt b/CMakeLists.txt index 9daed4855..9a198a43c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,6 +367,12 @@ if(REGRESSION_TESTS) add_subdirectory(tests/regression_tests) endif() +# Applications +if(BUILD_APPLICATIONS) + # Compile each of the applications + add_subdirectory(applications) +endif() + # ========================================================= # Final steps # ========================================================= diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt new file mode 100644 index 000000000..1c6973f73 --- /dev/null +++ b/applications/CMakeLists.txt @@ -0,0 +1,64 @@ +## +# CMake for PRISMS-PF applications +## + +message(STATUS "Setting up PRISMS-PF applications...") + +# A list of the applications +set(APPLICATIONS + allen_cahn_explicit + alloy_solidification + blank + cahn_hilliard_explicit + coupled_allen_cahn_cahn_hilliard + eshelby_inclusion + MgNd_precipitate_single_Bppp + nucleation + precipitate_evolution + spinodal_decomposition +) + +# For each regression application install the source files, configure, and compile +foreach(app ${APPLICATIONS}) + # Install the source files + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${app}/ + DESTINATION ${CMAKE_INSTALL_PREFIX}/applications/${app} + FILES_MATCHING + PATTERN "CMakeFiles*" EXCLUDE + PATTERN "*.in" + PATTERN "*.cc" + PATTERN "*.h" + PATTERN "*.prm" + PATTERN "CMakeLists.txt" + PATTERN "*.md" + ) + + # Compile during installation + install( + CODE + " + message(STATUS \"Building regression test: ${app}\") + execute_process( + COMMAND ${CMAKE_COMMAND} + -S ${CMAKE_INSTALL_PREFIX}/applications/${app}/ + WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/applications/${app} + RESULT_VARIABLE configure_result + ) + if(configure_result) + message(WARNING \"Failed to configure application: ${app}\") + else() + execute_process( + COMMAND ${CMAKE_COMMAND} --build . + WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/applications/${app} + RESULT_VARIABLE compile_result + ) + if(compile_result) + message(WARNING \"Failed to compile application: ${app}\") + endif() + endif() + " + ) +endforeach() + +message(STATUS "PRISMS-PF applications setup complete.") \ No newline at end of file diff --git a/applications/MgNd_precipitate_single_Bppp/CMakeLists.txt b/applications/MgNd_precipitate_single_Bppp/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/MgNd_precipitate_single_Bppp/CMakeLists.txt +++ b/applications/MgNd_precipitate_single_Bppp/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/allen_cahn_explicit/CMakeLists.txt b/applications/allen_cahn_explicit/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/allen_cahn_explicit/CMakeLists.txt +++ b/applications/allen_cahn_explicit/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/alloy_solidification/CMakeLists.txt b/applications/alloy_solidification/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/alloy_solidification/CMakeLists.txt +++ b/applications/alloy_solidification/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/cahn_hilliard_explicit/CMakeLists.txt b/applications/cahn_hilliard_explicit/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/cahn_hilliard_explicit/CMakeLists.txt +++ b/applications/cahn_hilliard_explicit/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/coupled_allen_cahn_cahn_hilliard/CMakeLists.txt b/applications/coupled_allen_cahn_cahn_hilliard/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/coupled_allen_cahn_cahn_hilliard/CMakeLists.txt +++ b/applications/coupled_allen_cahn_cahn_hilliard/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/eshelby_inclusion/CMakeLists.txt b/applications/eshelby_inclusion/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/eshelby_inclusion/CMakeLists.txt +++ b/applications/eshelby_inclusion/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/nucleation/CMakeLists.txt b/applications/nucleation/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/nucleation/CMakeLists.txt +++ b/applications/nucleation/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/precipitate_evolution/CMakeLists.txt b/applications/precipitate_evolution/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/precipitate_evolution/CMakeLists.txt +++ b/applications/precipitate_evolution/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/applications/spinodal_decomposition/CMakeLists.txt b/applications/spinodal_decomposition/CMakeLists.txt index aa05c1d61..5f34be6c0 100644 --- a/applications/spinodal_decomposition/CMakeLists.txt +++ b/applications/spinodal_decomposition/CMakeLists.txt @@ -1,25 +1,23 @@ ## # CMake script for the PRISMS-PF applications -# Adapted from the ASPECT CMake file ## cmake_minimum_required(VERSION 3.13.4) -# Get the core library's directory (3 levels up from the macro file) -get_filename_component( - PRISMS_PF_CORE_DIR - ${CMAKE_CURRENT_LIST_DIR}/../.. - ABSOLUTE -) - -# Include core library's configuration -include(${PRISMS_PF_CORE_DIR}/cmake/prisms_pf_config.cmake) - -# Include setup script -include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) - # Create a project for the application project(myapp CXX) -# Set up the application -prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +# Find the PRISMS-PF package +find_package(prisms_pf QUIET HINTS ${PRISMS_PF_DIR} $ENV{PRISMS_PF_DIR}) +if(PRISMS_PF_FOUND) + # Include setup script + include(${PRISMS_PF_CORE_DIR}/cmake/setup_application.cmake) + + # Set up the application + prisms_pf_autopilot(${PRISMS_PF_CORE_DIR}) +else() + message( + FATAL_ERROR + "PRISMS-PF package not found. Please make sure it is in path." + ) +endif() diff --git a/cmake/setup_cached_variables.cmake b/cmake/setup_cached_variables.cmake index dd5e789f5..69b2fb7a8 100644 --- a/cmake/setup_cached_variables.cmake +++ b/cmake/setup_cached_variables.cmake @@ -13,6 +13,9 @@ message(STATUS "UNIT_TESTS = ${UNIT_TESTS}") option(REGRESSION_TESTS "Whether to build the regression tests or not." OFF) message(STATUS "REGRESSION_TESTS = ${REGRESSION_TESTS}") +option(BUILD_APPLICATIONS "Whether to build all the pre-built applications or not." OFF) +message(STATUS "BUILD_APPLICATIONS = ${BUILD_APPLICATIONS}") + option( 64BIT_INDICES "Whether to compile PRISMS-PF with 64-bit numbers for large simulations" diff --git a/cmake/write_config.cmake b/cmake/write_config.cmake index 7849b55f6..540006ab0 100644 --- a/cmake/write_config.cmake +++ b/cmake/write_config.cmake @@ -69,6 +69,7 @@ write_to_both("# # # UNIT_TESTS: ${UNIT_TESTS} # REGRESSION_TESTS: ${REGRESSION_TESTS} +# BUILD_APPLICATIONS ${BUILD_APPLICATIONS} # 64BIT_INDICES: ${64BIT_INDICES} # ADDITIONAL_OPTIMIZATIONS: ${ADDITIONAL_OPTIMIZATIONS} # ADDITIONAL_DEGREES: ${ADDITIONAL_DEGREES} From 6edd35344e11b73339f4742c2cbd5fdbc0ea71df Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 6 Oct 2025 19:15:52 -0700 Subject: [PATCH 09/17] updating workflows --- .github/workflows/compile_applications.yml | 6 +++-- .github/workflows/linux.yml | 31 ++++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/compile_applications.yml b/.github/workflows/compile_applications.yml index cea8692fa..24711d0a4 100644 --- a/.github/workflows/compile_applications.yml +++ b/.github/workflows/compile_applications.yml @@ -39,7 +39,10 @@ jobs: - name: Compile PRISMS-PF run: | - cmake -G Ninja -D BUILD_APPLICATIONS=ON . + cmake -G Ninja \ + -D BUILD_APPLICATIONS=ON \ + -D CMAKE_INSTALL_PREFIX=/usr/local \ + . ninja -j $(nproc) - name: Compile PRISMS-PF applications @@ -47,7 +50,6 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - export PRISMS_PF_DIR=$PWD/install ninja -j $(nproc) install diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 133a9a0d5..3e3bdc8c1 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -40,7 +40,11 @@ jobs: - name: Compile PRISMS-PF run: | - cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON . + cmake -G Ninja \ + -D UNIT_TESTS=ON \ + -D REGRESSION_TESTS=ON \ + -D CMAKE_INSTALL_PREFIX=/usr/local \ + . ninja -j $(nproc) - name: Run PRISMS-PF unit tests @@ -55,7 +59,6 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - export PRISMS_PF_DIR=$PWD/install ninja install @@ -64,9 +67,13 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - export PRISMS_PF_DIR=$PWD/install - cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON -D N_THREADS=2. + cmake -G Ninja \ + -D UNIT_TESTS=ON \ + -D REGRESSION_TESTS=ON \ + -D N_THREADS=2 \ + -D CMAKE_INSTALL_PREFIX=/usr/local \ + . ninja install linux-optimizations: @@ -83,7 +90,12 @@ jobs: - name: Compile PRISMS-PF run: | - cmake -G Ninja -D ADDITIONAL_OPTIMIZATIONS=ON -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON . + cmake -G Ninja \ + -D ADDITIONAL_OPTIMIZATIONS=ON \ + -D UNIT_TESTS=ON \ + -D REGRESSION_TESTS=ON \ + -D CMAKE_INSTALL_PREFIX=/usr/local \ + . ninja -j $(nproc) - name: Run PRISMS-PF unit tests @@ -98,7 +110,6 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - export PRISMS_PF_DIR=$PWD/install ninja install @@ -107,7 +118,11 @@ jobs: run: | export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - export PRISMS_PF_DIR=$PWD/install - cmake -G Ninja -D UNIT_TESTS=ON -D REGRESSION_TESTS=ON -D N_THREADS=2. + cmake -G Ninja \ + -D UNIT_TESTS=ON \ + -D REGRESSION_TESTS=ON \ + -D N_THREADS=2 \ + -D CMAKE_INSTALL_PREFIX=/usr/local \ + . ninja install From 813f13ac39c4bacd6c6c530a13d4f206415f0664 Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 6 Oct 2025 19:42:18 -0700 Subject: [PATCH 10/17] fixes to cmake install interface --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a198a43c..ab43ed2ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,8 +264,8 @@ foreach(_build ${PRISMS_PF_BUILD_TYPES}) target_include_directories( ${_library} PUBLIC - $ - $ + $ + $ PRIVATE ${CMAKE_BINARY_DIR}/src ) @@ -323,8 +323,8 @@ install( # Install the headers install( - DIRECTORY ${CMAKE_BINARY_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/prisms_pf + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ + DESTINATION include/prisms_pf FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" From ab46121c281853e0386bd2c8639c0742bc9d0816 Mon Sep 17 00:00:00 2001 From: landinjm Date: Mon, 6 Oct 2025 19:45:24 -0700 Subject: [PATCH 11/17] removing sign conversion warning --- cmake/setup_prisms_pf.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/setup_prisms_pf.cmake b/cmake/setup_prisms_pf.cmake index ab6de0af2..820279849 100644 --- a/cmake/setup_prisms_pf.cmake +++ b/cmake/setup_prisms_pf.cmake @@ -79,7 +79,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC -Wextra -Wpedantic -Wconversion - -Wsign-conversion + # -Wsign-conversion # This is disabled because deal.II uses int when it should be uint so it just produces a lot of noise for limited utility -Wshadow -Wnon-virtual-dtor -Wold-style-cast @@ -102,7 +102,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Clang/AppleClang -Wextra -Wpedantic -Wconversion - -Wsign-conversion + # -Wsign-conversion # This is disabled because deal.II uses int when it should be uint so it just produces a lot of noise for limited utility -Wshadow -Wnon-virtual-dtor -Wold-style-cast @@ -137,7 +137,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") # Newer Intel oneAPI compiler -Wextra -Wpedantic -Wconversion - -Wsign-conversion + # -Wsign-conversion # This is disabled because deal.II uses int when it should be uint so it just produces a lot of noise for limited utility -Wshadow -Wnon-virtual-dtor -Wold-style-cast From b8b6eb3738d47d7ba7306a330e9963dfc49fdb0d Mon Sep 17 00:00:00 2001 From: landinjm Date: Tue, 7 Oct 2025 09:09:37 -0700 Subject: [PATCH 12/17] update the dir here --- tests/regression_tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/regression_tests/CMakeLists.txt b/tests/regression_tests/CMakeLists.txt index eb7afe326..cbad1521f 100644 --- a/tests/regression_tests/CMakeLists.txt +++ b/tests/regression_tests/CMakeLists.txt @@ -74,6 +74,7 @@ install(CODE " execute_process( COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run.py -j ${N_THREADS} + -d ${CMAKE_INSTALL_PREFIX}/tests/regression_tests ${REGRESSION_TEST_APPS} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE run_result From f22f9f12c68b9a762af145770413a39ce842d1f1 Mon Sep 17 00:00:00 2001 From: landinjm Date: Tue, 7 Oct 2025 09:11:17 -0700 Subject: [PATCH 13/17] fix target here --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab43ed2ae..59bca16d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,7 +391,7 @@ configure_package_config_file( # Unwrap the compiler compile_commands.json after the build if(${UNWRAP_COMPILER} STREQUAL "ON") add_custom_command( - TARGET ${LIBRARY_NAME_DEBUG} + TARGET prisms_pf_debug POST_BUILD COMMAND /bin/bash From 54fbee1a48de93dae093ebf755167b038d0eeb12 Mon Sep 17 00:00:00 2001 From: landinjm Date: Tue, 7 Oct 2025 09:27:28 -0700 Subject: [PATCH 14/17] fixing flag append --- CMakeLists.txt | 2 +- cmake/macros/macro_append_flags.cmake | 13 +++++++++++++ cmake/modules/FindPRISMS_PF_DEAL_II.cmake | 9 --------- contrib/utilities/clang_tidy.sh | 2 +- contrib/utilities/cppcheck.sh | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 cmake/macros/macro_append_flags.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 59bca16d3..4a09e74b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ if(NOT PRISMS_PF_ADDITIONAL_CXX_FLAGS STREQUAL "") STATUS "Appending PRISMS_PF_ADDITIONAL_CXX_FLAGS: '${PRISMS_PF_ADDITIONAL_CXX_FLAGS}':" ) - string(APPEND PRISMS_PF_CXX_FLAGS " ${PRISMS_PF_ADDITIONAL_CXX_FLAGS}") + append_flags(PRISMS_PF_ADDITIONAL_CXX_FLAGS PRISMS_PF_CXX_FLAGS) message(STATUS " PRISMS_PF_WARNING_FLAGS: ${PRISMS_PF_WARNING_FLAGS}") message(STATUS " PRISMS_PF_CXX_FLAGS: ${PRISMS_PF_CXX_FLAGS}") message(STATUS " PRISMS_PF_CXX_FLAGS_DEBUG: ${PRISMS_PF_CXX_FLAGS_DEBUG}") diff --git a/cmake/macros/macro_append_flags.cmake b/cmake/macros/macro_append_flags.cmake new file mode 100644 index 000000000..71f99cf9f --- /dev/null +++ b/cmake/macros/macro_append_flags.cmake @@ -0,0 +1,13 @@ +# +# Split a string of flags into a list. For example, this would take +# something like `-Wall -Wpedantic` and turn it into `-Wall; -Wpedantic` +# + +macro(append_flags SOURCE_FLAGS DEST_FLAGS) + if(${SOURCE_FLAGS}) + separate_arguments(_temp_flags NATIVE_COMMAND "${${SOURCE_FLAGS}}") + foreach(flag IN LISTS _temp_flags) + list(APPEND ${DEST_FLAGS} "${flag}") + endforeach() + endif() +endmacro() \ No newline at end of file diff --git a/cmake/modules/FindPRISMS_PF_DEAL_II.cmake b/cmake/modules/FindPRISMS_PF_DEAL_II.cmake index 22f67163d..8e6f78031 100644 --- a/cmake/modules/FindPRISMS_PF_DEAL_II.cmake +++ b/cmake/modules/FindPRISMS_PF_DEAL_II.cmake @@ -70,15 +70,6 @@ if(PRISMS_PF_WITH_ZLIB) endif() endif() -macro(append_flags SOURCE_FLAGS DEST_FLAGS) - if(${SOURCE_FLAGS}) - separate_arguments(_temp_flags NATIVE_COMMAND "${${SOURCE_FLAGS}}") - foreach(flag IN LISTS _temp_flags) - list(APPEND ${DEST_FLAGS} "${flag}") - endforeach() - endif() -endmacro() - function(remove_std_flag variable_name) # Get the current value set(flags "${${variable_name}}") diff --git a/contrib/utilities/clang_tidy.sh b/contrib/utilities/clang_tidy.sh index 50c797133..af81c7995 100755 --- a/contrib/utilities/clang_tidy.sh +++ b/contrib/utilities/clang_tidy.sh @@ -39,7 +39,7 @@ for arg in "$@"; do done # Construct the cmake arguments -ARGS=("-D" "CMAKE_EXPORT_COMPILE_COMMANDS=ON" "-D" "CMAKE_BUILD_TYPE=Debug" "-D" "UNWRAP_COMPILER=ON" "-D" "PRISMS_PF_ADDITIONAL_CXX_FLAGS=-Wpedantic -Wall -Wextra" "${CMAKE_ARGS[@]}") +ARGS=("-D" "CMAKE_EXPORT_COMPILE_COMMANDS=ON" "-D" "CMAKE_BUILD_TYPE=Debug" "-D" "UNWRAP_COMPILER=ON" "${CMAKE_ARGS[@]}") # Compile if [ -f CMakeCache.txt ]; then diff --git a/contrib/utilities/cppcheck.sh b/contrib/utilities/cppcheck.sh index 746228680..c5822d735 100755 --- a/contrib/utilities/cppcheck.sh +++ b/contrib/utilities/cppcheck.sh @@ -35,7 +35,7 @@ for arg in "$@"; do done # Construct the cmake arguments -ARGS=("-D" "CMAKE_EXPORT_COMPILE_COMMANDS=ON" "-D" "CMAKE_BUILD_TYPE=Debug" "-D" "PRISMS_PF_ADDITIONAL_CXX_FLAGS=-Werror -Wpedantic -Wall -Wextra" "${CMAKE_ARGS[@]}") +ARGS=("-D" "CMAKE_EXPORT_COMPILE_COMMANDS=ON" "-D" "CMAKE_BUILD_TYPE=Debug" "-D" "${CMAKE_ARGS[@]}") # Compile if [ -f CMakeCache.txt ]; then From 45c50378ad52977118204ae9da759c1b2421049d Mon Sep 17 00:00:00 2001 From: landinjm Date: Tue, 7 Oct 2025 09:40:45 -0700 Subject: [PATCH 15/17] loosen relative tolerance --- tests/regression_tests/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/regression_tests/run.py b/tests/regression_tests/run.py index 27a9f2cf0..670688eb5 100644 --- a/tests/regression_tests/run.py +++ b/tests/regression_tests/run.py @@ -12,8 +12,8 @@ # Executable name. For now we will use release mode executable_name = "main-release" -# Tolerance -tolerance = 1e-10 +# Relative tolerance +tolerance = 1e-5 # Mapping from the application name to the absolute directory path app_map = {} From 9d9f1981c04558b1a187524e139ca1ab96db25ae Mon Sep 17 00:00:00 2001 From: landinjm Date: Tue, 7 Oct 2025 10:02:25 -0700 Subject: [PATCH 16/17] small typo --- contrib/utilities/cppcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/utilities/cppcheck.sh b/contrib/utilities/cppcheck.sh index c5822d735..d6d15a93b 100755 --- a/contrib/utilities/cppcheck.sh +++ b/contrib/utilities/cppcheck.sh @@ -35,7 +35,7 @@ for arg in "$@"; do done # Construct the cmake arguments -ARGS=("-D" "CMAKE_EXPORT_COMPILE_COMMANDS=ON" "-D" "CMAKE_BUILD_TYPE=Debug" "-D" "${CMAKE_ARGS[@]}") +ARGS=("-D" "CMAKE_EXPORT_COMPILE_COMMANDS=ON" "-D" "CMAKE_BUILD_TYPE=Debug" "${CMAKE_ARGS[@]}") # Compile if [ -f CMakeCache.txt ]; then From 631a7b845f3f6ca0d7f71207455f065b4331b015 Mon Sep 17 00:00:00 2001 From: landinjm Date: Wed, 8 Oct 2025 15:11:03 -0700 Subject: [PATCH 17/17] loosen tolerance --- tests/regression_tests/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/regression_tests/run.py b/tests/regression_tests/run.py index 670688eb5..b98ce9ec6 100644 --- a/tests/regression_tests/run.py +++ b/tests/regression_tests/run.py @@ -13,7 +13,7 @@ executable_name = "main-release" # Relative tolerance -tolerance = 1e-5 +tolerance = 1e-4 # Mapping from the application name to the absolute directory path app_map = {}