Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORE] Correcting hexahedron quadrature Lobatto #12917

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions kratos/integration/hexahedron_gauss_lobatto_integration_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class HexahedronGaussLobattoIntegrationPoints1
static const IntegrationPointsArrayType& IntegrationPoints()
{
static const IntegrationPointsArrayType s_integration_points{{
IntegrationPointType( -1.00 , -1.00, 0.00, 1.00 ),
IntegrationPointType( 1.00 , -1.00, 0.00, 1.00 ),
IntegrationPointType( 1.00 , 1.00, 0.00, 1.00 ),
IntegrationPointType( -1.00 , 1.00, 0.00, 1.00 )
IntegrationPointType( -1.0 , -1.0, 0.0, 1.0 ),
IntegrationPointType( 1.0 , -1.0, 0.0, 1.0 ),
IntegrationPointType( 1.0 , 1.0, 0.0, 1.0 ),
IntegrationPointType( -1.0 , 1.0, 0.0, 1.0 )
}};
return s_integration_points;
}
Expand Down Expand Up @@ -90,14 +90,14 @@ class HexahedronGaussLobattoIntegrationPoints2
static const IntegrationPointsArrayType& IntegrationPoints()
{
static const IntegrationPointsArrayType s_integration_points{{
IntegrationPointType( -1.00 , -1.00, -1.00, 0.50 ),
IntegrationPointType( 1.00 , -1.00, -1.00, 0.50 ),
IntegrationPointType( 1.00 , 1.00, -1.00, 0.50 ),
IntegrationPointType( -1.00 , 1.00, -1.00, 0.50 ),
IntegrationPointType( -1.00 , -1.00, 1.00, 0.50 ),
IntegrationPointType( 1.00 , -1.00, 1.00, 0.50 ),
IntegrationPointType( 1.00 , 1.00, 1.00, 0.50 ),
IntegrationPointType( -1.00 , 1.00, 1.00, 0.50 )
IntegrationPointType( -1.0 , -1.0, -1.0, 1.0 ),
IntegrationPointType( 1.0 , -1.0, -1.0, 1.0 ),
IntegrationPointType( 1.0 , 1.0, -1.0, 1.0 ),
IntegrationPointType( -1.0 , 1.0, -1.0, 1.0 ),
IntegrationPointType( -1.0 , -1.0, 1.0, 1.0 ),
IntegrationPointType( 1.0 , -1.0, 1.0, 1.0 ),
IntegrationPointType( 1.0 , 1.0, 1.0, 1.0 ),
IntegrationPointType( -1.0 , 1.0, 1.0, 1.0 )
}};
return s_integration_points;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// Project includes
#include "testing/testing.h"
#include "integration/quadrilateral_gauss_lobatto_integration_points.h"
#include "integration/hexahedron_gauss_lobatto_integration_points.h"

namespace Kratos::Testing
{
Expand Down Expand Up @@ -75,5 +76,31 @@ KRATOS_TEST_CASE_IN_SUITE(GaussLobattoQuadrilateralQuadraturesTest, KratosCoreFa

}

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();

// Analytical results, reference
const double integral_f = 40.0;

double quadrature_integral_f = 0.0;

// Integral for f with Lobatto 1
for (IndexType IP = 0; IP < r_lobatto.IntegrationPoints().size(); ++IP) {
const auto& r_IP = r_lobatto.IntegrationPoints()[IP];
const double X = r_IP.X();
const double Y = r_IP.Y();
const double Z = r_IP.Z();
const double w = r_IP.Weight();

quadrature_integral_f += w * (X + Y + Z + 5.0);
}

KRATOS_CHECK_NEAR(quadrature_integral_f, integral_f, 1.0E-6);
}

} // namespace Kratos::Testing
Loading