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] Adding new Lobatto quadratures to linear geometries #12918

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions kratos/geometries/geometry_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
7 changes: 5 additions & 2 deletions kratos/geometries/hexahedra_3d_8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,7 @@ template<class TPointType> class Hexahedra3D8 : public Geometry<TPointType>
Quadrature < HexahedronGaussLegendreIntegrationPoints4, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < HexahedronGaussLegendreIntegrationPoints5, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < HexahedronGaussLobattoIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
rubenzorrilla marked this conversation as resolved.
Show resolved Hide resolved
Quadrature < HexahedronGaussLobattoIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints()
}
};
Expand All @@ -1467,7 +1468,8 @@ template<class TPointType> class Hexahedra3D8 : public Geometry<TPointType>
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_5 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 )
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_LOBATTO_1 )
}
};
return shape_functions_values;
Expand All @@ -1488,7 +1490,8 @@ template<class TPointType> class Hexahedra3D8 : public Geometry<TPointType>
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_5 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 )
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ),
Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 )
}
};
return shape_functions_local_gradients;
Expand Down
12 changes: 9 additions & 3 deletions kratos/geometries/quadrilateral_2d_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
{
Expand Down Expand Up @@ -1053,6 +1054,8 @@ template<class TPointType> class Quadrilateral2D4
Quadrature < QuadrilateralCollocationIntegrationPoints4,
2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < QuadrilateralCollocationIntegrationPoints5,
2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < QuadrilateralGaussLobattoIntegrationPoints2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Quadrature < QuadrilateralGaussLobattoIntegrationPoints2,
Quadrature < QuadrilateralGaussLobattoIntegrationPoints1,

2, IntegrationPoint<3> >::GenerateIntegrationPoints()
}
};
Expand Down Expand Up @@ -1086,7 +1089,9 @@ template<class TPointType> class Quadrilateral2D4
Quadrilateral2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ),
Quadrilateral2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 )
GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ),
Quadrilateral2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_LOBATTO_1 )
}
};
return shape_functions_values;
Expand All @@ -1111,6 +1116,7 @@ template<class TPointType> class Quadrilateral2D4
Quadrilateral2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ),
Quadrilateral2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ),
Quadrilateral2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ),
Quadrilateral2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ),
}
};
return shape_functions_local_gradients;
Expand Down
15 changes: 11 additions & 4 deletions kratos/geometries/tetrahedra_3d_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -1857,6 +1858,8 @@ template<class TPointType> class Tetrahedra3D4 : public Geometry<TPointType>
3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature<TetrahedronGaussLegendreIntegrationPoints5,
3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature<TetrahedronGaussLobattoIntegrationPoints1,
3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
}
};
return integration_points;
Expand All @@ -1876,7 +1879,9 @@ template<class TPointType> class Tetrahedra3D4 : public Geometry<TPointType>
Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_GAUSS_4),
Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_GAUSS_5)
GeometryData::IntegrationMethod::GI_GAUSS_5),
Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_LOBATTO_1)
}
};
return shape_functions_values;
Expand All @@ -1897,7 +1902,9 @@ template<class TPointType> class Tetrahedra3D4 : public Geometry<TPointType>
Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
GeometryData::IntegrationMethod::GI_GAUSS_4),
Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
GeometryData::IntegrationMethod::GI_GAUSS_5)
GeometryData::IntegrationMethod::GI_GAUSS_5),
Tetrahedra3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
GeometryData::IntegrationMethod::GI_LOBATTO_1)
}
};
return shape_functions_local_gradients;
Expand Down
16 changes: 9 additions & 7 deletions kratos/geometries/triangle_2d_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -1549,7 +1549,8 @@ template<class TPointType> class Triangle2D3
Quadrature<TriangleCollocationIntegrationPoints2, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature<TriangleCollocationIntegrationPoints3, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature<TriangleCollocationIntegrationPoints4, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature<TriangleCollocationIntegrationPoints5, 2, IntegrationPoint<3> >::GenerateIntegrationPoints()
Quadrature<TriangleCollocationIntegrationPoints5, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature<TriangleGaussLobattoIntegrationPoints1, 2, IntegrationPoint<3> >::GenerateIntegrationPoints()
}
};
return integration_points;
Expand Down Expand Up @@ -1583,6 +1584,8 @@ template<class TPointType> class Triangle2D3
GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ),
Triangle2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ),
Triangle2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
GeometryData::IntegrationMethod::GI_LOBATTO_1 ),
rubenzorrilla marked this conversation as resolved.
Show resolved Hide resolved
}
};
return shape_functions_values;
Expand All @@ -1607,6 +1610,7 @@ template<class TPointType> class Triangle2D3
Triangle2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ),
Triangle2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ),
Triangle2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ),
Triangle2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_LOBATTO_1 ),
rubenzorrilla marked this conversation as resolved.
Show resolved Hide resolved
}
};
return shape_functions_local_gradients;
Expand Down Expand Up @@ -2267,5 +2271,3 @@ template<class TPointType> const
GeometryDimension Triangle2D3<TPointType>::msGeometryDimension(2, 2);

}// namespace Kratos.

#endif // KRATOS_TRIANGLE_2D_3_H_INCLUDED defined
Original file line number Diff line number Diff line change
@@ -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<IntegrationPointType, 4> 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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Loading