From 3cc3af2fee8c461be15e166df8aa41764f7d5f8d Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Wed, 5 Jun 2024 16:53:14 -0500 Subject: [PATCH] removing irrelevant cmake tests --- docker/Dockerfile | 14 ---- test/integration/cmake/README.md | 3 - .../cmake/configs/robertson/config.json | 1 - .../cmake/configs/robertson/reactions.json | 43 ---------- .../cmake/configs/robertson/species.json | 16 ---- .../cmake/fetch_content/CMakeLists.txt | 37 --------- .../cmake/find_package/CMakeLists.txt | 30 ------- test/integration/cmake/test_micm.cpp | 81 ------------------- 8 files changed, 225 deletions(-) delete mode 100644 test/integration/cmake/README.md delete mode 100644 test/integration/cmake/configs/robertson/config.json delete mode 100644 test/integration/cmake/configs/robertson/reactions.json delete mode 100644 test/integration/cmake/configs/robertson/species.json delete mode 100644 test/integration/cmake/fetch_content/CMakeLists.txt delete mode 100644 test/integration/cmake/find_package/CMakeLists.txt delete mode 100644 test/integration/cmake/test_micm.cpp diff --git a/docker/Dockerfile b/docker/Dockerfile index 189be6357..d9874a428 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,18 +22,4 @@ RUN mkdir /build \ ../micm \ && make install -j 8 -# now test if we can use the installed files -RUN cd /micm/test/integration/cmake/find_package \ - && mkdir build && cd build \ - && cmake .. \ - && make \ - && make test - -# now test that fetch content can be used -RUN cd /micm/test/integration/cmake/fetch_content \ - && mkdir build && cd build \ - && cmake .. \ - && make \ - && make test - WORKDIR /build \ No newline at end of file diff --git a/test/integration/cmake/README.md b/test/integration/cmake/README.md deleted file mode 100644 index c6a47a3a2..000000000 --- a/test/integration/cmake/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This folder tests usage with cmake. These are not tests that can be run with `make test`. -Both of these are tested in the Dockerfile so they are tested as part of the automated build. Please -look at that dockerfile to see how to test these. \ No newline at end of file diff --git a/test/integration/cmake/configs/robertson/config.json b/test/integration/cmake/configs/robertson/config.json deleted file mode 100644 index 61165b00d..000000000 --- a/test/integration/cmake/configs/robertson/config.json +++ /dev/null @@ -1 +0,0 @@ -{"camp-files": ["species.json", "reactions.json"]} diff --git a/test/integration/cmake/configs/robertson/reactions.json b/test/integration/cmake/configs/robertson/reactions.json deleted file mode 100644 index cbffae848..000000000 --- a/test/integration/cmake/configs/robertson/reactions.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "camp-data": [ - { - "name": "reaction rates no user defined", - "type": "MECHANISM", - "reactions": [ - { - "type": "PHOTOLYSIS", - "reactants": { - "A": {} - }, - "products": { - "B": {} - }, - "MUSICA name": "r1" - }, - { - "type": "PHOTOLYSIS", - "reactants": { - "B": { "qty": 2} - }, - "products": { - "B": {}, - "C": {} - }, - "MUSICA name": "r2" - }, - { - "type": "PHOTOLYSIS", - "reactants": { - "B": {}, - "C": {} - }, - "products": { - "A": {}, - "C": {} - }, - "MUSICA name": "r3" - } - ] - } - ] -} \ No newline at end of file diff --git a/test/integration/cmake/configs/robertson/species.json b/test/integration/cmake/configs/robertson/species.json deleted file mode 100644 index 5a1a8db68..000000000 --- a/test/integration/cmake/configs/robertson/species.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "camp-data": [ - { - "name": "A", - "type": "CHEM_SPEC" - }, - { - "name": "B", - "type": "CHEM_SPEC" - }, - { - "name": "C", - "type": "CHEM_SPEC" - } - ] -} \ No newline at end of file diff --git a/test/integration/cmake/fetch_content/CMakeLists.txt b/test/integration/cmake/fetch_content/CMakeLists.txt deleted file mode 100644 index f30177d54..000000000 --- a/test/integration/cmake/fetch_content/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.11) - -project( - test_micm_fetch_content - VERSION 0.0.0 - LANGUAGES CXX -) - -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) - -include(FetchContent) - -FetchContent_Declare(micm - GIT_REPOSITORY https://github.com/NCAR/micm.git - GIT_TAG bed20158d8c907109cb8e39d2c534faf54d48384 -) - -FetchContent_MakeAvailable(micm) - -################################################################################ -# Tests -add_executable(test_micm ../test_micm.cpp) - -target_link_libraries(test_micm - PUBLIC - musica::micm -) - -enable_testing() - -add_test( - NAME test_micm - COMMAND test_micm -) - -add_custom_target(copy_configs ALL ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/../configs ${CMAKE_BINARY_DIR}/configs) \ No newline at end of file diff --git a/test/integration/cmake/find_package/CMakeLists.txt b/test/integration/cmake/find_package/CMakeLists.txt deleted file mode 100644 index 7174d582c..000000000 --- a/test/integration/cmake/find_package/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -cmake_minimum_required(VERSION 3.11) - -project( - test_micm_fetch_content - VERSION 0.0.0 - LANGUAGES CXX -) - -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) - -find_package(micm 3.3.1 REQUIRED) - -################################################################################ -# Tests -add_executable(test_micm ../test_micm.cpp) - -target_link_libraries(test_micm - PUBLIC - musica::micm -) - -enable_testing() - -add_test( - NAME test_micm - COMMAND test_micm -) - -add_custom_target(copy_configs ALL ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/../configs ${CMAKE_BINARY_DIR}/configs) \ No newline at end of file diff --git a/test/integration/cmake/test_micm.cpp b/test/integration/cmake/test_micm.cpp deleted file mode 100644 index 0310bbc00..000000000 --- a/test/integration/cmake/test_micm.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include - -using namespace micm; - -void print_header() -{ - std::cout << std::setw(5) << "time" - << "," << std::setw(10) << "A" - << "," << std::setw(10) << "B" - << "," << std::setw(10) << "C" << std::endl; -} - -template -void print_state(double time, StatePolicy& state) -{ - std::ios oldState(nullptr); - oldState.copyfmt(std::cout); - - std::cout << std::setw(5) << time << ","; - std::cout << std::scientific << std::setprecision(2) << std::setw(10) << state.variables_[0][state.variable_map_["A"]] - << "," << std::setw(10) << state.variables_[0][state.variable_map_["B"]] << "," << std::setw(10) - << state.variables_[0][state.variable_map_["C"]] << std::endl; - - std::cout.copyfmt(oldState); -} - -int main() -{ - constexpr size_t n_threads = 3; - - SolverConfig solverConfig; - - std::string config_path = "./configs/robertson"; - solverConfig.ReadAndParse(config_path); - - micm::SolverParameters solver_params = solverConfig.GetSolverParams(); - auto params = solver_params.parameters_; - params.reorder_state_ = false; - - auto chemical_system = solver_params.system_; - auto reactions = solver_params.processes_; - - RosenbrockSolver<> solver{ chemical_system, reactions, params }; - auto state = solver.GetState(); - - // mol m-3 - state.variables_[0] = { 1, 0, 0 }; - - double k1 = 0.04; - double k2 = 3e7; - double k3 = 1e4; - state.SetCustomRateParameter("PHOTO.r1", k1); - state.SetCustomRateParameter("PHOTO.r2", k2); - state.SetCustomRateParameter("PHOTO.r3", k3); - - double temperature = 272.5; // [K] - double pressure = 101253.3; // [Pa] - double air_density = 1e6; // [mol m-3] - - state.conditions_[0].temperature_ = temperature; - state.conditions_[0].pressure_ = pressure; - state.conditions_[0].air_density_ = air_density; - - double time_step = 200; // s - - print_header(); - print_state(0, state); - for (int i = 0; i < 10; ++i) - { - double elapsed_solve_time = 0; - - while (elapsed_solve_time < time_step) - { - auto result = solver.Solve(time_step - elapsed_solve_time, state); - elapsed_solve_time = result.final_time_; - state.variables_ = result.result_; - } - print_state(time_step * (i + 1), state); - } -} \ No newline at end of file