Skip to content

Commit

Permalink
separating unsteady workflow test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Jul 9, 2024
1 parent 6973411 commit bb38fd1
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/gmsh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<TARGET_OBJECTS:scaleupROMObj>
)

add_executable(test_unsteady_workflow test_unsteady_workflow.cpp
$<TARGET_OBJECTS:scaleupROMObj>
)
33 changes: 0 additions & 33 deletions test/gmsh/test_multi_comp_workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
62 changes: 62 additions & 0 deletions test/gmsh/test_unsteady_workflow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2023 Lawrence Livermore National Security, LLC. See the top-level LICENSE file for details.
//
// SPDX-License-Identifier: MIT

#include<gtest/gtest.h>
#include "main_workflow.hpp"
#include <cmath>

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;
}

0 comments on commit bb38fd1

Please sign in to comment.