-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6973411
commit bb38fd1
Showing
4 changed files
with
71 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |