From 4f4e75424bde69a41d67ef07b1c628a4d76c825d Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 08:42:52 +0100 Subject: [PATCH 01/39] add last tets quadrature Lobatto --- ...ahedron_gauss_lobatto_integration_points.h | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 kratos/integration/tetrahedron_gauss_lobatto_integration_points.h diff --git a/kratos/integration/tetrahedron_gauss_lobatto_integration_points.h b/kratos/integration/tetrahedron_gauss_lobatto_integration_points.h new file mode 100644 index 00000000000..dd88beaa3c7 --- /dev/null +++ b/kratos/integration/tetrahedron_gauss_lobatto_integration_points.h @@ -0,0 +1,77 @@ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ ` +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Alejandro Cornejo +// +// + +#pragma once + +// System includes + +// External includes + +// Project includes +#include "integration/quadrature.h" + +namespace Kratos +{ + +class TetrahedronGaussLobattoIntegrationPoints1 +{ +public: + KRATOS_CLASS_POINTER_DEFINITION(TetrahedronGaussLobattoIntegrationPoints1); + typedef std::size_t SizeType; + + static const unsigned int Dimension = 3; + + typedef IntegrationPoint<2> IntegrationPointType; + + typedef std::array IntegrationPointsArrayType; + + typedef IntegrationPointType::PointType PointType; + + static SizeType IntegrationPointsNumber() + { + return 4; + } + + static const IntegrationPointsArrayType& IntegrationPoints() + { + const double one_over_twenty_four = 1.0 / 24.0; + static const IntegrationPointsArrayType s_integration_points{{ + IntegrationPointType( 0.0, 0.0 , 0.0, one_over_twenty_four ), + IntegrationPointType( 1.0, 0.0 , 0.0, one_over_twenty_four ), + IntegrationPointType( 0.0, 1.0 , 0.0, one_over_twenty_four ), + IntegrationPointType( 0.0, 0.0 , 1.0, one_over_twenty_four ) + }}; + return s_integration_points; + } + + std::string Info() const + { + std::stringstream buffer; + buffer << "Tetrahedron Gauss-Lobatto quadrature 1 (4 points, degree of precision = 1)"; + return buffer.str(); + } +}; // Class TetrahedronGaussLobattoIntegrationPoints1 + +///@name Type Definitions +///@{ + + +///@} +///@name Input and output +///@{ + + +///@} + + +} // namespace Kratos. From 3c3cd85a2ada6e43785172ee596c533406e29693 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 11:59:35 +0100 Subject: [PATCH 02/39] adding tetrahedron test lobatto --- .../test_integration_quadratures.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp b/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp index 55aee9545e7..38e2dc94ef8 100644 --- a/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp +++ b/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp @@ -19,6 +19,7 @@ #include "integration/quadrilateral_gauss_lobatto_integration_points.h" #include "integration/hexahedron_gauss_lobatto_integration_points.h" #include "integration/triangle_gauss_lobatto_integration_points.h" +#include "integration/tetrahedron_gauss_lobatto_integration_points.h" namespace Kratos::Testing { @@ -130,4 +131,26 @@ KRATOS_TEST_CASE_IN_SUITE(GaussLobattoTriangleQuadraturesTest, KratosCoreFastSui KRATOS_CHECK_NEAR(quadrature_integral_f, integral_f, 1.0E-6); } +KRATOS_TEST_CASE_IN_SUITE(GaussLobattoTetrahedronQuadraturesTest, KratosCoreFastSuite) +{ + + // In This test we evaluate the Gauss-Lobatto quadrature for integrating + // f = 1.0 over an isoparametric tetrahedron + + const auto& r_lobatto_1 = TetrahedronGaussLobattoIntegrationPoints1(); + + // Analytical result, reference + const double integral_f = 1.0 / 6.0; + + double quadrature_integral_f = 0.0; + + // Integral for f with Lobatto 1 + for (IndexType IP = 0; IP < r_lobatto_1.IntegrationPoints().size(); ++IP) { + const double w = r_lobatto_1.IntegrationPoints()[IP].Weight(); + quadrature_integral_f += w; + } + + KRATOS_CHECK_NEAR(quadrature_integral_f, integral_f, 1.0E-6); +} + } // namespace Kratos::Testing \ No newline at end of file From 1ff4baef6cb3501d43895fc50d1e4cb264370633 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 14:40:00 +0100 Subject: [PATCH 03/39] adding new quadrature type --- kratos/geometries/geometry_data.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kratos/geometries/geometry_data.h b/kratos/geometries/geometry_data.h index dd0b5782742..6624d7103b2 100644 --- a/kratos/geometries/geometry_data.h +++ b/kratos/geometries/geometry_data.h @@ -83,6 +83,7 @@ class GeometryData GI_EXTENDED_GAUSS_3, GI_EXTENDED_GAUSS_4, GI_EXTENDED_GAUSS_5, + GI_LOBATTO_1, NumberOfIntegrationMethods // Note that this entry needs to be always the last to be used as integration methods counter }; From 40d78fcf5e32eb24f7c389011b9d9cf95b4fb418 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 14:40:31 +0100 Subject: [PATCH 04/39] adding lobatto to quad 2d 4N --- kratos/geometries/quadrilateral_2d_4.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kratos/geometries/quadrilateral_2d_4.h b/kratos/geometries/quadrilateral_2d_4.h index cfd9a1ba4d7..de7b1cb8dd5 100644 --- a/kratos/geometries/quadrilateral_2d_4.h +++ b/kratos/geometries/quadrilateral_2d_4.h @@ -4,8 +4,8 @@ // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // -// License: BSD License -// Kratos default license: kratos/license.txt +// License: BSD License +// Kratos default license: kratos/license.txt // // Main authors: Riccardo Rossi // Janosch Stascheit @@ -26,6 +26,7 @@ #include "utilities/integration_utilities.h" #include "integration/quadrilateral_gauss_legendre_integration_points.h" #include "integration/quadrilateral_collocation_integration_points.h" +#include "integration/quadrilateral_gauss_lobatto_integration_points.h" namespace Kratos { @@ -1053,6 +1054,8 @@ template class Quadrilateral2D4 Quadrature < QuadrilateralCollocationIntegrationPoints4, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < QuadrilateralCollocationIntegrationPoints5, + 2, IntegrationPoint<3> >::GenerateIntegrationPoints(), + Quadrature < QuadrilateralGaussLobattoIntegrationPoints2, 2, IntegrationPoint<3> >::GenerateIntegrationPoints() } }; @@ -1086,7 +1089,9 @@ template class Quadrilateral2D4 Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ) + GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), + Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsValues( + GeometryData::IntegrationMethod::GI_LOBATTO_1 ) } }; return shape_functions_values; @@ -1111,6 +1116,7 @@ template class Quadrilateral2D4 Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), + Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ), } }; return shape_functions_local_gradients; From 5b5db616f31bf03d15fa4eed7d26a20ae67c6378 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 14:46:21 +0100 Subject: [PATCH 05/39] update triangle 2D3N --- kratos/geometries/triangle_2d_3.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/kratos/geometries/triangle_2d_3.h b/kratos/geometries/triangle_2d_3.h index e4841163c16..03e36c47960 100644 --- a/kratos/geometries/triangle_2d_3.h +++ b/kratos/geometries/triangle_2d_3.h @@ -4,8 +4,8 @@ // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // -// License: BSD License -// Kratos default license: kratos/license.txt +// License: BSD License +// Kratos default license: kratos/license.txt // // Main authors: Riccardo Rossi // Janosch Stascheit @@ -14,8 +14,7 @@ // Josep Maria Carbonell // -#if !defined(KRATOS_TRIANGLE_2D_3_H_INCLUDED ) -#define KRATOS_TRIANGLE_2D_3_H_INCLUDED +#pragma once // System includes @@ -26,6 +25,7 @@ #include "geometries/line_2d_2.h" #include "integration/triangle_gauss_legendre_integration_points.h" #include "integration/triangle_collocation_integration_points.h" +#include "integration/triangle_gauss_lobatto_integration_points.h" #include "utilities/intersection_utilities.h" namespace Kratos @@ -1549,7 +1549,8 @@ template class Triangle2D3 Quadrature >::GenerateIntegrationPoints(), Quadrature >::GenerateIntegrationPoints(), Quadrature >::GenerateIntegrationPoints(), - Quadrature >::GenerateIntegrationPoints() + Quadrature >::GenerateIntegrationPoints(), + Quadrature >::GenerateIntegrationPoints() } }; return integration_points; @@ -1582,7 +1583,9 @@ template class Triangle2D3 Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), + GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ),, + Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( + GeometryData::IntegrationMethod::GI_LOBATTO_1 ), } }; return shape_functions_values; @@ -1607,6 +1610,7 @@ template class Triangle2D3 Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), + Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ), } }; return shape_functions_local_gradients; @@ -2267,5 +2271,3 @@ template const GeometryDimension Triangle2D3::msGeometryDimension(2, 2); }// namespace Kratos. - -#endif // KRATOS_TRIANGLE_2D_3_H_INCLUDED defined From 80b13ecb8803b2aa3f71e448dc5cd0f0c8f0ac85 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 14:48:25 +0100 Subject: [PATCH 06/39] update tet 3D4N --- kratos/geometries/tetrahedra_3d_4.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kratos/geometries/tetrahedra_3d_4.h b/kratos/geometries/tetrahedra_3d_4.h index dcad8408b4e..e50862432df 100644 --- a/kratos/geometries/tetrahedra_3d_4.h +++ b/kratos/geometries/tetrahedra_3d_4.h @@ -4,8 +4,8 @@ // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // -// License: BSD License -// Kratos default license: kratos/license.txt +// License: BSD License +// Kratos default license: kratos/license.txt // // Main authors: Riccardo Rossi // Janosch Stascheit @@ -23,6 +23,7 @@ // Project includes #include "geometries/triangle_3d_3.h" #include "integration/tetrahedron_gauss_legendre_integration_points.h" +#include "integration/tetrahedron_gauss_lobatto_integration_points.h" #include "geometries/plane.h" #include "utilities/geometry_utilities.h" @@ -1857,6 +1858,8 @@ template class Tetrahedra3D4 : public Geometry 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature >::GenerateIntegrationPoints(), + Quadrature >::GenerateIntegrationPoints(), } }; return integration_points; @@ -1876,7 +1879,9 @@ template class Tetrahedra3D4 : public Geometry Tetrahedra3D4::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4), Tetrahedra3D4::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_GAUSS_5) + GeometryData::IntegrationMethod::GI_GAUSS_5), + Tetrahedra3D4::CalculateShapeFunctionsIntegrationPointsValues( + GeometryData::IntegrationMethod::GI_LOBATTO_1) } }; return shape_functions_values; @@ -1897,7 +1902,9 @@ template class Tetrahedra3D4 : public Geometry Tetrahedra3D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4), Tetrahedra3D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_GAUSS_5) + GeometryData::IntegrationMethod::GI_GAUSS_5), + Tetrahedra3D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( + GeometryData::IntegrationMethod::GI_LOBATTO_1) } }; return shape_functions_local_gradients; From 30788d485d187ced1abcf6df01de6c1d1ab96745 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 14:52:05 +0100 Subject: [PATCH 07/39] update hexa 3D 8N --- kratos/geometries/hexahedra_3d_8.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kratos/geometries/hexahedra_3d_8.h b/kratos/geometries/hexahedra_3d_8.h index edc8c86391b..32d6b728d85 100644 --- a/kratos/geometries/hexahedra_3d_8.h +++ b/kratos/geometries/hexahedra_3d_8.h @@ -1450,6 +1450,7 @@ template class Hexahedra3D8 : public Geometry Quadrature < HexahedronGaussLegendreIntegrationPoints4, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLegendreIntegrationPoints5, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), + Quadrature < HexahedronGaussLobattoIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLobattoIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints() } }; @@ -1467,7 +1468,8 @@ template class Hexahedra3D8 : public Geometry Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4 ), Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_5 ), Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ), - Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ) + Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ), + Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_LOBATTO_1 ) } }; return shape_functions_values; @@ -1488,7 +1490,8 @@ template class Hexahedra3D8 : public Geometry Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 ), Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_5 ), Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ), - Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ) + Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ), + Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ) } }; return shape_functions_local_gradients; From 11f2e5d16f3d6966504a286a421904a247606e99 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Tue, 10 Dec 2024 14:54:27 +0100 Subject: [PATCH 08/39] minor --- kratos/geometries/triangle_2d_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kratos/geometries/triangle_2d_3.h b/kratos/geometries/triangle_2d_3.h index 03e36c47960..f483aa90eef 100644 --- a/kratos/geometries/triangle_2d_3.h +++ b/kratos/geometries/triangle_2d_3.h @@ -1583,7 +1583,7 @@ template class Triangle2D3 Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ),, + GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_LOBATTO_1 ), } From 114d45bf5cab38955ebb77988eee30876f3e842d Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Fri, 13 Dec 2024 11:34:09 +0100 Subject: [PATCH 09/39] remove commas --- kratos/geometries/quadrilateral_2d_4.h | 2 +- kratos/geometries/tetrahedra_3d_4.h | 2 +- kratos/geometries/triangle_2d_3.h | 4 ++-- kratos/utilities/geometry_tester.cpp | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kratos/geometries/quadrilateral_2d_4.h b/kratos/geometries/quadrilateral_2d_4.h index de7b1cb8dd5..8030374ad91 100644 --- a/kratos/geometries/quadrilateral_2d_4.h +++ b/kratos/geometries/quadrilateral_2d_4.h @@ -1116,7 +1116,7 @@ template class Quadrilateral2D4 Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), - Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ), + Quadrilateral2D4::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ) } }; return shape_functions_local_gradients; diff --git a/kratos/geometries/tetrahedra_3d_4.h b/kratos/geometries/tetrahedra_3d_4.h index e50862432df..f779c64ea7e 100644 --- a/kratos/geometries/tetrahedra_3d_4.h +++ b/kratos/geometries/tetrahedra_3d_4.h @@ -1859,7 +1859,7 @@ template class Tetrahedra3D4 : public Geometry Quadrature >::GenerateIntegrationPoints(), Quadrature >::GenerateIntegrationPoints(), + 3, IntegrationPoint<3> >::GenerateIntegrationPoints() } }; return integration_points; diff --git a/kratos/geometries/triangle_2d_3.h b/kratos/geometries/triangle_2d_3.h index f483aa90eef..0b18ab82aeb 100644 --- a/kratos/geometries/triangle_2d_3.h +++ b/kratos/geometries/triangle_2d_3.h @@ -1585,7 +1585,7 @@ template class Triangle2D3 Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_LOBATTO_1 ), + GeometryData::IntegrationMethod::GI_LOBATTO_1 ) } }; return shape_functions_values; @@ -1610,7 +1610,7 @@ template class Triangle2D3 Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ), - Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ), + Triangle2D3::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ) } }; return shape_functions_local_gradients; diff --git a/kratos/utilities/geometry_tester.cpp b/kratos/utilities/geometry_tester.cpp index ea0eaa2d51c..97c13b15264 100644 --- a/kratos/utilities/geometry_tester.cpp +++ b/kratos/utilities/geometry_tester.cpp @@ -1144,6 +1144,8 @@ std::string GeometryTesterUtility::GetIntegrationName( return std::string("GI_EXTENDED_GAUSS_4"); case GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 : return std::string("GI_EXTENDED_GAUSS_5"); + case GeometryData::IntegrationMethod::GI_LOBATTO_1 : + return std::string("GI_LOBATTO_1"); case GeometryData::IntegrationMethod::NumberOfIntegrationMethods : return std::string("NumberOfIntegrationMethods"); }; From 6bacc5983cfbdb8eb07ff8c5c2fed809827c3fff Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Fri, 13 Dec 2024 14:25:56 +0100 Subject: [PATCH 10/39] adding more CI suggestions --- kratos/integration/integration_info.cpp | 4 ++++ kratos/integration/integration_info.h | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/kratos/integration/integration_info.cpp b/kratos/integration/integration_info.cpp index 833ab5ccd72..ab962b76637 100644 --- a/kratos/integration/integration_info.cpp +++ b/kratos/integration/integration_info.cpp @@ -110,6 +110,10 @@ namespace Kratos mNumberOfIntegrationPointsPerSpanVector[DimensionIndex] = 5; mQuadratureMethodVector[DimensionIndex] = QuadratureMethod::EXTENDED_GAUSS; break; + case IntegrationMethod::GI_LOBATTO_1: + mNumberOfIntegrationPointsPerSpanVector[DimensionIndex] = 2; + mQuadratureMethodVector[DimensionIndex] = QuadratureMethod::LOBATTO; + break; case IntegrationMethod::NumberOfIntegrationMethods: mNumberOfIntegrationPointsPerSpanVector[DimensionIndex] = 0; mQuadratureMethodVector[DimensionIndex] = QuadratureMethod::Default; diff --git a/kratos/integration/integration_info.h b/kratos/integration/integration_info.h index 0b93d113573..7360657b0ca 100644 --- a/kratos/integration/integration_info.h +++ b/kratos/integration/integration_info.h @@ -61,6 +61,7 @@ class KRATOS_API(KRATOS_CORE) IntegrationInfo : public Flags Default, GAUSS, EXTENDED_GAUSS, + LOBATTO, GRID }; @@ -135,8 +136,11 @@ class KRATOS_API(KRATOS_CORE) IntegrationInfo : public Flags if (ThisQuadratureMethod == QuadratureMethod::GAUSS) { return IntegrationMethod::GI_GAUSS_2; } - else { + else if (ThisQuadratureMethod == QuadratureMethod::EXTENDED_GAUSS) { return IntegrationMethod::GI_EXTENDED_GAUSS_2; + } + else { + return IntegrationMethod::GI_LOBATTO_1; } break; case 3: From e138fafff8093e4b716fd8e0bbeb3cf8f0cd9899 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Fri, 13 Dec 2024 14:59:09 +0100 Subject: [PATCH 11/39] even more CI --- kratos/tests/cpp_tests/geometries/test_geometry.cpp | 6 ++++-- kratos/tests/cpp_tests/geometries/test_geometry.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kratos/tests/cpp_tests/geometries/test_geometry.cpp b/kratos/tests/cpp_tests/geometries/test_geometry.cpp index 53024231df3..750591c5195 100644 --- a/kratos/tests/cpp_tests/geometries/test_geometry.cpp +++ b/kratos/tests/cpp_tests/geometries/test_geometry.cpp @@ -4,8 +4,8 @@ // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // -// License: BSD License -// Kratos default license: kratos/license.txt +// License: BSD License +// Kratos default license: kratos/license.txt // // Main authors: Carlos A. Roig // Vicente Mataix Ferrandiz @@ -60,6 +60,8 @@ namespace Testing { return "GI_EXTENDED_GAUSS_4"; case GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 : return "GI_EXTENDED_GAUSS_5"; + case GeometryData::IntegrationMethod::GI_LOBATTO_1 : + return "GI_LOBATTO_1"; case GeometryData::IntegrationMethod::NumberOfIntegrationMethods : return "NumberOfIntegrationMethods"; }; diff --git a/kratos/tests/cpp_tests/geometries/test_geometry.h b/kratos/tests/cpp_tests/geometries/test_geometry.h index 6b52278ba8f..009d3f94a22 100644 --- a/kratos/tests/cpp_tests/geometries/test_geometry.h +++ b/kratos/tests/cpp_tests/geometries/test_geometry.h @@ -4,8 +4,8 @@ // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // -// License: BSD License -// Kratos default license: kratos/license.txt +// License: BSD License +// Kratos default license: kratos/license.txt // // Main authors: Carlos A. Roig // Vicente Mataix Ferrandiz From 367e84dbdfc1fa796d5dcfd606cdb2071804eb63 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Mon, 16 Dec 2024 17:42:14 +0100 Subject: [PATCH 12/39] renaming --- kratos/geometries/hexahedra_3d_8.h | 4 +-- kratos/geometries/hexahedra_interface_3d_8.h | 4 +-- kratos/geometries/quadrilateral_2d_4.h | 2 +- ...ahedron_gauss_lobatto_integration_points.h | 20 ++++++-------- kratos/integration/integration_info.h | 10 +++---- ...lateral_gauss_lobatto_integration_points.h | 26 +++++++++---------- .../test_integration_quadratures.cpp | 8 +++--- 7 files changed, 34 insertions(+), 40 deletions(-) diff --git a/kratos/geometries/hexahedra_3d_8.h b/kratos/geometries/hexahedra_3d_8.h index 32d6b728d85..3fe7bb6a621 100644 --- a/kratos/geometries/hexahedra_3d_8.h +++ b/kratos/geometries/hexahedra_3d_8.h @@ -1450,8 +1450,8 @@ template class Hexahedra3D8 : public Geometry Quadrature < HexahedronGaussLegendreIntegrationPoints4, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLegendreIntegrationPoints5, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < HexahedronGaussLobattoIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < HexahedronGaussLobattoIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints() + Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), + Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints() } }; return integration_points; diff --git a/kratos/geometries/hexahedra_interface_3d_8.h b/kratos/geometries/hexahedra_interface_3d_8.h index aaadab166fc..1bbb84a0a03 100644 --- a/kratos/geometries/hexahedra_interface_3d_8.h +++ b/kratos/geometries/hexahedra_interface_3d_8.h @@ -1766,9 +1766,9 @@ template class HexahedraInterface3D8 : public Geometry >::GenerateIntegrationPoints(), - Quadrature < HexahedronGaussLobattoIntegrationPoints2, + Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), IntegrationPointsArrayType(), IntegrationPointsArrayType() diff --git a/kratos/geometries/quadrilateral_2d_4.h b/kratos/geometries/quadrilateral_2d_4.h index 8030374ad91..5fc08b3ccd5 100644 --- a/kratos/geometries/quadrilateral_2d_4.h +++ b/kratos/geometries/quadrilateral_2d_4.h @@ -1055,7 +1055,7 @@ template class Quadrilateral2D4 2, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < QuadrilateralCollocationIntegrationPoints5, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < QuadrilateralGaussLobattoIntegrationPoints2, + Quadrature < QuadrilateralGaussLobattoIntegrationPoints1, 2, IntegrationPoint<3> >::GenerateIntegrationPoints() } }; diff --git a/kratos/integration/hexahedron_gauss_lobatto_integration_points.h b/kratos/integration/hexahedron_gauss_lobatto_integration_points.h index b9a11431cb5..7b4e59e4268 100644 --- a/kratos/integration/hexahedron_gauss_lobatto_integration_points.h +++ b/kratos/integration/hexahedron_gauss_lobatto_integration_points.h @@ -28,10 +28,10 @@ namespace Kratos { //TODO -class HexahedronGaussLobattoIntegrationPoints1 +class HexahedronGaussLobattoIntegrationPoints0 { public: - KRATOS_CLASS_POINTER_DEFINITION(HexahedronGaussLobattoIntegrationPoints1); + KRATOS_CLASS_POINTER_DEFINITION(HexahedronGaussLobattoIntegrationPoints0); typedef std::size_t SizeType; static const unsigned int Dimension = 3; @@ -61,17 +61,15 @@ class HexahedronGaussLobattoIntegrationPoints1 std::string Info() const { std::stringstream buffer; - buffer << "Hexahedron Gauss-Lobatto quadrature 1 "; + buffer << "Hexahedron Gauss-Lobatto quadrature 0 "; return buffer.str(); } +}; // Class HexahedronGaussLobattoIntegrationPoints0 - -}; // Class HexahedronGaussLobattoIntegrationPoints1 - -class HexahedronGaussLobattoIntegrationPoints2 +class HexahedronGaussLobattoIntegrationPoints1 { public: - KRATOS_CLASS_POINTER_DEFINITION(HexahedronGaussLobattoIntegrationPoints2); + KRATOS_CLASS_POINTER_DEFINITION(HexahedronGaussLobattoIntegrationPoints1); typedef std::size_t SizeType; static const unsigned int Dimension = 3; @@ -105,12 +103,10 @@ class HexahedronGaussLobattoIntegrationPoints2 std::string Info() const { std::stringstream buffer; - buffer << "Hexahedron Gauss-Lobatto quadrature 2 "; + buffer << "Hexahedron Gauss-Lobatto quadrature 1 "; return buffer.str(); } - - -}; // Class HexahedronGaussLobattoIntegrationPoints2 +}; // Class HexahedronGaussLobattoIntegrationPoints1 diff --git a/kratos/integration/integration_info.h b/kratos/integration/integration_info.h index 7360657b0ca..acc9a883ec8 100644 --- a/kratos/integration/integration_info.h +++ b/kratos/integration/integration_info.h @@ -128,19 +128,19 @@ class KRATOS_API(KRATOS_CORE) IntegrationInfo : public Flags if (ThisQuadratureMethod == QuadratureMethod::GAUSS) { return IntegrationMethod::GI_GAUSS_1; } - else { + else if (ThisQuadratureMethod == QuadratureMethod::EXTENDED_GAUSS) { return IntegrationMethod::GI_EXTENDED_GAUSS_1; } + else { + return IntegrationMethod::GI_LOBATTO_1; + } break; case 2: if (ThisQuadratureMethod == QuadratureMethod::GAUSS) { return IntegrationMethod::GI_GAUSS_2; } - else if (ThisQuadratureMethod == QuadratureMethod::EXTENDED_GAUSS) { - return IntegrationMethod::GI_EXTENDED_GAUSS_2; - } else { - return IntegrationMethod::GI_LOBATTO_1; + return IntegrationMethod::GI_EXTENDED_GAUSS_2; } break; case 3: diff --git a/kratos/integration/quadrilateral_gauss_lobatto_integration_points.h b/kratos/integration/quadrilateral_gauss_lobatto_integration_points.h index 96e038d0681..526b10ab5c6 100644 --- a/kratos/integration/quadrilateral_gauss_lobatto_integration_points.h +++ b/kratos/integration/quadrilateral_gauss_lobatto_integration_points.h @@ -21,15 +21,13 @@ // Project includes #include "integration/quadrature.h" -// TO BE COMPLETED: Only the needed ones have been implemented - namespace Kratos { - class QuadrilateralGaussLobattoIntegrationPoints1 + class QuadrilateralGaussLobattoIntegrationPoints0 { public: - KRATOS_CLASS_POINTER_DEFINITION(QuadrilateralGaussLobattoIntegrationPoints1); + KRATOS_CLASS_POINTER_DEFINITION(QuadrilateralGaussLobattoIntegrationPoints0); typedef std::size_t SizeType; static const unsigned int Dimension = 2; @@ -56,16 +54,16 @@ namespace Kratos std::string Info() const { std::stringstream buffer; - buffer << "Quadrilateral Gauss-Lobatto integration 1 "; + buffer << "Quadrilateral Gauss-Lobatto integration 0 "; return buffer.str(); } - }; // Class QuadrilateralGaussLobattoIntegrationPoints1 + }; // Class QuadrilateralGaussLobattoIntegrationPoints0 - class QuadrilateralGaussLobattoIntegrationPoints2 + class QuadrilateralGaussLobattoIntegrationPoints1 { public: - KRATOS_CLASS_POINTER_DEFINITION(QuadrilateralGaussLobattoIntegrationPoints2); + KRATOS_CLASS_POINTER_DEFINITION(QuadrilateralGaussLobattoIntegrationPoints1); typedef std::size_t SizeType; static const unsigned int Dimension = 2; @@ -94,16 +92,16 @@ namespace Kratos std::string Info() const { std::stringstream buffer; - buffer << "Quadrilateral Gauss-Lobatto integration 2 "; + buffer << "Quadrilateral Gauss-Lobatto integration 1 "; return buffer.str(); } - }; // Class QuadrilateralGaussLobattoIntegrationPoints2 + }; // Class QuadrilateralGaussLobattoIntegrationPoints1 - class QuadrilateralGaussLobattoIntegrationPoints3 + class QuadrilateralGaussLobattoIntegrationPoints2 { public: - KRATOS_CLASS_POINTER_DEFINITION(QuadrilateralGaussLobattoIntegrationPoints3); + KRATOS_CLASS_POINTER_DEFINITION(QuadrilateralGaussLobattoIntegrationPoints2); typedef std::size_t SizeType; static const unsigned int Dimension = 2; @@ -146,10 +144,10 @@ namespace Kratos std::string Info() const { std::stringstream buffer; - buffer << "Quadrilateral Gauss-Lobatto integration 3 "; + buffer << "Quadrilateral Gauss-Lobatto integration 2 "; return buffer.str(); } - }; // Class QuadrilateralGaussLobattoIntegrationPoints3 + }; // Class QuadrilateralGaussLobattoIntegrationPoints2 } diff --git a/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp b/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp index 38e2dc94ef8..af7e87b0d18 100644 --- a/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp +++ b/kratos/tests/cpp_tests/integration/test_integration_quadratures.cpp @@ -30,9 +30,9 @@ KRATOS_TEST_CASE_IN_SUITE(GaussLobattoQuadrilateralQuadraturesTest, KratosCoreFa // In This test we evaluate the Gauss-Lobatto quadratures for integrating // f = (x+y) and g = (x+y)^2 over a [-1, 1] quadrilateral - const auto& r_lobatto_1 = QuadrilateralGaussLobattoIntegrationPoints1(); - const auto& r_lobatto_2 = QuadrilateralGaussLobattoIntegrationPoints2(); - const auto& r_lobatto_3 = QuadrilateralGaussLobattoIntegrationPoints3(); + const auto& r_lobatto_1 = QuadrilateralGaussLobattoIntegrationPoints0(); + const auto& r_lobatto_2 = QuadrilateralGaussLobattoIntegrationPoints1(); + const auto& r_lobatto_3 = QuadrilateralGaussLobattoIntegrationPoints2(); // Analytical results, reference const double integral_f = 0.0; @@ -84,7 +84,7 @@ KRATOS_TEST_CASE_IN_SUITE(GaussLobattoHexaQuadraturesTest, KratosCoreFastSuite) // In This test we evaluate the Gauss-Lobatto quadratures for integrating // f = (x+y+z+5) over a [-1, 1] hexa - const auto& r_lobatto = HexahedronGaussLobattoIntegrationPoints2(); + const auto& r_lobatto = HexahedronGaussLobattoIntegrationPoints1(); // Analytical results, reference const double integral_f = 40.0; From c64a7b49a5e1a1215ec8c86943ed9a35545649fb Mon Sep 17 00:00:00 2001 From: markelov208 <146726001+markelov208@users.noreply.github.com> Date: Mon, 30 Dec 2024 19:50:07 +0100 Subject: [PATCH 13/39] [StructuralMechnicsApplication] Make sure the structural/interface elements used in the quay wall work with the geo reset displacement process (Timoshenko Curved Beam) (#12963) * changed TIMOSHENKO_BEAM_PRESTRESS_PK2 to BEAM_PRESTRESS_PK2 * added CalculateOnIntegrationPoints(Vector,... * added unit tests * extracted CalculateStrainVector private function * cleaned unit tests * cleaned timoshenko_beam_element_2D2N * removed Z coordinate for 2D unit tests * response to the review * reverted ScalarVector(3,.. --- .../timoshenko_beam_element_2D2N.cpp | 18 +-- .../timoshenko_curved_beam_element_2D3N.cpp | 148 ++++++++---------- .../timoshenko_curved_beam_element_2D3N.h | 14 +- ...tructural_mechanics_python_application.cpp | 2 +- .../structural_mechanics_application.cpp | 2 +- ...ctural_mechanics_application_variables.cpp | 2 +- ...ructural_mechanics_application_variables.h | 3 +- .../tests/cpp_tests/test_timoshenko_beams.cpp | 63 +++++--- 8 files changed, 132 insertions(+), 120 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_beam_element_2D2N.cpp b/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_beam_element_2D2N.cpp index c6728f15170..de40573bd78 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_beam_element_2D2N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_beam_element_2D2N.cpp @@ -951,15 +951,12 @@ void LinearTimoshenkoBeamElement2D2N::CalculateOnIntegrationPoints( const SizeType strain_size = mConstitutiveLawVector[0]->GetStrainSize(); const SizeType mat_size = GetDoFsPerNode() * GetGeometry().size(); rOutput.resize(integration_points.size()); - const auto &r_props = GetProperties(); if (rVariable == PK2_STRESS_VECTOR) { - - const auto &r_geometry = GetGeometry(); - - ConstitutiveLaw::Parameters cl_values(r_geometry, r_props, rProcessInfo); + const auto &r_props = GetProperties(); + ConstitutiveLaw::Parameters cl_values(GetGeometry(), r_props, rProcessInfo); const double length = CalculateLength(); - const double Phi = StructuralMechanicsElementUtilities::CalculatePhi(r_props, length); + const double phi = StructuralMechanicsElementUtilities::CalculatePhi(r_props, length); VectorType strain_vector(strain_size), stress_vector(strain_size); StructuralMechanicsElementUtilities::InitializeConstitutiveLawValuesForStressCalculation(cl_values, strain_vector, stress_vector); @@ -969,13 +966,12 @@ void LinearTimoshenkoBeamElement2D2N::CalculateOnIntegrationPoints( // Loop over the integration points for (SizeType integration_point = 0; integration_point < integration_points.size(); ++integration_point) { - CalculateGeneralizedStrainsVector(strain_vector, length, Phi, integration_points[integration_point].X(), nodal_values); + CalculateGeneralizedStrainsVector(strain_vector, length, phi, integration_points[integration_point].X(), nodal_values); mConstitutiveLawVector[integration_point]->CalculateMaterialResponsePK2(cl_values); - auto stress_vector = cl_values.GetStressVector(); - if ( this->GetProperties().Has(TIMOSHENKO_BEAM_PRESTRESS_PK2)) { - stress_vector += this->GetProperties()[TIMOSHENKO_BEAM_PRESTRESS_PK2]; + rOutput[integration_point] = cl_values.GetStressVector(); + if ( this->GetProperties().Has(BEAM_PRESTRESS_PK2)) { + rOutput[integration_point] += this->GetProperties()[BEAM_PRESTRESS_PK2]; } - rOutput[integration_point] = stress_vector; } } } diff --git a/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.cpp b/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.cpp index 6ba7bea908d..91a4d028863 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.cpp @@ -672,119 +672,101 @@ void LinearTimoshenkoCurvedBeamElement2D3N::CalculateOnIntegrationPoints( { const auto& r_integration_points = IntegrationPoints(GetIntegrationMethod()); rOutput.resize(r_integration_points.size()); - const auto &r_props = GetProperties(); if (rVariable == AXIAL_FORCE || rVariable == BENDING_MOMENT || rVariable == SHEAR_FORCE) { - const auto &r_geometry = GetGeometry(); - - ConstitutiveLaw::Parameters cl_values(r_geometry, r_props, rProcessInfo); - auto &r_cl_options = cl_values.GetOptions(); - r_cl_options.Set(ConstitutiveLaw::COMPUTE_STRESS , true); - r_cl_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); - - // Let's initialize the cl values + ConstitutiveLaw::Parameters cl_values(GetGeometry(), GetProperties(), rProcessInfo); VectorType strain_vector(StrainSize), stress_vector(StrainSize); - strain_vector.clear(); - cl_values.SetStrainVector(strain_vector); - cl_values.SetStressVector(stress_vector); - - GlobalSizeVector nodal_values, B_b, dNu, dN_theta, N_shape, Nu, N_theta, dN_shape; - BoundedMatrix frenet_serret; - BoundedVector N_forces, Gamma; // axial and shear forces, strains - BoundedMatrix B_s, aux_B_s; - - // Loop over the integration points - for (SizeType IP = 0; IP < r_integration_points.size(); ++IP) { - const double xi = r_integration_points[IP].X(); - const double J = GetJacobian(xi); - - GetNodalValuesVector(nodal_values); + StructuralMechanicsElementUtilities::InitializeConstitutiveLawValuesForStressCalculation(cl_values, strain_vector, stress_vector); - const array_3 shape_functions = GetShapeFunctionsValues(xi); - const array_3 d_shape_functions = GetFirstDerivativesShapeFunctionsValues(xi, J); - - GetShapeFunctionsValuesGlobalVectors(shape_functions, N_shape, Nu, N_theta); - GetShapeFunctionsValuesGlobalVectors(d_shape_functions, dN_shape, dNu, dN_theta); - - array_3 t, n; - GetTangentandTransverseUnitVectors(xi, t, n); - noalias(frenet_serret) = GetFrenetSerretMatrix(xi, t, n); - noalias(B_b) = dN_theta; - - // we fill aux_B_s - for (IndexType i = 0; i < SystemSize; ++i) { - aux_B_s(0, i) = dNu[i] + t[1] * N_theta[i]; - aux_B_s(1, i) = dN_shape[i] - t[0] * N_theta[i]; - } - noalias(B_s) = prod(frenet_serret, aux_B_s); + for (SizeType integration_point = 0; integration_point < r_integration_points.size(); ++integration_point) { - noalias(Gamma) = prod(B_s, nodal_values); - strain_vector[0] = Gamma[0]; // axial strain - strain_vector[2] = Gamma[1]; // shear strain - strain_vector[1] = inner_prod(B_b, nodal_values); // curvature + noalias(strain_vector) = CalculateStrainVector(r_integration_points[integration_point].X()); - mConstitutiveLawVector[IP]->CalculateMaterialResponseCauchy(cl_values); + mConstitutiveLawVector[integration_point]->CalculateMaterialResponseCauchy(cl_values); const Vector &r_generalized_stresses = cl_values.GetStressVector(); if (rVariable == AXIAL_FORCE) { - rOutput[IP] = r_generalized_stresses[0]; + rOutput[integration_point] = r_generalized_stresses[0]; } else if (rVariable == BENDING_MOMENT) { - rOutput[IP] = r_generalized_stresses[1]; + rOutput[integration_point] = r_generalized_stresses[1]; } else if (rVariable == SHEAR_FORCE) { - rOutput[IP] = r_generalized_stresses[2]; + rOutput[integration_point] = r_generalized_stresses[2]; } } } else if (rVariable == AXIAL_STRAIN || rVariable == BENDING_STRAIN || rVariable == SHEAR_STRAIN) { - // Let's initialize the cl values VectorType strain_vector(StrainSize); - GlobalSizeVector nodal_values, B_b, dNu, dN_theta, N_shape, Nu, N_theta, dN_shape; - BoundedMatrix frenet_serret; - BoundedVector N_forces, Gamma; // axial and shear forces, strains - BoundedMatrix B_s, aux_B_s; + for (SizeType integration_point = 0; integration_point < r_integration_points.size(); ++integration_point) { - // Loop over the integration points - for (SizeType IP = 0; IP < r_integration_points.size(); ++IP) { - const double xi = r_integration_points[IP].X(); - const double J = GetJacobian(xi); + noalias(strain_vector) = CalculateStrainVector(r_integration_points[integration_point].X()); - GetNodalValuesVector(nodal_values); + if (rVariable == AXIAL_STRAIN) { + rOutput[integration_point] = strain_vector[0]; + } else if (rVariable == BENDING_STRAIN) { + rOutput[integration_point] = strain_vector[1]; + } else if (rVariable == SHEAR_STRAIN) { + rOutput[integration_point] = strain_vector[2]; + } + } + } +} - const array_3 shape_functions = GetShapeFunctionsValues(xi); - const array_3 d_shape_functions = GetFirstDerivativesShapeFunctionsValues(xi, J); +void LinearTimoshenkoCurvedBeamElement2D3N::CalculateOnIntegrationPoints( + const Variable& rVariable, + std::vector& rOutput, + const ProcessInfo& rProcessInfo + ) +{ + const auto& r_integration_points = IntegrationPoints(GetIntegrationMethod()); + rOutput.resize(r_integration_points.size()); - GetShapeFunctionsValuesGlobalVectors(shape_functions, N_shape, Nu, N_theta); - GetShapeFunctionsValuesGlobalVectors(d_shape_functions, dN_shape, dNu, dN_theta); + if (rVariable == PK2_STRESS_VECTOR) { + ConstitutiveLaw::Parameters cl_values(GetGeometry(), GetProperties(), rProcessInfo); + VectorType strain_vector(StrainSize), stress_vector(StrainSize); + StructuralMechanicsElementUtilities::InitializeConstitutiveLawValuesForStressCalculation(cl_values, strain_vector, stress_vector); - array_3 t, n; - GetTangentandTransverseUnitVectors(xi, t, n); - noalias(frenet_serret) = GetFrenetSerretMatrix(xi, t, n); - noalias(B_b) = dN_theta; + for (SizeType integration_point = 0; integration_point < r_integration_points.size(); ++integration_point) { - // we fill aux_B_s - for (IndexType i = 0; i < SystemSize; ++i) { - aux_B_s(0, i) = dNu[i] + t[1] * N_theta[i]; - aux_B_s(1, i) = dN_shape[i] - t[0] * N_theta[i]; - } - noalias(B_s) = prod(frenet_serret, aux_B_s); + noalias(strain_vector) = CalculateStrainVector(r_integration_points[integration_point].X()); - noalias(Gamma) = prod(B_s, nodal_values); - strain_vector[0] = Gamma[0]; // axial strain - strain_vector[2] = Gamma[1]; // shear strain - strain_vector[1] = inner_prod(B_b, nodal_values); // curvature + mConstitutiveLawVector[integration_point]->CalculateMaterialResponsePK2(cl_values); - if (rVariable == AXIAL_STRAIN) { - rOutput[IP] = strain_vector[0]; - } else if (rVariable == BENDING_STRAIN) { - rOutput[IP] = strain_vector[1]; - } else if (rVariable == SHEAR_STRAIN) { - rOutput[IP] = strain_vector[2]; + rOutput[integration_point] = cl_values.GetStressVector(); + if ( this->GetProperties().Has(BEAM_PRESTRESS_PK2)) { + rOutput[integration_point] += this->GetProperties()[BEAM_PRESTRESS_PK2]; } } } } +Vector LinearTimoshenkoCurvedBeamElement2D3N::CalculateStrainVector(double Xi) +{ + GlobalSizeVector nodal_values, dNu, dN_theta, n_shape, nu, n_theta, dN_shape; + + GetNodalValuesVector(nodal_values); + GetShapeFunctionsValuesGlobalVectors(GetShapeFunctionsValues(Xi), n_shape, nu, n_theta); + GetShapeFunctionsValuesGlobalVectors(GetFirstDerivativesShapeFunctionsValues(Xi, GetJacobian(Xi)), dN_shape, dNu, dN_theta); + + array_3 t, n; + GetTangentandTransverseUnitVectors(Xi, t, n); + BoundedMatrix aux_B_s; + for (IndexType i = 0; i < SystemSize; ++i) { + aux_B_s(0, i) = dNu[i] + t[1] * n_theta[i]; + aux_B_s(1, i) = dN_shape[i] - t[0] * n_theta[i]; + } + + BoundedMatrix frenet_serret = GetFrenetSerretMatrix(Xi, t, n); + BoundedVector gamma = prod(prod(frenet_serret, aux_B_s), nodal_values); + + Vector strain_vector(3); + strain_vector[0] = gamma[0]; // axial strain + strain_vector[2] = gamma[1]; // shear strain + strain_vector[1] = inner_prod(dN_theta, nodal_values); // curvature + + return strain_vector; +} + /***********************************************************************************/ /***********************************************************************************/ diff --git a/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.h b/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.h index ad1080bace0..b36f91622ca 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.h +++ b/applications/StructuralMechanicsApplication/custom_elements/beam_elements/timoshenko_curved_beam_element_2D3N.h @@ -333,6 +333,18 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) LinearTimoshenkoCurvedBeamEle const ProcessInfo& rCurrentProcessInfo ) override; + /** + * @brief Calculate a double Variable on the Element Constitutive Law + * @param rVariable The variable we want to get + * @param rOutput The values obtained in the integration points + * @param rCurrentProcessInfo the current process info instance + */ + void CalculateOnIntegrationPoints( + const Variable& rVariable, + std::vector& rOutput, + const ProcessInfo& rCurrentProcessInfo + ) override; + /** * @brief Get on rVariable Constitutive Law from the element * @param rVariable The variable we want to get @@ -457,7 +469,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) LinearTimoshenkoCurvedBeamEle ///@name Private Operations ///@{ - + Vector CalculateStrainVector(double Xi); ///@} ///@name Private Access ///@{ diff --git a/applications/StructuralMechanicsApplication/custom_python/structural_mechanics_python_application.cpp b/applications/StructuralMechanicsApplication/custom_python/structural_mechanics_python_application.cpp index 3fa928e6767..cc5fa9eb965 100644 --- a/applications/StructuralMechanicsApplication/custom_python/structural_mechanics_python_application.cpp +++ b/applications/StructuralMechanicsApplication/custom_python/structural_mechanics_python_application.cpp @@ -91,7 +91,7 @@ PYBIND11_MODULE(KratosStructuralMechanicsApplication,m) KRATOS_REGISTER_IN_PYTHON_VARIABLE(m,I33) KRATOS_REGISTER_IN_PYTHON_VARIABLE(m,IZ) KRATOS_REGISTER_IN_PYTHON_VARIABLE(m,BEAM_INITIAL_STRAIN_VECTOR) - KRATOS_REGISTER_IN_PYTHON_VARIABLE(m,TIMOSHENKO_BEAM_PRESTRESS_PK2) + KRATOS_REGISTER_IN_PYTHON_VARIABLE(m,BEAM_PRESTRESS_PK2) // semi rigid beam variables KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, ROTATIONAL_STIFFNESS_AXIS_2) diff --git a/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp b/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp index 107540fcb98..ef392a60037 100644 --- a/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp +++ b/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp @@ -347,7 +347,7 @@ void KratosStructuralMechanicsApplication::Register() { KRATOS_REGISTER_VARIABLE(I33) KRATOS_REGISTER_VARIABLE(LUMPED_MASS_ROTATION_COEFFICIENT) KRATOS_REGISTER_VARIABLE(BEAM_INITIAL_STRAIN_VECTOR) - KRATOS_REGISTER_VARIABLE(TIMOSHENKO_BEAM_PRESTRESS_PK2) + KRATOS_REGISTER_VARIABLE(BEAM_PRESTRESS_PK2) // semi rigid beam variables diff --git a/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.cpp b/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.cpp index fc67e0d8b43..e2785045d01 100644 --- a/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.cpp +++ b/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.cpp @@ -71,7 +71,7 @@ KRATOS_CREATE_VARIABLE(double, I22) KRATOS_CREATE_VARIABLE(double, I33) KRATOS_CREATE_VARIABLE(double, LUMPED_MASS_ROTATION_COEFFICIENT) KRATOS_CREATE_VARIABLE(Vector, BEAM_INITIAL_STRAIN_VECTOR) -KRATOS_CREATE_VARIABLE(Vector, TIMOSHENKO_BEAM_PRESTRESS_PK2) +KRATOS_CREATE_VARIABLE(Vector, BEAM_PRESTRESS_PK2) // semi rigid beam variables diff --git a/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.h b/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.h index ed0ab5cfb80..ef3a86bd543 100644 --- a/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.h +++ b/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.h @@ -92,8 +92,7 @@ namespace Kratos KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,double, I33) KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,double, LUMPED_MASS_ROTATION_COEFFICIENT) KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,Vector, BEAM_INITIAL_STRAIN_VECTOR) - KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,Vector, TIMOSHENKO_BEAM_PRESTRESS_PK2) - + KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,Vector, BEAM_PRESTRESS_PK2) // Semi rigid beam variables KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION, double, ROTATIONAL_STIFFNESS_AXIS_2) diff --git a/applications/StructuralMechanicsApplication/tests/cpp_tests/test_timoshenko_beams.cpp b/applications/StructuralMechanicsApplication/tests/cpp_tests/test_timoshenko_beams.cpp index 83dc5e31712..27375096c4d 100644 --- a/applications/StructuralMechanicsApplication/tests/cpp_tests/test_timoshenko_beams.cpp +++ b/applications/StructuralMechanicsApplication/tests/cpp_tests/test_timoshenko_beams.cpp @@ -20,7 +20,8 @@ namespace Kratos::Testing { -void CreateBeamModel2N(std::string TimoshenkoBeamElementName) +template +void Create2DBeamModel_and_CheckPK2Stress(const std::string & TimoshenkoBeamElementName, const std::vector& rExpectedShearStress, const std::vector& rExpectedBendingMoment) { Model current_model; auto &r_model_part = current_model.CreateModelPart("ModelPart",1); @@ -32,29 +33,29 @@ void CreateBeamModel2N(std::string TimoshenkoBeamElementName) auto p_elem_prop = r_model_part.CreateNewProperties(0); constexpr auto youngs_modulus = 2.0e+06; p_elem_prop->SetValue(YOUNG_MODULUS, youngs_modulus); - constexpr auto cross_area = 1.0; - p_elem_prop->SetValue(CROSS_AREA, cross_area); - constexpr auto i33 = 1.0; - p_elem_prop->SetValue(I33, i33); - constexpr auto area_effective_y = 1.0; - p_elem_prop->SetValue(AREA_EFFECTIVE_Y, area_effective_y); + p_elem_prop->SetValue(CROSS_AREA, 1.0); + p_elem_prop->SetValue(I33, 1.0); + p_elem_prop->SetValue(AREA_EFFECTIVE_Y, 5.0/6.0); const auto &r_clone_cl = KratosComponents::Get("TimoshenkoBeamElasticConstitutiveLaw"); p_elem_prop->SetValue(CONSTITUTIVE_LAW, r_clone_cl.Clone()); // Create the test element constexpr double directional_length = 2.0; - auto p_node_1 = r_model_part.CreateNewNode(1, 0.0, 0.0, 0.0); - auto p_node_2 = r_model_part.CreateNewNode(2, directional_length, directional_length, directional_length); + r_model_part.CreateNewNode(1, 0.0, 0.0, 0.0); + r_model_part.CreateNewNode(2, directional_length, directional_length, 0.0); + std::vector element_nodes{1,2}; + if constexpr (TNNodes==3) { + r_model_part.CreateNewNode(3, directional_length/2, directional_length/2, 0.0); + element_nodes.push_back(3); + } for (auto& r_node : r_model_part.Nodes()){ r_node.AddDof(DISPLACEMENT_X); r_node.AddDof(DISPLACEMENT_Y); - r_node.AddDof(DISPLACEMENT_Z); r_node.AddDof(ROTATION_Z); } - std::vector element_nodes {1,2}; auto p_element = r_model_part.CreateNewElement(std::move(TimoshenkoBeamElementName), 1, element_nodes, p_elem_prop); const auto& r_process_info = r_model_part.GetProcessInfo(); p_element->Initialize(r_process_info); // Initialize the element to initialize the constitutive law @@ -62,32 +63,54 @@ void CreateBeamModel2N(std::string TimoshenkoBeamElementName) constexpr auto induced_strain = 0.1; p_element->GetGeometry()[1].FastGetSolutionStepValue(DISPLACEMENT) += ScalarVector(3, induced_strain * directional_length); p_element->GetGeometry()[1].FastGetSolutionStepValue(ROTATION_Z) += 0.1; + if constexpr(TNNodes==3) { + p_element->GetGeometry()[2].FastGetSolutionStepValue(DISPLACEMENT) += ScalarVector(3, induced_strain * directional_length/2.0); + p_element->GetGeometry()[2].FastGetSolutionStepValue(ROTATION_Z) += 0.1/2.0; + } std::vector stress_vectors; p_element->CalculateOnIntegrationPoints(PK2_STRESS_VECTOR, stress_vectors, r_process_info); constexpr auto expected_stress = induced_strain * youngs_modulus; - constexpr auto expected_shear_stress = -37500.0; - constexpr auto tolerance = 1.0e-5; Vector expected_stress_vector(3); - expected_stress_vector <<= expected_stress, 29631.5,expected_shear_stress; + expected_stress_vector <<= expected_stress, rExpectedBendingMoment[0],rExpectedShearStress[0]; KRATOS_EXPECT_VECTOR_RELATIVE_NEAR(expected_stress_vector, stress_vectors[0], tolerance); - expected_stress_vector <<= expected_stress, 70710.7,expected_shear_stress; + expected_stress_vector <<= expected_stress, rExpectedBendingMoment[1],rExpectedShearStress[1]; KRATOS_EXPECT_VECTOR_RELATIVE_NEAR(expected_stress_vector, stress_vectors[1], tolerance); - expected_stress_vector <<= expected_stress, 111790,expected_shear_stress; - KRATOS_EXPECT_VECTOR_RELATIVE_NEAR(expected_stress_vector, stress_vectors[2], tolerance); + if(stress_vectors.size()>2) { + expected_stress_vector <<= expected_stress, rExpectedBendingMoment[2],rExpectedShearStress[2]; + KRATOS_EXPECT_VECTOR_RELATIVE_NEAR(expected_stress_vector, stress_vectors[2], tolerance); + } + expected_stress_vector <<= expected_stress, rExpectedBendingMoment[0],rExpectedShearStress[0]; Vector pre_stress(3); pre_stress <<= 1.0e5, 1.0e4, 1.0e3; - p_element->GetProperties().SetValue(TIMOSHENKO_BEAM_PRESTRESS_PK2, pre_stress); + p_element->GetProperties().SetValue(BEAM_PRESTRESS_PK2, pre_stress); p_element->CalculateOnIntegrationPoints(PK2_STRESS_VECTOR, stress_vectors, r_process_info); expected_stress_vector += pre_stress; - KRATOS_EXPECT_VECTOR_RELATIVE_NEAR(expected_stress_vector, stress_vectors[2], tolerance); + KRATOS_EXPECT_VECTOR_RELATIVE_NEAR(expected_stress_vector, stress_vectors[0], tolerance); } KRATOS_TEST_CASE_IN_SUITE(LinearTimoshenkoBeam2D2N_CalculatesPK2Stress, KratosStructuralMechanicsFastSuite) { - CreateBeamModel2N("LinearTimoshenkoBeamElement2D2N"); + const std::vector expected_shear_stress {-32608.7, -32608.7, -32608.7}; + const std::vector expected_bending_moment {34989.6, 70710.7, 106432.0}; + + Create2DBeamModel_and_CheckPK2Stress<2>("LinearTimoshenkoBeamElement2D2N", expected_shear_stress, expected_bending_moment); + } + + KRATOS_TEST_CASE_IN_SUITE(LinearTimoshenkodBeam2D3N_CalculatesPK2Stress, KratosStructuralMechanicsFastSuite) + { + const std::vector expected_shear_stress {2604.74, -21673.6, -48084.9}; + const std::vector expected_bending_moment {86720.4, 68516.6, 61527.5}; + Create2DBeamModel_and_CheckPK2Stress<3>("LinearTimoshenkoBeamElement2D3N", expected_shear_stress, expected_bending_moment); + } + + KRATOS_TEST_CASE_IN_SUITE(LinearTimoshenkodCurvedBeam2D3N_CalculatesPK2Stress, KratosStructuralMechanicsFastSuite) + { + const std::vector expected_shear_stress {17610.4, 65722.9}; + const std::vector expected_bending_moment {70710.7, 70710.7}; + Create2DBeamModel_and_CheckPK2Stress<3>("LinearTimoshenkoCurvedBeamElement2D3N", expected_shear_stress, expected_bending_moment); } } From 83998d3a633138296f75d9b61fe56590d0ac4d0d Mon Sep 17 00:00:00 2001 From: Alejandro Date: Tue, 31 Dec 2024 11:19:51 +0100 Subject: [PATCH 14/39] correcting new naming --- kratos/geometries/quadrilateral_interface_2d_4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kratos/geometries/quadrilateral_interface_2d_4.h b/kratos/geometries/quadrilateral_interface_2d_4.h index 9817956e923..06abfcbd6cb 100644 --- a/kratos/geometries/quadrilateral_interface_2d_4.h +++ b/kratos/geometries/quadrilateral_interface_2d_4.h @@ -1301,9 +1301,9 @@ template class QuadrilateralInterface2D4 IntegrationPointsContainerType integration_points = { { - Quadrature < QuadrilateralGaussLobattoIntegrationPoints1, + Quadrature < QuadrilateralGaussLobattoIntegrationPoints0, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < QuadrilateralGaussLobattoIntegrationPoints2, + Quadrature < QuadrilateralGaussLobattoIntegrationPoints1, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(), IntegrationPointsArrayType(), IntegrationPointsArrayType() From 4418d33dbd80889db0543d56e7840d50c86f92c1 Mon Sep 17 00:00:00 2001 From: Daniel Diez Date: Tue, 31 Dec 2024 21:51:22 +0100 Subject: [PATCH 15/39] [Core] Add Calculate methods for int and array_1d in Condition and Element (#12970) * Add Calculate methods for int and array_1d in Condition and Element classes * exposing method to python --------- Co-authored-by: Daniel Diez --- kratos/includes/condition.h | 11 +++++++++++ kratos/includes/element.h | 11 +++++++++++ kratos/python/add_mesh_to_python.cpp | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/kratos/includes/condition.h b/kratos/includes/condition.h index 404f4c42f6d..8c7726fce67 100644 --- a/kratos/includes/condition.h +++ b/kratos/includes/condition.h @@ -669,6 +669,11 @@ class Condition : public GeometricalObject * the Output is given on integration points and characterizes the condition * Calculate(..) methods are: OPTIONAL */ + virtual void Calculate(const Variable& rVariable, + int& Output, + const ProcessInfo& rCurrentProcessInfo) + { + } virtual void Calculate(const Variable& rVariable, double& Output, @@ -682,6 +687,12 @@ class Condition : public GeometricalObject { } + virtual void Calculate(const Variable< array_1d >& rVariable, + array_1d& Output, + const ProcessInfo& rCurrentProcessInfo) + { + } + virtual void Calculate(const Variable& rVariable, Vector& Output, const ProcessInfo& rCurrentProcessInfo) diff --git a/kratos/includes/element.h b/kratos/includes/element.h index 563a5e76bfd..98e27fa44c0 100644 --- a/kratos/includes/element.h +++ b/kratos/includes/element.h @@ -682,6 +682,11 @@ class Element : public GeometricalObject * the Output is given on integration points and characterizes the element * Calculate(..) methods are: OPTIONAL */ + virtual void Calculate(const Variable& rVariable, + int& Output, + const ProcessInfo& rCurrentProcessInfo) + { + } virtual void Calculate(const Variable& rVariable, double& Output, @@ -695,6 +700,12 @@ class Element : public GeometricalObject { } + virtual void Calculate(const Variable >& rVariable, + array_1d & Output, + const ProcessInfo& rCurrentProcessInfo) + { + } + virtual void Calculate(const Variable& rVariable, Vector& Output, const ProcessInfo& rCurrentProcessInfo) diff --git a/kratos/python/add_mesh_to_python.cpp b/kratos/python/add_mesh_to_python.cpp index 77e69a3d43d..c19a2a68c82 100644 --- a/kratos/python/add_mesh_to_python.cpp +++ b/kratos/python/add_mesh_to_python.cpp @@ -483,8 +483,10 @@ void AddMeshToPython(pybind11::module& m) .def("SetValuesOnIntegrationPoints", SetValuesOnIntegrationPointsArray1d) .def("SetValuesOnIntegrationPoints", SetValuesOnIntegrationPointsArray1d) .def("ResetConstitutiveLaw", &Element::ResetConstitutiveLaw) + .def("Calculate", &EntityCalculateInterface) .def("Calculate", &EntityCalculateInterface) .def("Calculate", &EntityCalculateInterface >) + .def("Calculate", &EntityCalculateInterface >) .def("Calculate", &EntityCalculateInterface) .def("Calculate", &EntityCalculateInterface) .def("CalculateLumpedMassVector", &ElementCalculateLumpedMassVector) @@ -639,8 +641,10 @@ void AddMeshToPython(pybind11::module& m) // .def(SolutionStepVariableIndexingPython > >()) // .def(SolutionStepVariableIndexingPython > >()) // .def(SolutionStepVariableIndexingPython > >()) + .def("Calculate", &EntityCalculateInterface) .def("Calculate", &EntityCalculateInterface) .def("Calculate", &EntityCalculateInterface >) + .def("Calculate", &EntityCalculateInterface >) .def("Calculate", &EntityCalculateInterface) .def("Calculate", &EntityCalculateInterface) From 45eaa4d47c8f63b8e7b7698541e2791ec6c49dd9 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 09:12:39 +0100 Subject: [PATCH 16/39] start generalizing Mapping CL --- .../generic_anisotropic_3d_law.cpp | 86 +++++++++++++------ .../generic_anisotropic_3d_law.h | 53 +++++++----- 2 files changed, 88 insertions(+), 51 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp index 9ad824a951c..f9694f19a6d 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp @@ -26,15 +26,20 @@ namespace Kratos { -ConstitutiveLaw::Pointer GenericAnisotropic3DLaw::Create(Kratos::Parameters NewParameters) const +/***********************************************************************************/ +/***********************************************************************************/ + +template +ConstitutiveLaw::Pointer GenericAnisotropicLaw::Create(Kratos::Parameters NewParameters) const { - return Kratos::make_shared(); + return Kratos::make_shared(); } /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateMaterialResponsePK1(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::CalculateMaterialResponsePK1(ConstitutiveLaw::Parameters& rValues) { this->CalculateMaterialResponsePK2(rValues); @@ -49,7 +54,8 @@ void GenericAnisotropic3DLaw::CalculateMaterialResponsePK1(ConstitutiveLaw::Para /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) { this->CalculateMaterialResponsePK2(rValues); @@ -64,7 +70,8 @@ void GenericAnisotropic3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::P /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateMaterialResponseKirchhoff(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::CalculateMaterialResponseKirchhoff(ConstitutiveLaw::Parameters& rValues) { this->CalculateMaterialResponsePK2(rValues); @@ -79,7 +86,8 @@ void GenericAnisotropic3DLaw::CalculateMaterialResponseKirchhoff(ConstitutiveLaw /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::CalculateMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) { // Get Values to compute the constitutive law: Flags& r_flags = rValues.GetOptions(); @@ -169,7 +177,8 @@ void GenericAnisotropic3DLaw::CalculateMaterialResponsePK2(ConstitutiveLaw::Para /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateOrthotropicElasticMatrix( +template +void GenericAnisotropicLaw::CalculateOrthotropicElasticMatrix( BoundedMatrixVoigtType& rElasticityTensor, const Properties& rMaterialProperties) { @@ -217,7 +226,8 @@ void GenericAnisotropic3DLaw::CalculateOrthotropicElasticMatrix( /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::FinalizeMaterialResponsePK1(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::FinalizeMaterialResponsePK1(ConstitutiveLaw::Parameters& rValues) { this->FinalizeMaterialResponsePK2(rValues); } @@ -225,7 +235,8 @@ void GenericAnisotropic3DLaw::FinalizeMaterialResponsePK1(ConstitutiveLaw::Param /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::FinalizeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::FinalizeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) { this->FinalizeMaterialResponsePK2(rValues); } @@ -233,7 +244,8 @@ void GenericAnisotropic3DLaw::FinalizeMaterialResponseCauchy(ConstitutiveLaw::Pa /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::FinalizeMaterialResponseKirchhoff(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::FinalizeMaterialResponseKirchhoff(ConstitutiveLaw::Parameters& rValues) { this->FinalizeMaterialResponsePK2(rValues); } @@ -241,7 +253,8 @@ void GenericAnisotropic3DLaw::FinalizeMaterialResponseKirchhoff(ConstitutiveLaw: /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) { Flags& r_flags = rValues.GetOptions(); if (r_flags.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { @@ -303,7 +316,8 @@ void GenericAnisotropic3DLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::Param /***********************************************************************************/ /***********************************************************************************/ -double& GenericAnisotropic3DLaw::GetValue( +template +double& GenericAnisotropicLaw::GetValue( const Variable& rThisVariable, double& rValue ) @@ -314,7 +328,8 @@ double& GenericAnisotropic3DLaw::GetValue( /***********************************************************************************/ /***********************************************************************************/ -Vector& GenericAnisotropic3DLaw::GetValue( +template +Vector& GenericAnisotropicLaw::GetValue( const Variable& rThisVariable, Vector& rValue ) @@ -325,7 +340,8 @@ Vector& GenericAnisotropic3DLaw::GetValue( /***********************************************************************************/ /***********************************************************************************/ -Matrix& GenericAnisotropic3DLaw::GetValue( +template +Matrix& GenericAnisotropicLaw::GetValue( const Variable& rThisVariable, Matrix& rValue ) @@ -336,7 +352,8 @@ Matrix& GenericAnisotropic3DLaw::GetValue( /***********************************************************************************/ /***********************************************************************************/ -bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) +template +bool GenericAnisotropicLaw::Has(const Variable& rThisVariable) { return mpIsotropicCL->Has(rThisVariable); } @@ -344,7 +361,8 @@ bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) /***********************************************************************************/ /***********************************************************************************/ -bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) +template +bool GenericAnisotropicLaw::Has(const Variable& rThisVariable) { return mpIsotropicCL->Has(rThisVariable); } @@ -352,7 +370,8 @@ bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) /***********************************************************************************/ /***********************************************************************************/ -bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) +template +bool GenericAnisotropicLaw::Has(const Variable& rThisVariable) { return false; } @@ -360,7 +379,8 @@ bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) /***********************************************************************************/ /***********************************************************************************/ -bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) +template +bool GenericAnisotropicLaw::Has(const Variable& rThisVariable) { return mpIsotropicCL->Has(rThisVariable); } @@ -368,7 +388,8 @@ bool GenericAnisotropic3DLaw::Has(const Variable& rThisVariable) /***********************************************************************************/ /***********************************************************************************/ -double& GenericAnisotropic3DLaw::CalculateValue( +template +double& GenericAnisotropicLaw::CalculateValue( Parameters& rParameterValues, const Variable& rThisVariable, double& rValue) @@ -379,7 +400,8 @@ double& GenericAnisotropic3DLaw::CalculateValue( /***********************************************************************************/ /***********************************************************************************/ -Vector& GenericAnisotropic3DLaw::CalculateValue( +template +Vector& GenericAnisotropicLaw::CalculateValue( Parameters& rParameterValues, const Variable& rThisVariable, Vector& rValue) @@ -516,7 +538,8 @@ Vector& GenericAnisotropic3DLaw::CalculateValue( /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateAnisotropicStressMapperMatrix( +template +void GenericAnisotropicLaw::CalculateAnisotropicStressMapperMatrix( const Properties& rProperties, BoundedMatrixVoigtType& rAs, BoundedMatrixVoigtType& rAsInv @@ -546,7 +569,8 @@ void GenericAnisotropic3DLaw::CalculateAnisotropicStressMapperMatrix( /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateAnisotropicStrainMapperMatrix( +template +void GenericAnisotropicLaw::CalculateAnisotropicStrainMapperMatrix( const BoundedMatrixVoigtType& rAnisotropicElasticMatrix, const BoundedMatrixVoigtType& rIsotropicElasticMatrix, const BoundedMatrixVoigtType &rAs, @@ -565,7 +589,8 @@ void GenericAnisotropic3DLaw::CalculateAnisotropicStrainMapperMatrix( /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::InitializeMaterial( +template +void GenericAnisotropicLaw::InitializeMaterial( const Properties& rMaterialProperties, const GeometryType& rElementGeometry, const Vector& rShapeFunctionsValues) @@ -589,7 +614,8 @@ void GenericAnisotropic3DLaw::InitializeMaterial( /***********************************************************************************/ /***********************************************************************************/ -Matrix& GenericAnisotropic3DLaw::CalculateValue( +template +Matrix& GenericAnisotropicLaw::CalculateValue( ConstitutiveLaw::Parameters& rParameterValues, const Variable& rThisVariable, Matrix& rValue @@ -601,7 +627,8 @@ Matrix& GenericAnisotropic3DLaw::CalculateValue( /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::InitializeMaterialResponsePK2(Parameters& rValues) +template +void GenericAnisotropicLaw::InitializeMaterialResponsePK2(Parameters& rValues) { mpIsotropicCL->InitializeMaterialResponsePK2(rValues); } @@ -610,7 +637,8 @@ void GenericAnisotropic3DLaw::InitializeMaterialResponsePK2(Parameters& rValues) /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateCauchyGreenStrain( +template +void GenericAnisotropicLaw::CalculateCauchyGreenStrain( ConstitutiveLaw::Parameters& rValues, Vector& rStrainVector ) @@ -630,7 +658,8 @@ void GenericAnisotropic3DLaw::CalculateCauchyGreenStrain( /***********************************************************************************/ /***********************************************************************************/ -int GenericAnisotropic3DLaw::Check( +template +int GenericAnisotropicLaw::Check( const Properties& rMaterialProperties, const GeometryType& rElementGeometry, const ProcessInfo& rCurrentProcessInfo @@ -644,7 +673,8 @@ int GenericAnisotropic3DLaw::Check( /***********************************************************************************/ /***********************************************************************************/ -void GenericAnisotropic3DLaw::CalculateTangentTensor(ConstitutiveLaw::Parameters& rValues) +template +void GenericAnisotropicLaw::CalculateTangentTensor(ConstitutiveLaw::Parameters& rValues) { const Properties& r_material_properties = rValues.GetMaterialProperties(); diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h index 6c05b60411b..ec303c54f0c 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h @@ -30,6 +30,9 @@ namespace Kratos ///@name Type Definitions ///@{ + /// The size type definition +using SizeType = std::size_t; + ///@} ///@name Enum's ///@{ @@ -42,15 +45,15 @@ namespace Kratos ///@name Kratos Classes ///@{ /** - * @class GenericAnisotropic3DLaw - * @ingroup StructuralMechanicsApplication + * @class GenericAnisotropicLaw + * @ingroup ConstitutiveLawsApplication * @brief This CL takes into account the material anisotropy in terms of * young modulus, poisson ratio, orientation and strengths. - * @details See "Comportamiento mecánico de los materiales compuestos" by S. Oller, - * Chapter "Anisotropía mecánica" + * @details See "Nonlinear behavior of existing pre-tensioned concrete beams: Experimental study and finite element modeling with the constitutive Serial-Parallel rule of mixtures", DOI: https://doi.org/10.1016/j.istruc.2024.106990 * @author Alejandro Cornejo */ -class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw +template +class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw : public ConstitutiveLaw { public: @@ -66,23 +69,20 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw /// Definition of the machine precision tolerance static constexpr double machine_tolerance = std::numeric_limits::epsilon(); - /// The size type definition - typedef std::size_t SizeType; - /// Static definition of the dimension - static constexpr SizeType Dimension = 3; + static constexpr SizeType Dimension = TDim; /// Static definition of the VoigtSize - static constexpr SizeType VoigtSize = 6; + static constexpr SizeType VoigtSize = (TDim == 3) ? 6 : 3; /// The definition of the bounded matrix type - typedef BoundedMatrix BoundedMatrixType; + using BoundedMatrixType = BoundedMatrix; /// The definition of the bounded matrix type - typedef BoundedMatrix BoundedMatrixVoigtType; + using BoundedMatrixVoigtType = BoundedMatrix; - /// Counted pointer of GenericAnisotropic3DLaw - KRATOS_CLASS_POINTER_DEFINITION(GenericAnisotropic3DLaw); + /// Counted pointer of GenericAnisotropicLaw + KRATOS_CLASS_POINTER_DEFINITION(GenericAnisotropicLaw); ///@} ///@name Life Cycle @@ -91,7 +91,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw /** * Constructor. */ - GenericAnisotropic3DLaw() + GenericAnisotropicLaw() { } @@ -100,11 +100,11 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw */ ConstitutiveLaw::Pointer Clone() const override { - return Kratos::make_shared(*this); + return Kratos::make_shared(*this); } // Copy constructor - GenericAnisotropic3DLaw(GenericAnisotropic3DLaw const& rOther) + GenericAnisotropicLaw(GenericAnisotropicLaw const& rOther) : ConstitutiveLaw(rOther), mpIsotropicCL(rOther.mpIsotropicCL) { @@ -113,7 +113,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw /** * Destructor. */ - ~GenericAnisotropic3DLaw() override + ~GenericAnisotropicLaw() override { } @@ -137,7 +137,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw */ SizeType WorkingSpaceDimension() override { - return 3; + return Dimension; }; /** @@ -145,7 +145,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw */ SizeType GetStrainSize() const override { - return 6; + return VoigtSize; }; /** @@ -348,6 +348,9 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw return mpIsotropicCL->RequiresFinalizeMaterialResponse(); } + /** + * @brief This method computes the orthotropic elastic constitutive matrix + */ void CalculateOrthotropicElasticMatrix( BoundedMatrixVoigtType &rElasticityTensor, const Properties &rMaterialProperties); @@ -356,6 +359,10 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw const GeometryType &rElementGeometry, const ProcessInfo &rCurrentProcessInfo) const override; + /** + * @brief This method computes an estimation of the tangent constitutive matrix, which relates the + * stress increment with the strain increment. + */ void CalculateTangentTensor(ConstitutiveLaw::Parameters &rValues); ///@} ///@name Access @@ -375,7 +382,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw ///@} - protected: +protected: ///@name Protected static Member Variables ///@{ @@ -421,7 +428,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw ///@{ ///@} - private: +private: ///@name Static Member Variables ///@{ @@ -473,6 +480,6 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropic3DLaw ///@} -}; // Class GenericAnisotropic3DLaw +}; // Class GenericAnisotropicLaw } // namespace Kratos From 767739ed2d36c878febe6cae9af6e76a899bd8c6 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 09:48:39 +0100 Subject: [PATCH 17/39] improve generality of rotations to 2D --- .../advanced_constitutive_law_utilities.cpp | 79 +++++++++++-------- .../advanced_constitutive_law_utilities.h | 10 +-- 2 files changed, 52 insertions(+), 37 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp index 0781dee6d77..7b2a02a1e22 100644 --- a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp +++ b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp @@ -677,19 +677,23 @@ Matrix AdvancedConstitutiveLawUtilities::CalculateDirectPlasticDefor template void AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEuler1( const double EulerAngle1, - BoundedMatrix& rRotationOperator + BoundedMatrix& rRotationOperator ) { - noalias(rRotationOperator) = ZeroMatrix(Dimension, Dimension); + rRotationOperator.clear(); - const double cos_angle = std::cos(EulerAngle1 * Globals::Pi / 180.0); - const double sin_angle = std::sin(EulerAngle1 * Globals::Pi / 180.0); + const double angle_radians = EulerAngle1 * Globals::Pi / 180.0; + const double cos_angle = std::cos(angle_radians); + const double sin_angle = std::sin(angle_radians); rRotationOperator(0, 0) = cos_angle; rRotationOperator(0, 1) = sin_angle; rRotationOperator(1, 0) = -sin_angle; rRotationOperator(1, 1) = cos_angle; - rRotationOperator(2, 2) = 1.0; + + if constexpr (Dimension == 3) { + rRotationOperator(2, 2) = 1.0; + } } /***********************************************************************************/ @@ -698,19 +702,24 @@ void AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEule template void AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEuler2( const double EulerAngle2, - BoundedMatrix& rRotationOperator + BoundedMatrix& rRotationOperator ) { - noalias(rRotationOperator) = ZeroMatrix(Dimension, Dimension); + rRotationOperator.clear(); - const double cos_angle = std::cos(EulerAngle2 * Globals::Pi / 180.0); - const double sin_angle = std::sin(EulerAngle2 * Globals::Pi / 180.0); + if constexpr (Dimension == 3) { + const double cos_angle = std::cos(EulerAngle2 * Globals::Pi / 180.0); + const double sin_angle = std::sin(EulerAngle2 * Globals::Pi / 180.0); + + rRotationOperator(0, 0) = 1.0; + rRotationOperator(1, 1) = cos_angle; + rRotationOperator(1, 2) = sin_angle; + rRotationOperator(2, 1) = -sin_angle; + rRotationOperator(2, 2) = cos_angle; + } else { + KRATOS_ERROR << "This operation cannot be done in Dimension = 2 ..." + } - rRotationOperator(0, 0) = 1.0; - rRotationOperator(1, 1) = cos_angle; - rRotationOperator(1, 2) = sin_angle; - rRotationOperator(2, 1) = -sin_angle; - rRotationOperator(2, 2) = cos_angle; } /***********************************************************************************/ @@ -719,7 +728,7 @@ void AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEule template void AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEuler3( const double EulerAngle3, - BoundedMatrix& rRotationOperator + BoundedMatrix& rRotationOperator ) { AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEuler1(EulerAngle3, rRotationOperator); @@ -733,26 +742,32 @@ void AdvancedConstitutiveLawUtilities::CalculateRotationOperator( const double EulerAngle1, // phi const double EulerAngle2, // theta const double EulerAngle3, // hi - BoundedMatrix& rRotationOperator // global to local coordinates + BoundedMatrix& rRotationOperator // global to local coordinates ) { + const double pi_over_180 = Globals::Pi / 180.0; - const double cos1 = std::cos(EulerAngle1 * pi_over_180); - const double sin1 = std::sin(EulerAngle1 * pi_over_180); - const double cos2 = std::cos(EulerAngle2 * pi_over_180); - const double sin2 = std::sin(EulerAngle2 * pi_over_180); - const double cos3 = std::cos(EulerAngle3 * pi_over_180); - const double sin3 = std::sin(EulerAngle3 * pi_over_180); - - rRotationOperator(0, 0) = cos1 * cos3 - sin1 * cos2 * sin3; - rRotationOperator(0, 1) = sin1 * cos3 + cos1 * cos2 * sin3; - rRotationOperator(0, 2) = sin2 * sin3; - rRotationOperator(1, 0) = -cos1 * sin3 - sin1 * cos2 * cos3; - rRotationOperator(1, 1) = -sin1 * sin3 + cos1 * cos2 * cos3; - rRotationOperator(1, 2) = sin2 * cos3; - rRotationOperator(2, 0) = sin1 * sin2; - rRotationOperator(2, 1) = -cos1 * sin2; - rRotationOperator(2, 2) = cos2; + + if constexpr (Dimension == 3) { + const double cos1 = std::cos(EulerAngle1 * pi_over_180); + const double sin1 = std::sin(EulerAngle1 * pi_over_180); + const double cos2 = std::cos(EulerAngle2 * pi_over_180); + const double sin2 = std::sin(EulerAngle2 * pi_over_180); + const double cos3 = std::cos(EulerAngle3 * pi_over_180); + const double sin3 = std::sin(EulerAngle3 * pi_over_180); + + rRotationOperator(0, 0) = cos1 * cos3 - sin1 * cos2 * sin3; + rRotationOperator(0, 1) = sin1 * cos3 + cos1 * cos2 * sin3; + rRotationOperator(0, 2) = sin2 * sin3; + rRotationOperator(1, 0) = -cos1 * sin3 - sin1 * cos2 * cos3; + rRotationOperator(1, 1) = -sin1 * sin3 + cos1 * cos2 * cos3; + rRotationOperator(1, 2) = sin2 * cos3; + rRotationOperator(2, 0) = sin1 * sin2; + rRotationOperator(2, 1) = -cos1 * sin2; + rRotationOperator(2, 2) = cos2; + } else { // In 2D + AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEuler1(EulerAngle1, rRotationOperator); + } } /***********************************************************************************/ diff --git a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h index af35f45f2da..bf8b9790f31 100644 --- a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h +++ b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h @@ -433,7 +433,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) AdvancedConstitutiveLawUtilities */ static void CalculateRotationOperatorEuler1( const double EulerAngle1, - BoundedMatrix& rRotationOperator + BoundedMatrix& rRotationOperator ); /** @@ -442,7 +442,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) AdvancedConstitutiveLawUtilities */ static void CalculateRotationOperatorEuler2( const double EulerAngle2, - BoundedMatrix& rRotationOperator + BoundedMatrix& rRotationOperator ); /** @@ -451,7 +451,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) AdvancedConstitutiveLawUtilities */ static void CalculateRotationOperatorEuler3( const double EulerAngle3, - BoundedMatrix& rRotationOperator + BoundedMatrix& rRotationOperator ); /** @@ -468,10 +468,10 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) AdvancedConstitutiveLawUtilities const double EulerAngle1, // phi const double EulerAngle2, // theta const double EulerAngle3, // hi - BoundedMatrix& rRotationOperator + BoundedMatrix& rRotationOperator ); - /** + /** * @brief This computes the MacaullyBrackets of a double */ static double MacaullyBrackets(const double Number); From 4d6534b85e712ed6227fe4a14670a74bff5c8c60 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 10:01:39 +0100 Subject: [PATCH 18/39] cleaning th aniso CL --- .../generic_anisotropic_3d_law.cpp | 130 ++++++------------ .../generic_anisotropic_3d_law.h | 15 +- 2 files changed, 48 insertions(+), 97 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp index f9694f19a6d..014bd360626 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp @@ -86,6 +86,25 @@ void GenericAnisotropicLaw::CalculateMaterialResponseKirchhoff(Constitutiv /***********************************************************************************/ /***********************************************************************************/ +template +void GenericAnisotropicLaw::CalculateRotationMatrixVoigt( + const Properties& rMaterialProperties, + BoundedMatrixVoigtType &rT +) +{ + if (rMaterialProperties.Has(EULER_ANGLES) && MathUtils::Norm3(rMaterialProperties[EULER_ANGLES]) > machine_tolerance) { + BoundedMatrixType rotation_matrix; + const Vector& r_euler_angles = rMaterialProperties[EULER_ANGLES]; + AdvancedConstitutiveLawUtilities::CalculateRotationOperator(r_euler_angles[0], r_euler_angles[1], r_euler_angles[2], rotation_matrix); + ConstitutiveLawUtilities::CalculateRotationOperatorVoigt(rotation_matrix, rT); + } else { + noalias(rT) = IdentityMatrix(VoigtSize, VoigtSize); + } +} + +/***********************************************************************************/ +/***********************************************************************************/ + template void GenericAnisotropicLaw::CalculateMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) { @@ -99,7 +118,7 @@ void GenericAnisotropicLaw::CalculateMaterialResponsePK2(ConstitutiveLaw:: if (!flag_strain) { Vector& r_strain_vector = rValues.GetStrainVector(); - this->CalculateCauchyGreenStrain(rValues, r_strain_vector); + ConstitutiveLawUtilities::CalculateCauchyGreenStrain(rValues, r_strain_vector); } // this strain in the real anisotropic space @@ -114,22 +133,8 @@ void GenericAnisotropicLaw::CalculateMaterialResponsePK2(ConstitutiveLaw:: if (flag_stress) { // Here we compute the rotation tensors due to the angles of the local and global axes - BoundedMatrixType rotation_matrix; BoundedMatrixVoigtType voigt_rotation_matrix; - - if (r_material_properties.Has(EULER_ANGLES) && - MathUtils::Norm3(r_material_properties[EULER_ANGLES]) > machine_tolerance) { - const Vector& r_euler_angles = r_material_properties[EULER_ANGLES]; - AdvancedConstitutiveLawUtilities::CalculateRotationOperator( - r_euler_angles(0), r_euler_angles(1), - r_euler_angles(2), rotation_matrix); - ConstitutiveLawUtilities::CalculateRotationOperatorVoigt( - (rotation_matrix), - voigt_rotation_matrix); - } else { - noalias(rotation_matrix) = IdentityMatrix(Dimension, Dimension); - noalias(voigt_rotation_matrix) = IdentityMatrix(VoigtSize, VoigtSize); - } + CalculateRotationMatrixVoigt(r_material_properties, voigt_rotation_matrix); // We compute the mappers As and Ae BoundedMatrixVoigtType stress_mapper, strain_mapper; @@ -138,11 +143,10 @@ void GenericAnisotropicLaw::CalculateMaterialResponsePK2(ConstitutiveLaw:: Matrix isotropic_elastic_matrix; this->CalculateAnisotropicStressMapperMatrix(r_material_properties, stress_mapper, stress_mapper_inv); - mpIsotropicCL->CalculateValue(rValues, CONSTITUTIVE_MATRIX, isotropic_elastic_matrix); // takes the props of the iso cl + mpIsotropicCL->CalculateValue(rValues, CONSTITUTIVE_MATRIX, isotropic_elastic_matrix); // Takes the props of the iso cl this->CalculateOrthotropicElasticMatrix(anisotropic_elastic_matrix, r_material_properties); - this->CalculateAnisotropicStrainMapperMatrix(anisotropic_elastic_matrix, - isotropic_elastic_matrix, stress_mapper, - strain_mapper); + this->CalculateAnisotropicStrainMapperMatrix(anisotropic_elastic_matrix, isotropic_elastic_matrix, stress_mapper, strain_mapper); + Vector &r_iso_strain_vector = rValues.GetStrainVector(); // Now we rotate the strain Eglob-> Eloc @@ -259,7 +263,7 @@ void GenericAnisotropicLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::P Flags& r_flags = rValues.GetOptions(); if (r_flags.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { Vector& r_strain_vector = rValues.GetStrainVector(); - this->CalculateCauchyGreenStrain(rValues, r_strain_vector); + ConstitutiveLawUtilities::CalculateCauchyGreenStrain(rValues, r_strain_vector); } // this strain in the real anisotropic space @@ -271,22 +275,8 @@ void GenericAnisotropicLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::P rValues.SetMaterialProperties(r_props_iso_cl); // Here we compute the rotation tensors due to the angles of the local and global axes - BoundedMatrixType rotation_matrix; BoundedMatrixVoigtType voigt_rotation_matrix; - - if (r_material_properties.Has(EULER_ANGLES) && - MathUtils::Norm3(r_material_properties[EULER_ANGLES]) > machine_tolerance) { - const Vector& r_euler_angles = r_material_properties[EULER_ANGLES]; - AdvancedConstitutiveLawUtilities::CalculateRotationOperator( - r_euler_angles(0), r_euler_angles(1), - r_euler_angles(2), rotation_matrix); - ConstitutiveLawUtilities::CalculateRotationOperatorVoigt( - (rotation_matrix), - voigt_rotation_matrix); - } else { - noalias(rotation_matrix) = IdentityMatrix(Dimension, Dimension); - noalias(voigt_rotation_matrix) = IdentityMatrix(VoigtSize, VoigtSize); - } + CalculateRotationMatrixVoigt(r_material_properties, voigt_rotation_matrix); // We compute the mappers As and Ae BoundedMatrixVoigtType stress_mapper, strain_mapper; @@ -302,7 +292,7 @@ void GenericAnisotropicLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::P strain_mapper); Vector &r_iso_strain_vector = rValues.GetStrainVector(); // Now we rotate the strain Eglob-> Eloc - r_iso_strain_vector = prod((voigt_rotation_matrix), r_iso_strain_vector); + r_iso_strain_vector = prod(voigt_rotation_matrix, r_iso_strain_vector); // Now we map the strains to the isotropic fictitious space: Eiso = Ae*Ereal,loc r_iso_strain_vector = prod(strain_mapper, r_iso_strain_vector); // mapped @@ -409,7 +399,7 @@ Vector& GenericAnisotropicLaw::CalculateValue( if (rThisVariable == GREEN_LAGRANGE_STRAIN_VECTOR) { Flags& r_flags = rParameterValues.GetOptions(); if (r_flags.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { - this->CalculateCauchyGreenStrain(rParameterValues, rValue); + ConstitutiveLawUtilities::CalculateCauchyGreenStrain(rParameterValues, rValue); } else { noalias(rValue) = rParameterValues.GetStrainVector(); } @@ -487,25 +477,10 @@ Vector& GenericAnisotropicLaw::CalculateValue( values_iso_cl.SetMaterialProperties(r_props_iso_cl); // Here we compute the rotation tensors due to the angles of the local and global axes - BoundedMatrixType rotation_matrix; - BoundedMatrixVoigtType voigt_rotation_matrix, inv_voigt_rotation_matrix; - - if (r_material_properties.Has(EULER_ANGLES) && - MathUtils::Norm3(r_material_properties[EULER_ANGLES]) > machine_tolerance) { - const Vector& r_euler_angles = r_material_properties[EULER_ANGLES]; - AdvancedConstitutiveLawUtilities::CalculateRotationOperator( - r_euler_angles(0), r_euler_angles(1), - r_euler_angles(2), rotation_matrix); - ConstitutiveLawUtilities::CalculateRotationOperatorVoigt( - (rotation_matrix), - voigt_rotation_matrix); - double det = 0.0; - MathUtils::InvertMatrix(voigt_rotation_matrix, inv_voigt_rotation_matrix, det); - } else { - noalias(rotation_matrix) = IdentityMatrix(Dimension, Dimension); - noalias(voigt_rotation_matrix) = IdentityMatrix(VoigtSize, VoigtSize); - noalias(inv_voigt_rotation_matrix) = IdentityMatrix(VoigtSize, VoigtSize); - } + BoundedMatrixVoigtType voigt_rotation_matrix; + CalculateRotationMatrixVoigt(r_material_properties, voigt_rotation_matrix); + double det = 0.0; + MathUtils::InvertMatrix(voigt_rotation_matrix, inv_voigt_rotation_matrix, det); // We compute the mappers As and Ae BoundedMatrixVoigtType stress_mapper, strain_mapper; @@ -516,9 +491,7 @@ Vector& GenericAnisotropicLaw::CalculateValue( this->CalculateAnisotropicStressMapperMatrix(r_material_properties, stress_mapper, stress_mapper_inv); mpIsotropicCL->CalculateValue(values_iso_cl, CONSTITUTIVE_MATRIX, isotropic_elastic_matrix); this->CalculateOrthotropicElasticMatrix(anisotropic_elastic_matrix, r_material_properties); - this->CalculateAnisotropicStrainMapperMatrix(anisotropic_elastic_matrix, - isotropic_elastic_matrix, stress_mapper, - strain_mapper); + this->CalculateAnisotropicStrainMapperMatrix(anisotropic_elastic_matrix, isotropic_elastic_matrix, stress_mapper, strain_mapper); BoundedMatrixVoigtType invAe; double aux_det; MathUtils::InvertMatrix(strain_mapper, invAe, aux_det); @@ -545,12 +518,10 @@ void GenericAnisotropicLaw::CalculateAnisotropicStressMapperMatrix( BoundedMatrixVoigtType& rAsInv ) { - noalias(rAs) = ZeroMatrix(VoigtSize, VoigtSize); - noalias(rAsInv) = ZeroMatrix(VoigtSize, VoigtSize); + rAs.clear(); + rAsInv.clear(); const Vector &r_iso_aniso_yield_ratios = rProperties[ISOTROPIC_ANISOTROPIC_YIELD_RATIO]; - KRATOS_ERROR_IF_NOT(r_iso_aniso_yield_ratios.size() == VoigtSize) << "The length of the ISOTROPIC_ANISOTROPIC_YIELD_RATIO is not correct" << std::endl; - - if (VoigtSize == 6) { + if constexpr (VoigtSize == 6) { rAs(0, 0) = r_iso_aniso_yield_ratios(0); rAs(1, 1) = r_iso_aniso_yield_ratios(1); rAs(2, 2) = r_iso_aniso_yield_ratios(2); @@ -562,6 +533,7 @@ void GenericAnisotropicLaw::CalculateAnisotropicStressMapperMatrix( rAs(1, 1) = r_iso_aniso_yield_ratios(1); rAs(2, 2) = r_iso_aniso_yield_ratios(2); } + for (IndexType i = 0; i < VoigtSize; ++i) rAsInv(i, i) = 1.0 / rAs(i, i); } @@ -577,8 +549,6 @@ void GenericAnisotropicLaw::CalculateAnisotropicStrainMapperMatrix( BoundedMatrixVoigtType& rAe ) { - noalias(rAe) = ZeroMatrix(VoigtSize, VoigtSize); - Matrix inv_isotropic_elastic_matrix(VoigtSize, VoigtSize); noalias(inv_isotropic_elastic_matrix) = ZeroMatrix(VoigtSize, VoigtSize); double aux_det; @@ -602,13 +572,13 @@ void GenericAnisotropicLaw::InitializeMaterial( mpIsotropicCL->InitializeMaterial(r_props_isotropic_cl, rElementGeometry, rShapeFunctionsValues); // We check now the dimension of the CL pointer, must be 3D - KRATOS_ERROR_IF_NOT(mpIsotropicCL->GetStrainSize() == 6) << "The slave CL has a dimension lower than 3, not possible" << std::endl; + KRATOS_ERROR_IF_NOT(mpIsotropicCL->GetStrainSize() == VoigtSize) << "The slave CL has a different dimension of the Generic Anisotropic CL..." << std::endl; // Let's check variables KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ISOTROPIC_ANISOTROPIC_YIELD_RATIO)) << "ISOTROPIC_ANISOTROPIC_YIELD_RATIO not defined in properties" << std::endl; KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ORTHOTROPIC_ELASTIC_CONSTANTS)) << "The ORTHOTROPIC_ELASTIC_CONSTANTS are not defined" << std::endl; - KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == 6) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; + KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == VoigtSize) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; } /***********************************************************************************/ @@ -633,28 +603,6 @@ void GenericAnisotropicLaw::InitializeMaterialResponsePK2(Parameters& rVal mpIsotropicCL->InitializeMaterialResponsePK2(rValues); } - -/***********************************************************************************/ -/***********************************************************************************/ - -template -void GenericAnisotropicLaw::CalculateCauchyGreenStrain( - ConstitutiveLaw::Parameters& rValues, - Vector& rStrainVector - ) -{ - // Compute total deformation gradient - const BoundedMatrixType& F = rValues.GetDeformationGradientF(); - - BoundedMatrixType E_tensor = ZeroMatrix(F.size1()); - E_tensor = prod(trans(F), F); - for(unsigned int i = 0; i < Dimension; ++i) - E_tensor(i, i) -= 1.0; - E_tensor *= 0.5; - - noalias(rStrainVector) = MathUtils::StrainTensorToVector(E_tensor); -} - /***********************************************************************************/ /***********************************************************************************/ diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h index ec303c54f0c..349654dffb3 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h @@ -73,10 +73,10 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw static constexpr SizeType Dimension = TDim; /// Static definition of the VoigtSize - static constexpr SizeType VoigtSize = (TDim == 3) ? 6 : 3; + static constexpr SizeType VoigtSize = (Dimension == 3) ? 6 : 3; /// The definition of the bounded matrix type - using BoundedMatrixType = BoundedMatrix; + using BoundedMatrixType = BoundedMatrix; /// The definition of the bounded matrix type using BoundedMatrixVoigtType = BoundedMatrix; @@ -311,6 +311,13 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw BoundedMatrixVoigtType& rAsInv ); + /** + * @brief This computes the rotation matrix, from global to local + */ + void CalculateRotationMatrixVoigt( + const Properties& rProperties, + BoundedMatrixVoigtType &rT); + /** * @brief This computes the mapper operator between the strain in the isotropic * "ficticious" space and the real anisotropic space @@ -446,10 +453,6 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw ///@name Private Operations ///@{ - void CalculateCauchyGreenStrain( - ConstitutiveLaw::Parameters &rValues, - Vector &rStrainVector); - ///@} ///@name Private Access ///@{ From b5671fc24bc236948ecaef15bd8cfac81988886b Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 10:15:03 +0100 Subject: [PATCH 19/39] start registering --- .../constitutive_laws_application.cpp | 1 + .../constitutive_laws_application.h | 3 ++- .../composites/rule_of_mixtures_law.cpp | 2 +- .../anisotropy_orthotropy/generic_anisotropic_3d_law.cpp | 4 +--- .../add_custom_constitutive_laws_to_python.cpp | 9 +++++++++ .../advanced_constitutive_law_utilities.cpp | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp b/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp index d51f8fb9ebc..19f043e7dcb 100644 --- a/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp +++ b/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp @@ -72,6 +72,7 @@ void KratosConstitutiveLawsApplication::Register() KRATOS_REGISTER_CONSTITUTIVE_LAW("SerialParallelRuleOfMixturesLaw", mSerialParallelRuleOfMixturesLaw); // Anisotropic law + KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropic2DLaw", mGenericAnisotropic2DLaw); KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropic3DLaw", mGenericAnisotropic3DLaw); /// Plasticity diff --git a/applications/ConstitutiveLawsApplication/constitutive_laws_application.h b/applications/ConstitutiveLawsApplication/constitutive_laws_application.h index 8115fda211a..7852cb18967 100644 --- a/applications/ConstitutiveLawsApplication/constitutive_laws_application.h +++ b/applications/ConstitutiveLawsApplication/constitutive_laws_application.h @@ -623,7 +623,8 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) KratosConstitutiveLawsApplicatio const ParallelRuleOfMixturesLaw<2> mParallelRuleOfMixturesLaw2D; // Anisotropic law - const GenericAnisotropic3DLaw mGenericAnisotropic3DLaw; + const GenericAnisotropicLaw<2> mGenericAnisotropic2DLaw; + const GenericAnisotropicLaw<3> mGenericAnisotropic3DLaw; const AssociativePlasticDamageModel >> mAssociativePlasticDamageModel3DVonMises; const AssociativePlasticDamageModel >> mAssociativePlasticDamageModel3DDruckerPrager; diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/composites/rule_of_mixtures_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/composites/rule_of_mixtures_law.cpp index efa3383a6e6..67550ba6a43 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/composites/rule_of_mixtures_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/composites/rule_of_mixtures_law.cpp @@ -1505,7 +1505,7 @@ void ParallelRuleOfMixturesLaw::CalculateRotationMatrix( const double euler_angle_theta = layers_euler_angles[3*Layer + 1]; const double euler_angle_hi = layers_euler_angles[3*Layer + 2]; - BoundedMatrix rotation_matrix; + BoundedMatrix rotation_matrix; if (std::abs(euler_angle_phi) + std::abs(euler_angle_theta) + std::abs(euler_angle_hi) > machine_tolerance) { AdvancedConstitutiveLawUtilities::CalculateRotationOperator(euler_angle_phi, euler_angle_theta, euler_angle_hi, rotation_matrix); diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp index 014bd360626..8d3715619c1 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp @@ -287,9 +287,7 @@ void GenericAnisotropicLaw::FinalizeMaterialResponsePK2(ConstitutiveLaw::P this->CalculateAnisotropicStressMapperMatrix(r_material_properties, stress_mapper, stress_mapper_inv); mpIsotropicCL->CalculateValue(rValues, CONSTITUTIVE_MATRIX, isotropic_elastic_matrix); // takes the props of the iso cl this->CalculateOrthotropicElasticMatrix(anisotropic_elastic_matrix, r_material_properties); - this->CalculateAnisotropicStrainMapperMatrix(anisotropic_elastic_matrix, - isotropic_elastic_matrix, stress_mapper, - strain_mapper); + this->CalculateAnisotropicStrainMapperMatrix(anisotropic_elastic_matrix, isotropic_elastic_matrix, stress_mapper, strain_mapper); Vector &r_iso_strain_vector = rValues.GetStrainVector(); // Now we rotate the strain Eglob-> Eloc r_iso_strain_vector = prod(voigt_rotation_matrix, r_iso_strain_vector); diff --git a/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp b/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp index efb2fbbd5db..64e86d99ea0 100644 --- a/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp +++ b/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp @@ -103,6 +103,7 @@ // Rules of mixtures #include "custom_constitutive/composites/rule_of_mixtures_law.h" #include "custom_constitutive/composites/traction_separation_law.h" +#include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h" #include "custom_constitutive/small_strains/plastic_damage/associative_plastic_damage_model.h" @@ -1355,6 +1356,14 @@ void AddCustomConstitutiveLawsToPython(pybind11::module& m) (m,"SerialParallelRuleOfMixturesLaw").def(py::init<>()) ; + py::class_< GenericAnisotropicLaw<2>, typename GenericAnisotropicLaw<2>::Pointer, ConstitutiveLaw > + (m,"GenericAnisotropic2DLaw").def(py::init<>()) + ; + + py::class_< GenericAnisotropicLaw<3>, typename GenericAnisotropicLaw<3>::Pointer, ConstitutiveLaw > + (m,"GenericAnisotropic3DLaw").def(py::init<>()) + ; + py::class_< AssociativePlasticDamageModel >>, typename AssociativePlasticDamageModel >>::Pointer, ConstitutiveLaw > diff --git a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp index 7b2a02a1e22..c5b0ffb94b3 100644 --- a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp +++ b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp @@ -717,7 +717,7 @@ void AdvancedConstitutiveLawUtilities::CalculateRotationOperatorEule rRotationOperator(2, 1) = -sin_angle; rRotationOperator(2, 2) = cos_angle; } else { - KRATOS_ERROR << "This operation cannot be done in Dimension = 2 ..." + KRATOS_ERROR << "This operation cannot be done in Dimension = 2 ..." << std::endl; } } From 03ca74556cdb1af22d5a9daac44934bf304b6754 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 12:46:16 +0100 Subject: [PATCH 20/39] updates to 3d and 2D aniso --- .../generic_anisotropic_3d_law.cpp | 10 ++++++++-- .../anisotropy_orthotropy/generic_anisotropic_3d_law.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp index 8d3715619c1..c986506a436 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp @@ -17,7 +17,7 @@ // External includes // Project includes -#include "utilities/math_utils.h" + #include "constitutive_laws_application_variables.h" #include "generic_anisotropic_3d_law.h" #include "custom_utilities/tangent_operator_calculator_utility.h" @@ -475,7 +475,7 @@ Vector& GenericAnisotropicLaw::CalculateValue( values_iso_cl.SetMaterialProperties(r_props_iso_cl); // Here we compute the rotation tensors due to the angles of the local and global axes - BoundedMatrixVoigtType voigt_rotation_matrix; + BoundedMatrixVoigtType voigt_rotation_matrix, inv_voigt_rotation_matrix; CalculateRotationMatrixVoigt(r_material_properties, voigt_rotation_matrix); double det = 0.0; MathUtils::InvertMatrix(voigt_rotation_matrix, inv_voigt_rotation_matrix, det); @@ -638,4 +638,10 @@ void GenericAnisotropicLaw::CalculateTangentTensor(ConstitutiveLaw::Parame } } +/***********************************************************************************/ +/***********************************************************************************/ + +template class GenericAnisotropicLaw<2>; +template class GenericAnisotropicLaw<3>; + } // namespace Kratos diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h index 349654dffb3..23df8fc0b47 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h @@ -100,7 +100,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw */ ConstitutiveLaw::Pointer Clone() const override { - return Kratos::make_shared(*this); + return Kratos::make_shared>(*this); } // Copy constructor From 2ef67915cbb3b197ae3a09cec56eb2a7fc8961ae Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 15:52:20 +0100 Subject: [PATCH 21/39] optimization in utils --- .../constitutive_law_utilities.cpp | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_utilities/constitutive_law_utilities.cpp b/applications/StructuralMechanicsApplication/custom_utilities/constitutive_law_utilities.cpp index 0d7a8186131..abe5ba8336c 100644 --- a/applications/StructuralMechanicsApplication/custom_utilities/constitutive_law_utilities.cpp +++ b/applications/StructuralMechanicsApplication/custom_utilities/constitutive_law_utilities.cpp @@ -218,17 +218,21 @@ void ConstitutiveLawUtilities::CalculateRotationOperatorVoigt( const double c = rEulerOperator(0, 0); const double s = rEulerOperator(0, 1); - rVoigtOperator(0, 0) = std::pow(c, 2); - rVoigtOperator(0, 1) = std::pow(s, 2); - rVoigtOperator(0, 2) = c * s; + const double c_square = c * c; + const double s_square = s * s; + const double c_times_s = c * s; - rVoigtOperator(1, 0) = std::pow(s, 2); - rVoigtOperator(1, 1) = std::pow(c, 2); - rVoigtOperator(1, 2) = -c * s; + rVoigtOperator(0, 0) = c_square; + rVoigtOperator(0, 1) = s_square; + rVoigtOperator(0, 2) = c_times_s; + + rVoigtOperator(1, 0) = s_square; + rVoigtOperator(1, 1) = c_square; + rVoigtOperator(1, 2) = -c_times_s; rVoigtOperator(2, 0) = -2.0 * c * s; rVoigtOperator(2, 1) = 2.0 * c * s; - rVoigtOperator(2, 2) = std::pow(c, 2) - std::pow(s, 2); + rVoigtOperator(2, 2) = c_square - s_square; } else { const double l1 = rEulerOperator(0, 0); const double l2 = rEulerOperator(1, 0); @@ -240,23 +244,23 @@ void ConstitutiveLawUtilities::CalculateRotationOperatorVoigt( const double n2 = rEulerOperator(1, 2); const double n3 = rEulerOperator(2, 2); - rVoigtOperator(0, 0) = std::pow(l1, 2); - rVoigtOperator(0, 1) = std::pow(m1, 2); - rVoigtOperator(0, 2) = std::pow(n1, 2); + rVoigtOperator(0, 0) = l1 * l1; + rVoigtOperator(0, 1) = m1 * m1; + rVoigtOperator(0, 2) = n1 * n1; rVoigtOperator(0, 3) = l1 * m1; rVoigtOperator(0, 4) = m1 * n1; rVoigtOperator(0, 5) = n1 * l1; - rVoigtOperator(1, 0) = std::pow(l2, 2); - rVoigtOperator(1, 1) = std::pow(m2, 2); - rVoigtOperator(1, 2) = std::pow(n2, 2); + rVoigtOperator(1, 0) = l2 * l2; + rVoigtOperator(1, 1) = m2 * m2; + rVoigtOperator(1, 2) = n2 * n2; rVoigtOperator(1, 3) = l2 * m2; rVoigtOperator(1, 4) = m2 * n2; rVoigtOperator(1, 5) = n2 * l2; - rVoigtOperator(2, 0) = std::pow(l3, 2); - rVoigtOperator(2, 1) = std::pow(m3, 2); - rVoigtOperator(2, 2) = std::pow(n3, 2); + rVoigtOperator(2, 0) = l3 * l3; + rVoigtOperator(2, 1) = m3 * m3; + rVoigtOperator(2, 2) = n3 * n3; rVoigtOperator(2, 3) = l3 * m3; rVoigtOperator(2, 4) = m3 * n3; rVoigtOperator(2, 5) = n3 * l3; From da58eb7590f0be6c710cb77dc18ea110282aea21 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 15:56:41 +0100 Subject: [PATCH 22/39] improving the CL aniso --- .../generic_anisotropic_3d_law.cpp | 63 +++++-------------- .../generic_anisotropic_3d_law.h | 19 +++--- 2 files changed, 26 insertions(+), 56 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp index c986506a436..2d38f5c6c68 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp @@ -186,45 +186,11 @@ void GenericAnisotropicLaw::CalculateOrthotropicElasticMatrix( BoundedMatrixVoigtType& rElasticityTensor, const Properties& rMaterialProperties) { - KRATOS_TRY - - noalias(rElasticityTensor) = ZeroMatrix(VoigtSize, VoigtSize); - - const Vector& r_ortho_elastic_constants = rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS]; - const double Ex = r_ortho_elastic_constants(0); - const double Ey = r_ortho_elastic_constants(1); - const double Ez = r_ortho_elastic_constants(2); - const double vxy = r_ortho_elastic_constants(3); - const double vyz = r_ortho_elastic_constants(4); - const double vxz = r_ortho_elastic_constants(5); - - const double vyx = vxy * Ey / Ex; - const double vzx = vxz * Ez / Ex; - const double vzy = vyz * Ez / Ey; - - KRATOS_ERROR_IF(vyx > 0.5) << "The Poisson_yx is greater than 0.5." << std::endl; - KRATOS_ERROR_IF(vzx > 0.5) << "The Poisson_zx is greater than 0.5." << std::endl; - KRATOS_ERROR_IF(vzy > 0.5) << "The Poisson_zy is greater than 0.5." << std::endl; - - const double ctant = 1.0 / (1.0 - vxy * vyx - vzy * vyz - vzx * vxz - vxy * vyz * vzx - vxz * vyx * vzy); - - rElasticityTensor(0, 0) = Ex * (1.0 - vyz * vzy) * ctant; - rElasticityTensor(0, 1) = Ex * (vyx + vyz * vzx) * ctant; - rElasticityTensor(1, 0) = Ey * (vxy + vzy * vxz) * ctant; - - rElasticityTensor(0, 2) = Ex * (vzx + vyx * vzy) * ctant; - rElasticityTensor(2, 0) = Ez * (vxz + vxy * vyz) * ctant; - rElasticityTensor(1, 1) = Ey * (1.0 - vxz * vzx) * ctant; - - rElasticityTensor(1, 2) = Ey * (vzy + vxy * vzx) * ctant; - rElasticityTensor(2, 1) = Ez * (vyz + vyx * vxz) * ctant; - rElasticityTensor(2, 2) = Ez * (1.0 - vxy * vyx) * ctant; - - rElasticityTensor(3, 3) = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + vyx) / Ex + (1.0 + vxy) / Ey); - rElasticityTensor(4, 4) = (rMaterialProperties.Has(SHEAR_MODULUS_YZ)) ? rMaterialProperties[SHEAR_MODULUS_YZ] : 1.0 / ((1.0 + vzy) / Ey + (1.0 + vyz) / Ez); - rElasticityTensor(5, 5) = (rMaterialProperties.Has(SHEAR_MODULUS_XZ)) ? rMaterialProperties[SHEAR_MODULUS_XZ] : 1.0 / ((1.0 + vzx) / Ex + (1.0 + vxz) / Ez); + if constexpr (Dimension == 3) { + AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMatrix(rElasticityTensor, rMaterialProperties); + } else { - KRATOS_CATCH("") + } } /***********************************************************************************/ @@ -548,7 +514,6 @@ void GenericAnisotropicLaw::CalculateAnisotropicStrainMapperMatrix( ) { Matrix inv_isotropic_elastic_matrix(VoigtSize, VoigtSize); - noalias(inv_isotropic_elastic_matrix) = ZeroMatrix(VoigtSize, VoigtSize); double aux_det; MathUtils::InvertMatrix(rIsotropicElasticMatrix, inv_isotropic_elastic_matrix, aux_det); noalias(rAe) = prod(inv_isotropic_elastic_matrix, Matrix(prod(rAs, rAnisotropicElasticMatrix))); @@ -568,15 +533,6 @@ void GenericAnisotropicLaw::InitializeMaterial( KRATOS_ERROR_IF_NOT(r_props_isotropic_cl.Has(CONSTITUTIVE_LAW)) << "No constitutive law set" << std::endl; mpIsotropicCL = r_props_isotropic_cl[CONSTITUTIVE_LAW]->Clone(); mpIsotropicCL->InitializeMaterial(r_props_isotropic_cl, rElementGeometry, rShapeFunctionsValues); - - // We check now the dimension of the CL pointer, must be 3D - KRATOS_ERROR_IF_NOT(mpIsotropicCL->GetStrainSize() == VoigtSize) << "The slave CL has a different dimension of the Generic Anisotropic CL..." << std::endl; - - // Let's check variables - KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ISOTROPIC_ANISOTROPIC_YIELD_RATIO)) << "ISOTROPIC_ANISOTROPIC_YIELD_RATIO not defined in properties" << std::endl; - - KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ORTHOTROPIC_ELASTIC_CONSTANTS)) << "The ORTHOTROPIC_ELASTIC_CONSTANTS are not defined" << std::endl; - KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == VoigtSize) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; } /***********************************************************************************/ @@ -613,6 +569,17 @@ int GenericAnisotropicLaw::Check( { const auto it_cl_begin = rMaterialProperties.GetSubProperties().begin(); const auto& r_props_iso_cl = *(it_cl_begin); + + // We check now the dimension of the CL pointer, must be 3D + KRATOS_ERROR_IF_NOT(mpIsotropicCL->GetStrainSize() == VoigtSize) << "The slave CL has a different dimension of the Generic Anisotropic CL..." << std::endl; + + // Let's check variables + KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ISOTROPIC_ANISOTROPIC_YIELD_RATIO)) << "ISOTROPIC_ANISOTROPIC_YIELD_RATIO not defined in properties" << std::endl; + + KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ORTHOTROPIC_ELASTIC_CONSTANTS)) << "The ORTHOTROPIC_ELASTIC_CONSTANTS are not defined" << std::endl; + KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == VoigtSize) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; + + return mpIsotropicCL->Check(r_props_iso_cl, rElementGeometry, rCurrentProcessInfo); } diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h index 23df8fc0b47..125dd5599c4 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h @@ -44,11 +44,11 @@ using SizeType = std::size_t; ///@} ///@name Kratos Classes ///@{ -/** + +/* * @class GenericAnisotropicLaw * @ingroup ConstitutiveLawsApplication - * @brief This CL takes into account the material anisotropy in terms of - * young modulus, poisson ratio, orientation and strengths. + * @brief This CL takes into account the material anisotropy in terms of young modulus, poisson ratio, orientation and strengths. 3D CLs and plane strain. * @details See "Nonlinear behavior of existing pre-tensioned concrete beams: Experimental study and finite element modeling with the constitutive Serial-Parallel rule of mixtures", DOI: https://doi.org/10.1016/j.istruc.2024.106990 * @author Alejandro Cornejo */ @@ -56,7 +56,7 @@ template class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw : public ConstitutiveLaw { - public: +public: ///@name Type Definitions ///@{ @@ -330,8 +330,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw const BoundedMatrixVoigtType& rAnisotropicElasticMatrix, const BoundedMatrixVoigtType& rIsotropicElasticMatrix, const BoundedMatrixVoigtType &rAs, - BoundedMatrixVoigtType& rAe - ); + BoundedMatrixVoigtType& rAe); /** * Initialize the material response in terms of 2nd Piola-Kirchhoff stresses @@ -357,11 +356,15 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw /** * @brief This method computes the orthotropic elastic constitutive matrix + * This method is overriden in the derived class for plane stress */ - void CalculateOrthotropicElasticMatrix( + virtual void CalculateOrthotropicElasticMatrix( BoundedMatrixVoigtType &rElasticityTensor, const Properties &rMaterialProperties); + /** + * @brief This method checks the properties in the nested CL + */ int Check(const Properties &rMaterialProperties, const GeometryType &rElementGeometry, const ProcessInfo &rCurrentProcessInfo) const override; @@ -371,6 +374,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw * stress increment with the strain increment. */ void CalculateTangentTensor(ConstitutiveLaw::Parameters &rValues); + ///@} ///@name Access ///@{ @@ -417,7 +421,6 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw mpIsotropicCL = pIsotropicConstitutiveLaw; } - ///@} ///@name Protected Operations ///@{ From fc55557461195b174a77cb71ce58e17d52de684f Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 16:29:31 +0100 Subject: [PATCH 23/39] implementing D is ortho in 2D --- .../advanced_constitutive_law_utilities.cpp | 135 ++++++++++++++++++ .../advanced_constitutive_law_utilities.h | 21 +++ 2 files changed, 156 insertions(+) diff --git a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp index c5b0ffb94b3..52f4cdabeb1 100644 --- a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp +++ b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp @@ -19,6 +19,7 @@ #include "includes/global_variables.h" #include "utilities/math_utils.h" #include "custom_utilities/advanced_constitutive_law_utilities.h" +#include "constitutive_laws_application_variables.h" namespace Kratos { @@ -857,6 +858,140 @@ double AdvancedConstitutiveLawUtilities::GetPropertyFromTemperatureT /***********************************************************************************/ /***********************************************************************************/ +template +void AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMatrix( + BoundedMatrixVoigtType& rElasticityTensor, + const Properties& rMaterialProperties) +{ + KRATOS_TRY + + rElasticityTensor.clear(); + + const Vector& r_ortho_elastic_constants = rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS]; + const double Ex = r_ortho_elastic_constants[0]; + const double Ey = r_ortho_elastic_constants[1]; + const double Ez = r_ortho_elastic_constants[2]; + const double vxy = r_ortho_elastic_constants[3]; + const double vyz = r_ortho_elastic_constants[4]; + const double vxz = r_ortho_elastic_constants[5]; + + const double vyx = vxy * Ey / Ex; + const double vzx = vxz * Ez / Ex; + const double vzy = vyz * Ez / Ey; + + KRATOS_ERROR_IF(vyx > 0.5) << "The Poisson_yx is greater than 0.5." << std::endl; + KRATOS_ERROR_IF(vzx > 0.5) << "The Poisson_zx is greater than 0.5." << std::endl; + KRATOS_ERROR_IF(vzy > 0.5) << "The Poisson_zy is greater than 0.5." << std::endl; + + const double ctant = 1.0 / (1.0 - vxy * vyx - vzy * vyz - vzx * vxz - vxy * vyz * vzx - vxz * vyx * vzy); + + rElasticityTensor(0, 0) = Ex * (1.0 - vyz * vzy) * ctant; + rElasticityTensor(0, 1) = Ex * (vyx + vyz * vzx) * ctant; + rElasticityTensor(1, 0) = Ey * (vxy + vzy * vxz) * ctant; + + rElasticityTensor(0, 2) = Ex * (vzx + vyx * vzy) * ctant; + rElasticityTensor(2, 0) = Ez * (vxz + vxy * vyz) * ctant; + rElasticityTensor(1, 1) = Ey * (1.0 - vxz * vzx) * ctant; + + rElasticityTensor(1, 2) = Ey * (vzy + vxy * vzx) * ctant; + rElasticityTensor(2, 1) = Ez * (vyz + vyx * vxz) * ctant; + rElasticityTensor(2, 2) = Ez * (1.0 - vxy * vyx) * ctant; + + rElasticityTensor(3, 3) = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + vyx) / Ex + (1.0 + vxy) / Ey); + rElasticityTensor(4, 4) = (rMaterialProperties.Has(SHEAR_MODULUS_YZ)) ? rMaterialProperties[SHEAR_MODULUS_YZ] : 1.0 / ((1.0 + vzy) / Ey + (1.0 + vyz) / Ez); + rElasticityTensor(5, 5) = (rMaterialProperties.Has(SHEAR_MODULUS_XZ)) ? rMaterialProperties[SHEAR_MODULUS_XZ] : 1.0 / ((1.0 + vzx) / Ex + (1.0 + vxz) / Ez); + + KRATOS_CATCH("") +} + +/***********************************************************************************/ +/***********************************************************************************/ + +template +void AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMatrixPlaneStrain( + BoundedMatrixVoigtType& rElasticityTensor, + const Properties& rMaterialProperties) +{ + KRATOS_TRY + + rElasticityTensor.clear(); + // The input vector is the same as in 3D. + const Vector& r_ortho_elastic_constants = rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS]; + const double E1 = r_ortho_elastic_constants[0]; + const double E2 = r_ortho_elastic_constants[1]; + const double E3 = r_ortho_elastic_constants[2]; + const double v12 = r_ortho_elastic_constants[3]; + const double v23 = r_ortho_elastic_constants[4]; + const double v13 = r_ortho_elastic_constants[5]; + + const double v21 = v12 * E2 / E1; + const double v31 = v13 * E3 / E1; + const double v32 = v23 * E3 / E2; + + KRATOS_ERROR_IF(v21 > 0.5) << "The Poisson_yx is greater than 0.5." << std::endl; + KRATOS_ERROR_IF(v31 > 0.5) << "The Poisson_zx is greater than 0.5." << std::endl; + KRATOS_ERROR_IF(v32 > 0.5) << "The Poisson_zy is greater than 0.5." << std::endl; + + const double a = 1.0 - v23 * v32; + const double b = v12 + v32 * v13; + const double c = v21 + v23 * v31; + const double d = 1.0 - v13 * v31; + + const double factor = a * d - b * c; + + const double G12 = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + v21) * E1 + (1.0 + v12) / E2); + + rElasticityTensor(0, 0) = a * E1; + rElasticityTensor(0, 1) = b * E1; + rElasticityTensor(1, 0) = c * E2; + rElasticityTensor(1, 1) = d * E2; + rElasticityTensor(2, 2) = factor * G12; + + rElasticityTensor /= factor; + + KRATOS_CATCH("") +} + +/***********************************************************************************/ +/***********************************************************************************/ + +template +void AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMatrixPlaneStress( + BoundedMatrixVoigtType& rElasticityTensor, + const Properties& rMaterialProperties) +{ + KRATOS_TRY + + rElasticityTensor.clear(); + // The input vector is the same as in 3D. + const Vector& r_ortho_elastic_constants = rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS]; + const double E1 = r_ortho_elastic_constants[0]; + const double E2 = r_ortho_elastic_constants[1]; + const double v12 = r_ortho_elastic_constants[3]; + + const double v21 = v12 * E2 / E1; + + KRATOS_ERROR_IF(v21 > 0.5) << "The Poisson_yx is greater than 0.5." << std::endl; + + const double factor = 1.0 - v12 * v21; + + const double G12 = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + v21) * E1 + (1.0 + v12) / E2); + + rElasticityTensor(0, 0) = E1; + rElasticityTensor(0, 1) = v21 * E1; + rElasticityTensor(1, 0) = v12 * E2; + rElasticityTensor(1, 1) = E2; + rElasticityTensor(2, 2) = factor * G12; + + rElasticityTensor /= factor; + + KRATOS_CATCH("") +} + +/***********************************************************************************/ +/***********************************************************************************/ + + template class AdvancedConstitutiveLawUtilities<3>; template class AdvancedConstitutiveLawUtilities<6>; diff --git a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h index bf8b9790f31..265cbe7587f 100644 --- a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h +++ b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.h @@ -471,6 +471,27 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) AdvancedConstitutiveLawUtilities BoundedMatrix& rRotationOperator ); + /** + * @brief This computes the elastic constituive matrix for a 3D elastic CL + */ + static void CalculateOrthotropicElasticMatrix( + BoundedMatrixVoigtType &rElasticityTensor, + const Properties &rMaterialProperties); + + /** + * @brief This computes the elastic constituive matrix for a 3D elastic CL + */ + static void CalculateOrthotropicElasticMatrixPlaneStrain( + BoundedMatrixVoigtType &rElasticityTensor, + const Properties &rMaterialProperties); + + /** + * @brief This computes the elastic constituive matrix for a 3D elastic CL + */ + static void CalculateOrthotropicElasticMatrixPlaneStress( + BoundedMatrixVoigtType &rElasticityTensor, + const Properties &rMaterialProperties); + /** * @brief This computes the MacaullyBrackets of a double */ From 37f2069b6754bae25eebf11c1da978dc37ae2320 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 16:30:33 +0100 Subject: [PATCH 24/39] adding plane strain to old CL --- .../anisotropy_orthotropy/generic_anisotropic_3d_law.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp index 2d38f5c6c68..66b53c3fdf1 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp @@ -188,8 +188,8 @@ void GenericAnisotropicLaw::CalculateOrthotropicElasticMatrix( { if constexpr (Dimension == 3) { AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMatrix(rElasticityTensor, rMaterialProperties); - } else { - + } else { // The 2D is plane strain + AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMatrixPlaneStrain(rElasticityTensor, rMaterialProperties); } } @@ -579,7 +579,6 @@ int GenericAnisotropicLaw::Check( KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ORTHOTROPIC_ELASTIC_CONSTANTS)) << "The ORTHOTROPIC_ELASTIC_CONSTANTS are not defined" << std::endl; KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == VoigtSize) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; - return mpIsotropicCL->Check(r_props_iso_cl, rElementGeometry, rCurrentProcessInfo); } From 4f1031d5fcc34ed064ef1946e72a4aeada3f658d Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 16:38:28 +0100 Subject: [PATCH 25/39] renaming the CL in 2D --- .../constitutive_laws_application.cpp | 2 +- .../constitutive_laws_application.h | 4 ++-- ...ric_anisotropic_3d_law.cpp => generic_anisotropic_law.cpp} | 2 +- ...generic_anisotropic_3d_law.h => generic_anisotropic_law.h} | 0 .../custom_python/add_custom_constitutive_laws_to_python.cpp | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) rename applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/{generic_anisotropic_3d_law.cpp => generic_anisotropic_law.cpp} (99%) rename applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/{generic_anisotropic_3d_law.h => generic_anisotropic_law.h} (100%) diff --git a/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp b/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp index 19f043e7dcb..a496290fc65 100644 --- a/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp +++ b/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp @@ -72,7 +72,7 @@ void KratosConstitutiveLawsApplication::Register() KRATOS_REGISTER_CONSTITUTIVE_LAW("SerialParallelRuleOfMixturesLaw", mSerialParallelRuleOfMixturesLaw); // Anisotropic law - KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropic2DLaw", mGenericAnisotropic2DLaw); + KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropicPlaneStrain2DLaw", mGenericAnisotropicPlaneStrain2DLaw); KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropic3DLaw", mGenericAnisotropic3DLaw); /// Plasticity diff --git a/applications/ConstitutiveLawsApplication/constitutive_laws_application.h b/applications/ConstitutiveLawsApplication/constitutive_laws_application.h index 7852cb18967..5cc1e178154 100644 --- a/applications/ConstitutiveLawsApplication/constitutive_laws_application.h +++ b/applications/ConstitutiveLawsApplication/constitutive_laws_application.h @@ -66,7 +66,7 @@ #include "custom_constitutive/small_strains/plastic_damage/generic_small_strain_plastic_damage_model.h" #include "custom_constitutive/small_strains/damage/generic_small_strain_orthotropic_damage.h" #include "custom_constitutive/composites/serial_parallel_rule_of_mixtures_law.h" -#include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h" +#include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h" #include "custom_constitutive/small_strains/linear/multi_linear_elastic_1d_law.h" #include "custom_constitutive/small_strains/linear/multi_linear_isotropic_plane_stress_2d.h" #include "custom_constitutive/small_strains/damage/generic_small_strain_isotropic_damage_plane_stress.h" @@ -623,7 +623,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) KratosConstitutiveLawsApplicatio const ParallelRuleOfMixturesLaw<2> mParallelRuleOfMixturesLaw2D; // Anisotropic law - const GenericAnisotropicLaw<2> mGenericAnisotropic2DLaw; + const GenericAnisotropicLaw<2> mGenericAnisotropicPlaneStrain2DLaw; const GenericAnisotropicLaw<3> mGenericAnisotropic3DLaw; const AssociativePlasticDamageModel >> mAssociativePlasticDamageModel3DVonMises; diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp similarity index 99% rename from applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp rename to applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp index 66b53c3fdf1..dc78294cd7a 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp @@ -19,7 +19,7 @@ // Project includes #include "constitutive_laws_application_variables.h" -#include "generic_anisotropic_3d_law.h" +#include "generic_anisotropic_law.h" #include "custom_utilities/tangent_operator_calculator_utility.h" #include "custom_utilities/advanced_constitutive_law_utilities.h" #include "custom_utilities/constitutive_law_utilities.h" diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h similarity index 100% rename from applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h rename to applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h diff --git a/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp b/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp index 64e86d99ea0..d09a33b7702 100644 --- a/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp +++ b/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp @@ -103,7 +103,7 @@ // Rules of mixtures #include "custom_constitutive/composites/rule_of_mixtures_law.h" #include "custom_constitutive/composites/traction_separation_law.h" -#include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_3d_law.h" +#include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h" #include "custom_constitutive/small_strains/plastic_damage/associative_plastic_damage_model.h" @@ -1357,7 +1357,7 @@ void AddCustomConstitutiveLawsToPython(pybind11::module& m) ; py::class_< GenericAnisotropicLaw<2>, typename GenericAnisotropicLaw<2>::Pointer, ConstitutiveLaw > - (m,"GenericAnisotropic2DLaw").def(py::init<>()) + (m,"GenericAnisotropicPlaneStrain2DLaw").def(py::init<>()) ; py::class_< GenericAnisotropicLaw<3>, typename GenericAnisotropicLaw<3>::Pointer, ConstitutiveLaw > From 9db35dbf8453c78718854825a5fe55b6a9ac1e8b Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 17:06:37 +0100 Subject: [PATCH 26/39] registering new plane stress aniso CL --- .../constitutive_laws_application.cpp | 1 + .../constitutive_laws_application.h | 2 + .../generic_anisotropic_law.cpp | 18 +- .../generic_anisotropic_law.h | 4 +- ...eneric_anisotropic_plane_stress_2d_law.cpp | 48 ++++ .../generic_anisotropic_plane_stress_2d_law.h | 216 ++++++++++++++++++ ...add_custom_constitutive_laws_to_python.cpp | 9 +- 7 files changed, 285 insertions(+), 13 deletions(-) create mode 100644 applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.cpp create mode 100644 applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.h diff --git a/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp b/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp index a496290fc65..f872f72efa0 100644 --- a/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp +++ b/applications/ConstitutiveLawsApplication/constitutive_laws_application.cpp @@ -74,6 +74,7 @@ void KratosConstitutiveLawsApplication::Register() // Anisotropic law KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropicPlaneStrain2DLaw", mGenericAnisotropicPlaneStrain2DLaw); KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropic3DLaw", mGenericAnisotropic3DLaw); + KRATOS_REGISTER_CONSTITUTIVE_LAW("GenericAnisotropicPlaneStress2DLaw", mGenericAnisotropicPlaneStress2DLaw); /// Plasticity diff --git a/applications/ConstitutiveLawsApplication/constitutive_laws_application.h b/applications/ConstitutiveLawsApplication/constitutive_laws_application.h index 5cc1e178154..6c1947ea841 100644 --- a/applications/ConstitutiveLawsApplication/constitutive_laws_application.h +++ b/applications/ConstitutiveLawsApplication/constitutive_laws_application.h @@ -67,6 +67,7 @@ #include "custom_constitutive/small_strains/damage/generic_small_strain_orthotropic_damage.h" #include "custom_constitutive/composites/serial_parallel_rule_of_mixtures_law.h" #include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h" +#include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.h" #include "custom_constitutive/small_strains/linear/multi_linear_elastic_1d_law.h" #include "custom_constitutive/small_strains/linear/multi_linear_isotropic_plane_stress_2d.h" #include "custom_constitutive/small_strains/damage/generic_small_strain_isotropic_damage_plane_stress.h" @@ -625,6 +626,7 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) KratosConstitutiveLawsApplicatio // Anisotropic law const GenericAnisotropicLaw<2> mGenericAnisotropicPlaneStrain2DLaw; const GenericAnisotropicLaw<3> mGenericAnisotropic3DLaw; + const GenericAnisotropicPlaneStress2DLaw mGenericAnisotropicPlaneStress2DLaw; const AssociativePlasticDamageModel >> mAssociativePlasticDamageModel3DVonMises; const AssociativePlasticDamageModel >> mAssociativePlasticDamageModel3DDruckerPrager; diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp index dc78294cd7a..c1b17b01167 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp @@ -486,16 +486,16 @@ void GenericAnisotropicLaw::CalculateAnisotropicStressMapperMatrix( rAsInv.clear(); const Vector &r_iso_aniso_yield_ratios = rProperties[ISOTROPIC_ANISOTROPIC_YIELD_RATIO]; if constexpr (VoigtSize == 6) { - rAs(0, 0) = r_iso_aniso_yield_ratios(0); - rAs(1, 1) = r_iso_aniso_yield_ratios(1); - rAs(2, 2) = r_iso_aniso_yield_ratios(2); - rAs(3, 3) = r_iso_aniso_yield_ratios(3); - rAs(4, 4) = r_iso_aniso_yield_ratios(4); - rAs(5, 5) = r_iso_aniso_yield_ratios(5); + rAs(0, 0) = r_iso_aniso_yield_ratios[0]; + rAs(1, 1) = r_iso_aniso_yield_ratios[1]; + rAs(2, 2) = r_iso_aniso_yield_ratios[2]; + rAs(3, 3) = r_iso_aniso_yield_ratios[3]; + rAs(4, 4) = r_iso_aniso_yield_ratios[4]; + rAs(5, 5) = r_iso_aniso_yield_ratios[5]; } else { - rAs(0, 0) = r_iso_aniso_yield_ratios(0); - rAs(1, 1) = r_iso_aniso_yield_ratios(1); - rAs(2, 2) = r_iso_aniso_yield_ratios(2); + rAs(0, 0) = r_iso_aniso_yield_ratios[0]; + rAs(1, 1) = r_iso_aniso_yield_ratios[1]; + rAs(2, 2) = r_iso_aniso_yield_ratios[2]; } for (IndexType i = 0; i < VoigtSize; ++i) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h index 125dd5599c4..0e66fe0e6f1 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h @@ -61,10 +61,10 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw ///@{ /// The node definition - typedef Node NodeType; + using NodeType = Node; /// The geometry definition - typedef Geometry GeometryType; + using GeometryType = Geometry; /// Definition of the machine precision tolerance static constexpr double machine_tolerance = std::numeric_limits::epsilon(); diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.cpp new file mode 100644 index 00000000000..d3168ad89f3 --- /dev/null +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.cpp @@ -0,0 +1,48 @@ +// KRATOS ___ _ _ _ _ _ __ _ +// / __\___ _ __ ___| |_(_) |_ _ _| |_(_)_ _____ / / __ ___ _____ /_\ _ __ _ __ +// / / / _ \| '_ \/ __| __| | __| | | | __| \ \ / / _ \/ / / _` \ \ /\ / / __| //_\\| '_ \| '_ | +// / /__| (_) | | | \__ \ |_| | |_| |_| | |_| |\ V / __/ /__| (_| |\ V V /\__ \/ _ \ |_) | |_) | +// \____/\___/|_| |_|___/\__|_|\__|\__,_|\__|_| \_/ \___\____/\__,_| \_/\_/ |___/\_/ \_/ .__/| .__/ +// |_| |_| +// +// License: BSD License +// license: structural_mechanics_application/license.txt +// +// Main authors: Alejandro Cornejo +// +// + +// System includes + +// External includes + +// Project includes + +#include "generic_anisotropic_plane_stress_2d_law.h" +#include "custom_utilities/advanced_constitutive_law_utilities.h" + +namespace Kratos +{ + +/***********************************************************************************/ +/***********************************************************************************/ + +ConstitutiveLaw::Pointer GenericAnisotropicPlaneStress2DLaw::Create(Kratos::Parameters NewParameters) const +{ + return Kratos::make_shared(); +} + +/***********************************************************************************/ +/***********************************************************************************/ + +void GenericAnisotropicPlaneStress2DLaw::CalculateOrthotropicElasticMatrix( + BoundedMatrixVoigtType& rElasticityTensor, + const Properties& rMaterialProperties) +{ + AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMatrixPlaneStress(rElasticityTensor, rMaterialProperties); +} + +/***********************************************************************************/ +/***********************************************************************************/ + +} // namespace Kratos diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.h new file mode 100644 index 00000000000..c4179021127 --- /dev/null +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.h @@ -0,0 +1,216 @@ +// KRATOS ___ _ _ _ _ _ __ _ +// / __\___ _ __ ___| |_(_) |_ _ _| |_(_)_ _____ / / __ ___ _____ /_\ _ __ _ __ +// / / / _ \| '_ \/ __| __| | __| | | | __| \ \ / / _ \/ / / _` \ \ /\ / / __| //_\\| '_ \| '_ | +// / /__| (_) | | | \__ \ |_| | |_| |_| | |_| |\ V / __/ /__| (_| |\ V V /\__ \/ _ \ |_) | |_) | +// \____/\___/|_| |_|___/\__|_|\__|\__,_|\__|_| \_/ \___\____/\__,_| \_/\_/ |___/\_/ \_/ .__/| .__/ +// |_| |_| +// +// License: BSD License +// license: structural_mechanics_application/license.txt +// +// Main authors: Alejandro Cornejo +// +// + +#pragma once + +// System includes + +// External includes + +// Project includes +#include "generic_anisotropic_law.h" + +namespace Kratos +{ +///@name Kratos Globals +///@{ + +///@} +///@name Type Definitions +///@{ + + /// The size type definition +using SizeType = std::size_t; + +///@} +///@name Enum's +///@{ + +///@} +///@name Functions +///@{ + +///@} +///@name Kratos Classes +///@{ + +/* + * @class GenericAnisotropicLaw + * @ingroup ConstitutiveLawsApplication + * @brief This CL takes into account the material anisotropy in terms of young modulus, poisson ratio, orientation and strengths. 3D CLs and plane strain. + * @details See "Nonlinear behavior of existing pre-tensioned concrete beams: Experimental study and finite element modeling with the constitutive Serial-Parallel rule of mixtures", DOI: https://doi.org/10.1016/j.istruc.2024.106990 + * @author Alejandro Cornejo + */ +class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicPlaneStress2DLaw + : public GenericAnisotropicLaw<2> +{ +public: + ///@name Type Definitions + ///@{ + + using BaseType = GenericAnisotropicLaw<2>; + + /// Counted pointer of GenericAnisotropicLaw + KRATOS_CLASS_POINTER_DEFINITION(GenericAnisotropicPlaneStress2DLaw); + + ///@} + ///@name Life Cycle + ///@{ + + /** + * Constructor. + */ + GenericAnisotropicPlaneStress2DLaw() + { + } + + /** + * Clone. + */ + ConstitutiveLaw::Pointer Clone() const override + { + return Kratos::make_shared(*this); + } + + // Copy constructor + GenericAnisotropicPlaneStress2DLaw(GenericAnisotropicPlaneStress2DLaw const& rOther) + : BaseType(rOther) + { + } + + /** + * Destructor. + */ + ~GenericAnisotropicPlaneStress2DLaw() override + { + } + + /** + * creates a new constitutive law pointer + * @param NewParameters The configuration parameters of the new constitutive law + * @return a Pointer to the new constitutive law + */ + ConstitutiveLaw::Pointer Create(Kratos::Parameters NewParameters) const override; + + ///@} + ///@name Operators + ///@{ + + ///@} + ///@name Operations + ///@{ + + + /** + * @brief This method computes the orthotropic elastic constitutive matrix + * This method is overriden in the derived class for plane stress + */ + void CalculateOrthotropicElasticMatrix( + BoundedMatrixVoigtType &rElasticityTensor, + const Properties &rMaterialProperties) override; + + ///@} + ///@name Access + ///@{ + + ///@} + ///@name Inquiry + ///@{ + + ///@} + ///@name Input and output + ///@{ + + ///@} + ///@name Friends + ///@{ + + ///@} + +protected: + ///@name Protected static Member Variables + ///@{ + + ///@} + ///@name Protected member Variables + ///@{ + + ///@} + ///@name Protected Operators + ///@{ + + ///@} + ///@name Protected Operations + ///@{ + + ///@} + ///@name Protected Access + ///@{ + + ///@} + ///@name Protected Inquiry + ///@{ + + ///@} + ///@name Protected LifeCycle + ///@{ + + ///@} +private: + ///@name Static Member Variables + ///@{ + + ///@} + ///@name Member Variables + ///@{ + + ///@} + ///@name Private Operators + ///@{ + + ///@} + ///@name Private Operations + ///@{ + + ///@} + ///@name Private Access + ///@{ + + ///@} + ///@name Private Inquiry + ///@{ + + ///@} + ///@name Un accessible methods + ///@{ + + // Serialization + + friend class Serializer; + + void save(Serializer& rSerializer) const override + { + KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, BaseType) + } + + void load(Serializer& rSerializer) override + { + KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, BaseType) + } + + ///@} + +}; // Class GenericAnisotropicLaw + +} // namespace Kratos diff --git a/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp b/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp index d09a33b7702..f0764e9d813 100644 --- a/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp +++ b/applications/ConstitutiveLawsApplication/custom_python/add_custom_constitutive_laws_to_python.cpp @@ -104,6 +104,7 @@ #include "custom_constitutive/composites/rule_of_mixtures_law.h" #include "custom_constitutive/composites/traction_separation_law.h" #include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h" +#include "custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_plane_stress_2d_law.h" #include "custom_constitutive/small_strains/plastic_damage/associative_plastic_damage_model.h" @@ -1356,12 +1357,16 @@ void AddCustomConstitutiveLawsToPython(pybind11::module& m) (m,"SerialParallelRuleOfMixturesLaw").def(py::init<>()) ; + py::class_< GenericAnisotropicLaw<3>, typename GenericAnisotropicLaw<3>::Pointer, ConstitutiveLaw > + (m,"GenericAnisotropic3DLaw").def(py::init<>()) + ; + py::class_< GenericAnisotropicLaw<2>, typename GenericAnisotropicLaw<2>::Pointer, ConstitutiveLaw > (m,"GenericAnisotropicPlaneStrain2DLaw").def(py::init<>()) ; - py::class_< GenericAnisotropicLaw<3>, typename GenericAnisotropicLaw<3>::Pointer, ConstitutiveLaw > - (m,"GenericAnisotropic3DLaw").def(py::init<>()) + py::class_< GenericAnisotropicPlaneStress2DLaw, typename GenericAnisotropicPlaneStress2DLaw::Pointer, ConstitutiveLaw > + (m,"GenericAnisotropicPlaneStress2DLaw").def(py::init<>()) ; py::class_< AssociativePlasticDamageModel >>, From 67c899f8ae5c1ea21c33e8f1d776aed6530c0085 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 17:25:54 +0100 Subject: [PATCH 27/39] correct check --- .../anisotropy_orthotropy/generic_anisotropic_law.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp index c1b17b01167..72ef19b258d 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp @@ -577,7 +577,7 @@ int GenericAnisotropicLaw::Check( KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ISOTROPIC_ANISOTROPIC_YIELD_RATIO)) << "ISOTROPIC_ANISOTROPIC_YIELD_RATIO not defined in properties" << std::endl; KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ORTHOTROPIC_ELASTIC_CONSTANTS)) << "The ORTHOTROPIC_ELASTIC_CONSTANTS are not defined" << std::endl; - KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == VoigtSize) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; + KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == 6) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; return mpIsotropicCL->Check(r_props_iso_cl, rElementGeometry, rCurrentProcessInfo); } From 3377c3622d6b7d026fa2a5c7beb15a932e987252 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 17:43:54 +0100 Subject: [PATCH 28/39] minor mistake --- .../custom_utilities/advanced_constitutive_law_utilities.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp index 52f4cdabeb1..7f13d7309d5 100644 --- a/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp +++ b/applications/ConstitutiveLawsApplication/custom_utilities/advanced_constitutive_law_utilities.cpp @@ -939,7 +939,7 @@ void AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMa const double factor = a * d - b * c; - const double G12 = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + v21) * E1 + (1.0 + v12) / E2); + const double G12 = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + v21) / E1 + (1.0 + v12) / E2); rElasticityTensor(0, 0) = a * E1; rElasticityTensor(0, 1) = b * E1; @@ -975,7 +975,7 @@ void AdvancedConstitutiveLawUtilities::CalculateOrthotropicElasticMa const double factor = 1.0 - v12 * v21; - const double G12 = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + v21) * E1 + (1.0 + v12) / E2); + const double G12 = (rMaterialProperties.Has(SHEAR_MODULUS_XY)) ? rMaterialProperties[SHEAR_MODULUS_XY] : 1.0 / ((1.0 + v21) / E1 + (1.0 + v12) / E2); rElasticityTensor(0, 0) = E1; rElasticityTensor(0, 1) = v21 * E1; From e23e84c5a8ec5a8b6e4c6180ed70386dd01b46cb Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 18:29:33 +0100 Subject: [PATCH 29/39] simpler solution --- .../generic_anisotropic_law.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp index 72ef19b258d..df519cdd903 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp @@ -485,21 +485,11 @@ void GenericAnisotropicLaw::CalculateAnisotropicStressMapperMatrix( rAs.clear(); rAsInv.clear(); const Vector &r_iso_aniso_yield_ratios = rProperties[ISOTROPIC_ANISOTROPIC_YIELD_RATIO]; - if constexpr (VoigtSize == 6) { - rAs(0, 0) = r_iso_aniso_yield_ratios[0]; - rAs(1, 1) = r_iso_aniso_yield_ratios[1]; - rAs(2, 2) = r_iso_aniso_yield_ratios[2]; - rAs(3, 3) = r_iso_aniso_yield_ratios[3]; - rAs(4, 4) = r_iso_aniso_yield_ratios[4]; - rAs(5, 5) = r_iso_aniso_yield_ratios[5]; - } else { - rAs(0, 0) = r_iso_aniso_yield_ratios[0]; - rAs(1, 1) = r_iso_aniso_yield_ratios[1]; - rAs(2, 2) = r_iso_aniso_yield_ratios[2]; - } - for (IndexType i = 0; i < VoigtSize; ++i) + for (IndexType i = 0; i < VoigtSize; ++i) { + rAs(i, i) = r_iso_aniso_yield_ratios[i]; rAsInv(i, i) = 1.0 / rAs(i, i); + } } /***********************************************************************************/ From 0f8c1a60a9519044898f69a90965d2463cdf6932 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 18:31:33 +0100 Subject: [PATCH 30/39] Always use the same input in 2D an in 3D --- .../generic_anisotropic_law.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp index df519cdd903..8f2a75951cc 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp @@ -484,10 +484,22 @@ void GenericAnisotropicLaw::CalculateAnisotropicStressMapperMatrix( { rAs.clear(); rAsInv.clear(); + // We use the same input in 2D and in 3D const Vector &r_iso_aniso_yield_ratios = rProperties[ISOTROPIC_ANISOTROPIC_YIELD_RATIO]; + if constexpr (VoigtSize == 6) { + rAs(0, 0) = r_iso_aniso_yield_ratios[0]; // xx + rAs(1, 1) = r_iso_aniso_yield_ratios[1]; // yy + rAs(2, 2) = r_iso_aniso_yield_ratios[2]; // zz + rAs(3, 3) = r_iso_aniso_yield_ratios[3]; // xy + rAs(4, 4) = r_iso_aniso_yield_ratios[4]; // yz + rAs(5, 5) = r_iso_aniso_yield_ratios[5]; // xz + } else { + rAs(0, 0) = r_iso_aniso_yield_ratios[0]; // xx + rAs(1, 1) = r_iso_aniso_yield_ratios[1]; // yy + rAs(2, 2) = r_iso_aniso_yield_ratios[3]; // xy + } for (IndexType i = 0; i < VoigtSize; ++i) { - rAs(i, i) = r_iso_aniso_yield_ratios[i]; rAsInv(i, i) = 1.0 / rAs(i, i); } } From a47debfb3211a6b9cc2e661ee649213a4d0734be Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 18:40:03 +0100 Subject: [PATCH 31/39] remove unused method --- .../generic_anisotropic_law.cpp | 28 ++----------------- .../generic_anisotropic_law.h | 15 ++++------ 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp index 8f2a75951cc..e37bfed64d6 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.cpp @@ -9,7 +9,7 @@ // license: structural_mechanics_application/license.txt // // Main authors: Alejandro Cornejo -// Collaborator: Lucia Barbu +// // // System includes @@ -572,43 +572,19 @@ int GenericAnisotropicLaw::Check( const auto it_cl_begin = rMaterialProperties.GetSubProperties().begin(); const auto& r_props_iso_cl = *(it_cl_begin); - // We check now the dimension of the CL pointer, must be 3D + // We check now the dimension of the CL pointer and th dimension of the anisotropic one KRATOS_ERROR_IF_NOT(mpIsotropicCL->GetStrainSize() == VoigtSize) << "The slave CL has a different dimension of the Generic Anisotropic CL..." << std::endl; // Let's check variables KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ISOTROPIC_ANISOTROPIC_YIELD_RATIO)) << "ISOTROPIC_ANISOTROPIC_YIELD_RATIO not defined in properties" << std::endl; - KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(ORTHOTROPIC_ELASTIC_CONSTANTS)) << "The ORTHOTROPIC_ELASTIC_CONSTANTS are not defined" << std::endl; KRATOS_ERROR_IF_NOT(rMaterialProperties[ORTHOTROPIC_ELASTIC_CONSTANTS].size() == 6) << "The dimension of the ORTHOTROPIC_ELASTIC_CONSTANTS is incorrect" << std::endl; - return mpIsotropicCL->Check(r_props_iso_cl, rElementGeometry, rCurrentProcessInfo); } /***********************************************************************************/ /***********************************************************************************/ -template -void GenericAnisotropicLaw::CalculateTangentTensor(ConstitutiveLaw::Parameters& rValues) -{ - const Properties& r_material_properties = rValues.GetMaterialProperties(); - - const bool consider_perturbation_threshold = r_material_properties.Has(CONSIDER_PERTURBATION_THRESHOLD) ? r_material_properties[CONSIDER_PERTURBATION_THRESHOLD] : true; - const TangentOperatorEstimation tangent_operator_estimation = r_material_properties.Has(TANGENT_OPERATOR_ESTIMATION) ? static_cast(r_material_properties[TANGENT_OPERATOR_ESTIMATION]) : TangentOperatorEstimation::SecondOrderPerturbation; - - if (tangent_operator_estimation == TangentOperatorEstimation::Analytic) { - KRATOS_ERROR << "Analytic solution not available" << std::endl; - } else if (tangent_operator_estimation == TangentOperatorEstimation::FirstOrderPerturbation) { - // Calculates the Tangent Constitutive Tensor by perturbation (first order) - TangentOperatorCalculatorUtility::CalculateTangentTensor(rValues, this, ConstitutiveLaw::StressMeasure_PK2, consider_perturbation_threshold, 1); - } else if (tangent_operator_estimation == TangentOperatorEstimation::SecondOrderPerturbation) { - // Calculates the Tangent Constitutive Tensor by perturbation (second order) - TangentOperatorCalculatorUtility::CalculateTangentTensor(rValues, this, ConstitutiveLaw::StressMeasure_PK2, consider_perturbation_threshold, 2); - } -} - -/***********************************************************************************/ -/***********************************************************************************/ - template class GenericAnisotropicLaw<2>; template class GenericAnisotropicLaw<3>; diff --git a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h index 0e66fe0e6f1..c799be9bbd3 100644 --- a/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h +++ b/applications/ConstitutiveLawsApplication/custom_constitutive/small_strains/anisotropy_orthotropy/generic_anisotropic_law.h @@ -9,7 +9,7 @@ // license: structural_mechanics_application/license.txt // // Main authors: Alejandro Cornejo -// Collaborator: Lucia Barbu +// // #pragma once @@ -365,15 +365,10 @@ class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericAnisotropicLaw /** * @brief This method checks the properties in the nested CL */ - int Check(const Properties &rMaterialProperties, - const GeometryType &rElementGeometry, - const ProcessInfo &rCurrentProcessInfo) const override; - - /** - * @brief This method computes an estimation of the tangent constitutive matrix, which relates the - * stress increment with the strain increment. - */ - void CalculateTangentTensor(ConstitutiveLaw::Parameters &rValues); + int Check( + const Properties &rMaterialProperties, + const GeometryType &rElementGeometry, + const ProcessInfo &rCurrentProcessInfo) const override; ///@} ///@name Access From 2b76e0131cd9d2505df914abf29a4fdfb781e002 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 18:57:41 +0100 Subject: [PATCH 32/39] updating old test: was FAKE! --- .../anisotropy_test_materials.json | 2 +- .../anisotropy_test_parameters.json | 52 +-- .../anisotropy_test_results.json | 386 +++++++++--------- 3 files changed, 211 insertions(+), 229 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_materials.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_materials.json index d1a26c55af6..16b26e15bb5 100644 --- a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_materials.json +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_materials.json @@ -24,7 +24,7 @@ "YOUNG_MODULUS" : 40E9, "POISSON_RATIO" : 0.3, "YIELD_STRESS" : 0.8e7, - "FRACTURE_ENERGY" : 100000, + "FRACTURE_ENERGY" : 10000, "SOFTENING_TYPE" : 1 }, "Tables" : {} diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json index b7a61ce7071..479bb597368 100644 --- a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json @@ -1,6 +1,6 @@ { "problem_data" : { - "problem_name" : "serial_parallel_test", + "problem_name" : "anisotropy_test", "parallel_type" : "OpenMP", "start_time" : 0.0, "end_time" : 30.0, @@ -14,13 +14,13 @@ "analysis_type" : "non_linear", "model_import_settings" : { "input_type" : "mdpa", - "input_filename" : "SerialParallelRuleOfMixturesCube/serial_parallel_damage_test" + "input_filename" : "AnisotropyCube/anisotropy_test" }, "material_import_settings" : { - "materials_filename" : "SerialParallelRuleOfMixturesCube/serial_parallel_damage_test_materials.json" + "materials_filename" : "AnisotropyCube/anisotropy_test_materials.json" }, "time_stepping" : { - "time_step" : 1.1 + "time_step" : 1.0 }, "line_search" : false, "convergence_criterion" : "residual_criterion", @@ -29,10 +29,7 @@ "residual_relative_tolerance" : 0.0001, "residual_absolute_tolerance" : 1e-9, "max_iteration" : 10, - "rotation_dofs" : false, - "linear_solver_settings":{ - "solver_type": "amgcl" - } + "rotation_dofs" : false }, "processes" : { "constraints_process_list" : [{ @@ -52,7 +49,7 @@ "model_part_name" : "Structure.DISPLACEMENT_Displacement_Auto2", "variable_name" : "DISPLACEMENT", "constrained" : [false,false,true], - "value" : [null,null,"0.00001*t"], + "value" : [null,null,"0.0001*t"], "interval" : [0.0,"End"] } }], @@ -70,8 +67,7 @@ "model_part_name" : "Structure.Parts_Parts_Auto1", "time_frequency" : 0.2 } - } - ] + }] }, "_json_output_process" : [ { @@ -85,37 +81,5 @@ "model_part_name" : "Structure.Parts_Parts_Auto1", "time_frequency" : 0.2 } - } - ] - //"_output_processes" : { - // "gid_output" : [{ - // "python_module" : "gid_output_process", - // "kratos_module" : "KratosMultiphysics", - // "process_name" : "GiDOutputProcess", - // "help" : "This process writes postprocessing files for GiD", - // "Parameters" : { - // "model_part_name" : "Structure.computing_domain", - // "output_name" : "small_deformation_plasticity_test", - // "postprocess_parameters" : { - // "result_file_configuration" : { - // "gidpost_flags" : { - // "GiDPostMode" : "GiD_PostBinary", - // "WriteDeformedMeshFlag" : "WriteDeformed", - // "MultiFileFlag" : "SingleFile" - // }, - // "file_label" : "step", - // "output_control_type" : "step", - // "output_frequency" : 1, - // "body_output" : true, - // "node_output" : false, - // "skin_output" : false, - // "plane_output" : [], - // "nodal_results" : ["DISPLACEMENT"], - // "gauss_point_results" : ["GREEN_LAGRANGE_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR","UNIAXIAL_STRESS","DAMAGE"] - // }, - // "point_data_configuration" : [] - // } - // } - // }] - //} + }] } diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json index e15fe860461..73aeb36188f 100644 --- a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json @@ -1,33 +1,35 @@ { "TIME": [ - 1.1, - 2.2, - 3.3000000000000003, - 4.4, - 5.5, - 6.6, - 7.699999999999999, - 8.799999999999999, - 9.899999999999999, - 10.999999999999998, - 12.099999999999998, - 13.199999999999998, - 14.299999999999997, - 15.399999999999997, - 16.499999999999996, - 17.599999999999998, - 18.7, - 19.8, - 20.900000000000002, - 22.000000000000004, - 23.100000000000005, - 24.200000000000006, - 25.300000000000008, - 26.40000000000001, - 27.50000000000001, - 28.600000000000012, - 29.700000000000014, - 30.800000000000015 + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, + 6.0, + 7.0, + 8.0, + 9.0, + 10.0, + 11.0, + 12.0, + 13.0, + 14.0, + 15.0, + 16.0, + 17.0, + 18.0, + 19.0, + 20.0, + 21.0, + 22.0, + 23.0, + 24.0, + 25.0, + 26.0, + 27.0, + 28.0, + 29.0, + 30.0 ], "ELEMENT_1": { "DAMAGE": { @@ -44,22 +46,24 @@ 0.0, 0.0, 0.0, - 0.0, - 0.0, - 0.0, - 0.08497382961154254, - 0.2003498542211647, - 0.3039640565567405, - 0.3976610905437068, - 0.48279089512707996, - 0.560235016951109, - 0.6304079380140246, - 0.6932616463370467, - 0.7483870552707599, - 0.7953157307175527, - 0.833959370553301, - 0.8649135422342809, - 0.8892892417657103 + 0.03054266236607206, + 0.09989023013277876, + 0.15999168705084055, + 0.21258045312550766, + 0.2589822985753525, + 0.3002283771269102, + 0.33713275715816715, + 0.3703466932453926, + 0.400397391444107, + 0.4277162021716665, + 0.45265945840296684, + 0.47552410430756387, + 0.496559573009828, + 0.5159769233260516, + 0.5339559461151646, + 0.5506507478401043, + 0.5661941789098381, + 0.5807013763533321 ], "1": [ 0.0, @@ -69,27 +73,29 @@ 0.0, 0.0, 0.0, - 0.0, - 0.16392470688197802, - 0.30788062941775296, - 0.4185605748734288, - 0.505759400044122, - 0.5758025924785972, - 0.6329739791868596, - 0.6802664627169739, - 0.7209233176829885, - 0.7559261956265719, - 0.785934950793872, - 0.8118733214707485, - 0.8344645616732929, - 0.8542769695014911, - 0.8717544903822655, - 0.8872335650067829, - 0.9009532051795921, - 0.9130713448318001, - 0.9236990068846305, - 0.9329465515256958, - 0.9409453295939485 + 0.09398725566618493, + 0.1978220851258894, + 0.2809649841296237, + 0.35026695679909814, + 0.4076301792688717, + 0.45488541925021875, + 0.49392318426535686, + 0.5277558583713448, + 0.5573594250217027, + 0.5834801991873723, + 0.6066986474340126, + 0.6274730324718596, + 0.6461699642483663, + 0.663086222108585, + 0.6784646254305134, + 0.6925057640794074, + 0.7053767962395486, + 0.7172181347610187, + 0.7281485905000781, + 0.7382693726929195, + 0.7476672321051541, + 0.7564169538736628, + 0.7645833517794748 ], "2": [ 0.0, @@ -99,27 +105,29 @@ 0.0, 0.0, 0.0, - 0.0, - 0.1639247068819779, - 0.30788062941775285, - 0.4185605748734288, - 0.505759400044122, - 0.5758025924785969, - 0.6329739791868598, - 0.6802664627169739, - 0.7209233176829885, - 0.7559261956265716, - 0.7859349507938717, - 0.8118733214707486, - 0.8344645616732929, - 0.8542769695014911, - 0.8717544903822655, - 0.8872335650067829, - 0.9009532051795919, - 0.9130713448318001, - 0.9236990068846305, - 0.9329465515256958, - 0.9409453295939486 + 0.09398725566618726, + 0.19782208512588906, + 0.280964984129627, + 0.3502669567990887, + 0.40763017926885614, + 0.45488541925022496, + 0.4939231842653595, + 0.5277558583713434, + 0.5573594250217011, + 0.5834801991873808, + 0.6066986474340046, + 0.6274730324718605, + 0.6461699642483681, + 0.6630862221085856, + 0.6784646254305152, + 0.6925057640794062, + 0.7053767962395439, + 0.7172181347610178, + 0.7281485905000794, + 0.7382693726929186, + 0.7476672321051555, + 0.7564169538736615, + 0.7645833517794716 ], "3": [ 0.0, @@ -134,22 +142,24 @@ 0.0, 0.0, 0.0, - 0.0, - 0.0, - 0.0, - 0.08497382961154287, - 0.20034985422116391, - 0.3039640565567382, - 0.397661090543708, - 0.48279089512707996, - 0.560235016951109, - 0.6304079380140246, - 0.6932616463370462, - 0.74838705527076, - 0.7953157307175528, - 0.8339593705533013, - 0.8649135422342809, - 0.8892892417657103 + 0.030542662366076834, + 0.09989023013278253, + 0.1599916870508422, + 0.21258045312550278, + 0.2589822985753558, + 0.30022837712691475, + 0.3371327571581654, + 0.3703466932453928, + 0.400397391444102, + 0.4277162021716616, + 0.45265945840296784, + 0.475524104307564, + 0.4965595730098249, + 0.515976923326052, + 0.5339559461151708, + 0.5506507478401028, + 0.5661941789098388, + 0.5807013763533322 ], "4": [ 0.0, @@ -161,25 +171,27 @@ 0.0, 0.0, 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0849738296115422, - 0.20034985422115237, - 0.30396405655673353, - 0.397661090543707, - 0.48279089512708084, - 0.5602350169511087, - 0.630407938014024, - 0.6932616463370407, - 0.7483870552707579, - 0.7953157307175552, - 0.8339593705532944, - 0.864913542234285, - 0.8892892417657093 + 0.02405583697056013, + 0.1227415769212018, + 0.20386976680614743, + 0.26921212565003694, + 0.3215154753078101, + 0.3668449449397174, + 0.40650820293074585, + 0.44150517361184416, + 0.47261357434204565, + 0.500447391605554, + 0.5254978140490356, + 0.5481624702443199, + 0.568766692449556, + 0.5875792332644888, + 0.604824053099839, + 0.6206892786408722, + 0.6353340939651582, + 0.6488941002957074, + 0.6614855272323621, + 0.6732085726918995, + 0.6841500748586252 ], "5": [ 0.0, @@ -188,28 +200,30 @@ 0.0, 0.0, 0.0, - 0.0, - 0.0, - 0.1639247068819787, - 0.3078806294177534, - 0.4185605748734288, - 0.505759400044122, - 0.5758025924785972, - 0.6329739791868598, - 0.6802664627169768, - 0.7209233176829886, - 0.7559261956265712, - 0.7859349507938715, - 0.8118733214707486, - 0.834464561673293, - 0.8542769695014911, - 0.8717544903822655, - 0.8872335650067824, - 0.9009532051795919, - 0.9130713448318004, - 0.9236990068846298, - 0.9329465515256964, - 0.9409453295939484 + 0.13681170265013665, + 0.24906602020725577, + 0.3356980020757008, + 0.4047681680915376, + 0.46179068615003704, + 0.5091940683627034, + 0.5483659189409148, + 0.5807267522554853, + 0.6087726746888605, + 0.6333128280619473, + 0.6549658796429684, + 0.6742130144889269, + 0.6914341151518801, + 0.7069330874187227, + 0.7209559500902281, + 0.7337039911618549, + 0.7453434919431234, + 0.756013020137959, + 0.7658289725798197, + 0.774889838870199, + 0.7832795175392597, + 0.7910699215988796, + 0.7983230450146053, + 0.8050926158823195 ], "6": [ 0.0, @@ -218,28 +232,30 @@ 0.0, 0.0, 0.0, - 0.0, - 0.0, - 0.1639247068819787, - 0.3078806294177534, - 0.4185605748734288, - 0.505759400044122, - 0.5758025924785972, - 0.6329739791868598, - 0.6802664627169765, - 0.7209233176829886, - 0.7559261956265719, - 0.7859349507938715, - 0.8118733214707488, - 0.834464561673293, - 0.8542769695014912, - 0.8717544903822656, - 0.8872335650067824, - 0.9009532051795918, - 0.9130713448318004, - 0.9236990068846299, - 0.9329465515256963, - 0.9409453295939485 + 0.13681170265013776, + 0.24906602020726032, + 0.33569800207569966, + 0.40476816809154514, + 0.4617906861500186, + 0.5091940683626731, + 0.5483659189409249, + 0.5807267522554889, + 0.6087726746888578, + 0.6333128280619462, + 0.6549658796429833, + 0.6742130144889114, + 0.6914341151518824, + 0.7069330874187264, + 0.7209559500902308, + 0.7337039911618598, + 0.745343491943121, + 0.7560130201379502, + 0.765828972579819, + 0.7748898388702014, + 0.7832795175392562, + 0.7910699215988828, + 0.7983230450146028, + 0.8050926158823137 ], "7": [ 0.0, @@ -251,25 +267,27 @@ 0.0, 0.0, 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.08497382961154343, - 0.2003498542211618, - 0.3039640565567351, - 0.39766109054370813, - 0.48279089512708095, - 0.5602350169511094, - 0.6304079380140242, - 0.6932616463370409, - 0.7483870552707579, - 0.7953157307175557, - 0.8339593705532946, - 0.8649135422342851, - 0.8892892417657094 + 0.024055836970571676, + 0.12274157692117338, + 0.20386976680610014, + 0.2692121256500548, + 0.32151547530781754, + 0.3668449449397141, + 0.4065082029307425, + 0.44150517361186903, + 0.47261357434202267, + 0.5004473916055568, + 0.5254978140490415, + 0.5481624702443222, + 0.5687666924495621, + 0.5875792332644852, + 0.6048240530998252, + 0.6206892786408699, + 0.6353340939651619, + 0.6488941002957039, + 0.6614855272323665, + 0.6732085726918959, + 0.6841500748586162 ] } } From ac3c43907c58e7d16bcf4ad8a3da65710a8fd7c4 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 19:12:29 +0100 Subject: [PATCH 33/39] 3d ok --- .../anisotropy_test_parameters.json | 30 +- .../anisotropy_test_results.json | 476 +++++++++--------- 2 files changed, 253 insertions(+), 253 deletions(-) diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json index 479bb597368..f65d1aa0f82 100644 --- a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_parameters.json @@ -49,7 +49,7 @@ "model_part_name" : "Structure.DISPLACEMENT_Displacement_Auto2", "variable_name" : "DISPLACEMENT", "constrained" : [false,false,true], - "value" : [null,null,"0.0001*t"], + "value" : [null,null,"0.00001*t"], "interval" : [0.0,"End"] } }], @@ -68,18 +68,18 @@ "time_frequency" : 0.2 } }] - }, - "_json_output_process" : [ - { - "python_module" : "json_output_process", - "kratos_module" : "KratosMultiphysics", - "help" : "", - "process_name" : "JsonOutputProcess", - "Parameters" : { - "gauss_points_output_variables" : ["DAMAGE"], - "output_file_name" : "AnisotropyCube/anisotropy_test_results.json", - "model_part_name" : "Structure.Parts_Parts_Auto1", - "time_frequency" : 0.2 - } - }] + } + //"_json_output_process" : [ + //{ + // "python_module" : "json_output_process", + // "kratos_module" : "KratosMultiphysics", + // "help" : "", + // "process_name" : "JsonOutputProcess", + // "Parameters" : { + // "gauss_points_output_variables" : ["DAMAGE"], + // "output_file_name" : "AnisotropyCube/anisotropy_test_results.json", + // "model_part_name" : "Structure.Parts_Parts_Auto1", + // "time_frequency" : 0.2 + // } + //}] } diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json index 73aeb36188f..5e2822fc663 100644 --- a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_test_results.json @@ -35,259 +35,259 @@ "DAMAGE": { "0": [ 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.03054266236607206, - 0.09989023013277876, - 0.15999168705084055, - 0.21258045312550766, - 0.2589822985753525, - 0.3002283771269102, - 0.33713275715816715, - 0.3703466932453926, - 0.400397391444107, - 0.4277162021716665, - 0.45265945840296684, - 0.47552410430756387, - 0.496559573009828, - 0.5159769233260516, - 0.5339559461151646, - 0.5506507478401043, - 0.5661941789098381, - 0.5807013763533321 + 0.3703463501054223, + 0.5807013125792653, + 0.6858783470322534, + 0.7489842351424558, + 0.7910522188354059, + 0.8211039098387255, + 0.8436417399781939, + 0.8611707624620276, + 0.8751937499736083, + 0.8866669373576644, + 0.8962277903431974, + 0.9043176228821856, + 0.9112516560508597, + 0.9172610507226795, + 0.9225191770451143, + 0.9271586119806348, + 0.9312824708593755, + 0.9349721604881396, + 0.9382928063018301, + 0.9412971288891722, + 0.944028263279271, + 0.9465218427600096, + 0.9488075617409981, + 0.9509103635289516, + 0.9528513540010051, + 0.9546485122394448, + 0.9563172488876821, + 0.9578708489842317, + 0.9593208262300325 ], "1": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.09398725566618493, - 0.1978220851258894, - 0.2809649841296237, - 0.35026695679909814, - 0.4076301792688717, - 0.45488541925021875, - 0.49392318426535686, - 0.5277558583713448, - 0.5573594250217027, - 0.5834801991873723, - 0.6066986474340126, - 0.6274730324718596, - 0.6461699642483663, - 0.663086222108585, - 0.6784646254305134, - 0.6925057640794074, - 0.7053767962395486, - 0.7172181347610187, - 0.7281485905000781, - 0.7382693726929195, - 0.7476672321051541, - 0.7564169538736628, - 0.7645833517794748 + 0.28096466663773545, + 0.6461697955446122, + 0.7645833477467442, + 0.8237893638694037, + 0.8593124305315241, + 0.8829933101124907, + 0.8999087306387259, + 0.9125948376118134, + 0.9224614629709466, + 0.9303544740412512, + 0.9368121389761599, + 0.9421932989169386, + 0.9467463805154822, + 0.9506488305382936, + 0.9540307762018362, + 0.9569898127051153, + 0.9596005715553703, + 0.9619210994151607, + 0.9639972225589095, + 0.9658656019829832, + 0.9675559156224085, + 0.9690924454147459, + 0.9704952503457945, + 0.9717810462328633, + 0.9729638743596116, + 0.9740556158101339, + 0.9750663915063913, + 0.976004876523188, + 0.976878549372391, + 0.9776938914302293 ], "2": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.09398725566618726, - 0.19782208512588906, - 0.280964984129627, - 0.3502669567990887, - 0.40763017926885614, - 0.45488541925022496, - 0.4939231842653595, - 0.5277558583713434, - 0.5573594250217011, - 0.5834801991873808, - 0.6066986474340046, - 0.6274730324718605, - 0.6461699642483681, - 0.6630862221085856, - 0.6784646254305152, - 0.6925057640794062, - 0.7053767962395439, - 0.7172181347610178, - 0.7281485905000794, - 0.7382693726929186, - 0.7476672321051555, - 0.7564169538736615, - 0.7645833517794716 + 0.28096466663765507, + 0.6461697955446102, + 0.7645833477467434, + 0.8237893638694036, + 0.8593124305315243, + 0.8829933101124925, + 0.8999087306387427, + 0.9125948376118451, + 0.9224614629709328, + 0.930354474041226, + 0.9368121389761346, + 0.9421932989169584, + 0.9467463805154325, + 0.9506488305382823, + 0.9540307762018411, + 0.9569898127051368, + 0.9596005715553669, + 0.9619210994151774, + 0.9639972225589133, + 0.9658656019829828, + 0.9675559156224057, + 0.9690924454147554, + 0.970495250345792, + 0.9717810462328581, + 0.9729638743596071, + 0.9740556158101321, + 0.9750663915063912, + 0.9760048765231919, + 0.9768785493723953, + 0.9776938914302269 ], "3": [ 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.030542662366076834, - 0.09989023013278253, - 0.1599916870508422, - 0.21258045312550278, - 0.2589822985753558, - 0.30022837712691475, - 0.3371327571581654, - 0.3703466932453928, - 0.400397391444102, - 0.4277162021716616, - 0.45265945840296784, - 0.475524104307564, - 0.4965595730098249, - 0.515976923326052, - 0.5339559461151708, - 0.5506507478401028, - 0.5661941789098388, - 0.5807013763533322 + 0.3703463501054062, + 0.5807013125792628, + 0.6858783470322531, + 0.7489842351424568, + 0.7910522188353757, + 0.8211039098386895, + 0.8436417399781879, + 0.8611707624620546, + 0.8751937499736238, + 0.8866669373576412, + 0.8962277903431932, + 0.9043176228821873, + 0.9112516560508628, + 0.9172610507226696, + 0.9225191770451073, + 0.9271586119806452, + 0.9312824708593627, + 0.9349721604881244, + 0.9382928063018365, + 0.9412971288891819, + 0.944028263279261, + 0.9465218427600074, + 0.9488075617410008, + 0.9509103635289591, + 0.9528513540010007, + 0.9546485122394496, + 0.95631724888768, + 0.9578708489842344, + 0.9593208262300356 ], "4": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.02405583697056013, - 0.1227415769212018, - 0.20386976680614743, - 0.26921212565003694, - 0.3215154753078101, - 0.3668449449397174, - 0.40650820293074585, - 0.44150517361184416, - 0.47261357434204565, - 0.500447391605554, - 0.5254978140490356, - 0.5481624702443199, - 0.568766692449556, - 0.5875792332644888, - 0.604824053099839, - 0.6206892786408722, - 0.6353340939651582, - 0.6488941002957074, - 0.6614855272323621, - 0.6732085726918995, - 0.6841500748586252 + 0.024054436534102108, + 0.5254973515759862, + 0.6841500630324189, + 0.7634756832675195, + 0.8110706404537296, + 0.8427984728191676, + 0.8654631718842709, + 0.8824611255220076, + 0.8956814065885437, + 0.9062573746898921, + 0.9149102299112031, + 0.9221207612732518, + 0.9282218180568983, + 0.9334511476249779, + 0.9379830970117622, + 0.9419484259627495, + 0.9454471269393688, + 0.9485569716960255, + 0.9513393588935537, + 0.9538434074047839, + 0.9561088800924714, + 0.9581683101861961, + 0.9600485729485582, + 0.9617720644222978, + 0.9633575972770746, + 0.9648210899213379, + 0.9661761024777809, + 0.967434257906534, + 0.9686055759992707, + 0.9696987405742831 ], "5": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.13681170265013665, - 0.24906602020725577, - 0.3356980020757008, - 0.4047681680915376, - 0.46179068615003704, - 0.5091940683627034, - 0.5483659189409148, - 0.5807267522554853, - 0.6087726746888605, - 0.6333128280619473, - 0.6549658796429684, - 0.6742130144889269, - 0.6914341151518801, - 0.7069330874187227, - 0.7209559500902281, - 0.7337039911618549, - 0.7453434919431234, - 0.756013020137959, - 0.7658289725798197, - 0.774889838870199, - 0.7832795175392597, - 0.7910699215988796, - 0.7983230450146053, - 0.8050926158823195 + 0.40477112944938876, + 0.7069329499470747, + 0.8050926270061836, + 0.8541715561565126, + 0.8836182669388262, + 0.9032485416166576, + 0.9172700017229616, + 0.9277857261256732, + 0.9359642611449026, + 0.9425067598534744, + 0.9478594155084898, + 0.9523196909167985, + 0.9560935216684462, + 0.959328004335143, + 0.9621310095210563, + 0.9645834400320652, + 0.9667471626229583, + 0.9686702958174428, + 0.9703908278823334, + 0.9719391494033877, + 0.973339862264779, + 0.9746130952680514, + 0.9757754765447438, + 0.9768408628647136, + 0.9778208939100611, + 0.978725418639132, + 0.9795628269027461, + 0.9803403099995769, + 0.9810640673234562, + 0.9817394716810717 ], "6": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.13681170265013776, - 0.24906602020726032, - 0.33569800207569966, - 0.40476816809154514, - 0.4617906861500186, - 0.5091940683626731, - 0.5483659189409249, - 0.5807267522554889, - 0.6087726746888578, - 0.6333128280619462, - 0.6549658796429833, - 0.6742130144889114, - 0.6914341151518824, - 0.7069330874187264, - 0.7209559500902308, - 0.7337039911618598, - 0.745343491943121, - 0.7560130201379502, - 0.765828972579819, - 0.7748898388702014, - 0.7832795175392562, - 0.7910699215988828, - 0.7983230450146028, - 0.8050926158823137 + 0.40477112944917737, + 0.7069329499470757, + 0.8050926270061831, + 0.8541715561565125, + 0.8836182669388264, + 0.9032485416166693, + 0.9172700017230032, + 0.9277857261257343, + 0.935964261144869, + 0.9425067598534228, + 0.9478594155084494, + 0.9523196909168363, + 0.9560935216683533, + 0.959328004335121, + 0.9621310095210682, + 0.9645834400321074, + 0.9667471626229492, + 0.9686702958174777, + 0.9703908278823449, + 0.9719391494033851, + 0.973339862264771, + 0.9746130952680718, + 0.9757754765447398, + 0.9768408628647031, + 0.9778208939100506, + 0.97872541863913, + 0.9795628269027443, + 0.9803403099995845, + 0.9810640673234634, + 0.9817394716810665 ], "7": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.024055836970571676, - 0.12274157692117338, - 0.20386976680610014, - 0.2692121256500548, - 0.32151547530781754, - 0.3668449449397141, - 0.4065082029307425, - 0.44150517361186903, - 0.47261357434202267, - 0.5004473916055568, - 0.5254978140490415, - 0.5481624702443222, - 0.5687666924495621, - 0.5875792332644852, - 0.6048240530998252, - 0.6206892786408699, - 0.6353340939651619, - 0.6488941002957039, - 0.6614855272323665, - 0.6732085726918959, - 0.6841500748586162 + 0.024054436533822998, + 0.5254973515759825, + 0.6841500630324172, + 0.7634756832675194, + 0.8110706404537303, + 0.8427984728191757, + 0.8654631718843245, + 0.8824611255221018, + 0.8956814065885, + 0.906257374689816, + 0.914910229911131, + 0.92212076127331, + 0.9282218180567519, + 0.9334511476249442, + 0.9379830970117775, + 0.9419484259628138, + 0.9454471269393578, + 0.948556971696076, + 0.9513393588935665, + 0.953843407404782, + 0.9561088800924622, + 0.9581683101862247, + 0.9600485729485511, + 0.9617720644222821, + 0.9633575972770604, + 0.9648210899213332, + 0.9661761024777797, + 0.9674342579065456, + 0.968605575999283, + 0.9696987405742757 ] } } From 1966dfa64bf480da04b69cc3044ba918c2cc7c21 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 2 Jan 2025 19:55:53 +0100 Subject: [PATCH 34/39] adding 2d test --- .../AnisotropyCube/anisotropy_2d_test.mdpa | 65 +++++++++++ .../anisotropy_2d_test_materials.json | 32 ++++++ .../anisotropy_2d_test_parameters.json | 93 ++++++++++++++++ .../anisotropy_2d_test_results.json | 104 ++++++++++++++++++ .../tests/test_ConstitutiveLawsApplication.py | 2 + .../tests/test_factory.py | 3 + 6 files changed, 299 insertions(+) create mode 100644 applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test.mdpa create mode 100644 applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_materials.json create mode 100644 applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_parameters.json create mode 100644 applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_results.json diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test.mdpa b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test.mdpa new file mode 100644 index 00000000000..71377086af2 --- /dev/null +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test.mdpa @@ -0,0 +1,65 @@ +Begin ModelPartData +// VARIABLE_NAME value +End ModelPartData + +Begin Properties 0 +End Properties +Begin Nodes + 1 0.6696930000 2.7809300000 0.0000000000 + 2 0.6696930000 0.5902400000 0.0000000000 + 3 -3.2463085000 2.7809300000 0.0000000000 + 4 0.6696930000 -1.6004500000 0.0000000000 + 5 -3.2463085000 0.5902400000 0.0000000000 + 6 -3.2463085000 -1.6004500000 0.0000000000 + 7 -7.1623100000 2.7809300000 0.0000000000 + 8 -7.1623100000 0.5902400000 0.0000000000 + 9 -7.1623100000 -1.6004500000 0.0000000000 +End Nodes + + +Begin Elements SmallDisplacementElement2D4N// GUI group identifier: Solid Auto1 + 1 0 3 5 2 1 + 2 0 7 8 5 3 + 3 0 5 6 4 2 + 4 0 8 9 6 5 +End Elements + +Begin SubModelPart Parts_Solid_Solid_Auto1 // Group Solid Auto1 // Subtree Parts_Solid + Begin SubModelPartNodes + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + End SubModelPartNodes + Begin SubModelPartElements + 1 + 2 + 3 + 4 + End SubModelPartElements +End SubModelPart +Begin SubModelPart DISPLACEMENT_Displacement_Auto1 // Group Displacement Auto1 // Subtree DISPLACEMENT + Begin SubModelPartNodes + 7 + 8 + 9 + End SubModelPartNodes +End SubModelPart +Begin SubModelPart SelfWeight2D_Self_weight_Auto1 // Group Self weight Auto1 // Subtree SelfWeight2D + Begin SubModelPartNodes + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + End SubModelPartNodes +End SubModelPart diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_materials.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_materials.json new file mode 100644 index 00000000000..b8d98434899 --- /dev/null +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_materials.json @@ -0,0 +1,32 @@ +{ + "properties" : [{ + "model_part_name" : "Structure.Parts_Solid_Solid_Auto1", + "properties_id" : 1, + "Material" : { + "constitutive_law" : { + "name" : "GenericAnisotropicPlaneStress2DLaw" + }, + "Variables" : { + "ORTHOTROPIC_ELASTIC_CONSTANTS" : [10e9, 2.1e9, 2.1e9, 0.29, 0.29, 0.29], + "EULER_ANGLES" : [32,0,0], + "ISOTROPIC_ANISOTROPIC_YIELD_RATIO" : [1,1,1,1,1,1], + "DENSITY" : 7850 + }, + "Tables" : {} + }, + "sub_properties" : [{ + "properties_id" : 10, + "Material" : { + "constitutive_law" : { + "name" : "LinearElasticPlaneStrain2DLaw" + }, + "Variables" : { + "DENSITY" : 2400.0, + "YOUNG_MODULUS" : 40E9, + "POISSON_RATIO" : 0.3 + }, + "Tables" : {} + } + }] + }] +} diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_parameters.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_parameters.json new file mode 100644 index 00000000000..092f40800d5 --- /dev/null +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_parameters.json @@ -0,0 +1,93 @@ +{ + "problem_data" : { + "problem_name" : "anisotropy_2d_test", + "parallel_type" : "OpenMP", + "echo_level" : 1, + "start_time" : 0.0, + "end_time" : 1.0 + }, + "solver_settings" : { + "time_stepping" : { + "time_step" : 1.0 + }, + "solver_type" : "Static", + "model_part_name" : "Structure", + "domain_size" : 2, + "echo_level" : 1, + "analysis_type" : "non_linear", + "model_import_settings" : { + "input_type" : "mdpa", + "input_filename" : "AnisotropyCube/anisotropy_2d_test" + }, + "material_import_settings" : { + "materials_filename" : "AnisotropyCube/anisotropy_2d_test_materials.json" + }, + "line_search" : false, + "convergence_criterion" : "residual_criterion", + "displacement_relative_tolerance" : 0.0001, + "displacement_absolute_tolerance" : 1e-9, + "residual_relative_tolerance" : 0.0001, + "residual_absolute_tolerance" : 1e-9, + "max_iteration" : 10, + "use_old_stiffness_in_first_iteration" : false, + "rotation_dofs" : false, + "volumetric_strain_dofs" : false + }, + "processes" : { + "constraints_process_list" : [{ + "python_module" : "assign_vector_variable_process", + "kratos_module" : "KratosMultiphysics", + "process_name" : "AssignVectorVariableProcess", + "Parameters" : { + "model_part_name" : "Structure.DISPLACEMENT_Displacement_Auto1", + "variable_name" : "DISPLACEMENT", + "interval" : [0.0,"End"], + "constrained" : [true,true,true], + "value" : [0.0,0.0,0.0] + } + }], + "loads_process_list" : [{ + "python_module" : "assign_vector_by_direction_process", + "kratos_module" : "KratosMultiphysics", + "check" : "DirectorVectorNonZero direction", + "process_name" : "AssignVectorByDirectionProcess", + "Parameters" : { + "model_part_name" : "Structure.SelfWeight2D_Self_weight_Auto1", + "variable_name" : "VOLUME_ACCELERATION", + "interval" : [0.0,"End"], + "constrained" : false, + "modulus" : 9.81, + "direction" : [1,0,0.0] + } + }], + "list_other_processes" : [], + "json_check_process" : [ + { + "python_module" : "from_json_check_result_process", + "kratos_module" : "KratosMultiphysics", + "help" : "", + "process_name" : "FromJsonCheckResultProcess", + "Parameters" : { + "check_variables" : ["DISPLACEMENT"], + "input_file_name" : "AnisotropyCube/anisotropy_2d_test_results.json", + "model_part_name" : "Structure.Parts_Solid_Solid_Auto1", + "time_frequency" : 0.1 + } + }] + //"_json_output_process" : [ + //{ + // "python_module" : "json_output_process", + // "kratos_module" : "KratosMultiphysics", + // "help" : "", + // "process_name" : "JsonOutputProcess", + // "Parameters" : { + // "output_variables" : ["DISPLACEMENT"], + // "output_file_name" : "AnisotropyCube/anisotropy_2d_test_results.json", + // "model_part_name" : "Structure.Parts_Solid_Solid_Auto1", + // "time_frequency" : 0.1 + // } + //}] + }, + "output_processes" : {}, + "analysis_stage" : "KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis" +} diff --git a/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_results.json b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_results.json new file mode 100644 index 00000000000..66ddf396886 --- /dev/null +++ b/applications/ConstitutiveLawsApplication/tests/AnisotropyCube/anisotropy_2d_test_results.json @@ -0,0 +1,104 @@ +{ + "TIME": [ + 1.0 + ], + "NODE_1": { + "DISPLACEMENT_X": [ + 0.0005237129686011353 + ], + "DISPLACEMENT_Y": [ + -0.0004905129181585165 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_2": { + "DISPLACEMENT_X": [ + 0.00052650436190964 + ], + "DISPLACEMENT_Y": [ + -0.0004821475041993483 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_3": { + "DISPLACEMENT_X": [ + 0.0004038998113975294 + ], + "DISPLACEMENT_Y": [ + -0.00039855850816312646 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_4": { + "DISPLACEMENT_X": [ + 0.0005139806181518545 + ], + "DISPLACEMENT_Y": [ + -0.00047272710313771304 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_5": { + "DISPLACEMENT_X": [ + 0.0003884411459232532 + ], + "DISPLACEMENT_Y": [ + -0.00036083936525943376 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_6": { + "DISPLACEMENT_X": [ + 0.00037635963836100077 + ], + "DISPLACEMENT_Y": [ + -0.00032342329242713354 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_7": { + "DISPLACEMENT_X": [ + 0.0 + ], + "DISPLACEMENT_Y": [ + 0.0 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_8": { + "DISPLACEMENT_X": [ + 0.0 + ], + "DISPLACEMENT_Y": [ + 0.0 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + }, + "NODE_9": { + "DISPLACEMENT_X": [ + 0.0 + ], + "DISPLACEMENT_Y": [ + 0.0 + ], + "DISPLACEMENT_Z": [ + 0.0 + ] + } +} \ No newline at end of file diff --git a/applications/ConstitutiveLawsApplication/tests/test_ConstitutiveLawsApplication.py b/applications/ConstitutiveLawsApplication/tests/test_ConstitutiveLawsApplication.py index b84370b5ab3..50969e14a31 100644 --- a/applications/ConstitutiveLawsApplication/tests/test_ConstitutiveLawsApplication.py +++ b/applications/ConstitutiveLawsApplication/tests/test_ConstitutiveLawsApplication.py @@ -17,6 +17,7 @@ from test_factory import SerialParallelRuleOfMixturesCubeDamageTest from test_factory import PlasticDamageTest from test_factory import AnisotropyTest +from test_factory import Anisotropy2DTest from test_factory import InitialStateInelasticityTest from test_factory import InitialStateInelasticity2Test from test_factory import SmallDeformationPlasticityTest @@ -55,6 +56,7 @@ def AssembleTestSuites(): smallSuite.addTest(BigCubeSmallDeformationPlasticityDPTest('test_execution')) smallSuite.addTest(BigCubeSmallDeformationPlasticityTTest('test_execution')) smallSuite.addTest(AnisotropyTest('test_execution')) + smallSuite.addTest(Anisotropy2DTest('test_execution')) smallSuite.addTest(InitialStateInelasticityTest('test_execution')) smallSuite.addTest(InitialStateInelasticity2Test('test_execution')) smallSuite.addTest(SimpleJ2PlasticityTest('test_execution')) diff --git a/applications/ConstitutiveLawsApplication/tests/test_factory.py b/applications/ConstitutiveLawsApplication/tests/test_factory.py index d447d240e95..ae586a68b9e 100644 --- a/applications/ConstitutiveLawsApplication/tests/test_factory.py +++ b/applications/ConstitutiveLawsApplication/tests/test_factory.py @@ -103,6 +103,9 @@ class PlasticDamageTest(TestFactory): class AnisotropyTest(TestFactory): file_name = "AnisotropyCube/anisotropy_test" +class Anisotropy2DTest(TestFactory): + file_name = "AnisotropyCube/anisotropy_2d_test" + class InitialStateInelasticityTest(TestFactory): file_name = "InitialStateInelasticity/initial_state2_test" From 52799a54597554c5ebefbba74398d77a4843c877 Mon Sep 17 00:00:00 2001 From: Anne van de Graaf Date: Fri, 3 Jan 2025 11:17:30 +0100 Subject: [PATCH 35/39] Removed a few duplicated `override`s (#12972) The common implementation of the duplicated `override`s has been moved to the base class. --- .../custom_retention/retention_law.cpp | 18 ++++++++++++++++++ .../custom_retention/retention_law.h | 2 +- .../saturated_below_phreatic_level_law.cpp | 18 ------------------ .../saturated_below_phreatic_level_law.h | 11 ----------- .../custom_retention/saturated_law.cpp | 18 ------------------ .../custom_retention/saturated_law.h | 9 --------- .../custom_retention/van_genuchten_law.cpp | 17 ----------------- .../custom_retention/van_genuchten_law.h | 9 --------- .../geo_mechanics_application.h | 4 ++-- 9 files changed, 21 insertions(+), 85 deletions(-) diff --git a/applications/GeoMechanicsApplication/custom_retention/retention_law.cpp b/applications/GeoMechanicsApplication/custom_retention/retention_law.cpp index 06bd9ef2aeb..46385123843 100644 --- a/applications/GeoMechanicsApplication/custom_retention/retention_law.cpp +++ b/applications/GeoMechanicsApplication/custom_retention/retention_law.cpp @@ -12,10 +12,28 @@ /* Project includes */ #include "custom_retention/retention_law.h" +#include "geo_mechanics_application_variables.h" namespace Kratos { +double& RetentionLaw::CalculateValue(Parameters& rParameters, const Variable& rThisVariable, double& rValue) const +{ + if (rThisVariable == DEGREE_OF_SATURATION) { + rValue = CalculateSaturation(rParameters); + } else if (rThisVariable == EFFECTIVE_SATURATION) { + rValue = CalculateEffectiveSaturation(rParameters); + } else if (rThisVariable == BISHOP_COEFFICIENT) { + rValue = CalculateBishopCoefficient(rParameters); + } else if (rThisVariable == DERIVATIVE_OF_SATURATION) { + rValue = CalculateDerivativeOfSaturation(rParameters); + } else if (rThisVariable == RELATIVE_PERMEABILITY) { + rValue = CalculateRelativePermeability(rParameters); + } + + return rValue; +} + void RetentionLaw::save(Serializer& rSerializer) const { // there is no member variables to be saved diff --git a/applications/GeoMechanicsApplication/custom_retention/retention_law.h b/applications/GeoMechanicsApplication/custom_retention/retention_law.h index 73a6bd1f67f..d7f796f27c5 100644 --- a/applications/GeoMechanicsApplication/custom_retention/retention_law.h +++ b/applications/GeoMechanicsApplication/custom_retention/retention_law.h @@ -87,7 +87,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) RetentionLaw * @param rValue a reference to the returned value * @param rValue output: the value of the specified variable */ - virtual double& CalculateValue(Parameters& rParameters, const Variable& rThisVariable, double& rValue) = 0; + double& CalculateValue(Parameters& rParameters, const Variable& rThisVariable, double& rValue) const; virtual double CalculateSaturation(Parameters& rParameters) const = 0; diff --git a/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.cpp b/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.cpp index e659f732bd9..f5d7366b2ef 100644 --- a/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.cpp +++ b/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.cpp @@ -54,24 +54,6 @@ double SaturatedBelowPhreaticLevelLaw::CalculateBishopCoefficient(Parameters& rP return CalculateEffectiveSaturation(rParameters); } -double& SaturatedBelowPhreaticLevelLaw::CalculateValue(Parameters& rParameterValues, - const Variable& rThisVariable, - double& rValue) -{ - if (rThisVariable == DEGREE_OF_SATURATION) { - rValue = this->CalculateSaturation(rParameterValues); - } else if (rThisVariable == EFFECTIVE_SATURATION) { - rValue = this->CalculateEffectiveSaturation(rParameterValues); - } else if (rThisVariable == BISHOP_COEFFICIENT) { - rValue = this->CalculateBishopCoefficient(rParameterValues); - } else if (rThisVariable == DERIVATIVE_OF_SATURATION) { - rValue = this->CalculateDerivativeOfSaturation(rParameterValues); - } else if (rThisVariable == RELATIVE_PERMEABILITY) { - rValue = this->CalculateRelativePermeability(rParameterValues); - } - return rValue; -} - int SaturatedBelowPhreaticLevelLaw::Check(const Properties& rMaterialProperties, const ProcessInfo&) { KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(SATURATED_SATURATION)) diff --git a/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.h b/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.h index ef9bb434922..685aac29ba6 100644 --- a/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.h +++ b/applications/GeoMechanicsApplication/custom_retention/saturated_below_phreatic_level_law.h @@ -45,17 +45,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SaturatedBelowPhreaticLevelLaw : pub double CalculateBishopCoefficient(Parameters& rParameters) const override; - /** - * @brief It calculates the value of a specified variable (double case) - * @param rParameterValues the needed parameters for the CL calculation - * @param rThisVariable the variable to be returned - * @param rValue a reference to the returned value - * @return rValue output: the value of the specified variable - */ - double& CalculateValue(RetentionLaw::Parameters& rParameterValues, - const Variable& rThisVariable, - double& rValue) override; - /** * @brief This function provides the place to perform checks on the completeness of the input. * @details It is designed to be called only once (or anyway, not often) typically at the beginning of the calculations, so to verify that nothing is missing from the input or that no common error is found. diff --git a/applications/GeoMechanicsApplication/custom_retention/saturated_law.cpp b/applications/GeoMechanicsApplication/custom_retention/saturated_law.cpp index fc2a01b3670..da79930a8fc 100644 --- a/applications/GeoMechanicsApplication/custom_retention/saturated_law.cpp +++ b/applications/GeoMechanicsApplication/custom_retention/saturated_law.cpp @@ -39,24 +39,6 @@ double SaturatedLaw::CalculateBishopCoefficient(Parameters& rParameters) const return CalculateEffectiveSaturation(rParameters); } -double& SaturatedLaw::CalculateValue(RetentionLaw::Parameters& rParameterValues, - const Variable& rThisVariable, - double& rValue) -{ - if (rThisVariable == DEGREE_OF_SATURATION) { - rValue = this->CalculateSaturation(rParameterValues); - } else if (rThisVariable == EFFECTIVE_SATURATION) { - rValue = this->CalculateEffectiveSaturation(rParameterValues); - } else if (rThisVariable == BISHOP_COEFFICIENT) { - rValue = this->CalculateBishopCoefficient(rParameterValues); - } else if (rThisVariable == DERIVATIVE_OF_SATURATION) { - rValue = this->CalculateDerivativeOfSaturation(rParameterValues); - } else if (rThisVariable == RELATIVE_PERMEABILITY) { - rValue = this->CalculateRelativePermeability(rParameterValues); - } - return rValue; -} - int SaturatedLaw::Check(const Properties& rMaterialProperties, const ProcessInfo& rCurrentProcessInfo) { if (rMaterialProperties.Has(SATURATED_SATURATION)) { diff --git a/applications/GeoMechanicsApplication/custom_retention/saturated_law.h b/applications/GeoMechanicsApplication/custom_retention/saturated_law.h index 611e926341d..25c37436100 100644 --- a/applications/GeoMechanicsApplication/custom_retention/saturated_law.h +++ b/applications/GeoMechanicsApplication/custom_retention/saturated_law.h @@ -45,15 +45,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SaturatedLaw : public RetentionLaw double CalculateBishopCoefficient(Parameters& rParameters) const override; - /** - * @brief It calculates the value of a specified variable (double case) - * @param rParameterValues the needed parameters for the CL calculation - * @param rThisVariable the variable to be returned - * @param rValue a reference to the returned value - * @return rValue output: the value of the specified variable - */ - double& CalculateValue(Parameters& rParameterValues, const Variable& rThisVariable, double& rValue) override; - /** * @brief This function provides the place to perform checks on the completeness of the input. * @details It is designed to be called only once (or anyway, not often) typically at the beginning of the calculations, so to verify that nothing is missing from the input or that no common error is found. diff --git a/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.cpp b/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.cpp index 95a910c70de..020465ce13f 100644 --- a/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.cpp +++ b/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.cpp @@ -103,23 +103,6 @@ double VanGenuchtenLaw::CalculateBishopCoefficient(Parameters& rParameters) cons return CalculateEffectiveSaturation(rParameters); } -double& VanGenuchtenLaw::CalculateValue(Parameters& rParameterValues, const Variable& rThisVariable, double& rValue) -{ - if (rThisVariable == DEGREE_OF_SATURATION) { - rValue = this->CalculateSaturation(rParameterValues); - } else if (rThisVariable == EFFECTIVE_SATURATION) { - rValue = this->CalculateEffectiveSaturation(rParameterValues); - } else if (rThisVariable == BISHOP_COEFFICIENT) { - rValue = this->CalculateBishopCoefficient(rParameterValues); - } else if (rThisVariable == DERIVATIVE_OF_SATURATION) { - rValue = this->CalculateDerivativeOfSaturation(rParameterValues); - } else if (rThisVariable == RELATIVE_PERMEABILITY) { - rValue = this->CalculateRelativePermeability(rParameterValues); - } - - return rValue; -} - int VanGenuchtenLaw::Check(const Properties& rMaterialProperties, const ProcessInfo& rCurrentProcessInfo) { KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(SATURATED_SATURATION)) diff --git a/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.h b/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.h index ca008a74c8e..a2a0719e722 100644 --- a/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.h +++ b/applications/GeoMechanicsApplication/custom_retention/van_genuchten_law.h @@ -44,15 +44,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) VanGenuchtenLaw : public RetentionLa double CalculateBishopCoefficient(Parameters& rParameters) const override; - /** - * @brief It calculates the value of a specified variable (double case) - * @param rParameterValues the needed parameters for the CL calculation - * @param rThisVariable the variable to be returned - * @param rValue a reference to the returned value - * @return rValue output: the value of the specified variable - */ - double& CalculateValue(Parameters& rParameterValues, const Variable& rThisVariable, double& rValue) override; - /** * @brief This function provides the place to perform checks on the completeness of the input. * @details It is designed to be called only once (or anyway, not often) typically at the beginning of the calculations, so to verify that nothing is missing from the input or that no common error is found. diff --git a/applications/GeoMechanicsApplication/geo_mechanics_application.h b/applications/GeoMechanicsApplication/geo_mechanics_application.h index d1b83295653..833cfe42a60 100644 --- a/applications/GeoMechanicsApplication/geo_mechanics_application.h +++ b/applications/GeoMechanicsApplication/geo_mechanics_application.h @@ -959,8 +959,8 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) KratosGeoMechanicsApplication : publ 0, Kratos::make_shared>(Condition::GeometryType::PointsArrayType(9))}; // constitutive models - const BilinearCohesive3DLaw mBilinearCohesive3DLaw; - const BilinearCohesive2DLaw mBilinearCohesive2DLaw; + const BilinearCohesive3DLaw mBilinearCohesive3DLaw; + const BilinearCohesive2DLaw mBilinearCohesive2DLaw; const GeoIncrementalLinearElasticLaw mLinearElasticPlaneStrain2DLaw{std::make_unique()}; const GeoIncrementalLinearElasticLaw mLinearElastic3DLaw{std::make_unique()}; const GeoLinearElasticPlaneStress2DLaw mLinearElasticPlaneStress2DLaw; From 103b12fd466be118b24f8825a91ac603a4c26f86 Mon Sep 17 00:00:00 2001 From: WPK4FEM <129858139+WPK4FEM@users.noreply.github.com> Date: Fri, 3 Jan 2025 11:22:42 +0100 Subject: [PATCH 36/39] [GeoMechanicsApplication] Remove number of umat state variables (#12968) The number of umat/udsm state variables can be deducted from the length of the vector supplied by the user. As this is user input, having an output item for it seems overkill. Removed all use of NUMBER_OF_UMAT_STATE_VARIABLES, the setup of the variable and the output item. --- .../small_strain_udsm_3D_law.cpp | 39 +++++----- .../small_strain_udsm_3D_law.hpp | 18 +++-- .../small_strain_umat_3D_law.cpp | 71 ++++++++----------- .../small_strain_umat_3D_law.hpp | 14 ++-- .../custom_elements/U_Pw_base_element.cpp | 5 +- .../geo_mechanics_application.cpp | 2 - .../geo_mechanics_application_variables.cpp | 3 - .../geo_mechanics_application_variables.h | 3 - .../MaterialParameters.json | 2 - .../tests/test_benchmark_set_2.py | 33 --------- .../MaterialParameters1.json | 1 - .../MaterialParameters.json | 2 - 12 files changed, 60 insertions(+), 133 deletions(-) diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp index 38e09d251a7..0b6d0e06d84 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp @@ -258,12 +258,12 @@ void SmallStrainUDSM3DLaw::ResetStateVariables(const Properties& rMaterialProper KRATOS_TRY // reset state variables - int nStateVariables = std::max(GetNumberOfStateVariablesFromUDSM(rMaterialProperties), 1); - mStateVariables.resize(nStateVariables); - noalias(mStateVariables) = ZeroVector(nStateVariables); + int n_state_variables = std::max(GetNumberOfStateVariablesFromUDSM(rMaterialProperties), 1); + mStateVariables.resize(n_state_variables); + noalias(mStateVariables) = ZeroVector(n_state_variables); - mStateVariablesFinalized.resize(nStateVariables); - noalias(mStateVariablesFinalized) = ZeroVector(nStateVariables); + mStateVariablesFinalized.resize(n_state_variables); + noalias(mStateVariablesFinalized) = ZeroVector(n_state_variables); KRATOS_CATCH("") } @@ -597,13 +597,13 @@ void SmallStrainUDSM3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Para if (rOptions.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) { // Constitutive matrix (D matrix) - Matrix& rConstitutiveMatrix = rValues.GetConstitutiveMatrix(); - CalculateConstitutiveMatrix(rValues, rConstitutiveMatrix); + Matrix& r_constitutive_matrix = rValues.GetConstitutiveMatrix(); + CalculateConstitutiveMatrix(rValues, r_constitutive_matrix); } if (rOptions.Is(ConstitutiveLaw::COMPUTE_STRESS)) { - Vector& rStressVector = rValues.GetStressVector(); - CalculateStress(rValues, rStressVector); + Vector& r_stress_vector = rValues.GetStressVector(); + CalculateStress(rValues, r_stress_vector); } KRATOS_CATCH("") @@ -612,10 +612,10 @@ void SmallStrainUDSM3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Para void SmallStrainUDSM3DLaw::UpdateInternalDeltaStrainVector(ConstitutiveLaw::Parameters& rValues) { KRATOS_TRY - const Vector& rStrainVector = rValues.GetStrainVector(); + const Vector& r_strain_vector = rValues.GetStrainVector(); for (unsigned int i = 0; i < mDeltaStrainVector.size(); ++i) { - mDeltaStrainVector[i] = rStrainVector(i) - mStrainVectorFinalized[i]; + mDeltaStrainVector[i] = r_strain_vector(i) - mStrainVectorFinalized[i]; } KRATOS_CATCH("") } @@ -806,7 +806,7 @@ void SmallStrainUDSM3DLaw::FinalizeMaterialResponseCauchy(ConstitutiveLaw::Param void SmallStrainUDSM3DLaw::SetInternalStrainVector(const Vector& rStrainVector) { KRATOS_TRY - std::copy_n(rStrainVector.begin(), mStrainVectorFinalized.size(), mStrainVectorFinalized.begin()); + std::copy(rStrainVector.begin(), rStrainVector.end(), mStrainVectorFinalized.begin()); KRATOS_CATCH("") } @@ -821,11 +821,11 @@ double& SmallStrainUDSM3DLaw::CalculateValue(ConstitutiveLaw::Parameters& rParam double& rValue) { if (rThisVariable == STRAIN_ENERGY) { - Vector& rStrainVector = rParameterValues.GetStrainVector(); - Vector& rStressVector = rParameterValues.GetStressVector(); - this->CalculateStress(rParameterValues, rStressVector); + const Vector& r_strain_vector = rParameterValues.GetStrainVector(); + Vector& r_stress_vector = rParameterValues.GetStressVector(); + this->CalculateStress(rParameterValues, r_stress_vector); - rValue = 0.5 * inner_prod(rStrainVector, rStressVector); // Strain energy = 0.5*E:C:E + rValue = 0.5 * inner_prod(r_strain_vector, r_stress_vector); // Strain energy = 0.5*E:C:E } return rValue; } @@ -898,13 +898,6 @@ double& SmallStrainUDSM3DLaw::GetValue(const Variable& rThisVariable, do return rValue; } -int& SmallStrainUDSM3DLaw::GetValue(const Variable& rThisVariable, int& rValue) -{ - if (rThisVariable == NUMBER_OF_UMAT_STATE_VARIABLES) - rValue = static_cast(mStateVariablesFinalized.size()); - return rValue; -} - void SmallStrainUDSM3DLaw::SetValue(const Variable& rThisVariable, const double& rValue, const ProcessInfo& rCurrentProcessInfo) diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp index 0496a48c8d1..a9862d413f5 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp @@ -133,7 +133,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUDSM3DLaw : public Consti /** * @brief Clone method */ - ConstitutiveLaw::Pointer Clone() const override; + [[nodiscard]] ConstitutiveLaw::Pointer Clone() const override; /** * Copy constructor. @@ -162,7 +162,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUDSM3DLaw : public Consti /** * @brief Voigt tensor size: */ - SizeType GetStrainSize() const override { return VoigtSize; } + [[nodiscard]] SizeType GetStrainSize() const override { return VoigtSize; } /** * @brief Returns the expected strain measure of this constitutive law (by default Green-Lagrange) @@ -258,9 +258,9 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUDSM3DLaw : public Consti // @details It is designed to be called only once (or anyway, not often) typically at the beginning // of the calculations, so to verify that nothing is missing from the input or that // no common error is found. - int Check(const Properties& rMaterialProperties, - const GeometryType& rElementGeometry, - const ProcessInfo& rCurrentProcessInfo) const override; + [[nodiscard]] int Check(const Properties& rMaterialProperties, + const GeometryType& rElementGeometry, + const ProcessInfo& rCurrentProcessInfo) const override; /** * This is to be called at the very beginning of the calculation @@ -289,14 +289,12 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUDSM3DLaw : public Consti * @param rMaterialProperties the Properties instance of the current element * @param rElementGeometry the geometry of the current element * @param rShapeFunctionsValues the shape functions values in the current integration point - * @param the current ProcessInfo instance */ void ResetMaterial(const Properties& rMaterialProperties, const GeometryType& rElementGeometry, const Vector& rShapeFunctionsValues) override; double& GetValue(const Variable& rThisVariable, double& rValue) override; - int& GetValue(const Variable& rThisVariable, int& rValue) override; Vector& GetValue(const Variable& rThisVariable, Vector& rValue) override; using ConstitutiveLaw::GetValue; @@ -313,7 +311,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUDSM3DLaw : public Consti ///@{ /// Turn back information as a string. - std::string Info() const override { return "SmallStrainUDSM3DLaw"; } + [[nodiscard]] std::string Info() const override { return "SmallStrainUDSM3DLaw"; } /// Print information about this object. void PrintInfo(std::ostream& rOStream) const override { rOStream << Info(); } @@ -455,8 +453,8 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUDSM3DLaw : public Consti int GetNumberOfStateVariablesFromUDSM(const Properties& rMaterialProperties); // get number of MaterialParameters - SizeType GetNumberOfMaterialParametersFromUDSM(const Properties& rMaterialProperties); - int GetStateVariableIndex(const Variable& rThisVariable) const; + SizeType GetNumberOfMaterialParametersFromUDSM(const Properties& rMaterialProperties); + [[nodiscard]] int GetStateVariableIndex(const Variable& rThisVariable) const; ///@} ///@name Serialization diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp index 8b791764af2..ee73b69b147 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp @@ -216,14 +216,14 @@ void SmallStrainUMAT3DLaw::ResetStateVariables(const Properties& rMaterialProper KRATOS_TRY // reset state variables - const auto& StateVariables = rMaterialProperties[STATE_VARIABLES]; - const auto nStateVariables = StateVariables.size(); + const auto& state_variables = rMaterialProperties[STATE_VARIABLES]; + const auto n_state_variables = state_variables.size(); - mStateVariables.resize(nStateVariables); - mStateVariablesFinalized.resize(nStateVariables); + mStateVariables.resize(n_state_variables); + mStateVariablesFinalized.resize(n_state_variables); - noalias(mStateVariables) = StateVariables; - noalias(mStateVariablesFinalized) = StateVariables; + noalias(mStateVariables) = state_variables; + noalias(mStateVariablesFinalized) = state_variables; KRATOS_CATCH("") } @@ -382,24 +382,24 @@ void SmallStrainUMAT3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Para KRATOS_TRY // Get Values to compute the constitutive law: - const Flags& rOptions = rValues.GetOptions(); + const Flags& r_options = rValues.GetOptions(); - KRATOS_DEBUG_ERROR_IF(rOptions.IsDefined(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN) && - rOptions.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) + KRATOS_DEBUG_ERROR_IF(r_options.IsDefined(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN) && + r_options.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) << "The SmallStrainUMAT3DLaw needs an element provided strain" << std::endl; KRATOS_ERROR_IF(!rValues.IsSetStrainVector() || rValues.GetStrainVector().size() != GetStrainSize()) << "Constitutive laws in the geomechanics application need a valid provided strain" << std::endl; - if (rOptions.Is(ConstitutiveLaw::COMPUTE_STRESS)) { - Vector& rStressVector = rValues.GetStressVector(); - CalculateStress(rValues, rStressVector); + if (r_options.Is(ConstitutiveLaw::COMPUTE_STRESS)) { + Vector& r_stress_vector = rValues.GetStressVector(); + CalculateStress(rValues, r_stress_vector); } - if (rOptions.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) { + if (r_options.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) { // Constitutive matrix (D matrix) - Matrix& rConstitutiveMatrix = rValues.GetConstitutiveMatrix(); - CalculateConstitutiveMatrix(rValues, rConstitutiveMatrix); + Matrix& r_constitutive_matrix = rValues.GetConstitutiveMatrix(); + CalculateConstitutiveMatrix(rValues, r_constitutive_matrix); } KRATOS_CATCH("") @@ -407,32 +407,26 @@ void SmallStrainUMAT3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Para void SmallStrainUMAT3DLaw::UpdateInternalDeltaStrainVector(ConstitutiveLaw::Parameters& rValues) { - const Vector& rStrainVector = rValues.GetStrainVector(); + const Vector& r_strain_vector = rValues.GetStrainVector(); for (unsigned int i = 0; i < mDeltaStrainVector.size(); ++i) { - mDeltaStrainVector[i] = rStrainVector(i) - mStrainVectorFinalized[i]; + mDeltaStrainVector[i] = r_strain_vector(i) - mStrainVectorFinalized[i]; } } void SmallStrainUMAT3DLaw::SetExternalStressVector(Vector& rStressVector) { - for (unsigned int i = 0; i < rStressVector.size(); ++i) { - rStressVector(i) = mStressVector[i]; - } + std::copy(mStressVector.begin(), mStressVector.end(), rStressVector.begin()); } void SmallStrainUMAT3DLaw::SetInternalStressVector(const Vector& rStressVector) { - for (unsigned int i = 0; i < mStressVectorFinalized.size(); ++i) { - mStressVectorFinalized[i] = rStressVector(i); - } + std::copy(rStressVector.begin(), rStressVector.end(), mStressVectorFinalized.begin()); } void SmallStrainUMAT3DLaw::SetInternalStrainVector(const Vector& rStrainVector) { - for (unsigned int i = 0; i < mStrainVectorFinalized.size(); ++i) { - mStrainVectorFinalized[i] = rStrainVector(i); - } + std::copy(rStrainVector.begin(), rStrainVector.end(), mStrainVectorFinalized.begin()); } void SmallStrainUMAT3DLaw::CopyConstitutiveMatrix(ConstitutiveLaw::Parameters& rValues, Matrix& rConstitutiveMatrix) @@ -549,12 +543,12 @@ void SmallStrainUMAT3DLaw::InitializeMaterialResponseCauchy(ConstitutiveLaw::Par if (!mIsModelInitialized) { // stress and strain vectors must be initialized: - const Vector& rStressVector = rValues.GetStressVector(); - const Vector& rStrainVector = rValues.GetStrainVector(); + const Vector& r_stress_vector = rValues.GetStressVector(); + const Vector& r_strain_vector = rValues.GetStrainVector(); - SetInternalStressVector(rStressVector); + SetInternalStressVector(r_stress_vector); - SetInternalStrainVector(rStrainVector); + SetInternalStrainVector(r_strain_vector); CallUMAT(rValues); mIsModelInitialized = true; @@ -598,13 +592,12 @@ double& SmallStrainUMAT3DLaw::CalculateValue(ConstitutiveLaw::Parameters& rParam const Variable& rThisVariable, double& rValue) { - Vector& rStrainVector = rParameterValues.GetStrainVector(); - Vector& rStressVector = rParameterValues.GetStressVector(); - if (rThisVariable == STRAIN_ENERGY) { - this->CalculateStress(rParameterValues, rStressVector); + const Vector& r_strain_vector = rParameterValues.GetStrainVector(); + Vector& r_stress_vector = rParameterValues.GetStressVector(); + this->CalculateStress(rParameterValues, r_stress_vector); - rValue = 0.5 * inner_prod(rStrainVector, rStressVector); // Strain energy = 0.5*E:C:E + rValue = 0.5 * inner_prod(r_strain_vector, r_stress_vector); // Strain energy = 0.5*E:C:E } return rValue; @@ -679,14 +672,6 @@ double& SmallStrainUMAT3DLaw::GetValue(const Variable& rThisVariable, do return rValue; } -int& SmallStrainUMAT3DLaw::GetValue(const Variable& rThisVariable, int& rValue) -{ - if (rThisVariable == NUMBER_OF_UMAT_STATE_VARIABLES) - rValue = static_cast(mStateVariablesFinalized.size()); - - return rValue; -} - void SmallStrainUMAT3DLaw::SetValue(const Variable& rThisVariable, const double& rValue, const ProcessInfo& rCurrentProcessInfo) diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp index 5f8fb4024dc..eec5918742e 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp @@ -138,7 +138,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUMAT3DLaw : public Consti /** * @brief Clone method */ - ConstitutiveLaw::Pointer Clone() const override; + [[nodiscard]] ConstitutiveLaw::Pointer Clone() const override; /** * @brief This function is designed to be called once to check compatibility with element @@ -154,7 +154,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUMAT3DLaw : public Consti /** * @brief Voigt tensor size: */ - SizeType GetStrainSize() const override { return VoigtSize; } + [[nodiscard]] SizeType GetStrainSize() const override { return VoigtSize; } /** * @brief Returns the expected strain measure of this constitutive law (by default Green-Lagrange) @@ -250,9 +250,9 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUMAT3DLaw : public Consti // @details It is designed to be called only once (or anyway, not often) typically at the beginning // of the calculations, so to verify that nothing is missing from the input or that // no common error is found. - int Check(const Properties& rMaterialProperties, - const GeometryType& rElementGeometry, - const ProcessInfo& rCurrentProcessInfo) const override; + [[nodiscard]] int Check(const Properties& rMaterialProperties, + const GeometryType& rElementGeometry, + const ProcessInfo& rCurrentProcessInfo) const override; /** * This is to be called at the very beginning of the calculation @@ -281,7 +281,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUMAT3DLaw : public Consti * @param rMaterialProperties the Properties instance of the current element * @param rElementGeometry the geometry of the current element * @param rShapeFunctionsValues the shape functions values in the current integration point - * @param the current ProcessInfo instance */ void ResetMaterial(const Properties& rMaterialProperties, const GeometryType& rElementGeometry, @@ -289,7 +288,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUMAT3DLaw : public Consti using ConstitutiveLaw::GetValue; double& GetValue(const Variable& rThisVariable, double& rValue) override; - int& GetValue(const Variable& rThisVariable, int& rValue) override; Vector& GetValue(const Variable& rThisVariable, Vector& rValue) override; using ConstitutiveLaw::SetValue; @@ -306,7 +304,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUMAT3DLaw : public Consti ///@{ /// Turn back information as a string. - std::string Info() const override { return "SmallStrainUMAT3DLaw"; } + [[nodiscard]] std::string Info() const override { return "SmallStrainUMAT3DLaw"; } /// Print information about this object. void PrintInfo(std::ostream& rOStream) const override { rOStream << Info(); } diff --git a/applications/GeoMechanicsApplication/custom_elements/U_Pw_base_element.cpp b/applications/GeoMechanicsApplication/custom_elements/U_Pw_base_element.cpp index f27964482d6..a409bdb5960 100644 --- a/applications/GeoMechanicsApplication/custom_elements/U_Pw_base_element.cpp +++ b/applications/GeoMechanicsApplication/custom_elements/U_Pw_base_element.cpp @@ -148,9 +148,8 @@ void UPwBaseElement::Initialize(const ProcessInfo& rCurrentProcessInfo) } mStateVariablesFinalized.resize(number_of_integration_points); - for (unsigned int i = 0; i < mConstitutiveLawVector.size(); ++i) { - if (auto nStateVariables = 0; - mConstitutiveLawVector[i]->GetValue(NUMBER_OF_UMAT_STATE_VARIABLES, nStateVariables) > 0) { + if (r_properties[CONSTITUTIVE_LAW]->Has(STATE_VARIABLES)) { + for (unsigned int i = 0; i < mConstitutiveLawVector.size(); ++i) { mConstitutiveLawVector[i]->SetValue(STATE_VARIABLES, mStateVariablesFinalized[i], rCurrentProcessInfo); } } diff --git a/applications/GeoMechanicsApplication/geo_mechanics_application.cpp b/applications/GeoMechanicsApplication/geo_mechanics_application.cpp index 4ff26bf0d52..7084b19dde8 100644 --- a/applications/GeoMechanicsApplication/geo_mechanics_application.cpp +++ b/applications/GeoMechanicsApplication/geo_mechanics_application.cpp @@ -534,8 +534,6 @@ void KratosGeoMechanicsApplication::Register() KRATOS_REGISTER_VARIABLE(IS_FORTRAN_UDSM) // Also for UMAT KRATOS_REGISTER_VARIABLE(UMAT_PARAMETERS) - - KRATOS_REGISTER_VARIABLE(NUMBER_OF_UMAT_STATE_VARIABLES) KRATOS_REGISTER_VARIABLE(INDEX_OF_UMAT_C_PARAMETER) KRATOS_REGISTER_VARIABLE(INDEX_OF_UMAT_PHI_PARAMETER) diff --git a/applications/GeoMechanicsApplication/geo_mechanics_application_variables.cpp b/applications/GeoMechanicsApplication/geo_mechanics_application_variables.cpp index bd0e49daab8..84f4b8a3d6e 100644 --- a/applications/GeoMechanicsApplication/geo_mechanics_application_variables.cpp +++ b/applications/GeoMechanicsApplication/geo_mechanics_application_variables.cpp @@ -179,11 +179,8 @@ KRATOS_CREATE_VARIABLE(int, UDSM_NUMBER) KRATOS_CREATE_VARIABLE(bool, IS_FORTRAN_UDSM) // Also for UMAT KRATOS_CREATE_VARIABLE(Vector, UMAT_PARAMETERS) - -KRATOS_CREATE_VARIABLE(int, NUMBER_OF_UMAT_STATE_VARIABLES) KRATOS_CREATE_VARIABLE(int, INDEX_OF_UMAT_C_PARAMETER) KRATOS_CREATE_VARIABLE(int, INDEX_OF_UMAT_PHI_PARAMETER) - KRATOS_CREATE_VARIABLE(Vector, STATE_VARIABLES) KRATOS_CREATE_VARIABLE(double, STATE_VARIABLE_1) diff --git a/applications/GeoMechanicsApplication/geo_mechanics_application_variables.h b/applications/GeoMechanicsApplication/geo_mechanics_application_variables.h index 8ff81f77c09..40fb6e46330 100644 --- a/applications/GeoMechanicsApplication/geo_mechanics_application_variables.h +++ b/applications/GeoMechanicsApplication/geo_mechanics_application_variables.h @@ -196,11 +196,8 @@ KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, int, UDSM_NUMBER) KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, bool, IS_FORTRAN_UDSM) // also for umat KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, Vector, UMAT_PARAMETERS) - -KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, int, NUMBER_OF_UMAT_STATE_VARIABLES) KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, int, INDEX_OF_UMAT_C_PARAMETER) KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, int, INDEX_OF_UMAT_PHI_PARAMETER) - KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, Vector, STATE_VARIABLES) KRATOS_DEFINE_APPLICATION_VARIABLE(GEO_MECHANICS_APPLICATION, double, STATE_VARIABLE_1) diff --git a/applications/GeoMechanicsApplication/tests/Simple_Dike_Gravity_Loading/simple_dike_test_with_gravity_umat.gid/MaterialParameters.json b/applications/GeoMechanicsApplication/tests/Simple_Dike_Gravity_Loading/simple_dike_test_with_gravity_umat.gid/MaterialParameters.json index 9381bcc8619..85a233216dc 100644 --- a/applications/GeoMechanicsApplication/tests/Simple_Dike_Gravity_Loading/simple_dike_test_with_gravity_umat.gid/MaterialParameters.json +++ b/applications/GeoMechanicsApplication/tests/Simple_Dike_Gravity_Loading/simple_dike_test_with_gravity_umat.gid/MaterialParameters.json @@ -25,7 +25,6 @@ 30, 0.0, 1000], - "NUMBER_OF_UMAT_STATE_VARIABLES": 1, "STATE_VARIABLES" : [0.0] }, "Tables": {} @@ -56,7 +55,6 @@ 20, 0.0, 1000], - "NUMBER_OF_UMAT_STATE_VARIABLES": 1, "STATE_VARIABLES" : [0.0] }, "Tables": {} diff --git a/applications/GeoMechanicsApplication/tests/test_benchmark_set_2.py b/applications/GeoMechanicsApplication/tests/test_benchmark_set_2.py index f67a2e892b3..5a9560fb1da 100644 --- a/applications/GeoMechanicsApplication/tests/test_benchmark_set_2.py +++ b/applications/GeoMechanicsApplication/tests/test_benchmark_set_2.py @@ -92,38 +92,5 @@ def test_benchmark2_2(self): self.assertAlmostEqual(max_y_total_stress_plaxis, max_y_cauchy_stress_kratos, delta=max(max_y_total_stress_plaxis*relative_precision_stress,absolute_precision_stress)) self.assertAlmostEqual(min_y_total_stress_plaxis, min_y_cauchy_stress_kratos, delta=max(abs(min_x_total_stress_plaxis*relative_precision_stress),absolute_precision_stress)) - @KratosUnittest.skip("unit test skipped as it is not ready") - def test_benchmark2_3(self): - """ - In this benchmark a four stage model is tested. - Stage 1: initialisation sand layer - Stage 2: addition of sheetpile - Stage 3: addition of dike - Stage 4: addition of water - - The test is calculated using gravity loading. - - This test compares minimum, maximum stress and displacement in the third and fourth stage. - - :return: - """ - - test_name = r'dike_with_sheetpile_all_stage' - project_path = test_helper.get_file_path(os.path.join('.', test_name)) - n_stages = 3 - test_helper.run_stages(project_path, n_stages) - - # max_x_disp_plaxis = 0.01279 - # min_x_disp_plaxis = -0.012234 - # - # max_y_disp_plaxis = 0.0 - # min_y_disp_plaxis = -0.21458 - # - # max_x_total_stress_plaxis = -311 - # min_x_total_stress_plaxis = -146256 - # - # max_y_total_stress_plaxis = -674 - # min_y_total_stress_plaxis = -432068 - if __name__ == '__main__': KratosUnittest.main() diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_umat/MaterialParameters1.json b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_umat/MaterialParameters1.json index e736f4d25a5..420219c09a1 100644 --- a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_umat/MaterialParameters1.json +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_k0_umat/MaterialParameters1.json @@ -29,7 +29,6 @@ 30, 0.0, 1000], - "NUMBER_OF_UMAT_STATE_VARIABLES": 1, "RETENTION_LAW": "SaturatedLaw", "SATURATED_SATURATION": 1.0 } diff --git a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_simple_dike/MaterialParameters.json b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_simple_dike/MaterialParameters.json index d44e0675e35..6272d694886 100644 --- a/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_simple_dike/MaterialParameters.json +++ b/applications/GeoMechanicsApplication/tests/test_k0_procedure_process/test_k0_procedure_simple_dike/MaterialParameters.json @@ -27,7 +27,6 @@ 30, 0.0, 1000], - "NUMBER_OF_UMAT_STATE_VARIABLES": 1, "STATE_VARIABLES" : [0.0] }, "Tables": {} @@ -58,7 +57,6 @@ 20, 0.0, 1000], - "NUMBER_OF_UMAT_STATE_VARIABLES": 1, "STATE_VARIABLES" : [0.0] }, "Tables": {} From b40fa06ad9801decdc5cc1976d92350ec52ff556 Mon Sep 17 00:00:00 2001 From: WPK4FEM <129858139+WPK4FEM@users.noreply.github.com> Date: Fri, 3 Jan 2025 15:46:08 +0100 Subject: [PATCH 37/39] Geo/check linear elastic parameters (#12974) Improved error readability and check on Poisson's ratio + unit testing for geo linear elastic --- .../linear_elastic_law.cpp | 16 +++++++---- ...est_linear_elastic_plane_strain_2D_law.cpp | 28 +++++++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/applications/GeoMechanicsApplication/custom_constitutive/linear_elastic_law.cpp b/applications/GeoMechanicsApplication/custom_constitutive/linear_elastic_law.cpp index cac5d93772a..72eba7ee1e2 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/linear_elastic_law.cpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/linear_elastic_law.cpp @@ -155,16 +155,20 @@ int GeoLinearElasticLaw::Check(const Properties& rMaterialProperties, const ProcessInfo& rCurrentProcessInfo) const { KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(YOUNG_MODULUS)) - << "YOUNG_MODULUS is not available in material parameters" << std::endl; + << "YOUNG_MODULUS is not available in the parameters of material " + << rMaterialProperties.Id() << "." << std::endl; KRATOS_ERROR_IF(rMaterialProperties[YOUNG_MODULUS] <= 0.0) - << "YOUNG_MODULUS is invalid value " << std::endl; + << "The value of YOUNG_MODULUS (" << rMaterialProperties[YOUNG_MODULUS] + << ") should be positive in material " << rMaterialProperties.Id() << "." << std::endl; KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(POISSON_RATIO)) - << "POISSON_RATIO is not available in material parameters" << std::endl; + << "POISSON_RATIO is not available in the parameters of material " + << rMaterialProperties.Id() << "." << std::endl; - const double& nu = rMaterialProperties[POISSON_RATIO]; - KRATOS_ERROR_IF((nu > 0.499 && nu < 0.501) || (nu < -0.999 && nu > -1.01)) - << "POISSON_RATIO has invalid value " << std::endl; + const auto nu = rMaterialProperties[POISSON_RATIO]; + KRATOS_ERROR_IF(nu < -1.0 || nu >= 0.5) << "The value of POISSON_RATIO (" << nu + << ") should be in the range [-1.0, 0.5> in material " + << rMaterialProperties.Id() << "." << std::endl; return 0; } diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_linear_elastic_plane_strain_2D_law.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_linear_elastic_plane_strain_2D_law.cpp index 6b1d44887ef..0e669489d05 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_linear_elastic_plane_strain_2D_law.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_linear_elastic_plane_strain_2D_law.cpp @@ -199,4 +199,32 @@ KRATOS_TEST_CASE_IN_SUITE(GeoLinearElasticPlaneStrain2DLawThrows_WhenElementProv } #endif +KRATOS_TEST_CASE_IN_SUITE(GeoLinearElasticPlaneStrain2DLawChecksYoungModulusAndPoissonRatio, + KratosGeoMechanicsFastSuiteWithoutKernel) +{ + auto law = CreateLinearElasticPlaneStrainLaw(); + ConstitutiveLaw::Parameters parameters; + Properties properties(3); + parameters.SetMaterialProperties(properties); + const auto element_geometry = Geometry{}; + const auto process_info = ProcessInfo{}; + KRATOS_EXPECT_EXCEPTION_IS_THROWN( + law.Check(properties, element_geometry, process_info), + "Error: YOUNG_MODULUS is not available in the parameters of material 3.") + properties.SetValue(YOUNG_MODULUS, -1.0e7); + KRATOS_EXPECT_EXCEPTION_IS_THROWN( + law.Check(properties, element_geometry, process_info), + "Error: The value of YOUNG_MODULUS (-1e+07) should be positive in material 3.") + properties.SetValue(YOUNG_MODULUS, 1.0e7); + KRATOS_EXPECT_EXCEPTION_IS_THROWN( + law.Check(properties, element_geometry, process_info), + "Error: POISSON_RATIO is not available in the parameters of material 3.") + properties.SetValue(POISSON_RATIO, 0.7); + KRATOS_EXPECT_EXCEPTION_IS_THROWN( + law.Check(properties, element_geometry, process_info), + "Error: The value of POISSON_RATIO (0.7) should be in the range [-1.0, 0.5> in material 3.") + properties.SetValue(POISSON_RATIO, 0.25); + KRATOS_EXPECT_EQ(law.Check(properties, element_geometry, process_info), 0); +} + } // namespace Kratos::Testing \ No newline at end of file From 87120b6bc191132d7fa514ab6e75e2fdf0d43113 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Sat, 4 Jan 2025 11:06:35 +0100 Subject: [PATCH 38/39] removing extended quadratures from hexa 3d 8n --- kratos/geometries/hexahedra_3d_8.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kratos/geometries/hexahedra_3d_8.h b/kratos/geometries/hexahedra_3d_8.h index 3fe7bb6a621..cbd3505c809 100644 --- a/kratos/geometries/hexahedra_3d_8.h +++ b/kratos/geometries/hexahedra_3d_8.h @@ -1449,8 +1449,6 @@ template class Hexahedra3D8 : public Geometry Quadrature < HexahedronGaussLegendreIntegrationPoints3, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLegendreIntegrationPoints4, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLegendreIntegrationPoints5, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints() } }; @@ -1467,8 +1465,6 @@ template class Hexahedra3D8 : public Geometry Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_3 ), Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4 ), Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_5 ), - Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ), - Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ), Hexahedra3D8::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_LOBATTO_1 ) } }; From 14ad16b9df25a45474d0f2ba91d890e7f734b09f Mon Sep 17 00:00:00 2001 From: Anne van de Graaf Date: Mon, 6 Jan 2025 14:58:38 +0100 Subject: [PATCH 39/39] [GeoMechanicsApplication] Move C++ unit tests to subdirectories (#12976) Moved the C++ unit tests of the GeoMechanicsApplication that were not yet inside a sub-directory of `cpp_tests` to appropriate sub-directories. In addition, three locally defined classes `StubElement` have been renamed to avoid name clashes when using Unity builds. --- .../test_Pw_normal_flux_condition.cpp | 2 +- .../test_T_micro_climate_flux_condition.cpp | 2 +- .../test_U_Pw_condition.cpp | 2 +- ...U_Pw_normal_lysmer_absorbing_condition.cpp | 2 +- .../test_t_normal_flux_condition.cpp | 2 +- .../test_thermal_dispersion_law.cpp | 2 +- .../test_thermal_filter_law.cpp | 2 +- .../test_truss_backbone_constitutive_law.cpp | 2 +- .../test_axisymmetric_stress_state.cpp | 2 +- .../test_plane_strain_stress_state.cpp | 4 +- .../test_steady_state_Pw_piping_element.cpp | 4 +- .../test_three_dimensional_stress_state.cpp | 4 +- .../test_transient_thermal_element.cpp | 2 +- .../test_activate_model_part_operation.cpp | 2 +- .../test_deactivate_model_part_operation.cpp | 2 +- .../test_apply_c_phi_reduction_process.cpp | 6 +-- ...t_phreatic_multi_line_pressure_process.cpp | 4 +- .../test_apply_k0_procedure_process.cpp | 16 +++---- ...atic_multi_line_pressure_table_process.cpp | 4 +- ...ulate_incremental_displacement_process.cpp | 2 +- ...egration_point_values_to_nodes_process.cpp | 43 +++++++++++-------- .../test_reset_displacement_process.cpp | 9 ++-- .../test_backward_euler_Pw_scheme.cpp | 2 +- .../test_backward_euler_T_scheme.cpp | 4 +- .../test_backward_euler_UPw_scheme.cpp | 2 +- .../test_generalized_newmark_T_scheme.cpp | 4 +- .../test_generalized_newmark_scheme.cpp | 2 +- ...ewton_rapson_erosion_processs_strategy.cpp | 6 +-- ...t_geomechanics_time_integration_scheme.cpp | 8 ++-- .../test_newmark_Pw_scheme.cpp | 4 +- .../test_newmark_dynamic_U_Pw_scheme.cpp | 4 +- .../test_newmark_quasistatic_U_Pw_scheme.cpp | 8 ++-- .../test_Hencky_strain.cpp | 4 +- .../test_builder_and_solver_factory.cpp | 2 +- .../test_compressibility_matrix.cpp | 4 +- .../test_constitutive_law_utilities.cpp} | 4 +- .../test_convergence_criteria_factory.cpp | 2 +- .../test_coupling_matrix.cpp | 4 +- .../test_dof_utilities.cpp | 4 +- .../test_equation_of_motion.cpp | 4 +- .../test_fluid_pressure.cpp | 4 +- .../test_linear_nodal_extrapolator.cpp | 4 +- .../test_node_utilities.cpp | 2 +- .../test_permeability_matrix.cpp | 4 +- .../test_process_factory.cpp | 2 +- .../test_process_info_parser.cpp | 4 +- .../test_scheme_factory.cpp | 2 +- .../test_soil_density.cpp | 4 +- .../test_solving_strategy_factory.cpp | 2 +- .../test_stress_strain_utitlities.cpp | 4 +- .../test_transport_equation_utilities.cpp | 4 +- .../test_variables_utilities.cpp | 4 +- ...icsNewtonRaphsonErosionProcessStrategy.cpp | 4 +- .../test_dgeosettlement.cpp | 10 ++--- .../test_head_extrapolation_flow_workflow.cpp | 6 +-- .../test_prescribed_time_incrementor.cpp | 2 +- .../test_solving_strategy_wrapper.cpp | 2 +- .../test_time_incrementor.cpp | 2 +- .../test_time_loop_executor.cpp | 4 +- .../test_time_stepping.cpp | 2 +- 60 files changed, 136 insertions(+), 128 deletions(-) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_conditions}/test_Pw_normal_flux_condition.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_conditions}/test_T_micro_climate_flux_condition.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_conditions}/test_U_Pw_condition.cpp (95%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_conditions}/test_U_Pw_normal_lysmer_absorbing_condition.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_conditions}/test_t_normal_flux_condition.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_constitutive}/test_thermal_dispersion_law.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_constitutive}/test_thermal_filter_law.cpp (95%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_constitutive}/test_truss_backbone_constitutive_law.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_elements}/test_axisymmetric_stress_state.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_elements}/test_plane_strain_stress_state.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_elements}/test_steady_state_Pw_piping_element.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_elements}/test_three_dimensional_stress_state.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_elements}/test_transient_thermal_element.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_operations}/test_activate_model_part_operation.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_operations}/test_deactivate_model_part_operation.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_processes}/test_apply_c_phi_reduction_process.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_processes}/test_apply_constant_phreatic_multi_line_pressure_process.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_processes}/test_apply_k0_procedure_process.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_processes}/test_apply_phreatic_multi_line_pressure_table_process.cpp (96%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_processes}/test_calculate_incremental_displacement_process.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_processes}/test_geo_extrapolate_integration_point_values_to_nodes_process.cpp (86%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_backward_euler_Pw_scheme.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_backward_euler_T_scheme.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_backward_euler_UPw_scheme.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_generalized_newmark_T_scheme.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_generalized_newmark_scheme.cpp (96%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_geo_mechanics_newton_rapson_erosion_processs_strategy.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_geomechanics_time_integration_scheme.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_newmark_Pw_scheme.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_newmark_dynamic_U_Pw_scheme.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_strategies}/test_newmark_quasistatic_U_Pw_scheme.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_Hencky_strain.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_builder_and_solver_factory.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_compressibility_matrix.cpp (96%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{test_constitutive_law_set6.cpp => custom_utilities/test_constitutive_law_utilities.cpp} (95%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_convergence_criteria_factory.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_coupling_matrix.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_dof_utilities.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_equation_of_motion.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_fluid_pressure.cpp (91%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_linear_nodal_extrapolator.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_node_utilities.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_permeability_matrix.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_process_factory.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_process_info_parser.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_scheme_factory.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_soil_density.cpp (93%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_solving_strategy_factory.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_stress_strain_utitlities.cpp (98%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_transport_equation_utilities.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_utilities}/test_variables_utilities.cpp (92%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_GeoMechanicsNewtonRaphsonErosionProcessStrategy.cpp (97%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_dgeosettlement.cpp (96%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_head_extrapolation_flow_workflow.cpp (95%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_prescribed_time_incrementor.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_solving_strategy_wrapper.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_time_incrementor.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_time_loop_executor.cpp (99%) rename applications/GeoMechanicsApplication/tests/cpp_tests/{ => custom_workflows}/test_time_stepping.cpp (99%) diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_Pw_normal_flux_condition.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_Pw_normal_flux_condition.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_Pw_normal_flux_condition.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_Pw_normal_flux_condition.cpp index a41080e1da5..fddaf65afc7 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_Pw_normal_flux_condition.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_Pw_normal_flux_condition.cpp @@ -16,7 +16,7 @@ #include "containers/model.h" #include "custom_conditions/Pw_normal_flux_condition.hpp" #include "custom_constitutive/linear_elastic_2D_interface_law.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_T_micro_climate_flux_condition.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_T_micro_climate_flux_condition.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_T_micro_climate_flux_condition.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_T_micro_climate_flux_condition.cpp index 0458510bc45..ffaef693800 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_T_micro_climate_flux_condition.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_T_micro_climate_flux_condition.cpp @@ -12,9 +12,9 @@ #include "containers/model.h" #include "custom_conditions/T_microclimate_flux_condition.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/line_2d_4.h" #include "geometries/line_2d_5.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_U_Pw_condition.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_U_Pw_condition.cpp similarity index 95% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_U_Pw_condition.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_U_Pw_condition.cpp index a1c1b3bcf79..51188f5d788 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_U_Pw_condition.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_U_Pw_condition.cpp @@ -13,7 +13,7 @@ // Project includes #include "custom_conditions/U_Pw_condition.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_U_Pw_normal_lysmer_absorbing_condition.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_U_Pw_normal_lysmer_absorbing_condition.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_U_Pw_normal_lysmer_absorbing_condition.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_U_Pw_normal_lysmer_absorbing_condition.cpp index 9425b0f77f7..930f646521e 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_U_Pw_normal_lysmer_absorbing_condition.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_U_Pw_normal_lysmer_absorbing_condition.cpp @@ -16,7 +16,7 @@ #include "custom_elements/U_Pw_small_strain_element.hpp" #include "custom_elements/plane_strain_stress_state.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_t_normal_flux_condition.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_t_normal_flux_condition.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_t_normal_flux_condition.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_t_normal_flux_condition.cpp index be5a9f051f8..f038051d1f3 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_t_normal_flux_condition.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_conditions/test_t_normal_flux_condition.cpp @@ -13,10 +13,10 @@ #include "containers/model.h" #include "custom_conditions/T_normal_flux_condition.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/line_2d_4.h" #include "geometries/line_2d_5.h" #include "includes/condition.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_thermal_dispersion_law.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_thermal_dispersion_law.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_thermal_dispersion_law.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_thermal_dispersion_law.cpp index 16f7a488493..1ff27ed193f 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_thermal_dispersion_law.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_thermal_dispersion_law.cpp @@ -12,8 +12,8 @@ #include "custom_constitutive/thermal_dispersion_law.h" #include "geo_mechanics_application.h" -#include "geo_mechanics_fast_suite.h" #include "includes/ublas_interface.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_thermal_filter_law.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_thermal_filter_law.cpp similarity index 95% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_thermal_filter_law.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_thermal_filter_law.cpp index 7063466f485..1a469891bef 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_thermal_filter_law.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_thermal_filter_law.cpp @@ -12,8 +12,8 @@ #include "custom_constitutive/thermal_filter_law.h" #include "geo_mechanics_application.h" -#include "geo_mechanics_fast_suite.h" #include "includes/ublas_interface.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_truss_backbone_constitutive_law.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_truss_backbone_constitutive_law.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_truss_backbone_constitutive_law.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_truss_backbone_constitutive_law.cpp index a280bf25d80..58ef83fc029 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_truss_backbone_constitutive_law.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_constitutive/test_truss_backbone_constitutive_law.cpp @@ -14,7 +14,7 @@ #include "custom_constitutive/truss_backbone_constitutive_law.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_axisymmetric_stress_state.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_axisymmetric_stress_state.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_axisymmetric_stress_state.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_axisymmetric_stress_state.cpp index b005f9e2484..e255f8b0cd0 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_axisymmetric_stress_state.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_axisymmetric_stress_state.cpp @@ -14,9 +14,9 @@ #include "containers/model.h" #include "custom_elements/axisymmetric_stress_state.h" #include "custom_elements/stress_state_policy.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/geometry.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include "tests/cpp_tests/test_utilities/model_setup_utilities.h" #include diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_plane_strain_stress_state.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_plane_strain_stress_state.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_plane_strain_stress_state.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_plane_strain_stress_state.cpp index e20668342cb..0907ccc303c 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_plane_strain_stress_state.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_plane_strain_stress_state.cpp @@ -12,8 +12,8 @@ #include "containers/model.h" #include "custom_elements/plane_strain_stress_state.h" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include "tests/cpp_tests/test_utilities/model_setup_utilities.h" #include @@ -120,4 +120,4 @@ KRATOS_TEST_CASE_IN_SUITE(PlaneStrainStressState_GivesCorrectStressTensorSize, K KRATOS_EXPECT_EQ(p_stress_state_policy->GetStressTensorSize(), STRESS_TENSOR_SIZE_2D); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_steady_state_Pw_piping_element.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_steady_state_Pw_piping_element.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_steady_state_Pw_piping_element.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_steady_state_Pw_piping_element.cpp index 5303b7c648c..b541f782894 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_steady_state_Pw_piping_element.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_steady_state_Pw_piping_element.cpp @@ -17,7 +17,7 @@ #include "custom_constitutive/linear_elastic_2D_interface_law.h" #include "custom_elements/plane_strain_stress_state.h" #include "custom_elements/steady_state_Pw_piping_element.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { @@ -167,4 +167,4 @@ KRATOS_TEST_CASE_IN_SUITE(CalculateHeadGradient, KratosGeoMechanicsFastSuiteWith // expected gradient should be 2. Test is failing on purpose to check CI KRATOS_EXPECT_NEAR(expected_gradient, 2, 1.0e-10); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_three_dimensional_stress_state.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_three_dimensional_stress_state.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_three_dimensional_stress_state.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_three_dimensional_stress_state.cpp index 5b98b723fcf..2932a027871 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_three_dimensional_stress_state.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_three_dimensional_stress_state.cpp @@ -12,8 +12,8 @@ #include "containers/model.h" #include "custom_elements/three_dimensional_stress_state.h" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include "tests/cpp_tests/test_utilities/model_setup_utilities.h" #include @@ -133,4 +133,4 @@ KRATOS_TEST_CASE_IN_SUITE(ThreeDimensionalStressState_GivesCorrectStressTensorSi KRATOS_EXPECT_EQ(p_stress_state_policy->GetStressTensorSize(), STRESS_TENSOR_SIZE_3D); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_transient_thermal_element.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_transient_thermal_element.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_transient_thermal_element.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_transient_thermal_element.cpp index 593898af069..3495df05f19 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_transient_thermal_element.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_transient_thermal_element.cpp @@ -13,9 +13,9 @@ #include "containers/model.h" #include "custom_elements/transient_thermal_element.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/triangle_2d_10.h" #include "geometries/triangle_2d_15.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_activate_model_part_operation.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_operations/test_activate_model_part_operation.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_activate_model_part_operation.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_operations/test_activate_model_part_operation.cpp index f28f09f4ed4..ecc91bac9c3 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_activate_model_part_operation.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_operations/test_activate_model_part_operation.cpp @@ -12,10 +12,10 @@ // Project includes #include "containers/model.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/quadrilateral_2d_4.h" #include "includes/expect.h" #include "processes/structured_mesh_generator_process.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" // Application includes #include "custom_operations/activate_model_part_operation.h" diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_deactivate_model_part_operation.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_operations/test_deactivate_model_part_operation.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_deactivate_model_part_operation.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_operations/test_deactivate_model_part_operation.cpp index 2d1f56b905b..ec2f72517b3 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_deactivate_model_part_operation.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_operations/test_deactivate_model_part_operation.cpp @@ -12,10 +12,10 @@ // Project includes #include "containers/model.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/quadrilateral_2d_4.h" #include "includes/expect.h" #include "processes/structured_mesh_generator_process.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" // Application includes #include "custom_operations/deactivate_model_part_operation.h" diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_c_phi_reduction_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_c_phi_reduction_process.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_c_phi_reduction_process.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_c_phi_reduction_process.cpp index 6e893f0c12f..d4cd526bd6b 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_c_phi_reduction_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_c_phi_reduction_process.cpp @@ -12,10 +12,10 @@ // #include "containers/model.h" #include "custom_processes/apply_c_phi_reduction_process.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/quadrilateral_2d_4.h" #include "processes/structured_mesh_generator_process.h" -#include "stub_linear_elastic_law.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/stub_linear_elastic_law.h" #include using namespace Kratos; @@ -200,4 +200,4 @@ KRATOS_TEST_CASE_IN_SUITE(CheckFailureNegativeReductionFactorApplyCPhiReductionP "Reduction factor should not drop below 0.01, calculation stopped."); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_constant_phreatic_multi_line_pressure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_constant_phreatic_multi_line_pressure_process.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_constant_phreatic_multi_line_pressure_process.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_constant_phreatic_multi_line_pressure_process.cpp index 7a449c9d65b..9cc58d522c4 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_constant_phreatic_multi_line_pressure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_constant_phreatic_multi_line_pressure_process.cpp @@ -11,10 +11,10 @@ // #include "containers/model.h" #include "custom_processes/apply_constant_phreatic_multi_line_pressure_process.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/quadrilateral_2d_4.h" #include "includes/checks.h" #include "processes/structured_mesh_generator_process.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; @@ -186,4 +186,4 @@ KRATOS_TEST_CASE_IN_SUITE(ApplyConstantPhreaticMultilinePressureProcess_AppliesC }); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_k0_procedure_process.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_k0_procedure_process.cpp index a38e9d932d5..e1bebae8f6e 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_k0_procedure_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_k0_procedure_process.cpp @@ -12,10 +12,10 @@ #include "containers/model.h" #include "custom_processes/apply_k0_procedure_process.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" #include "includes/element.h" -#include "stub_linear_elastic_law.h" -#include "test_utilities.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/stub_linear_elastic_law.h" +#include "tests/cpp_tests/test_utilities.h" #include #include @@ -32,10 +32,10 @@ class MockConstitutiveLaw : public GeoIncrementalLinearElasticLaw MOCK_METHOD(std::size_t, WorkingSpaceDimension, (), (override)); }; -class StubElement : public Element +class StubElementForK0ProcedureTest : public Element { public: - KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(StubElement); + KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(StubElementForK0ProcedureTest); void CalculateOnIntegrationPoints(const Variable& rVariable, std::vector& rOutput, @@ -63,7 +63,7 @@ Vector ApplyK0ProcedureOnStubElement(const Properties::Pointer& rProperties, con { Model model; auto& r_model_part = model.CreateModelPart("main"); - auto p_element = make_intrusive(); + auto p_element = make_intrusive(); p_element->SetProperties(rProperties); r_model_part.AddElement(p_element); @@ -98,7 +98,7 @@ ModelPart& PrepareTestModelPart(Model& rModel) 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); @@ -415,7 +415,7 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, Krat // Arrange Model model; auto& r_model_part = model.CreateModelPart("main"); - auto p_element = make_intrusive(); + auto p_element = make_intrusive(); p_element->SetId(1); p_element->SetProperties(std::make_shared()); r_model_part.AddElement(p_element); diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_phreatic_multi_line_pressure_table_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_phreatic_multi_line_pressure_table_process.cpp similarity index 96% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_phreatic_multi_line_pressure_table_process.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_phreatic_multi_line_pressure_table_process.cpp index 0bf75282f45..04681140a0c 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_apply_phreatic_multi_line_pressure_table_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_apply_phreatic_multi_line_pressure_table_process.cpp @@ -11,8 +11,8 @@ // #include "containers/model.h" #include "custom_processes/apply_phreatic_multi_line_pressure_table_process.h" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; @@ -77,4 +77,4 @@ KRATOS_TEST_CASE_IN_SUITE(ApplyPhreaticMultiLinePressureTableProcessDoesNotThrow r_model_part, test_parameters)) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_calculate_incremental_displacement_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_calculate_incremental_displacement_process.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_calculate_incremental_displacement_process.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_calculate_incremental_displacement_process.cpp index 2f238333a4d..fa955b0fc4e 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_calculate_incremental_displacement_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_calculate_incremental_displacement_process.cpp @@ -12,7 +12,7 @@ #include "custom_processes/calculate_incremental_displacement_process.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_geo_extrapolate_integration_point_values_to_nodes_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_geo_extrapolate_integration_point_values_to_nodes_process.cpp similarity index 86% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_geo_extrapolate_integration_point_values_to_nodes_process.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_geo_extrapolate_integration_point_values_to_nodes_process.cpp index da0036718a2..e3a965df896 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_geo_extrapolate_integration_point_values_to_nodes_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_geo_extrapolate_integration_point_values_to_nodes_process.cpp @@ -13,18 +13,21 @@ #include "containers/model.h" #include "custom_processes/geo_extrapolate_integration_point_values_to_nodes_process.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/quadrilateral_2d_4.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { -class StubElement : public Element +class StubElementForNodalExtrapolationTest : public Element { public: - KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(StubElement); + KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(StubElementForNodalExtrapolationTest); - StubElement(IndexType NewId, GeometryType::Pointer pGeometry) : Element(NewId, pGeometry) {} + StubElementForNodalExtrapolationTest(IndexType NewId, GeometryType::Pointer pGeometry) + : Element(NewId, pGeometry) + { + } void CalculateOnIntegrationPoints(const Variable& rVariable, std::vector& rOutput, @@ -83,11 +86,11 @@ ModelPart& CreateModelPartWithTwoStubElements(Model& model) auto node_6 = model_part.CreateNewNode(6, 2.0, 1.0, 0.0); auto geometry_1 = std::make_shared>(node_1, node_2, node_3, node_4); - auto element_1 = Kratos::make_intrusive(1, geometry_1); + auto element_1 = Kratos::make_intrusive(1, geometry_1); model_part.AddElement(element_1); auto geometry_2 = std::make_shared>(node_2, node_5, node_6, node_3); - auto element_2 = Kratos::make_intrusive(2, geometry_2); + auto element_2 = Kratos::make_intrusive(2, geometry_2); model_part.AddElement(element_2); return model_part; @@ -134,8 +137,10 @@ KRATOS_TEST_CASE_IN_SUITE(TestExtrapolationProcess_ExtrapolatesCorrectlyForConst Model model; auto& model_part = CreateModelPartWithTwoStubElements(model); - dynamic_cast(model_part.Elements()[1]).mIntegrationDoubleValues = {1.0, 1.0, 1.0, 1.0}; - dynamic_cast(model_part.Elements()[2]).mIntegrationDoubleValues = {1.0, 1.0, 1.0, 1.0}; + dynamic_cast(model_part.Elements()[1]).mIntegrationDoubleValues = { + 1.0, 1.0, 1.0, 1.0}; + dynamic_cast(model_part.Elements()[2]).mIntegrationDoubleValues = { + 1.0, 1.0, 1.0, 1.0}; auto parameters = Parameters(R"( { @@ -163,8 +168,10 @@ KRATOS_TEST_CASE_IN_SUITE(TestExtrapolationProcess_ExtrapolatesCorrectlyForTwoCo Model model; auto& model_part = CreateModelPartWithTwoStubElements(model); - dynamic_cast(model_part.Elements()[1]).mIntegrationDoubleValues = {1.0, 1.0, 1.0, 1.0}; - dynamic_cast(model_part.Elements()[2]).mIntegrationDoubleValues = {2.0, 2.0, 2.0, 2.0}; + dynamic_cast(model_part.Elements()[1]).mIntegrationDoubleValues = { + 1.0, 1.0, 1.0, 1.0}; + dynamic_cast(model_part.Elements()[2]).mIntegrationDoubleValues = { + 2.0, 2.0, 2.0, 2.0}; auto parameters = Parameters(R"( { @@ -196,11 +203,11 @@ KRATOS_TEST_CASE_IN_SUITE(TestExtrapolationProcess_ExtrapolatesCorrectlyForLinea auto& model_part = CreateModelPartWithTwoStubElements(model); // Linear field in x between -1 and 1 - dynamic_cast(model_part.Elements()[1]).mIntegrationDoubleValues = { + dynamic_cast(model_part.Elements()[1]).mIntegrationDoubleValues = { -0.57735, 0.57735, 0.57735, -0.57735}; // Linear field in y between -1 and 1 - dynamic_cast(model_part.Elements()[2]).mIntegrationDoubleValues = { + dynamic_cast(model_part.Elements()[2]).mIntegrationDoubleValues = { -0.57735, -0.57735, 0.57735, 0.57735}; auto parameters = Parameters(R"( @@ -232,12 +239,12 @@ KRATOS_TEST_CASE_IN_SUITE(TestExtrapolationProcess_ExtrapolatesMatrixCorrectlyFo auto& model_part = CreateModelPartWithTwoStubElements(model); // Linear field in x between -1 and 1 - dynamic_cast(model_part.Elements()[1]).mIntegrationMatrixValues = { + dynamic_cast(model_part.Elements()[1]).mIntegrationMatrixValues = { ScalarMatrix(3, 3, -0.57735), ScalarMatrix(3, 3, 0.57735), ScalarMatrix(3, 3, 0.57735), ScalarMatrix(3, 3, -0.57735)}; // Linear field in y between -1 and 1 - dynamic_cast(model_part.Elements()[2]).mIntegrationMatrixValues = { + dynamic_cast(model_part.Elements()[2]).mIntegrationMatrixValues = { ScalarMatrix(3, 3, -0.57735), ScalarMatrix(3, 3, -0.57735), ScalarMatrix(3, 3, 0.57735), ScalarMatrix(3, 3, 0.57735)}; @@ -276,12 +283,12 @@ KRATOS_TEST_CASE_IN_SUITE(TestExtrapolationProcess_ExtrapolatesVectorCorrectlyFo auto& model_part = CreateModelPartWithTwoStubElements(model); // Linear field in x between -1 and 1 - dynamic_cast(model_part.Elements()[1]).mIntegrationVectorValues = { + dynamic_cast(model_part.Elements()[1]).mIntegrationVectorValues = { ScalarVector(6, -0.57735), ScalarVector(6, 0.57735), ScalarVector(6, 0.57735), ScalarVector(6, -0.57735)}; // Linear field in y between -1 and 1 - dynamic_cast(model_part.Elements()[2]).mIntegrationVectorValues = { + dynamic_cast(model_part.Elements()[2]).mIntegrationVectorValues = { ScalarVector(6, -0.57735), ScalarVector(6, -0.57735), ScalarVector(6, 0.57735), ScalarVector(6, 0.57735)}; auto parameters = Parameters(R"( @@ -319,12 +326,12 @@ KRATOS_TEST_CASE_IN_SUITE(TestExtrapolationProcess_ExtrapolatesArrayCorrectlyFor auto& model_part = CreateModelPartWithTwoStubElements(model); // Linear field in x between -1 and 1 - dynamic_cast(model_part.Elements()[1]).mIntegrationArrayValues = { + dynamic_cast(model_part.Elements()[1]).mIntegrationArrayValues = { ScalarVector(3, -0.57735), ScalarVector(3, 0.57735), ScalarVector(3, 0.57735), ScalarVector(3, -0.57735)}; // Linear field in y between -1 and 1 - dynamic_cast(model_part.Elements()[2]).mIntegrationArrayValues = { + dynamic_cast(model_part.Elements()[2]).mIntegrationArrayValues = { ScalarVector(3, -0.57735), ScalarVector(3, -0.57735), ScalarVector(3, 0.57735), ScalarVector(3, 0.57735)}; auto parameters = Parameters(R"( diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_reset_displacement_process.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_reset_displacement_process.cpp index bf1db91bdd6..f669ccf0543 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_reset_displacement_process.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_processes/test_reset_displacement_process.cpp @@ -37,12 +37,13 @@ class StubConstitutiveLaw : public ConstitutiveLaw SizeType GetStrainSize() const override { return 4; } }; -class StubElement : public Element +class StubElementForResetDisplacementTest : public Element { public: - KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(StubElement); + KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(StubElementForResetDisplacementTest); - StubElement(IndexType NewId, const GeometryType::Pointer& pGeometry) : Element(NewId, pGeometry) + StubElementForResetDisplacementTest(IndexType NewId, const GeometryType::Pointer& pGeometry) + : Element(NewId, pGeometry) { mConstitutiveLaws = std::vector(3, make_shared()); } @@ -92,7 +93,7 @@ ModelPart& CreateModelPartWithAStubElement(Model& rModel) auto node_3 = model_part.CreateNewNode(3, 1.0, 1.0, 0.0); auto geometry = std::make_shared>(node_1, node_2, node_3); - model_part.AddElement(make_intrusive(1, geometry)); + model_part.AddElement(make_intrusive(1, geometry)); return model_part; } diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_Pw_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_Pw_scheme.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_Pw_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_Pw_scheme.cpp index 273a9bc670d..263e0483e90 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_Pw_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_Pw_scheme.cpp @@ -11,8 +11,8 @@ // #include "custom_strategies/schemes/backward_euler_quasistatic_Pw_scheme.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; using SparseSpaceType = UblasSpace; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_T_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_T_scheme.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_T_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_T_scheme.cpp index 3c4f9397105..1374af3093e 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_T_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_T_scheme.cpp @@ -11,8 +11,8 @@ // #include "custom_strategies/schemes/backward_euler_T_scheme.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { @@ -124,4 +124,4 @@ KRATOS_TEST_CASE_IN_SUITE(ForMissingTemperatureSolutionStepVariable_CheckBackwar "TEMPERATURE variable is not allocated for node 0") } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_UPw_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_UPw_scheme.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_UPw_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_UPw_scheme.cpp index d01f58659b2..5be0dc61e5e 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_backward_euler_UPw_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_backward_euler_UPw_scheme.cpp @@ -12,8 +12,8 @@ #include "containers/model.h" #include "custom_strategies/schemes/backward_euler_quasistatic_U_Pw_scheme.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_generalized_newmark_T_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_generalized_newmark_T_scheme.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_generalized_newmark_T_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_generalized_newmark_T_scheme.cpp index f9f2948017f..da601592d4c 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_generalized_newmark_T_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_generalized_newmark_T_scheme.cpp @@ -11,8 +11,8 @@ // #include "custom_strategies/schemes/generalized_newmark_T_scheme.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; using SparseSpaceType = UblasSpace; @@ -145,4 +145,4 @@ KRATOS_TEST_CASE_IN_SUITE(InitializeNewmarkTScheme_SetsTimeFactors, KratosGeoMec KRATOS_EXPECT_DOUBLE_EQ(model_part.GetProcessInfo()[DT_TEMPERATURE_COEFFICIENT], 1.0 / (theta * delta_time)); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_generalized_newmark_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_generalized_newmark_scheme.cpp similarity index 96% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_generalized_newmark_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_generalized_newmark_scheme.cpp index 88a9b3d5450..8ef9b941a25 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_generalized_newmark_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_generalized_newmark_scheme.cpp @@ -11,8 +11,8 @@ // #include "custom_strategies/schemes/generalized_newmark_scheme.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; using SparseSpaceType = UblasSpace; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_geo_mechanics_newton_rapson_erosion_processs_strategy.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_geo_mechanics_newton_rapson_erosion_processs_strategy.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_geo_mechanics_newton_rapson_erosion_processs_strategy.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_geo_mechanics_newton_rapson_erosion_processs_strategy.cpp index bbe6e65e069..16f3505e254 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_geo_mechanics_newton_rapson_erosion_processs_strategy.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_geo_mechanics_newton_rapson_erosion_processs_strategy.cpp @@ -12,8 +12,8 @@ // Project includes #include "custom_strategies/strategies/geo_mechanics_newton_raphson_erosion_process_strategy.hpp" -#include "geo_mechanics_fast_suite.h" -#include "test_utilities.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/test_utilities.h" #include #include @@ -213,4 +213,4 @@ KRATOS_TEST_CASE_IN_SUITE(CheckFinalizeSolutionStep, KratosGeoMechanicsFastSuite KRATOS_EXPECT_NEAR(elements[2].GetValue(PIPE_HEIGHT), expected_inactive_pipe_height, Defaults::relative_tolerance); KRATOS_EXPECT_NEAR(elements[3].GetValue(PIPE_HEIGHT), expected_inactive_pipe_height, Defaults::relative_tolerance); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_geomechanics_time_integration_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_geomechanics_time_integration_scheme.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_geomechanics_time_integration_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_geomechanics_time_integration_scheme.cpp index b824ddc9833..238393b65c2 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_geomechanics_time_integration_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_geomechanics_time_integration_scheme.cpp @@ -10,13 +10,13 @@ // Main authors: Richard Faasse // -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include "containers/model.h" #include "custom_strategies/schemes/geomechanics_time_integration_scheme.hpp" #include "spaces/ublas_space.h" -#include "test_utilities/spy_condition.h" -#include "test_utilities/spy_element.h" +#include "tests/cpp_tests/test_utilities/spy_condition.h" +#include "tests/cpp_tests/test_utilities/spy_element.h" using namespace Kratos; using SparseSpaceType = UblasSpace; @@ -264,4 +264,4 @@ KRATOS_TEST_CASE_IN_SUITE(GeoMechanicsTimeIntegrationScheme_GivesCorrectDofs_Whe TestUpdateForNumberOfThreads(2); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_Pw_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_Pw_scheme.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_Pw_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_Pw_scheme.cpp index 1434e432eed..893d8ea0d7d 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_Pw_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_Pw_scheme.cpp @@ -11,8 +11,8 @@ // #include "custom_strategies/schemes/newmark_quasistatic_Pw_scheme.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; using SparseSpaceType = UblasSpace; @@ -149,4 +149,4 @@ KRATOS_TEST_CASE_IN_SUITE(InitializeNewmarkPwScheme_SetsTimeFactors, KratosGeoMe KRATOS_EXPECT_DOUBLE_EQ(model_part.GetProcessInfo()[DT_PRESSURE_COEFFICIENT], 1.0 / (theta * delta_time)); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_dynamic_U_Pw_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_dynamic_U_Pw_scheme.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_dynamic_U_Pw_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_dynamic_U_Pw_scheme.cpp index 9114bda561e..75f40eb0ee5 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_dynamic_U_Pw_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_dynamic_U_Pw_scheme.cpp @@ -11,8 +11,8 @@ // #include "custom_strategies/schemes/newmark_dynamic_U_Pw_scheme.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { @@ -296,4 +296,4 @@ KRATOS_TEST_CASE_IN_SUITE(NewmarkDynamicUPwSchemeUpdate_DoesNotUpdateFixedScalar KRATOS_EXPECT_DOUBLE_EQ(actual_dt_water_pressure, expected_dt_water_pressure); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_quasistatic_U_Pw_scheme.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_quasistatic_U_Pw_scheme.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_quasistatic_U_Pw_scheme.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_quasistatic_U_Pw_scheme.cpp index a91f1b59487..64356296b7c 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_newmark_quasistatic_U_Pw_scheme.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_strategies/test_newmark_quasistatic_U_Pw_scheme.cpp @@ -10,12 +10,12 @@ // Main authors: Richard Faasse // -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include "custom_strategies/schemes/newmark_quasistatic_U_Pw_scheme.hpp" #include "spaces/ublas_space.h" -#include "test_utilities/spy_condition.h" -#include "test_utilities/spy_element.h" +#include "tests/cpp_tests/test_utilities/spy_condition.h" +#include "tests/cpp_tests/test_utilities/spy_element.h" namespace Kratos::Testing { @@ -170,4 +170,4 @@ KRATOS_TEST_CASE_IN_SUITE(ForInvalidGamma_CheckNewmarkUPwScheme_Throws, KratosGe "Gamma must be larger than zero, but got -2.5") } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_Hencky_strain.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_Hencky_strain.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_Hencky_strain.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_Hencky_strain.cpp index b0198f86ba1..613aa50291d 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_Hencky_strain.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_Hencky_strain.cpp @@ -12,7 +12,7 @@ #include "custom_utilities/math_utilities.h" #include "custom_utilities/stress_strain_utilities.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; @@ -97,4 +97,4 @@ KRATOS_TEST_CASE_IN_SUITE(CheckHenckyStrainPureShear, KratosGeoMechanicsFastSuit KRATOS_EXPECT_DOUBLE_EQ(2.0 * EHenckyAnalytical(1, 0), Evector(3)); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_builder_and_solver_factory.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_builder_and_solver_factory.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_builder_and_solver_factory.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_builder_and_solver_factory.cpp index 4083caaab2f..c40b2f29239 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_builder_and_solver_factory.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_builder_and_solver_factory.cpp @@ -11,9 +11,9 @@ // #include "custom_utilities/builder_and_solver_factory.hpp" -#include "geo_mechanics_fast_suite.h" #include "linear_solvers/linear_solver.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; using SparseSpaceType = UblasSpace; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_compressibility_matrix.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_compressibility_matrix.cpp similarity index 96% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_compressibility_matrix.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_compressibility_matrix.cpp index fbdeca13738..54aec220935 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_compressibility_matrix.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_compressibility_matrix.cpp @@ -12,8 +12,8 @@ #include "containers/model.h" #include "custom_utilities/transport_equation_utilities.hpp" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include using namespace Kratos; @@ -66,4 +66,4 @@ KRATOS_TEST_CASE_IN_SUITE(Calculatecompressibility_matrix3D4NGivesCorrectResults KRATOS_CHECK_MATRIX_NEAR(compressibility_matrix, expected_compressibility_matrix, 1e-12) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_constitutive_law_set6.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_constitutive_law_utilities.cpp similarity index 95% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_constitutive_law_set6.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_constitutive_law_utilities.cpp index aadeddbeb89..dfbda408a4e 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_constitutive_law_set6.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_constitutive_law_utilities.cpp @@ -11,8 +11,8 @@ // #include "custom_utilities/constitutive_law_utilities.hpp" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include using namespace Kratos; @@ -50,4 +50,4 @@ KRATOS_TEST_CASE_IN_SUITE(SetSixConstitutiveParametersCorrectResults, KratosGeoM KRATOS_CHECK_NEAR(ConstitutiveParameters.GetDeterminantF(), determinant_of_F, 1e-12); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_convergence_criteria_factory.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_convergence_criteria_factory.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_convergence_criteria_factory.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_convergence_criteria_factory.cpp index a08c1e3260c..861d917a25f 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_convergence_criteria_factory.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_convergence_criteria_factory.cpp @@ -11,8 +11,8 @@ // #include "custom_utilities/convergence_criteria_factory.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; using SparseSpaceType = UblasSpace; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_coupling_matrix.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_coupling_matrix.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_coupling_matrix.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_coupling_matrix.cpp index f838f0f9c39..5affff6d0fc 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_coupling_matrix.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_coupling_matrix.cpp @@ -12,8 +12,8 @@ #include "containers/model.h" #include "custom_utilities/transport_equation_utilities.hpp" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include using namespace Kratos; @@ -109,4 +109,4 @@ KRATOS_TEST_CASE_IN_SUITE(CalculateCouplingMatrix3D4NGivesCorrectResults, Kratos KRATOS_CHECK_MATRIX_NEAR(coupling_matrix, expected_coupling_matrix, 1e-12) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_dof_utilities.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_dof_utilities.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_dof_utilities.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_dof_utilities.cpp index b40e621ed22..0ebd50864c9 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_dof_utilities.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_dof_utilities.cpp @@ -20,9 +20,9 @@ #include "custom_utilities/dof_utilities.h" #include "geo_aliases.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" #include "includes/element.h" -#include "test_utilities/model_setup_utilities.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/test_utilities/model_setup_utilities.h" namespace { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_equation_of_motion.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_equation_of_motion.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_equation_of_motion.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_equation_of_motion.cpp index 30d8d07adb0..a2f3eb3251a 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_equation_of_motion.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_equation_of_motion.cpp @@ -13,7 +13,7 @@ #include "custom_constitutive/linear_elastic_2D_interface_law.h" #include "custom_utilities/equation_of_motion_utilities.h" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include "tests/cpp_tests/test_utilities.h" #include "tests/cpp_tests/test_utilities/model_setup_utilities.h" @@ -270,4 +270,4 @@ KRATOS_TEST_CASE_IN_SUITE(CalculatingTheInternalForceVectorFailsWhenTheMatrixVec #endif -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_fluid_pressure.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_fluid_pressure.cpp similarity index 91% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_fluid_pressure.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_fluid_pressure.cpp index dc3a284ce19..94bd36fcca4 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_fluid_pressure.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_fluid_pressure.cpp @@ -12,8 +12,8 @@ #include "boost/numeric/ublas/assignment.hpp" #include "custom_utilities/transport_equation_utilities.hpp" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; @@ -33,4 +33,4 @@ KRATOS_TEST_CASE_IN_SUITE(CalculateFluidPressureGivesCorrectResults, KratosGeoMe KRATOS_CHECK_NEAR(fluid_pressure, expected_value, 1e-12); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_linear_nodal_extrapolator.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_linear_nodal_extrapolator.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_linear_nodal_extrapolator.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_linear_nodal_extrapolator.cpp index a9fb6a5a55a..bb437732375 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_linear_nodal_extrapolator.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_linear_nodal_extrapolator.cpp @@ -11,11 +11,11 @@ // #include "custom_utilities/linear_nodal_extrapolator.h" -#include "geo_mechanics_fast_suite.h" #include "geometries/quadrilateral_2d_4.h" #include "geometries/quadrilateral_2d_8.h" #include "geometries/triangle_2d_3.h" #include "geometries/triangle_2d_6.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include namespace Kratos::Testing @@ -125,4 +125,4 @@ KRATOS_TEST_CASE_IN_SUITE(NodalExtrapolator_GivesCorrectExtrapolationMatrix_For2 KRATOS_EXPECT_MATRIX_NEAR(extrapolation_matrix, expected_extrapolation_matrix, 1e-6) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_node_utilities.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_node_utilities.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_node_utilities.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_node_utilities.cpp index 986706cc704..67fcc129bc0 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_node_utilities.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_node_utilities.cpp @@ -10,9 +10,9 @@ // Main authors: Richard Faasse // #include "custom_utilities/node_utilities.h" -#include "geo_mechanics_fast_suite.h" #include "includes/node.h" #include "includes/variables.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_permeability_matrix.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_permeability_matrix.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_permeability_matrix.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_permeability_matrix.cpp index b7152efb65c..669c6393e4c 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_permeability_matrix.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_permeability_matrix.cpp @@ -12,8 +12,8 @@ #include "containers/model.h" #include "custom_utilities/transport_equation_utilities.hpp" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include using namespace Kratos; @@ -90,4 +90,4 @@ KRATOS_TEST_CASE_IN_SUITE(CalculatePermeabilityMatrix3D4NGivesCorrectResults, Kr KRATOS_CHECK_MATRIX_NEAR(PermeabilityMatrix, PMatrix, 1e-12) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_process_factory.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_process_factory.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_process_factory.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_process_factory.cpp index 65f73caf6e9..d720d807726 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_process_factory.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_process_factory.cpp @@ -12,7 +12,7 @@ // #include "custom_utilities/process_factory.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_process_info_parser.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_process_info_parser.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_process_info_parser.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_process_info_parser.cpp index 672e290c5ac..cbdad872d79 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_process_info_parser.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_process_info_parser.cpp @@ -11,7 +11,7 @@ // #include "custom_utilities/json_process_info_parser.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; @@ -145,4 +145,4 @@ KRATOS_TEST_CASE_IN_SUITE(GetProcessList_ReturnsEmptyList_WhenNoProcessesAreDefi KRATOS_EXPECT_TRUE(parser.GetProcessList(Parameters{}).empty()) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_scheme_factory.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_scheme_factory.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_scheme_factory.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_scheme_factory.cpp index 808dc5b922a..b1794b007f0 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_scheme_factory.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_scheme_factory.cpp @@ -11,8 +11,8 @@ // #include "custom_utilities/scheme_factory.hpp" -#include "geo_mechanics_fast_suite.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_soil_density.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_soil_density.cpp similarity index 93% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_soil_density.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_soil_density.cpp index 74faa6ef3ce..e610d539c43 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_soil_density.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_soil_density.cpp @@ -11,8 +11,8 @@ // #include "custom_utilities/transport_equation_utilities.hpp" -#include "geo_mechanics_fast_suite.h" #include "includes/checks.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; @@ -38,4 +38,4 @@ KRATOS_TEST_CASE_IN_SUITE(CalculateSoilDensityGivesCorrectResults, KratosGeoMech KRATOS_CHECK_NEAR(soil_density, expected_value, 1e-12); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_solving_strategy_factory.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_solving_strategy_factory.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_solving_strategy_factory.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_solving_strategy_factory.cpp index 08d5695b4f4..ea0cc755a8f 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_solving_strategy_factory.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_solving_strategy_factory.cpp @@ -12,7 +12,7 @@ #include "containers/model.h" #include "custom_utilities/solving_strategy_factory.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_stress_strain_utitlities.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_stress_strain_utitlities.cpp similarity index 98% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_stress_strain_utitlities.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_stress_strain_utitlities.cpp index 6587da6c706..8b45edc8850 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_stress_strain_utitlities.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_stress_strain_utitlities.cpp @@ -13,7 +13,7 @@ #include "custom_utilities/math_utilities.h" #include "custom_utilities/stress_strain_utilities.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include "utilities/math_utils.h" #include @@ -190,4 +190,4 @@ KRATOS_TEST_CASE_IN_SUITE(CheckCalculateStrains, KratosGeoMechanicsFastSuiteWith KRATOS_EXPECT_VECTOR_NEAR(strains[i], expected_strains[i], 1.E-6) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_transport_equation_utilities.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_transport_equation_utilities.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_transport_equation_utilities.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_transport_equation_utilities.cpp index 5654072b439..9933d44ad88 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_transport_equation_utilities.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_transport_equation_utilities.cpp @@ -11,7 +11,7 @@ // #include "custom_utilities/transport_equation_utilities.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include namespace @@ -212,4 +212,4 @@ KRATOS_TEST_CASE_IN_SUITE(PermeabilityUpdateFactorIsComputedFromStrainsAndProper expected_factors, 1e-5) } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_variables_utilities.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_variables_utilities.cpp similarity index 92% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_variables_utilities.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_variables_utilities.cpp index 9c9b3064d6d..cd9755b96ed 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_variables_utilities.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_utilities/test_variables_utilities.cpp @@ -10,8 +10,8 @@ // Main authors: Richard Faasse // #include "custom_utilities/variables_utilities.hpp" -#include "geo_mechanics_fast_suite.h" #include "includes/variables.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { @@ -30,4 +30,4 @@ KRATOS_TEST_CASE_IN_SUITE(TestVariablesUtilitiesThrowsWhenComponentDoesNotExist, "Error: The component \"ACCELERATION_?\" is not registered!") } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_GeoMechanicsNewtonRaphsonErosionProcessStrategy.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_GeoMechanicsNewtonRaphsonErosionProcessStrategy.cpp similarity index 97% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_GeoMechanicsNewtonRaphsonErosionProcessStrategy.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_GeoMechanicsNewtonRaphsonErosionProcessStrategy.cpp index 91f34993d3d..5bf740423fd 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_GeoMechanicsNewtonRaphsonErosionProcessStrategy.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_GeoMechanicsNewtonRaphsonErosionProcessStrategy.cpp @@ -15,8 +15,8 @@ /* Project includes */ #include "custom_workflows/dgeoflow.h" -#include "flow_stubs.h" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/flow_stubs.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace Kratos::Testing { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_dgeosettlement.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_dgeosettlement.cpp similarity index 96% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_dgeosettlement.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_dgeosettlement.cpp index 5e1c9a5c74e..c20dbad7950 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_dgeosettlement.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_dgeosettlement.cpp @@ -11,10 +11,10 @@ // #include "custom_workflows/dgeosettlement.h" -#include "geo_mechanics_fast_suite.h" -#include "stub_input_utility.h" -#include "stub_process_info_parser.h" -#include "stub_time_loop_executor.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/stub_input_utility.h" +#include "tests/cpp_tests/stub_process_info_parser.h" +#include "tests/cpp_tests/stub_time_loop_executor.h" using namespace Kratos; @@ -168,4 +168,4 @@ KRATOS_TEST_CASE_IN_SUITE(RunStage_PassesTheCorrectProcessReferences, KratosGeoM RunStage(settlement); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_head_extrapolation_flow_workflow.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_head_extrapolation_flow_workflow.cpp similarity index 95% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_head_extrapolation_flow_workflow.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_head_extrapolation_flow_workflow.cpp index 642f6bec660..ea138e05a95 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_head_extrapolation_flow_workflow.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_head_extrapolation_flow_workflow.cpp @@ -15,9 +15,9 @@ // Project includes #include "custom_workflows/dgeoflow.h" -#include "flow_stubs.h" -#include "geo_mechanics_fast_suite.h" -#include "test_utilities.h" +#include "tests/cpp_tests/flow_stubs.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/test_utilities.h" namespace { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_prescribed_time_incrementor.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_prescribed_time_incrementor.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_prescribed_time_incrementor.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_prescribed_time_incrementor.cpp index 9b88bb05a1f..a5f223c9e70 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_prescribed_time_incrementor.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_prescribed_time_incrementor.cpp @@ -13,7 +13,7 @@ #include "custom_workflows/prescribed_time_incrementor.h" #include "custom_workflows/time_step_end_state.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_solving_strategy_wrapper.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_solving_strategy_wrapper.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_solving_strategy_wrapper.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_solving_strategy_wrapper.cpp index 01d6a5391c8..1bf8d56008d 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_solving_strategy_wrapper.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_solving_strategy_wrapper.cpp @@ -14,9 +14,9 @@ #include "custom_utilities/solving_strategy_factory.hpp" #include "custom_workflows/solving_strategy_wrapper.hpp" #include "geo_mechanics_application_variables.h" -#include "geo_mechanics_fast_suite.h" #include "linear_solvers/linear_solver.h" #include "spaces/ublas_space.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" namespace { diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_time_incrementor.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_incrementor.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_time_incrementor.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_incrementor.cpp index 45693bf8bdf..4cae98e80a2 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_time_incrementor.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_incrementor.cpp @@ -13,7 +13,7 @@ #include "custom_workflows/adaptive_time_incrementor.h" #include "custom_workflows/time_step_end_state.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" using namespace Kratos; diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_time_loop_executor.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_loop_executor.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_time_loop_executor.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_loop_executor.cpp index e2b69e6ff6e..53dd7b7b54a 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_time_loop_executor.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_loop_executor.cpp @@ -15,7 +15,7 @@ #include "custom_workflows/prescribed_time_incrementor.h" #include "custom_workflows/time_loop_executor.hpp" #include "custom_workflows/time_step_end_state.hpp" -#include "geo_mechanics_fast_suite.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include @@ -389,4 +389,4 @@ KRATOS_TEST_CASE_IN_SUITE(ExpectOutputIsInitializedAndFinalizedWhenRunThrows, Kr KRATOS_EXPECT_EQ(solver_strategy->GetCountFinalizeOutputCalled(), 1); } -} // namespace Kratos::Testing \ No newline at end of file +} // namespace Kratos::Testing diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_time_stepping.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_stepping.cpp similarity index 99% rename from applications/GeoMechanicsApplication/tests/cpp_tests/test_time_stepping.cpp rename to applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_stepping.cpp index 3447e8918f1..71cd2bdd759 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_time_stepping.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/custom_workflows/test_time_stepping.cpp @@ -13,8 +13,8 @@ #include "custom_workflows/strategy_wrapper.hpp" #include "custom_workflows/time_step_executor.h" -#include "geo_mechanics_fast_suite.h" #include "solving_strategies/strategies/solving_strategy.h" +#include "tests/cpp_tests/geo_mechanics_fast_suite.h" #include