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

[SMApp] Adding 2D truss elements 2N and 3N #12837

Merged
merged 37 commits into from
Nov 13, 2024

Conversation

AlejandroCornejo
Copy link
Member

@AlejandroCornejo AlejandroCornejo commented Nov 8, 2024

📝 Description
Adding 2 and 3 noded plane truss elements. Classic implementation of linear and quadratic FE with numerical integration. I am reusing the truss constitutive law already existing in the app (with a minor modification). Test added for each truss element. They are able to print axial forces and strains.

Template implementation for efficiency.

@RiccardoRossi @WPK4FEM

@AlejandroCornejo AlejandroCornejo requested a review from a team as a code owner November 8, 2024 17:10
@loumalouomega
Copy link
Member

CI fails

Copy link
Member

@loumalouomega loumalouomega left a comment

Choose a reason for hiding this comment

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

Once CI passes Okay

Copy link
Member

@philbucher philbucher left a comment

Choose a reason for hiding this comment

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

minor comments 👍

Copy link
Member

Choose a reason for hiding this comment

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

2 things:

  • can you please add cpp test for those fcts
  • are they really truss specific or do they require certain dofs?

Copy link
Member Author

Choose a reason for hiding this comment

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

The additions to this file are basic rotation of displacement DoFs, just lke in beams but eliminating the rotation DoF. If they are tested in the general python test is it necessary to add a cpp?

* @author Alejandro Cornejo
*/
template <SizeType TNNodes>
class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) LinearTrussElement2D
Copy link
Member

Choose a reason for hiding this comment

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

whats the difference to the existing truss elements?

Copy link
Member Author

Choose a reason for hiding this comment

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

These are 2D elements (thecurrent ones are just 3D). Besides, we use numerical integration so it is general in case a custom constitutive law is used.

Comment on lines 41 to 44
if constexpr (NNodes == 2) {
mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1;
} else {
mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_2;
Copy link
Member

Choose a reason for hiding this comment

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

this is duplicated several times, can you please refactor to a function?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@AlejandroCornejo
Copy link
Member Author

AlejandroCornejo commented Nov 11, 2024

Anyone knows how to sort this CI error out? @roigcarlo

Kratos::KratosStructuralMechanicsApplication::mLinearTrussElement2D3N' will be initialized after [-Werror=reorder]
  285 |     const LinearTrussElement2D<3> mLinearTrussElement2D3N;

I cannot reproduce it in my pc, either with WIN and WSL linux...

@roigcarlo
Copy link
Member

roigcarlo commented Nov 11, 2024

This is a warning that appears as an error because of the CI.

Its telling you that in the class creator you have a member initializer list which has a different order than the member declaration. In spanish:

class foo {
    //     This one is an error. Should be mArg2(), mArg3()
    //                  |
    // -----------------V    
    foo(): mArg1(), mArg3(), mArg2() { ... }

    int mArg1;
    int mArg2;
    int mArg3;
}

Just change the order of the affected variable in the initialization list and should be fixed.

Edit: Fun fact, the warning has little to do with the construction order, its better to do it this way because the destructor uses the reverse order when destroying the class and can only obtain such order from the declaration, and not the initialization, and this one can indeed lead to problems.

@AlejandroCornejo
Copy link
Member Author

@loumalouomega now it passes!

@loumalouomega
Copy link
Member

@loumalouomega now it passes!

Huuuum, how do I know that it actually passes and it is not the evil genius changing my perception of it?, I compile therefore I exist?

@AlejandroCornejo AlejandroCornejo merged commit 39ea498 into master Nov 13, 2024
11 checks passed
@AlejandroCornejo AlejandroCornejo deleted the structural-adding-2d-truss-elements branch November 13, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants