Skip to content
Snippets Groups Projects
Commit edd2f32d authored by Laura Stengel's avatar Laura Stengel
Browse files

fixed Boundary test

parent 67e48450
No related branches found
No related tags found
1 merge request!243Resolve "Fix DynamicBoundaryNeumann Tests"
......@@ -16,7 +16,7 @@ struct BoundaryTestParam {
}
double tolerance() const {
return (bndType == "Pol" ? 1e-4 : 1e-2) * (endTime * 10.0);
return (bndType == "Pol" ? 1e-10 : 1e-4) * (endTime * 10.0);
}
std::string geometry() const {
......@@ -57,13 +57,19 @@ protected:
testConfig["NewmarkGamma"] = "0.5";
if (GetParam().problemDimension == 2){
testConfig["MechLevel"] = "5"; // 5
testConfig["MechLevel"] = "4";
}
else {
testConfig["MechLevel"] = "3"; // 3
else{
testConfig["MechLevel"] = "2";
}
if (GetParam().problemGeo == "Quad"){
testConfig["MechPolynomialDegree"] = "2";
}
else{
testConfig["MechPolynomialDegree"] = "3";
}
testConfig["MechPolynomialDegree"] = "1"; // 1
testConfig["StartTime"] = "0.0";
testConfig["EndTime"] = std::to_string(GetParam().endTime);
testConfig["DeltaTime"] = "0.02";
......@@ -79,6 +85,7 @@ protected:
void TearDown() override {
Config::Close();
//Plotting::Instance().Clear();
}
~DBoundaryTest() override {
......@@ -89,13 +96,16 @@ protected:
TEST_P(DBoundaryTest, L2ErrorTest) {
cmMain->Initialize();
Vector &solution = cmMain->Run();
mout << "num " << cmMain->EvaluateQuantity(solution, "L2") << endl << endl;
Vector exactSolution(cmMain->GetDisplacement());
cmMain->SetDisplacement(true, exactSolution);
Vector &solution = cmMain->Run();
mout << cmMain->EvaluateQuantity(solution, "L2") << endl << endl;
mout << cmMain->EvaluateQuantity(exactSolution, "L2") << endl << endl;
// ASSERT_NEAR(cmMain->EvaluateQuantity(exactSolution, "L2"), 0.0, GetParam().tolerance());
double exact = cmMain->EvaluateQuantity(exactSolution, "L2");
mout << "exact " << exact << endl << endl;
ASSERT_NEAR(cmMain->EvaluateQuantity(exactSolution, "L2"), 0.0, GetParam().tolerance());
ASSERT_NEAR(cmMain->EvaluateQuantity(solution, "L2"), 0.0, GetParam().tolerance());
}
......@@ -103,32 +113,20 @@ TEST_P(DBoundaryTest, L2ErrorTest) {
INSTANTIATE_TEST_SUITE_P(DynamicTestOneStep, DBoundaryTest, Values(
BoundaryTestParam({2, 0.02, "Quad", "Dirichlet", "Pol"}),
BoundaryTestParam({2, 0.02, "Quad", "Dirichlet", "Exp"}),
// BoundaryTestParam({2, 0.01, "Quad", "Traction", "Pol"}),
// BoundaryTestParam({2, 0.01, "Quad", "Traction", "Exp"}),
// BoundaryTestParam({2, 0.02, "Quad", "Viscosity", "Pol"}),
BoundaryTestParam({2, 0.02, "Quad", "Stiffness", "Exp"}),
//
BoundaryTestParam({2, 0.02, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({2, 0.02, "Tet", "Dirichlet", "Pol"}),
BoundaryTestParam({2, 0.02, "Tet", "Dirichlet", "Exp"}),
// BoundaryTestParam({2, 0.01, "Tet", "Traction", "Pol"}),
// BoundaryTestParam({2, 0.01, "Tet", "Traction", "Exp"}),
// BoundaryTestParam({2, 0.02, "Tet", "Viscosity", "Pol"}),
BoundaryTestParam({2, 0.02, "Tet", "Stiffness", "Exp"}),
BoundaryTestParam({3, 0.02, "Quad", "Dirichlet", "Pol"}),
BoundaryTestParam({3, 0.02, "Quad", "Dirichlet", "Exp"}),
// BoundaryTestParam({3, 0.01, "Quad", "Traction", "Pol"}),
// BoundaryTestParam({3, 0.01, "Quad", "Traction", "Exp"}),
// BoundaryTestParam({3, 0.02, "Quad", "Viscosity", "Pol"}),
BoundaryTestParam({3, 0.02, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({3, 0.02, "Quad", "Neumann", "Pol"}),
BoundaryTestParam({3, 0.02, "Quad", "Neumann", "Exp"}),
//
BoundaryTestParam({3, 0.02, "Quad", "Dirichlet", "Pol"}),
BoundaryTestParam({3, 0.02, "Quad", "Dirichlet", "Exp"}),
BoundaryTestParam({3, 0.02, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({3, 0.02, "Quad", "Neumann", "Pol"}),
BoundaryTestParam({3, 0.02, "Quad", "Neumann", "Exp"}),
BoundaryTestParam({3, 0.02, "Tet", "Dirichlet", "Pol"}),
BoundaryTestParam({3, 0.02, "Tet", "Dirichlet", "Exp"}),
// BoundaryTestParam({3, 0.01, "Tet", "Traction", "Pol"}),
// BoundaryTestParam({3, 0.01, "Tet", "Traction", "Exp"}),
// BoundaryTestParam({3, 0.02, "Tet", "Viscosity", "Pol"}),
BoundaryTestParam({3, 0.02, "Tet", "Stiffness", "Exp"}),
BoundaryTestParam({3, 0.02, "Tet", "Neumann", "Pol"}),
BoundaryTestParam({3, 0.02, "Tet", "Neumann", "Exp"})
......@@ -138,32 +136,20 @@ INSTANTIATE_TEST_SUITE_P(DynamicTestOneStep, DBoundaryTest, Values(
INSTANTIATE_TEST_SUITE_P(DynamicTestTwoStep, DBoundaryTest, Values(
BoundaryTestParam({2, 0.04, "Quad", "Dirichlet", "Pol"}),
BoundaryTestParam({2, 0.04, "Quad", "Dirichlet", "Exp"}),
// BoundaryTestParam({2, 0.02, "Quad", "Traction", "Pol"}),
// BoundaryTestParam({2, 0.02, "Quad", "Traction", "Exp"}),
// BoundaryTestParam({2, 0.04, "Quad", "Viscosity", "Pol"}),
BoundaryTestParam({2, 0.04, "Quad", "Stiffness", "Exp"}),
//
BoundaryTestParam({2, 0.04, "Tet", "Dirichlet", "Pol"}),
BoundaryTestParam({2, 0.04, "Tet", "Dirichlet", "Exp"}),
// BoundaryTestParam({2, 0.02, "Tet", "Traction", "Pol"}),
// BoundaryTestParam({2, 0.02, "Tet", "Traction", "Exp"}),
// BoundaryTestParam({2, 0.04, "Tet", "Viscosity", "Pol"}),
BoundaryTestParam({2, 0.04, "Tet", "Stiffness", "Exp"}),
//
BoundaryTestParam({3, 0.04, "Quad", "Dirichlet", "Pol"}),
BoundaryTestParam({3, 0.04, "Quad", "Dirichlet", "Exp"}),
// BoundaryTestParam({3, 0.02, "Quad", "Traction", "Pol"}),
// BoundaryTestParam({3, 0.02, "Quad", "Traction", "Exp"}),
// BoundaryTestParam({3, 0.04, "Quad", "Viscosity", "Pol"}),
BoundaryTestParam({3, 0.04, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({3, 0.04, "Quad", "Neumann", "Pol"}),
BoundaryTestParam({3, 0.04, "Quad", "Neumann", "Exp"}),
BoundaryTestParam({3, 0.04, "Tet", "Dirichlet", "Pol"}),
BoundaryTestParam({3, 0.04, "Tet", "Dirichlet", "Exp"}),
// BoundaryTestParam({3, 0.02, "Tet", "Traction", "Pol"}),
// BoundaryTestParam({3, 0.02, "Tet", "Traction", "Exp"}),
// BoundaryTestParam({3, 0.04, "Tet", "Viscosity", "Pol"}),
BoundaryTestParam({3, 0.04, "Tet", "Stiffness", "Exp"}),
BoundaryTestParam({3, 0.04, "Tet", "Neumann", "Pol"}),
BoundaryTestParam({3, 0.04, "Tet", "Neumann", "Exp"})
......@@ -173,29 +159,21 @@ INSTANTIATE_TEST_SUITE_P(DynamicTestTwoStep, DBoundaryTest, Values(
INSTANTIATE_TEST_SUITE_P(DynamicTestFullTime, DBoundaryTest, Values(
BoundaryTestParam({2, 1.0, "Quad", "Dirichlet", "Pol"}),
BoundaryTestParam({2, 1.0, "Quad", "Dirichlet", "Exp"}),
// BoundaryTestParam({2, 1.0, "Quad", "Traction", "Pol"}),
// BoundaryTestParam({2, 1.0, "Quad", "Traction", "Exp"}),
// BoundaryTestParam({2, 1.0, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({2, 1.0, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({2, 1.0, "Tet", "Dirichlet", "Pol"}),
BoundaryTestParam({2, 1.0, "Tet", "Dirichlet", "Exp"}),
// BoundaryTestParam({2, 1.0, "Tet", "Traction", "Pol"}),
//BoundaryTestParam({2, 1.0, "Tet", "Traction", "Exp"}),
// BoundaryTestParam({2, 1.0, "Tet", "Stiffness", "Exp"}),
//
BoundaryTestParam({2, 1.0, "Tet", "Stiffness", "Exp"}),
BoundaryTestParam({3, 1.0, "Quad", "Dirichlet", "Pol"}),
BoundaryTestParam({3, 1.0, "Quad", "Dirichlet", "Exp"}),
// BoundaryTestParam({3, 1.0, "Quad", "Traction", "Pol"}),
// BoundaryTestParam({3, 1.0, "Quad", "Traction", "Exp"}),
// BoundaryTestParam({3, 1.0, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({3, 1.0, "Quad", "Stiffness", "Exp"}),
BoundaryTestParam({3, 1.0, "Quad", "Neumann", "Pol"}),
BoundaryTestParam({3, 1.0, "Quad", "Neumann", "Exp"}),
//
BoundaryTestParam({3, 1.0, "Tet", "Dirichlet", "Pol"}),
BoundaryTestParam({3, 1.0, "Tet", "Dirichlet", "Exp"}),
// BoundaryTestParam({3, 1.0, "Tet", "Traction", "Pol"}),
// BoundaryTestParam({3, 1.0, "Tet", "Traction", "Exp"}),
// BoundaryTestParam({3, 1.0, "Tet", "Stiffness", "Exp"}),
BoundaryTestParam({3, 1.0, "Tet", "Stiffness", "Exp"}),
BoundaryTestParam({3, 1.0, "Tet", "Neumann", "Pol"}),
BoundaryTestParam({3, 1.0, "Tet", "Neumann", "Exp"})
), testing::PrintToStringParamName());
......@@ -204,6 +182,7 @@ INSTANTIATE_TEST_SUITE_P(DynamicTestFullTime, DBoundaryTest, Values(
int main(int argc, char **argv) {
MppTest mppTest = MppTestBuilder(argc, argv).
WithPPM().
WithFileLogging().
WithScreenLogging().
WithoutDefaultConfig();
return mppTest.RUN_ALL_MPP_TESTS();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment