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

[ContactStructuralMechanicsApplication] Searching the element ID #8148

Open
Joekchu opened this issue Jan 26, 2021 · 21 comments
Open

[ContactStructuralMechanicsApplication] Searching the element ID #8148

Joekchu opened this issue Jan 26, 2021 · 21 comments

Comments

@Joekchu
Copy link

Joekchu commented Jan 26, 2021

Description
What is happening?

Hi, everyone!

I have a question about coding the contact algorithm:

I now have some beam element inserting into the solid elements. I want to create some virtual with the same coordinates as the integration point of the beam element. But I don't know how to know the ID of the 3D solid element where the virtual point lies. Do you guys have any suggestions on searching the element ID? The virtual point should lie in a certain position of one element (maybe on the edge or not)? So far, I have an idea is that I search every element and calculate the distance between the nodes of the solid element and the virtual node. If the distance of all nodes smaller than the characteristic length of the element, I assume this element is the object we search for. But it looks too complicated, do you have better suggestions?

Many thanks in advance.

Scope
Which areas of Kratos are involved

  • ContactStructuralMechanicsApplication
@RiccardoRossi
Copy link
Member

forwarding to @AlejandroCornejo and @loumalouomega

@AlejandroCornejo
Copy link
Member

Dear @Joekchu , Maybe @loumalouomega has a better idea because he has been working in this for a long time. If I'd have to do it I would use the IsInside method from the geometry in order to know if a node is inside a certain element.

You can check here the triangle_2d_3.h:

    bool IsInside(
        const CoordinatesArrayType& rPoint,
        CoordinatesArrayType& rResult,
        const double Tolerance = std::numeric_limits<double>::epsilon()
        ) const override
    {
        this->PointLocalCoordinates( rResult, rPoint );

        if ( (rResult[0] >= (0.0-Tolerance)) && (rResult[0] <= (1.0+Tolerance)) )
        {
            if ( (rResult[1] >= (0.0-Tolerance)) && (rResult[1] <= (1.0+Tolerance)) )
            {
                if ( (rResult[0] + rResult[1]) <= (1.0+Tolerance) )
                {
                    return true;
                }
            }
        }

        return false;
    }

@Joekchu
Copy link
Author

Joekchu commented Jan 26, 2021

Dear @AlejandroCornejo , thanks for your suggestion that looks more concise. One more question, I am a rookie of UBLAS, so I am not sure about the Point<3>, does it contain the information of one node with 3 components or this array contains many nodes and each node contain 3 component? Thanks in advance!

@AlejandroCornejo
Copy link
Member

Hi! you can create a Point as (point.h)

    Point(double NewX, double NewY = 0, double NewZ = 0) : BaseType()
    {
        this->operator()(0) = NewX;
        this->operator()(1) = NewY;
        this->operator()(2) = NewZ;
    }

@AlejandroCornejo
Copy link
Member

or, if I'm not wrong, you could do:

auto& r_geometry = elem.GetGeometry(); // beam elem
const auto& r_node_coords = r_geometry[0].GetCoordinates(); // 0, 1 or 2 depending on the node you want of the beam element
triangle_elem.GetGeometry().IsInside(r_node_coords , boolean, 1e-7);

@loumalouomega
Copy link
Member

loumalouomega commented Jan 26, 2021

Let me clarify. @Joekchu

  • Working in 2D.
  • You have beams elements (lines of 2 nodes).
  • You have solid elements (quads and triangles).

You want to check if the integrations points lies in some element, and the id of that element?

@loumalouomega loumalouomega changed the title Searching the element ID [ContactStructuralMechanicsApplication] Searching the element ID Jan 26, 2021
@Joekchu
Copy link
Author

Joekchu commented Jan 26, 2021

Hi, Vicente, nice to see you! This is Joe @loumalouomega

  1. Working in 3D;
  2. Yes, 2 nodes beam element;
  3. Yes.

Yes, I want to obtain the ID of the solid element where integrations points lie and then calculate the relative displacements between the target points of the pile and the solid element.

@Joekchu
Copy link
Author

Joekchu commented Jan 26, 2021

@AlejandroCornejo Also, million thanks to you. I am sure that I learn a lot from your answer.

@loumalouomega
Copy link
Member

loumalouomega commented Jan 26, 2021

Let me clarify. @Joekchu

* Working in 3D.

* You have beams elements (lines of 2 nodes).

* You have solid elements (tetra).

You want to check if the integrations points lies in some element, and the id of that element?

In that case (a little bit pesudo-code):

#include "utilities/binbased_fast_point_locator.h"

...

// We create the locator
BinBasedFastPointLocator<3> point_locator = BinBasedFastPointLocator<3>(r_model_part);
point_locator.UpdateSearchDatabase();

...

// BEGIN: loop over GP

Vector shape_functions;
Element::Pointer p_element = nullptr;
array_1d<double, 3> coordinates = HERE_THE_COORDINATES_OF_THE_GP_OF_THE_BEAM;// (should we add a method as in the solid for the local coordinates)

const bool is_found = point_locator.FindPointOnMeshSimplified(coordinates, shape_functions, p_element, max_number_of_searchs, 5.0e-2);

if (is_found) {
	const auto id_element = p_element->Id();
	... more code
}

// END: loop over GP

@loumalouomega
Copy link
Member

I will update my previous comment to 3D.

@loumalouomega
Copy link
Member

I will update my previous comment to 3D.

See my previous comment

@loumalouomega
Copy link
Member

If you use Hexahedra I don't know if it will work (I do not remember if we adapted in order to be generic, I think we did for the MPM formulation).

@Joekchu
Copy link
Author

Joekchu commented Jan 26, 2021

MPM you mean material point method or others? @loumalouomega

@loumalouomega
Copy link
Member

MPM you mean material point method or others? @loumalouomega

Yes, the ParticleMechanicsApplication does MPM

@Joekchu
Copy link
Author

Joekchu commented Jan 26, 2021

Thanks, sir, one more question: if your MPM application supports GPU acceleration?@loumalouomega

@loumalouomega
Copy link
Member

Thanks, sir, one more question: if your MPM application supports GPU acceleration?@loumalouomega

I don't know, I am not developer, @RiccardoRossi who is the main developer right now?

@loumalouomega
Copy link
Member

Thanks, sir, one more question: if your MPM application supports GPU acceleration?@loumalouomega

It is implicit BTW

@rubenzorrilla
Copy link
Member

Thanks, sir, one more question: if your MPM application supports GPU acceleration?@loumalouomega

It is implicit BTW

Just mentioning that there is an explicit solver as well.

@loumalouomega
Copy link
Member

Thanks, sir, one more question: if your MPM application supports GPU acceleration?@loumalouomega

It is implicit BTW

Just mentioning that there is an explicit solver as well.

I feel old now...

@loumalouomega
Copy link
Member

Thanks, sir, one more question: if your MPM application supports GPU acceleration?@loumalouomega

It is implicit BTW

Just mentioning that there is an explicit solver as well.

No GPU BTW?

@rubenzorrilla
Copy link
Member

Thanks, sir, one more question: if your MPM application supports GPU acceleration?@loumalouomega

It is implicit BTW

Just mentioning that there is an explicit solver as well.

No GPU BTW?

I don't think so...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants