From 3eea504dffc025f67bf60219e24253c0d591fa59 Mon Sep 17 00:00:00 2001 From: markelov Date: Thu, 14 Nov 2024 17:44:02 +0100 Subject: [PATCH 01/12] clean setup and added 3D tests --- .../test_apply_k0_procedure_process.cpp | 135 +++++++++++++++--- 1 file changed, 119 insertions(+), 16 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index c0ef1f5f406..cae284876ee 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -90,22 +90,6 @@ namespace ModelPart& PrepareTestModelPart(Model& rModel) { auto& result = rModel.CreateModelPart("dummy"); - - // Set up the test model part mesh - auto p_point_1 = Kratos::make_intrusive(1, 0.0, 0.0, 0.0); - auto p_point_2 = Kratos::make_intrusive(2, 0.0, 1.0, 0.0); - auto p_point_3 = Kratos::make_intrusive(3, 1.0, 1.0, 0.0); - auto p_point_4 = Kratos::make_intrusive(4, 1.0, 0.0, 0.0); - Quadrilateral2D4 domain_geometry(p_point_1, p_point_2, p_point_3, p_point_4); - - Parameters mesher_parameters(R"({ - "number_of_divisions": 2, - "element_name": "Element2D3N", - "condition_name": "LineCondition", - "create_skin_sub_model_part": true - })"); - StructuredMeshGeneratorProcess(domain_geometry, result, mesher_parameters).Execute(); - auto p_dummy_law = std::make_shared(); auto& r_model_part_properties = result.GetProperties(0); r_model_part_properties.SetValue(CONSTITUTIVE_LAW, p_dummy_law); @@ -199,6 +183,24 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NC, KratosGeoMecha KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } +KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NC_3D, KratosGeoMechanicsFastSuiteWithoutKernel) +{ + // Arrange + auto p_properties = std::make_shared(); + p_properties->SetValue(K0_NC, 0.5); + p_properties->SetValue(K0_MAIN_DIRECTION, 1); + Vector initial_stress_vector{6}; + initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + + // Act + const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); + + // Assert + Vector expected_stress_vector{6}; + expected_stress_vector <<= -5.0, -10.0, -5.0, 0.0, 0.0, 0.0; + KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); +} + KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithPhi, KratosGeoMechanicsFastSuiteWithoutKernel) { // Arrange @@ -222,6 +224,29 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithPhi, KratosGeoMechani KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } +KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithPhi_3D, KratosGeoMechanicsFastSuiteWithoutKernel) +{ + // Arrange + auto p_properties = std::make_shared(); + p_properties->SetValue(INDEX_OF_UMAT_PHI_PARAMETER, 1); + p_properties->SetValue(NUMBER_OF_UMAT_PARAMETERS, 1); + Vector umat_parameters{1}; + umat_parameters[0] = 30.0; + p_properties->SetValue(UMAT_PARAMETERS, umat_parameters); + p_properties->SetValue(K0_MAIN_DIRECTION, 1); + + Vector initial_stress_vector{6}; + initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + + // Act + const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); + + // Assert + Vector expected_stress_vector{6}; + expected_stress_vector <<= -5.0, -10.0, -5.0, 0.0, 0.0, 0.0; + KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); +} + KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCR, KratosGeoMechanicsFastSuiteWithoutKernel) { // Arrange @@ -241,6 +266,25 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCR, KratosGe KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } +KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCR_3D, KratosGeoMechanicsFastSuiteWithoutKernel) +{ + // Arrange + auto p_properties = std::make_shared(); + p_properties->SetValue(K0_NC, 0.5); + p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(OCR, 1.5); + Vector initial_stress_vector{6}; + initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + + // Act + const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); + + // Assert + Vector expected_stress_vector{6}; + expected_stress_vector <<= -7.5, -10.0, -7.5, 0.0, 0.0, 0.0; + KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); +} + KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCRandNu_UR, KratosGeoMechanicsFastSuiteWithoutKernel) { // Arrange @@ -261,6 +305,26 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCRandNu_UR, KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } +KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCRandNu_UR_3D, KratosGeoMechanicsFastSuiteWithoutKernel) +{ + // Arrange + auto p_properties = std::make_shared(); + p_properties->SetValue(K0_NC, 0.5); + p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(OCR, 1.5); + p_properties->SetValue(POISSON_UNLOADING_RELOADING, 0.25); + Vector initial_stress_vector{6}; + initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + + // Act + const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); + + // Assert + Vector expected_stress_vector{6}; + expected_stress_vector <<= -7 * 10.0 / 12.0, -10.0, -7 * 10.0 / 12.0, 0.0, 0.0, 0.0; + KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); +} + KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOP, KratosGeoMechanicsFastSuiteWithoutKernel) { // Arrange @@ -280,6 +344,25 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOP, KratosGe KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } +KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOP_3D, KratosGeoMechanicsFastSuiteWithoutKernel) +{ + // Arrange + auto p_properties = std::make_shared(); + p_properties->SetValue(K0_NC, 0.5); + p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(POP, 50.0); + Vector initial_stress_vector{6}; + initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + + // Act + const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); + + // Assert + Vector expected_stress_vector{6}; + expected_stress_vector <<= -30.0, -10.0, -30.0, 0.0, 0.0, 0.0; + KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); +} + KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOPandNu_UR, KratosGeoMechanicsFastSuiteWithoutKernel) { // Arrange @@ -300,6 +383,26 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOPandNu_UR, KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } +KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOPandNu_UR_3D, KratosGeoMechanicsFastSuiteWithoutKernel) +{ + // Arrange + auto p_properties = std::make_shared(); + p_properties->SetValue(K0_NC, 0.5); + p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(POP, 50.0); + p_properties->SetValue(POISSON_UNLOADING_RELOADING, 0.25); + Vector initial_stress_vector{6}; + initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + + // Act + const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); + + // Assert + Vector expected_stress_vector{6}; + expected_stress_vector <<= -30.0 + 50.0 / 3.0, -10.0, -30.0 + 50.0 / 3.0, 0.0, 0.0, 0.0; + KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); +} + KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, KratosGeoMechanicsFastSuiteWithoutKernel) { // Arrange From 15b7640c1797bdec506a14e726d8c8b8d1b8c96a Mon Sep 17 00:00:00 2001 From: markelov Date: Fri, 15 Nov 2024 11:17:25 +0100 Subject: [PATCH 02/12] used K0_MAIN_DIRECTION 2 --- .../apply_k0_procedure_process.cpp | 2 +- .../test_apply_k0_procedure_process.cpp | 38 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp index 360a2e3e299..0671292e42c 100644 --- a/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp @@ -79,7 +79,7 @@ void ApplyK0ProcedureProcess::CheckK0MainDirection(const Properties& rProperties KRATOS_ERROR_IF(!rProperties.Has(K0_MAIN_DIRECTION)) << "K0_MAIN_DIRECTION is not defined for element " << ElementId << "." << std::endl; KRATOS_ERROR_IF(rProperties[K0_MAIN_DIRECTION] < 0 || rProperties[K0_MAIN_DIRECTION] > 1) - << "K0_MAIN_DIRECTION should be 0 or 1 for element " << ElementId << "." << std::endl; + << "K0_MAIN_DIRECTION should be 0, 1 or 2 for element " << ElementId << "." << std::endl; } void ApplyK0ProcedureProcess::CheckK0(const Properties& rProperties, IndexType ElementId) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index cae284876ee..106f9901832 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -188,16 +188,16 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NC_3D, KratosGeoMe // Arrange auto p_properties = std::make_shared(); p_properties->SetValue(K0_NC, 0.5); - p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(K0_MAIN_DIRECTION, 2); Vector initial_stress_vector{6}; - initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + initial_stress_vector <<= 0.0, -10.0, -10.0, 27.0, 10.0, 5.0; // Act const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); // Assert Vector expected_stress_vector{6}; - expected_stress_vector <<= -5.0, -10.0, -5.0, 0.0, 0.0, 0.0; + expected_stress_vector <<= -5.0, -5.0, -10.0, 0.0, 0.0, 0.0; KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } @@ -233,17 +233,17 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithPhi_3D, KratosGeoMech Vector umat_parameters{1}; umat_parameters[0] = 30.0; p_properties->SetValue(UMAT_PARAMETERS, umat_parameters); - p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(K0_MAIN_DIRECTION, 2); Vector initial_stress_vector{6}; - initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + initial_stress_vector <<= 0.0, -10.0, -10.0, 27.0, 10.0, 5.0; // Act const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); // Assert Vector expected_stress_vector{6}; - expected_stress_vector <<= -5.0, -10.0, -5.0, 0.0, 0.0, 0.0; + expected_stress_vector <<= -5.0, -5.0, -10.0, 0.0, 0.0, 0.0; KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } @@ -271,17 +271,17 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCR_3D, Krato // Arrange auto p_properties = std::make_shared(); p_properties->SetValue(K0_NC, 0.5); - p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(K0_MAIN_DIRECTION, 2); p_properties->SetValue(OCR, 1.5); Vector initial_stress_vector{6}; - initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + initial_stress_vector <<= 0.0, -10.0, -10.0, 27.0, 10.0, 5.0; // Act const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); // Assert Vector expected_stress_vector{6}; - expected_stress_vector <<= -7.5, -10.0, -7.5, 0.0, 0.0, 0.0; + expected_stress_vector <<= -7.5, -7.5, -10.0, 0.0, 0.0, 0.0; KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } @@ -310,18 +310,18 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandOCRandNu_UR_3 // Arrange auto p_properties = std::make_shared(); p_properties->SetValue(K0_NC, 0.5); - p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(K0_MAIN_DIRECTION, 2); p_properties->SetValue(OCR, 1.5); p_properties->SetValue(POISSON_UNLOADING_RELOADING, 0.25); Vector initial_stress_vector{6}; - initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + initial_stress_vector <<= 0.0, -10.0, -10.0, 27.0, 10.0, 5.0; // Act const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); // Assert Vector expected_stress_vector{6}; - expected_stress_vector <<= -7 * 10.0 / 12.0, -10.0, -7 * 10.0 / 12.0, 0.0, 0.0, 0.0; + expected_stress_vector <<= -7 * 10.0 / 12.0, -7 * 10.0 / 12.0, -10.0, 0.0, 0.0, 0.0; KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } @@ -349,17 +349,17 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOP_3D, Krato // Arrange auto p_properties = std::make_shared(); p_properties->SetValue(K0_NC, 0.5); - p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(K0_MAIN_DIRECTION, 2); p_properties->SetValue(POP, 50.0); Vector initial_stress_vector{6}; - initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + initial_stress_vector <<= 0.0, -10.0, -10.0, 27.0, 10.0, 5.0; // Act const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); // Assert Vector expected_stress_vector{6}; - expected_stress_vector <<= -30.0, -10.0, -30.0, 0.0, 0.0, 0.0; + expected_stress_vector <<= -30.0, -30.0, -10.0, 0.0, 0.0, 0.0; KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } @@ -388,18 +388,18 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NCandPOPandNu_UR_3 // Arrange auto p_properties = std::make_shared(); p_properties->SetValue(K0_NC, 0.5); - p_properties->SetValue(K0_MAIN_DIRECTION, 1); + p_properties->SetValue(K0_MAIN_DIRECTION, 2); p_properties->SetValue(POP, 50.0); p_properties->SetValue(POISSON_UNLOADING_RELOADING, 0.25); Vector initial_stress_vector{6}; - initial_stress_vector <<= 0.0, -10.0, 0.0, 27.0, 10.0, 5.0; + initial_stress_vector <<= 0.0, -10.0, -10.0, 27.0, 10.0, 5.0; // Act const auto actual_stress_vector = ApplyK0ProcedureOnStubElement(p_properties, initial_stress_vector); // Assert Vector expected_stress_vector{6}; - expected_stress_vector <<= -30.0 + 50.0 / 3.0, -10.0, -30.0 + 50.0 / 3.0, 0.0, 0.0, 0.0; + expected_stress_vector <<= -30.0 + 50.0 / 3.0, -30.0 + 50.0 / 3.0, -10.0, 0.0, 0.0, 0.0; KRATOS_EXPECT_VECTOR_NEAR(actual_stress_vector, expected_stress_vector, Defaults::absolute_tolerance); } @@ -422,7 +422,7 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, Krat p_element->GetProperties().SetValue(K0_MAIN_DIRECTION, 4); KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), - "K0_MAIN_DIRECTION should be 0 or 1 for element 1.") + "K0_MAIN_DIRECTION should be 0, 1 or 2 for element 1.") p_element->GetProperties().SetValue(K0_MAIN_DIRECTION, 1); KRATOS_EXPECT_EXCEPTION_IS_THROWN( From c7e339522991efbf00eccb0c514542c846da4119 Mon Sep 17 00:00:00 2001 From: markelov Date: Fri, 15 Nov 2024 11:26:26 +0100 Subject: [PATCH 03/12] check for K0_MAIN_DIRECTION > 0 --- .../custom_processes/apply_k0_procedure_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp index 0671292e42c..8ea11797b3b 100644 --- a/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp @@ -78,7 +78,7 @@ void ApplyK0ProcedureProcess::CheckK0MainDirection(const Properties& rProperties { KRATOS_ERROR_IF(!rProperties.Has(K0_MAIN_DIRECTION)) << "K0_MAIN_DIRECTION is not defined for element " << ElementId << "." << std::endl; - KRATOS_ERROR_IF(rProperties[K0_MAIN_DIRECTION] < 0 || rProperties[K0_MAIN_DIRECTION] > 1) + KRATOS_ERROR_IF(rProperties[K0_MAIN_DIRECTION] < 0 || rProperties[K0_MAIN_DIRECTION] > 2) << "K0_MAIN_DIRECTION should be 0, 1 or 2 for element " << ElementId << "." << std::endl; } From 30e1915b8676ec20e401299103d0f26503a0de17 Mon Sep 17 00:00:00 2001 From: markelov Date: Fri, 15 Nov 2024 20:44:10 +0100 Subject: [PATCH 04/12] used the patch --- .../test_apply_k0_procedure_process.cpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index 106f9901832..ba3faad70e8 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -13,14 +13,10 @@ #include "custom_processes/apply_k0_procedure_process.h" #include "geo_mechanics_application_variables.h" #include "geo_mechanics_fast_suite.h" -#include "geometries/quadrilateral_2d_4.h" #include "includes/element.h" -#include "processes/structured_mesh_generator_process.h" #include "stub_linear_elastic_law.h" #include "test_utilities.h" -#include -#include #include namespace @@ -91,8 +87,12 @@ ModelPart& PrepareTestModelPart(Model& rModel) { auto& result = rModel.CreateModelPart("dummy"); auto p_dummy_law = std::make_shared(); - auto& r_model_part_properties = result.GetProperties(0); - r_model_part_properties.SetValue(CONSTITUTIVE_LAW, p_dummy_law); + auto p_model_part_properties = result.pGetProperties(0); + p_model_part_properties->SetValue(CONSTITUTIVE_LAW, p_dummy_law); + + auto p_element = make_intrusive(); + p_element->SetProperties(p_model_part_properties); + result.AddElement(p_element); return result; } @@ -110,7 +110,7 @@ namespace Kratos::Testing { KRATOS_TEST_CASE_IN_SUITE(AllElementsConsiderDiagonalEntriesOnlyAndNoShearWhenUseStandardProcedureFlagIsNotDefined, - KratosGeoMechanicsFastSuite) + KratosGeoMechanicsFastSuiteWithoutKernel) { Model model; auto& r_model_part = PrepareTestModelPart(model); @@ -120,11 +120,11 @@ KRATOS_TEST_CASE_IN_SUITE(AllElementsConsiderDiagonalEntriesOnlyAndNoShearWhenUs ApplyK0ProcedureProcess process{r_model_part, k0_settings}; process.ExecuteInitialize(); - KRATOS_EXPECT_TRUE(boost::algorithm::all_of(r_model_part.Elements(), ElementConsidersDiagonalEntriesOnlyAndNoShear)) + KRATOS_EXPECT_TRUE(ElementConsidersDiagonalEntriesOnlyAndNoShear(r_model_part.Elements()[0])) } KRATOS_TEST_CASE_IN_SUITE(AllElementsConsiderDiagonalEntriesOnlyAndNoShearWhenUsingStandardProcedure, - KratosGeoMechanicsFastSuite) + KratosGeoMechanicsFastSuiteWithoutKernel) { Model model; auto& r_model_part = PrepareTestModelPart(model); @@ -134,11 +134,11 @@ KRATOS_TEST_CASE_IN_SUITE(AllElementsConsiderDiagonalEntriesOnlyAndNoShearWhenUs ApplyK0ProcedureProcess process{r_model_part, k0_settings}; process.ExecuteInitialize(); - KRATOS_EXPECT_TRUE(boost::algorithm::all_of(r_model_part.Elements(), ElementConsidersDiagonalEntriesOnlyAndNoShear)) + KRATOS_EXPECT_TRUE(ElementConsidersDiagonalEntriesOnlyAndNoShear(r_model_part.Elements()[0])) } KRATOS_TEST_CASE_IN_SUITE(NoneOfElementsConsiderDiagonalEntriesOnlyAndNoShearWhenNotUsingStandardProcedure, - KratosGeoMechanicsFastSuite) + KratosGeoMechanicsFastSuiteWithoutKernel) { Model model; auto& r_model_part = PrepareTestModelPart(model); @@ -148,10 +148,10 @@ KRATOS_TEST_CASE_IN_SUITE(NoneOfElementsConsiderDiagonalEntriesOnlyAndNoShearWhe ApplyK0ProcedureProcess process{r_model_part, k0_settings}; process.ExecuteInitialize(); - KRATOS_EXPECT_TRUE(boost::algorithm::none_of(r_model_part.Elements(), ElementConsidersDiagonalEntriesOnlyAndNoShear)) + KRATOS_EXPECT_FALSE(ElementConsidersDiagonalEntriesOnlyAndNoShear(r_model_part.Elements()[0])) } -KRATOS_TEST_CASE_IN_SUITE(UseStandardProcedureFlagIsInEffectDuringProcessExecutionOnly, KratosGeoMechanicsFastSuite) +KRATOS_TEST_CASE_IN_SUITE(UseStandardProcedureFlagIsInEffectDuringProcessExecutionOnly, KratosGeoMechanicsFastSuiteWithoutKernel) { Model model; auto& r_model_part = PrepareTestModelPart(model); @@ -162,7 +162,7 @@ KRATOS_TEST_CASE_IN_SUITE(UseStandardProcedureFlagIsInEffectDuringProcessExecuti process.ExecuteInitialize(); // start considering diagonal entries only and no shear process.ExecuteFinalize(); // stop considering diagonal entries only and no shear - KRATOS_EXPECT_TRUE(boost::algorithm::none_of(r_model_part.Elements(), ElementConsidersDiagonalEntriesOnlyAndNoShear)) + KRATOS_EXPECT_FALSE(ElementConsidersDiagonalEntriesOnlyAndNoShear(r_model_part.Elements()[0])) } KRATOS_TEST_CASE_IN_SUITE(K0ProcedureIsAppliedCorrectlyWithK0_NC, KratosGeoMechanicsFastSuiteWithoutKernel) From bd2c38001f2025313c7b46ea92821ede72051718 Mon Sep 17 00:00:00 2001 From: markelov Date: Fri, 15 Nov 2024 21:43:51 +0100 Subject: [PATCH 05/12] format --- .../tests/cpp_tests/test_apply_k0_procedure_process.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index ba3faad70e8..b7b696e1aef 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -85,12 +85,12 @@ namespace ModelPart& PrepareTestModelPart(Model& rModel) { - auto& result = rModel.CreateModelPart("dummy"); + auto& result = rModel.CreateModelPart("dummy"); auto p_dummy_law = std::make_shared(); auto p_model_part_properties = result.pGetProperties(0); p_model_part_properties->SetValue(CONSTITUTIVE_LAW, p_dummy_law); - auto p_element = make_intrusive(); + auto p_element = make_intrusive(); p_element->SetProperties(p_model_part_properties); result.AddElement(p_element); @@ -151,7 +151,8 @@ KRATOS_TEST_CASE_IN_SUITE(NoneOfElementsConsiderDiagonalEntriesOnlyAndNoShearWhe KRATOS_EXPECT_FALSE(ElementConsidersDiagonalEntriesOnlyAndNoShear(r_model_part.Elements()[0])) } -KRATOS_TEST_CASE_IN_SUITE(UseStandardProcedureFlagIsInEffectDuringProcessExecutionOnly, KratosGeoMechanicsFastSuiteWithoutKernel) +KRATOS_TEST_CASE_IN_SUITE(UseStandardProcedureFlagIsInEffectDuringProcessExecutionOnly, + KratosGeoMechanicsFastSuiteWithoutKernel) { Model model; auto& r_model_part = PrepareTestModelPart(model); From e1ca9bc752e7e70c71b3f14aa64f956e593e8487 Mon Sep 17 00:00:00 2001 From: markelov Date: Mon, 18 Nov 2024 15:37:57 +0100 Subject: [PATCH 06/12] added integration test for 3D --- .../tests/test_k0_procedure_process.py | 20 + .../tests/test_k0_procedure_process/README.md | 1 + .../MaterialParameters.json | 35 ++ .../ProjectParameters.json | 168 +++++++ .../test_k0_procedure_k0_nc_3D/README.md | 6 + .../hexa_mesh_in_Z.mdpa | 422 ++++++++++++++++++ 6 files changed, 652 insertions(+) create mode 100644 applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/MaterialParameters.json create mode 100644 applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json create mode 100644 applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/README.md create mode 100644 applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/hexa_mesh_in_Z.mdpa diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py index bbbf8a09806..c083dcb1f52 100644 --- a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py @@ -472,5 +472,25 @@ def test_k0_procedure_for_tilted_layers(self): integration_point = (2, 0) # far right self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_vertical_stress=-22084, expected_horizontal_stress=-11042, rel_tol=0.02) + def test_k0_procedure_for_3d(self): + """ + Test to check whether the effective stress distribution is in line with regression data. + To this end, we test the horizontal, vertical and shear stresses at a selection + of integration points (defined as pairs of element IDs and integration point indices). + The settings are taken from lysmer_column3d_hexa_in_Z test. + """ + test_path = test_helper.get_file_path(os.path.join("test_k0_procedure_process", "test_k0_procedure_k0_nc_3D")) + simulation = test_helper.run_kratos(test_path) + + cauchy_stress_tensors = test_helper.get_on_integration_points(simulation, Kratos.CAUCHY_STRESS_TENSOR) + + # Check the stresses at a few integration points + integration_point = (1, 1) # bottom + self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_vertical_stress= -151.0731, expected_horizontal_stress= -151.0731, rel_tol=0.02) + integration_point = (10, 1) # middle + self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_vertical_stress=-98.5239, expected_horizontal_stress=-98.5239, rel_tol=0.02) + integration_point = (20, 1) # top + self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_vertical_stress=-9.0382, expected_horizontal_stress=-9.0382, rel_tol=0.02) + if __name__ == '__main__': KratosUnittest.main() diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/README.md b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/README.md index 1ee1b0f9d76..c18b2e9b957 100644 --- a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/README.md +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/README.md @@ -3,6 +3,7 @@ This folder contains the test cases: - [K0 procedure normal consolidation](https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc/README.md) +- [K0 procedure normal consolidation in 3D](https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/README.md) - [K0 procedure normal consolidation with layers](https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_layers/README.md) - [K0 procedure normal consolidation with OCR](https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_ocr/README.md) - [K0 procedure normal consolidation with OCR_field](https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_ocr_field/README.md) diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/MaterialParameters.json b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/MaterialParameters.json new file mode 100644 index 00000000000..6461fb95df9 --- /dev/null +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/MaterialParameters.json @@ -0,0 +1,35 @@ +{ + "properties": [{ + "model_part_name": "PorousDomain.soil", + "properties_id": 1, + "Material": { + "constitutive_law": { + "name" : "GeoIncrementalLinearElastic3DLaw" + }, + "Variables": { + "IGNORE_UNDRAINED" : true, + "YOUNG_MODULUS" : 10000, + "POISSON_RATIO" : 0.2, + "DENSITY_SOLID" : 2.65, + "DENSITY_WATER" : 1.0, + "POROSITY" : 0.3, + "BULK_MODULUS_SOLID" : 1.0e9, + "BULK_MODULUS_FLUID" : 2.0e-30, + "K0_NC" : 0.5, + "K0_MAIN_DIRECTION" : 2, + "PERMEABILITY_XX" : 4.5e-30, + "PERMEABILITY_YY" : 4.5e-30, + "PERMEABILITY_ZZ" : 4.5e-30, + "PERMEABILITY_XY" : 0.0, + "PERMEABILITY_YZ" : 0.0, + "PERMEABILITY_ZX" : 0.0, + "DYNAMIC_VISCOSITY" : 8.90e-7, + "RETENTION_LAW" : "SaturatedBelowPhreaticLevelLaw", + "SATURATED_SATURATION" : 1.0, + "RESIDUAL_SATURATION" : 1e-10, + "MINIMUM_RELATIVE_PERMEABILITY" : 0.0001 + }, + "Tables": {} + } + }] +} diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json new file mode 100644 index 00000000000..cca2ccf100a --- /dev/null +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json @@ -0,0 +1,168 @@ +{ + "problem_data": { + "problem_name": "lysmer_column3d_hexa_in_Z", + "start_time": 0.0, + "end_time": 0.3, + "echo_level": 1, + "parallel_type": "OpenMP", + "number_of_threads": 1 + }, + "solver_settings": { + "solver_type": "U_Pw", + "model_part_name": "PorousDomain", + "domain_size": 2, + "model_import_settings": { + "input_type": "mdpa", + "input_filename": "hexa_mesh_in_Z" + }, + "material_import_settings": { + "materials_filename": "MaterialParameters.json" + }, + "time_stepping": { + "time_step": 0.01, + "max_delta_time_factor": 1000 + }, + "buffer_size": 2, + "echo_level": 1, + "clear_storage": false, + "compute_reactions": false, + "move_mesh_flag": false, + "reform_dofs_at_each_step": false, + "nodal_smoothing": false, + "block_builder": true, + "solution_type": "Dynamic", + "scheme_type": "Newmark", + "reset_displacements": true, + "newmark_beta": 0.25, + "newmark_gamma": 0.5, + "newmark_theta": 0.5, + "rayleigh_m": 0.1, + "rayleigh_k": 0.001, + "strategy_type": "newton_raphson", + "convergence_criterion": "displacement_criterion", + "displacement_relative_tolerance": 1.0E-4, + "displacement_absolute_tolerance": 1.0E-9, + "residual_relative_tolerance": 1.0E-4, + "residual_absolute_tolerance": 1.0E-9, + "water_pressure_relative_tolerance": 1.0E-4, + "water_pressure_absolute_tolerance": 1.0E-9, + "min_iterations": 6, + "max_iterations": 30, + "number_cycles": 100, + "reduction_factor": 1, + "increase_factor": 1, + "desired_iterations": 4, + "max_radius_factor": 10.0, + "min_radius_factor": 0.1, + "calculate_reactions": true, + "max_line_search_iterations": 5, + "first_alpha_value": 0.5, + "second_alpha_value": 1.0, + "min_alpha": 0.1, + "max_alpha": 2.0, + "line_search_tolerance": 0.5, + "rotation_dofs": true, + "linear_solver_settings": { + "solver_type": "bicgstab", + "tolerance": 1.0e-6, + "max_iteration": 1000, + "scaling": true, + "preconditioner_type": "ilu0" + }, + "problem_domain_sub_model_part_list": ["soil"], + "processes_sub_model_part_list": ["sides","bottom"], + "body_domain_sub_model_part_list": ["soil"] + }, + "output_processes": { + "gid_output": [{ + "python_module": "gid_output_process", + "kratos_module": "KratosMultiphysics", + "process_name": "GiDOutputProcess", + "Parameters": { + "model_part_name": "PorousDomain.porous_computational_model_part", + "output_name": "hexa_mesh_in_Z", + "postprocess_parameters": { + "result_file_configuration": { + "gidpost_flags": { + "WriteDeformedMeshFlag": "WriteUndeformed", + "WriteConditionsFlag": "WriteElementsOnly", + "GiDPostMode": "GiD_PostAscii", + "MultiFileFlag": "SingleFile" + }, + "file_label": "step", + "output_control_type": "step", + "output_interval": 1, + "body_output": true, + "node_output": false, + "skin_output": false, + "plane_output": [], + "nodal_results": ["DISPLACEMENT","VOLUME_ACCELERATION"], + "gauss_point_results": ["CAUCHY_STRESS_TENSOR"] + }, + "point_data_configuration": [] + } + } + }] + }, + "processes": { + "constraints_process_list": [{ + "python_module": "apply_vector_constraint_table_process", + "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", + "process_name": "ApplyVectorConstraintTableProcess", + "Parameters": { + "model_part_name": "PorousDomain.sides", + "variable_name": "DISPLACEMENT", + "active": [true,true,false], + "is_fixed": [true,true,false], + "value": [0.0,0.0,0.0], + "table": [0,0,0] + } + },{ + "python_module": "apply_vector_constraint_table_process", + "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", + "process_name": "ApplyVectorConstraintTableProcess", + "Parameters": { + "model_part_name": "PorousDomain.bottom", + "variable_name": "DISPLACEMENT", + "active": [ true, true, true ], + "is_fixed": [ true, true, true ], + "value": [ 0.0, 0.0, 0.0 ], + "table": [ 0, 0, 0 ] } + }], + "loads_process_list": [{ + "python_module": "apply_vector_constraint_table_process", + "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", + "process_name": "ApplyVectorConstraintTableProcess", + "Parameters": { + "model_part_name": "PorousDomain.soil", + "variable_name": "VOLUME_ACCELERATION", + "active": [ false, false, true ], + "value": [ 0.0, 0.0, -9.81 ], + "table": [ 0, 0, 0 ] } + },{ + "python_module": "apply_scalar_constraint_table_process", + "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", + "process_name": "ApplyScalarConstraintTableProcess", + "Parameters": { + "model_part_name": "PorousDomain.soil", + "variable_name": "WATER_PRESSURE", + "is_fixed": true, + "fluid_pressure_type": "Hydrostatic", + "gravity_direction": 2, + "reference_coordinate": 0.0, + "table": 0, + "pressure_tension_cut_off": 0.0, + "specific_weight": 9810.0 + } + }], + "auxiliar_process_list": [{ + "python_module": "apply_k0_procedure_process", + "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", + "process_name": "ApplyK0ProcedureProcess", + "Parameters": { + "model_part_name": "PorousDomain.porous_computational_model_part", + "variable_name": "CAUCHY_STRESS_TENSOR" + } + }] + } +} diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/README.md b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/README.md new file mode 100644 index 00000000000..317beff3cd6 --- /dev/null +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/README.md @@ -0,0 +1,6 @@ +# Test K0 procedure normal consolidation + +**Author:** [Wijtze Pieter Kikstra](https://github.com/WPK4FEM) + +## Case Specification +A straightforward test for the K0 procedure process. Vertical effective stresses in the 3D column of soil follow from density, gravity constant, vertical distance to the surface and the presence of pore water pressure. Horizontal effective stresses are derived from the vertical effective stresses by multiplication with K0nc and checked at an integration point near the bottom of the column. diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/hexa_mesh_in_Z.mdpa b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/hexa_mesh_in_Z.mdpa new file mode 100644 index 00000000000..9210e8e9c61 --- /dev/null +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/hexa_mesh_in_Z.mdpa @@ -0,0 +1,422 @@ + +Begin Properties 1 +End Properties + + +Begin Nodes + 1 0.9999999997 0.9999999997 10.0000000000 + 2 0.0000000000 0.9999999997 10.0000000000 + 3 0.9999999997 0.0000000000 10.0000000000 + 4 0.9999999997 0.9999999997 9.0000000000 + 5 0.0000000000 0.0000000000 10.0000000000 + 6 0.9999999997 0.0000000000 9.0000000000 + 7 0.0000000000 0.9999999997 9.0000000000 + 8 0.0000000000 0.0000000000 9.0000000000 + 9 -0.9999999997 0.9999999997 10.0000000000 + 10 0.9999999997 -0.9999999997 10.0000000000 + 11 0.9999999997 0.9999999997 8.0000000000 + 12 0.0000000000 -0.9999999997 10.0000000000 + 13 -0.9999999997 0.0000000000 10.0000000000 + 14 -0.9999999997 0.9999999997 9.0000000000 + 15 0.9999999997 -0.9999999997 9.0000000000 + 16 0.0000000000 0.9999999997 8.0000000000 + 17 0.9999999997 0.0000000000 8.0000000000 + 18 0.0000000000 -0.9999999997 9.0000000000 + 19 -0.9999999997 0.0000000000 9.0000000000 + 20 0.0000000000 0.0000000000 8.0000000000 + 21 -0.9999999997 -0.9999999997 10.0000000000 + 22 0.9999999997 -0.9999999997 8.0000000000 + 23 -0.9999999997 0.9999999997 8.0000000000 + 24 -0.9999999997 -0.9999999997 9.0000000000 + 25 0.0000000000 -0.9999999997 8.0000000000 + 26 -0.9999999997 0.0000000000 8.0000000000 + 27 0.9999999997 0.9999999997 7.0000000000 + 28 0.0000000000 0.9999999997 7.0000000000 + 29 0.9999999997 0.0000000000 7.0000000000 + 30 0.0000000000 0.0000000000 7.0000000000 + 31 -0.9999999997 -0.9999999997 8.0000000000 + 32 0.9999999997 -0.9999999997 7.0000000000 + 33 -0.9999999997 0.9999999997 7.0000000000 + 34 -0.9999999997 0.0000000000 7.0000000000 + 35 0.0000000000 -0.9999999997 7.0000000000 + 36 0.9999999997 0.9999999997 6.0000000000 + 37 -0.9999999997 -0.9999999997 7.0000000000 + 38 0.9999999997 0.0000000000 6.0000000000 + 39 0.0000000000 0.9999999997 6.0000000000 + 40 0.0000000000 0.0000000000 6.0000000000 + 41 -0.9999999997 0.9999999997 6.0000000000 + 42 0.9999999997 -0.9999999997 6.0000000000 + 43 -0.9999999997 0.0000000000 6.0000000000 + 44 0.0000000000 -0.9999999997 6.0000000000 + 45 -0.9999999997 -0.9999999997 6.0000000000 + 46 0.9999999997 0.9999999997 5.0000000000 + 47 0.9999999997 0.0000000000 5.0000000000 + 48 0.0000000000 0.9999999997 5.0000000000 + 49 0.0000000000 0.0000000000 5.0000000000 + 50 -0.9999999997 0.9999999997 5.0000000000 + 51 0.9999999997 -0.9999999997 5.0000000000 + 52 0.0000000000 -0.9999999997 5.0000000000 + 53 -0.9999999997 0.0000000000 5.0000000000 + 54 -0.9999999997 -0.9999999997 5.0000000000 + 55 0.9999999997 0.9999999997 4.0000000000 + 56 0.0000000000 0.9999999997 4.0000000000 + 57 0.9999999997 0.0000000000 4.0000000000 + 58 0.0000000000 0.0000000000 4.0000000000 + 59 0.9999999997 -0.9999999997 4.0000000000 + 60 -0.9999999997 0.9999999997 4.0000000000 + 61 -0.9999999997 0.0000000000 4.0000000000 + 62 0.0000000000 -0.9999999997 4.0000000000 + 63 -0.9999999997 -0.9999999997 4.0000000000 + 64 0.9999999997 0.9999999997 3.0000000000 + 65 0.9999999997 0.0000000000 3.0000000000 + 66 0.0000000000 0.9999999997 3.0000000000 + 67 0.0000000000 0.0000000000 3.0000000000 + 68 -0.9999999997 0.9999999997 3.0000000000 + 69 0.9999999997 -0.9999999997 3.0000000000 + 70 -0.9999999997 0.0000000000 3.0000000000 + 71 0.0000000000 -0.9999999997 3.0000000000 + 72 -0.9999999997 -0.9999999997 3.0000000000 + 73 0.9999999997 0.9999999997 2.0000000000 + 74 0.0000000000 0.9999999997 2.0000000000 + 75 0.9999999997 0.0000000000 2.0000000000 + 76 0.0000000000 0.0000000000 2.0000000000 + 77 0.9999999997 -0.9999999997 2.0000000000 + 78 -0.9999999997 0.9999999997 2.0000000000 + 79 -0.9999999997 0.0000000000 2.0000000000 + 80 0.0000000000 -0.9999999997 2.0000000000 + 81 -0.9999999997 -0.9999999997 2.0000000000 + 82 0.9999999997 0.9999999997 1.0000000000 + 83 0.9999999997 0.0000000000 1.0000000000 + 84 0.0000000000 0.9999999997 1.0000000000 + 85 0.0000000000 0.0000000000 1.0000000000 + 86 0.9999999997 -0.9999999997 1.0000000000 + 87 -0.9999999997 0.9999999997 1.0000000000 + 88 0.0000000000 -0.9999999997 1.0000000000 + 89 -0.9999999997 0.0000000000 1.0000000000 + 90 -0.9999999997 -0.9999999997 1.0000000000 + 91 0.9999999997 0.9999999997 0.0000000000 + 92 0.9999999997 0.0000000000 0.0000000000 + 93 0.0000000000 0.9999999997 0.0000000000 + 94 0.0000000000 0.0000000000 0.0000000000 + 95 -0.9999999997 0.9999999997 0.0000000000 + 96 0.9999999997 -0.9999999997 0.0000000000 + 97 0.0000000000 -0.9999999997 0.0000000000 + 98 -0.9999999997 0.0000000000 0.0000000000 + 99 -0.9999999997 -0.9999999997 0.0000000000 +End Nodes + + +Begin Elements UPwSmallStrainElement3D8N + 1 1 85 84 93 94 89 87 95 98 + 2 1 88 85 94 97 90 89 98 99 + 3 1 76 74 84 85 79 78 87 89 + 4 1 80 76 85 88 81 79 89 90 + 5 1 67 66 74 76 70 68 78 79 + 6 1 71 67 76 80 72 70 79 81 + 7 1 58 56 66 67 61 60 68 70 + 8 1 62 58 67 71 63 61 70 72 + 9 1 49 48 56 58 53 50 60 61 + 10 1 52 49 58 62 54 53 61 63 + 11 1 40 39 48 49 43 41 50 53 + 12 1 44 40 49 52 45 43 53 54 + 13 1 30 28 39 40 34 33 41 43 + 14 1 35 30 40 44 37 34 43 45 + 15 1 20 16 28 30 26 23 33 34 + 16 1 25 20 30 35 31 26 34 37 + 17 1 8 7 16 20 19 14 23 26 + 18 1 18 8 20 25 24 19 26 31 + 19 1 5 2 7 8 13 9 14 19 + 20 1 12 5 8 18 21 13 19 24 + 21 1 83 82 91 92 85 84 93 94 + 22 1 86 83 92 96 88 85 94 97 + 23 1 75 73 82 83 76 74 84 85 + 24 1 77 75 83 86 80 76 85 88 + 25 1 65 64 73 75 67 66 74 76 + 26 1 69 65 75 77 71 67 76 80 + 27 1 57 55 64 65 58 56 66 67 + 28 1 59 57 65 69 62 58 67 71 + 29 1 47 46 55 57 49 48 56 58 + 30 1 51 47 57 59 52 49 58 62 + 31 1 38 36 46 47 40 39 48 49 + 32 1 42 38 47 51 44 40 49 52 + 33 1 29 27 36 38 30 28 39 40 + 34 1 32 29 38 42 35 30 40 44 + 35 1 17 11 27 29 20 16 28 30 + 36 1 22 17 29 32 25 20 30 35 + 37 1 6 4 11 17 8 7 16 20 + 38 1 15 6 17 22 18 8 20 25 + 39 1 3 1 4 6 5 2 7 8 + 40 1 10 3 6 15 12 5 8 18 +End Elements + + +Begin SubModelPart soil + Begin SubModelPartTables + End SubModelPartTables + Begin SubModelPartNodes + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + End SubModelPartNodes + Begin SubModelPartElements + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + End SubModelPartElements + Begin SubModelPartConditions + End SubModelPartConditions +End SubModelPart + +Begin SubModelPart sides + Begin SubModelPartTables + End SubModelPartTables + Begin SubModelPartNodes + 1 + 2 + 3 + 4 + 6 + 7 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 95 + 96 + 97 + 98 + 99 + End SubModelPartNodes + Begin SubModelPartElements + End SubModelPartElements + Begin SubModelPartConditions + End SubModelPartConditions +End SubModelPart + + +Begin SubModelPart bottom + Begin SubModelPartTables + End SubModelPartTables + Begin SubModelPartNodes + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + End SubModelPartNodes + Begin SubModelPartElements + End SubModelPartElements + Begin SubModelPartConditions + End SubModelPartConditions +End SubModelPart + From dd9a165994cc13f6a85ae2124907d95b5807d9dc Mon Sep 17 00:00:00 2001 From: markelov Date: Mon, 18 Nov 2024 23:09:39 +0100 Subject: [PATCH 07/12] added dimension into CheckK0MainDirection --- .../custom_processes/apply_k0_procedure_process.cpp | 13 +++++++++++-- .../cpp_tests/test_apply_k0_procedure_process.cpp | 12 ++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp index 8ea11797b3b..4377c5220ac 100644 --- a/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/custom_processes/apply_k0_procedure_process.cpp @@ -78,8 +78,17 @@ void ApplyK0ProcedureProcess::CheckK0MainDirection(const Properties& rProperties { KRATOS_ERROR_IF(!rProperties.Has(K0_MAIN_DIRECTION)) << "K0_MAIN_DIRECTION is not defined for element " << ElementId << "." << std::endl; - KRATOS_ERROR_IF(rProperties[K0_MAIN_DIRECTION] < 0 || rProperties[K0_MAIN_DIRECTION] > 2) - << "K0_MAIN_DIRECTION should be 0, 1 or 2 for element " << ElementId << "." << std::endl; + + const auto dimension = rProperties.GetValue(CONSTITUTIVE_LAW).get()->WorkingSpaceDimension(); + if (dimension == 2) { + KRATOS_ERROR_IF(rProperties[K0_MAIN_DIRECTION] < 0 || rProperties[K0_MAIN_DIRECTION] > 1) + << "K0_MAIN_DIRECTION should be 0 or 1 for element " << ElementId << "." << std::endl; + } else if (dimension == 3) { + KRATOS_ERROR_IF(rProperties[K0_MAIN_DIRECTION] < 0 || rProperties[K0_MAIN_DIRECTION] > 2) + << "K0_MAIN_DIRECTION should be 0, 1 or 2 for element " << ElementId << "." << std::endl; + } else { + KRATOS_ERROR << "dimension should be 2 or 3 for element " << ElementId << "." << std::endl; + } } void ApplyK0ProcedureProcess::CheckK0(const Properties& rProperties, IndexType ElementId) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index b7b696e1aef..56a861cfec9 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -10,6 +10,7 @@ // Main authors: Anne van de Graaf // #include "containers/model.h" +#include "custom_constitutive/plane_strain.h" #include "custom_processes/apply_k0_procedure_process.h" #include "geo_mechanics_application_variables.h" #include "geo_mechanics_fast_suite.h" @@ -18,6 +19,8 @@ #include "test_utilities.h" #include +#include +#include namespace { @@ -422,6 +425,15 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, Krat "K0_MAIN_DIRECTION is not defined for element 1."); p_element->GetProperties().SetValue(K0_MAIN_DIRECTION, 4); + + p_element->GetProperties().SetValue( + CONSTITUTIVE_LAW, std::make_unique(std::make_unique())); + KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), + "K0_MAIN_DIRECTION should be 0 or 1 for element 1.") + + p_element->GetProperties().SetValue( + CONSTITUTIVE_LAW, + std::make_unique(std::make_unique())); KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), "K0_MAIN_DIRECTION should be 0, 1 or 2 for element 1.") From 0473af7c07e2474c507b195a85d10ac91adfc947 Mon Sep 17 00:00:00 2001 From: markelov Date: Mon, 18 Nov 2024 23:12:59 +0100 Subject: [PATCH 08/12] format --- .../tests/cpp_tests/test_apply_k0_procedure_process.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index 56a861cfec9..ae455fb0e93 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -17,11 +17,11 @@ #include "includes/element.h" #include "stub_linear_elastic_law.h" #include "test_utilities.h" - -#include #include #include +#include + namespace { From aaaf7a44443cc43998a3abd50dc7e758f439a5ef Mon Sep 17 00:00:00 2001 From: markelov Date: Tue, 19 Nov 2024 13:05:38 +0100 Subject: [PATCH 09/12] used mock --- .../test_apply_k0_procedure_process.cpp | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index ae455fb0e93..a9c4e064c7b 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -10,7 +10,6 @@ // Main authors: Anne van de Graaf // #include "containers/model.h" -#include "custom_constitutive/plane_strain.h" #include "custom_processes/apply_k0_procedure_process.h" #include "geo_mechanics_application_variables.h" #include "geo_mechanics_fast_suite.h" @@ -18,15 +17,23 @@ #include "stub_linear_elastic_law.h" #include "test_utilities.h" #include -#include #include +#include namespace { using namespace Kratos; +class MockConstitutiveLaw : public GeoIncrementalLinearElasticLaw +{ +public: + //KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MockConstitutiveLaw); + + MOCK_METHOD(std::size_t, WorkingSpaceDimension, (), (override)); +}; + class StubElement : public Element { public: @@ -420,20 +427,25 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, Krat const auto k0_settings = Parameters{}; ApplyK0ProcedureProcess process{r_model_part, k0_settings}; + auto mock_constitutive_law = std::make_shared(); + p_element->GetProperties().SetValue(CONSTITUTIVE_LAW, mock_constitutive_law); + EXPECT_CALL(*mock_constitutive_law, WorkingSpaceDimension()).WillRepeatedly(testing::Return(2)); + // Act & Assert KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), "K0_MAIN_DIRECTION is not defined for element 1."); p_element->GetProperties().SetValue(K0_MAIN_DIRECTION, 4); - p_element->GetProperties().SetValue( - CONSTITUTIVE_LAW, std::make_unique(std::make_unique())); + EXPECT_CALL(*mock_constitutive_law, WorkingSpaceDimension()).WillRepeatedly(testing::Return(1)); + KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), + "dimension should be 2 or 3 for element 1.") + + EXPECT_CALL(*mock_constitutive_law, WorkingSpaceDimension()).WillRepeatedly(testing::Return(2)); KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), "K0_MAIN_DIRECTION should be 0 or 1 for element 1.") - p_element->GetProperties().SetValue( - CONSTITUTIVE_LAW, - std::make_unique(std::make_unique())); + EXPECT_CALL(*mock_constitutive_law, WorkingSpaceDimension()).WillRepeatedly(testing::Return(3)); KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), "K0_MAIN_DIRECTION should be 0, 1 or 2 for element 1.") From d79d5e57bd968c6a1ecdd0dd3fa37afec7b0d32e Mon Sep 17 00:00:00 2001 From: markelov Date: Tue, 19 Nov 2024 13:18:06 +0100 Subject: [PATCH 10/12] updated integration test --- .../tests/test_k0_procedure_process.py | 18 +++++++++++++++--- .../ProjectParameters.json | 12 ++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py index c083dcb1f52..50aa199738d 100644 --- a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process.py @@ -27,6 +27,17 @@ def assert_stresses_at_integration_points(self, cauchy_stress_tensors, integrati for integration_point in integration_points: self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_horizontal_stress, expected_vertical_stress, rel_tol) + def compare_stresses_at_integration_point(self, cauchy_stress_tensors, integration_point, k0_nc, rel_tol): + """ + Verifies whether the computed stresses are (nearly) equal to some expected values at the + given integration point. Note that this function assumes there are no shear stresses! + """ + element_id, integration_point_index = integration_point + stress_tensor = cauchy_stress_tensors[element_id-1][integration_point_index] + z_stress = stress_tensor[2, 2] + self.assertIsClose(stress_tensor[0, 0], z_stress*k0_nc, rel_tol=rel_tol, msg=f"X stress at integration point {integration_point_index} of element {element_id}") + self.assertIsClose(stress_tensor[1, 1], z_stress*k0_nc, rel_tol=rel_tol, msg=f"Y stress at integration point {integration_point_index} of element {element_id}") + def test_k0_procedure_k0_nc(self): """ Test to check if CAUCHY_STRESS_XX is correctly derived from CAUCHY_STRESS_YY using K0_NC @@ -484,13 +495,14 @@ def test_k0_procedure_for_3d(self): cauchy_stress_tensors = test_helper.get_on_integration_points(simulation, Kratos.CAUCHY_STRESS_TENSOR) + k0_nc = 0.5 # Check the stresses at a few integration points integration_point = (1, 1) # bottom - self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_vertical_stress= -151.0731, expected_horizontal_stress= -151.0731, rel_tol=0.02) + self.compare_stresses_at_integration_point(cauchy_stress_tensors, integration_point, k0_nc, rel_tol=0.02) integration_point = (10, 1) # middle - self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_vertical_stress=-98.5239, expected_horizontal_stress=-98.5239, rel_tol=0.02) + self.compare_stresses_at_integration_point(cauchy_stress_tensors, integration_point, k0_nc, rel_tol=0.02) integration_point = (20, 1) # top - self.assert_stresses_at_integration_point(cauchy_stress_tensors, integration_point, expected_vertical_stress=-9.0382, expected_horizontal_stress=-9.0382, rel_tol=0.02) + self.compare_stresses_at_integration_point(cauchy_stress_tensors, integration_point, k0_nc, rel_tol=0.02) if __name__ == '__main__': KratosUnittest.main() diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json index cca2ccf100a..4f31ef89fd3 100644 --- a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_nc_3D/ProjectParameters.json @@ -2,7 +2,7 @@ "problem_data": { "problem_name": "lysmer_column3d_hexa_in_Z", "start_time": 0.0, - "end_time": 0.3, + "end_time": 1.0, "echo_level": 1, "parallel_type": "OpenMP", "number_of_threads": 1 @@ -19,8 +19,8 @@ "materials_filename": "MaterialParameters.json" }, "time_stepping": { - "time_step": 0.01, - "max_delta_time_factor": 1000 + "time_step": 1.0, + "max_delta_time_factor": 1 }, "buffer_size": 2, "echo_level": 1, @@ -30,7 +30,7 @@ "reform_dofs_at_each_step": false, "nodal_smoothing": false, "block_builder": true, - "solution_type": "Dynamic", + "solution_type": "Quasi_Static", "scheme_type": "Newmark", "reset_displacements": true, "newmark_beta": 0.25, @@ -39,7 +39,7 @@ "rayleigh_m": 0.1, "rayleigh_k": 0.001, "strategy_type": "newton_raphson", - "convergence_criterion": "displacement_criterion", + "convergence_criterion": "residual_criterion", "displacement_relative_tolerance": 1.0E-4, "displacement_absolute_tolerance": 1.0E-9, "residual_relative_tolerance": 1.0E-4, @@ -48,7 +48,7 @@ "water_pressure_absolute_tolerance": 1.0E-9, "min_iterations": 6, "max_iterations": 30, - "number_cycles": 100, + "number_cycles": 1, "reduction_factor": 1, "increase_factor": 1, "desired_iterations": 4, From a1ad02023ef4195951d4b6bee34216829f80acd6 Mon Sep 17 00:00:00 2001 From: markelov Date: Tue, 19 Nov 2024 13:18:52 +0100 Subject: [PATCH 11/12] format --- .../tests/cpp_tests/test_apply_k0_procedure_process.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index a9c4e064c7b..a3fcdf304cd 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -29,7 +29,7 @@ using namespace Kratos; class MockConstitutiveLaw : public GeoIncrementalLinearElasticLaw { public: - //KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MockConstitutiveLaw); + // KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MockConstitutiveLaw); MOCK_METHOD(std::size_t, WorkingSpaceDimension, (), (override)); }; @@ -427,7 +427,7 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, Krat const auto k0_settings = Parameters{}; ApplyK0ProcedureProcess process{r_model_part, k0_settings}; - auto mock_constitutive_law = std::make_shared(); + auto mock_constitutive_law = std::make_shared(); p_element->GetProperties().SetValue(CONSTITUTIVE_LAW, mock_constitutive_law); EXPECT_CALL(*mock_constitutive_law, WorkingSpaceDimension()).WillRepeatedly(testing::Return(2)); @@ -438,8 +438,7 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, Krat p_element->GetProperties().SetValue(K0_MAIN_DIRECTION, 4); EXPECT_CALL(*mock_constitutive_law, WorkingSpaceDimension()).WillRepeatedly(testing::Return(1)); - KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), - "dimension should be 2 or 3 for element 1.") + KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), "dimension should be 2 or 3 for element 1.") EXPECT_CALL(*mock_constitutive_law, WorkingSpaceDimension()).WillRepeatedly(testing::Return(2)); KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(), From 3c5dbf5884dd8474c33102100a164f1d450454ad Mon Sep 17 00:00:00 2001 From: markelov Date: Tue, 19 Nov 2024 13:38:23 +0100 Subject: [PATCH 12/12] removed commented line --- .../tests/cpp_tests/test_apply_k0_procedure_process.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp index a3fcdf304cd..fc7523e8a0c 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp @@ -29,8 +29,6 @@ using namespace Kratos; class MockConstitutiveLaw : public GeoIncrementalLinearElasticLaw { public: - // KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MockConstitutiveLaw); - MOCK_METHOD(std::size_t, WorkingSpaceDimension, (), (override)); };