diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd0cb04a..291f0fe2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,11 @@ jobs: cd ${GITHUB_WORKSPACE}/build/test/gmsh echo 'if [ -f "./test_multi_comp_workflow" ]; then ./test_multi_comp_workflow; else echo "test_multi_comp_workflow does not exist. Passing the test."; fi' >> command.sh sh command.sh + - name: Test unsteady workflow + run: | + cd ${GITHUB_WORKSPACE}/build/test/gmsh + echo 'if [ -f "./test_unsteady_workflow" ]; then ./test_unsteady_workflow; else echo "test_unsteady_workflow does not exist. Passing the test."; fi' >> command.sh + sh command.sh # - name: Test parallel POD/EQP # run: | # cd ${GITHUB_WORKSPACE}/build/test diff --git a/test/gmsh/CMakeLists.txt b/test/gmsh/CMakeLists.txt index 4e297876..9da7249c 100644 --- a/test/gmsh/CMakeLists.txt +++ b/test/gmsh/CMakeLists.txt @@ -41,5 +41,9 @@ add_executable(stokes_multi_comp_dd_mms stokes_multi_comp_dd_mms.cpp ) add_executable(test_multi_comp_workflow test_multi_comp_workflow.cpp + $ + ) + +add_executable(test_unsteady_workflow test_unsteady_workflow.cpp $ ) \ No newline at end of file diff --git a/test/gmsh/test_multi_comp_workflow.cpp b/test/gmsh/test_multi_comp_workflow.cpp index cf105d48..0e7355c0 100644 --- a/test/gmsh/test_multi_comp_workflow.cpp +++ b/test/gmsh/test_multi_comp_workflow.cpp @@ -420,39 +420,6 @@ TEST(MultiComponentGlobalROM, SteadyNSTest_SeparateVariable) return; } -TEST(UnsteadyNS_Workflow, Periodic) -{ - config = InputParser("usns.periodic.yml"); - - printf("\nSample Generation \n\n"); - - config.dict_["main"]["mode"] = "sample_generation"; - printf("before GenerateSamples\n"); - GenerateSamples(MPI_COMM_WORLD); - - // config.dict_["main"]["mode"] = "train_rom"; - // TrainROM(MPI_COMM_WORLD); - - // config.dict_["main"]["mode"] = "train_eqp"; - // TrainEQP(MPI_COMM_WORLD); - - // printf("\nBuild ROM \n\n"); - - // config.dict_["main"]["mode"] = "build_rom"; - // BuildROM(MPI_COMM_WORLD); - - // config.dict_["main"]["mode"] = "single_run"; - // // config.dict_["solver"]["use_restart"] = true; - // // config.dict_["solver"]["restart_file"] = "usns_restart_00000000.h5"; - // double error = SingleRun(MPI_COMM_WORLD, "test_output.h5"); - - // // This reproductive case must have a very small error at the level of finite-precision. - // printf("Error: %.15E\n", error); - // EXPECT_TRUE(error < ns_threshold); - - return; -} - int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); diff --git a/test/gmsh/test_unsteady_workflow.cpp b/test/gmsh/test_unsteady_workflow.cpp new file mode 100644 index 00000000..fa9b17ff --- /dev/null +++ b/test/gmsh/test_unsteady_workflow.cpp @@ -0,0 +1,62 @@ +// Copyright 2023 Lawrence Livermore National Security, LLC. See the top-level LICENSE file for details. +// +// SPDX-License-Identifier: MIT + +#include +#include "main_workflow.hpp" +#include + +using namespace std; +using namespace mfem; + +static const double threshold = 1.0e-14; +static const double stokes_threshold = 2.0e-12; +static const double ns_threshold = 1.0e-7; + +/** + * Simple smoke test to make sure Google Test is properly linked + */ +TEST(GoogleTestFramework, GoogleTestFrameworkFound) { + SUCCEED(); +} + +TEST(UnsteadyNS_Workflow, Periodic) +{ + config = InputParser("usns.periodic.yml"); + + printf("\nSample Generation \n\n"); + + config.dict_["main"]["mode"] = "sample_generation"; + GenerateSamples(MPI_COMM_WORLD); + + config.dict_["main"]["mode"] = "train_rom"; + TrainROM(MPI_COMM_WORLD); + + config.dict_["main"]["mode"] = "train_eqp"; + TrainEQP(MPI_COMM_WORLD); + + printf("\nBuild ROM \n\n"); + + config.dict_["main"]["mode"] = "build_rom"; + BuildROM(MPI_COMM_WORLD); + + config.dict_["main"]["mode"] = "single_run"; + // config.dict_["solver"]["use_restart"] = true; + // config.dict_["solver"]["restart_file"] = "usns_restart_00000000.h5"; + double error = SingleRun(MPI_COMM_WORLD, "test_output.h5"); + + // This reproductive case must have a very small error at the level of finite-precision. + printf("Error: %.15E\n", error); + EXPECT_TRUE(error < ns_threshold); + + return; +} + +int main(int argc, char* argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + MPI_Init(&argc, &argv); + int result = RUN_ALL_TESTS(); + MPI_Finalize(); + return result; +}