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

Merged
merged 17 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions kratos/geometries/hexahedra_3d_8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1450,8 +1450,8 @@ 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(),
Quadrature < HexahedronGaussLobattoIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints()
Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
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 < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),

Why repeated?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not "repeated" actually. Previously, in the EXTENDED_GI_GAUSS thy were using the Lobatto so I just maintained the previous code.

Copy link
Member

Choose a reason for hiding this comment

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

Still I don't get it. But aren't we calling thrice the same method? In other words, shouldn't Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints() appear once? (right now it appears three times).

Copy link
Member Author

Choose a reason for hiding this comment

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

I may be totally wrong but, by analogy with other geometries I was implementing, on the one hand:

    static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
    {
        ShapeFunctionsValuesContainerType shape_functions_values =
        {
            {
                Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_1 ),
                Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_2 ),
                Hexahedra3D8<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_3 ),
                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_LOBATTO_1 )
            }
        };
        return shape_functions_values;
    }

and then we need to assing an individual quadrature to each os the previous entries:

    static const IntegrationPointsContainerType AllIntegrationPoints()
    {
        IntegrationPointsContainerType integration_points =
        {
            {
                Quadrature < HexahedronGaussLegendreIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
                Quadrature < HexahedronGaussLegendreIntegrationPoints2, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
                Quadrature < HexahedronGaussLegendreIntegrationPoints3, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
                Quadrature < HexahedronGaussLegendreIntegrationPoints4, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
                Quadrature < HexahedronGaussLegendreIntegrationPoints5, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
                Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), // was there already
                Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), // was there already
                Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints() // My contribution! :)
            }
        };
        return integration_points;
    }

Are we now on the same page?

Copy link
Member

Choose a reason for hiding this comment

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

OK. Now I understand. Your addition is correct. What is weird to me is that GI_EXTENDED_GAUSS_1 and GI_EXTENDED_GAUSS_2 feature the HexahedronGaussLobattoIntegrationPoints1 integration points (something that was already there).

Copy link
Member

Choose a reason for hiding this comment

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

@loumalouomega together with @AlejandroCornejo we've discussing about this. We think that it might be something weird with the hexa GI_EXTENDED_GAUSS_* integration as it was using the Lobatto integration points (rather than the collocation ones). I think that you can shred some light on this.

If it is actually wrong, or we put is as a boilerplate for a future implementation, my suggestion would be to remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

For now, I've removed the extended ones amd maintained the standard gauss and the new Lobatto one. FYI @loumalouomega

Quadrature < HexahedronGaussLobattoIntegrationPoints1, 3, IntegrationPoint<3> >::GenerateIntegrationPoints()
}
};
return integration_points;
Expand Down
4 changes: 2 additions & 2 deletions kratos/geometries/hexahedra_interface_3d_8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1766,9 +1766,9 @@ template<class TPointType> class HexahedraInterface3D8 : public Geometry<TPointT
IntegrationPointsContainerType integration_points =
{
{
Quadrature < HexahedronGaussLobattoIntegrationPoints1,
Quadrature < HexahedronGaussLobattoIntegrationPoints0,
3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < HexahedronGaussLobattoIntegrationPoints2,
Quadrature < HexahedronGaussLobattoIntegrationPoints1,
3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
IntegrationPointsArrayType(),
IntegrationPointsArrayType()
Expand Down
2 changes: 1 addition & 1 deletion kratos/geometries/quadrilateral_2d_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ template<class TPointType> class Quadrilateral2D4
2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < QuadrilateralCollocationIntegrationPoints5,
2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
Quadrature < QuadrilateralGaussLobattoIntegrationPoints2,
Quadrature < QuadrilateralGaussLobattoIntegrationPoints1,
2, IntegrationPoint<3> >::GenerateIntegrationPoints()
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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



Expand Down
10 changes: 5 additions & 5 deletions kratos/integration/integration_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading