From 2df04981827889ac0e6641a180b623f1997e1ec8 Mon Sep 17 00:00:00 2001 From: "jonathan.froehlich" <jonathan.froehlich@kit.edu> Date: Fri, 3 Dec 2021 16:13:19 +0100 Subject: [PATCH] Added Penalty tests --- cardmech/test/elasticity/CMakeLists.txt | 4 +- .../test/elasticity/TestVolumePenalty.cpp | 81 +++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 cardmech/test/elasticity/TestVolumePenalty.cpp diff --git a/cardmech/test/elasticity/CMakeLists.txt b/cardmech/test/elasticity/CMakeLists.txt index 295649abd..d111d1e8b 100644 --- a/cardmech/test/elasticity/CMakeLists.txt +++ b/cardmech/test/elasticity/CMakeLists.txt @@ -13,6 +13,7 @@ add_mpp_test(TestElasticityBlock ELASTICITY) add_mpp_test(TestCFLCondition ELASTICITY) add_mpp_test(TestPrestress ELASTICITY) add_mpp_test(TestVolume ELASTICITY) +add_mpp_test(TestVolumePenalty ELASTICITY) # === Parallel MPI tests === add_mpi_test(TestDirichletBeam ELASTICITY) @@ -22,4 +23,5 @@ add_mpi_test(TestElasticityBlock ELASTICITY) #add_mpi_test(TestDynamicBoundary ELASTICITY) add_mpi_test(TestCFLCondition ELASTICITY) add_mpi_test(TestPrestress ELASTICITY) -add_mpi_test(TestVolume ELASTICITY) \ No newline at end of file +add_mpi_test(TestVolume ELASTICITY) +add_mpi_test(TestVolumePenalty ELASTICITY) \ No newline at end of file diff --git a/cardmech/test/elasticity/TestVolumePenalty.cpp b/cardmech/test/elasticity/TestVolumePenalty.cpp new file mode 100644 index 000000000..a9280a597 --- /dev/null +++ b/cardmech/test/elasticity/TestVolumePenalty.cpp @@ -0,0 +1,81 @@ +#include "TestEnvironment.hpp" +#include "TestConfigurations.hpp" +#include "MainElasticity.hpp" + +constexpr double BEAM_TEST_TOLERANCE = 1e-1; + +class VolumePenaltyTest : public TestWithParam<std::string> { +protected: + MainElasticity *cmMain; + + VolumePenaltyTest() {} + + void SetUp() override { + std::map<std::string, std::string> testConfig = CARDIAC_TEST_CONFIG; + + testConfig["Model"] = "ActiveStrainElasticity"; + testConfig["MechModel"] = "Static"; + testConfig["MechDiscretization"] = "Passive"; + testConfig["PressureSteps"] = "10"; + testConfig["WithPrestress"] = "0"; + + testConfig["MechProblem"] = "ConstantPressure"; + testConfig["LVPressure"] = "10000"; + testConfig["RVPressure"] = "0"; + testConfig["RAPressure"] = "0"; + testConfig["LAPressure"] = "0"; + + testConfig["ProblemDimension"] = "3"; + testConfig["ProblemGeometry"] = "Tet"; + + testConfig["Mesh"] = "QuarterEllipsoid"; + testConfig["MechLevel"] = "0"; + testConfig["MechPolynomialDegree"] = "1"; + + + testConfig["ActiveMaterial"] = "Bonet"; + testConfig["GuccioneMat_C"] = "10000"; + testConfig["GuccioneMat_bf"] = "10"; + testConfig["GuccioneMat_bs"] = "10"; + testConfig["GuccioneMat_bfs"] = "10"; + + testConfig["VolumetricSplit"] = "0"; + testConfig["Incompressible"] = "false"; + testConfig["QuasiCompressiblePenalty"] = GetParam(); + testConfig["VolumetricPenalty"] = "20000"; + testConfig["PermeabilityPenalty"] = "20000"; + + Config::initialize(testConfig); + + cmMain = new MainElasticity(); + cmMain->Initialize(); + } + + void TearDown() override { + Config::close(); + } + + ~VolumePenaltyTest() override { + delete cmMain; + } +}; + + +TEST_P(VolumePenaltyTest, Consistency) { + Vector &solution = cmMain->Run(); + + mout << norm(solution) << endl; + +} + +INSTANTIATE_TEST_SUITE_P(TestVolumeFunctions, VolumePenaltyTest, Values( + "None", "Ciarlet", "Logarithmic" +)); + +int main(int argc, char **argv) { + MppTest mppTest = MppTestBuilder(argc, argv). + WithPPM(). + WithScreenLogging(). + WithoutDefaultConfig(); + return mppTest.RUN_ALL_MPP_TESTS(); +} \ No newline at end of file -- GitLab