Skip to content

Commit

Permalink
Merge pull request #12917 from KratosMultiphysics/correcting-hexa-qua…
Browse files Browse the repository at this point in the history
…drature-lobatto

[CORE] Correcting hexahedron quadrature Lobatto
  • Loading branch information
AlejandroCornejo authored Dec 9, 2024
2 parents 88697ed + 66df33a commit 888e7b3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
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

0 comments on commit 888e7b3

Please sign in to comment.