Skip to content

[SMApp] Adding 3D truss elements#12894

Merged
AlejandroCornejo merged 34 commits intomasterfrom
adding-3D-truss-linear
Dec 11, 2024
Merged

[SMApp] Adding 3D truss elements#12894
AlejandroCornejo merged 34 commits intomasterfrom
adding-3D-truss-linear

Conversation

@AlejandroCornejo
Copy link
Member

@AlejandroCornejo AlejandroCornejo commented Nov 29, 2024

📝 Description

This PR includes:

  • Implementation of the 3D truss elements (2 noded and 3 noded)
  • Addition of a test including 2 noded and 3 noded elements.

These elements use gauss quadratures to be combined with custom non-linear 1-d constitutive laws. Many methods are reused se we avoid code repetition.

// License: BSD License
// license: StructuralMechanicsApplication/license.txt
//
// Main authors: Alejandro Cornejo
Copy link
Member

Choose a reason for hiding this comment

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

Can you align your name with the license?Sorry for being so OCD

// License: BSD License
// license: StructuralMechanicsApplication/license.txt
//
// Main authors: Alejandro Cornejo
Copy link
Member

Choose a reason for hiding this comment

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

The same for the others headers

@loumalouomega
Copy link
Member

Minor comments, just aesthetic

loumalouomega
loumalouomega previously approved these changes Dec 2, 2024
@AlejandroCornejo
Copy link
Member Author

Now the implementation has been unified in just one element file, taking full advantage of the Dimension template.

Copy link
Contributor

@WPK4FEM WPK4FEM left a comment

Choose a reason for hiding this comment

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

Dear Alejandro,
Thank you for already compacting this implementation into 1 class in reaction to my early comments last Friday, That avoids quite a lot of repetition, without losing desired functionality. I have had a calm look today, please find my suggestions and decide if they should be taken up or not. Functionality looks o.k. to me. To use these elements in the GeoMechanicsApplication, a request from our side will follow in order to let these elements and the Timoshenko beams smoothly work with our reset_displacement functionality.
Thank you for the work done,
Best regards,
Wijtze Pieter

Comment on lines 123 to 127
rResult[local_index++] = r_geometry[i].GetDof(DISPLACEMENT_Y, xpos + 1).EquationId();
if constexpr (Dimension == 3) {
rResult[local_index++] = r_geometry[i].GetDof(DISPLACEMENT_Z, xpos + 2).EquationId();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, the unification of 2D and 3D now shows clearly the difference between them here.

Comment on lines +411 to +424
if constexpr (Dimension == 2) {
const double angle = GetAngle();

const double c = std::cos(angle);
const double s = std::sin(angle);
local_body_force[0] = c * body_force[0] + s * body_force[1];
local_body_force[1] = -s * body_force[0] + c * body_force[1];
return local_body_force;
} else {
BoundedMatrix<double, Dimension, Dimension> T;
noalias(T) = GetFrenetSerretMatrix(); // global to local
noalias(local_body_force) = prod(T, body_force);
return local_body_force;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Reading in GetFrenetSerretMatrix, that derives a rotation tensor from the orientation of the nodes of the element. The 2D code in the if branch here does a very similar thing based on GetAngle. Probably the GetFrenetSerretMatrix also works for 2D, such that it can be reused for 2D.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a decision to be made. In 3D I am forced to use Frenet Serret system to orient de truss. I can use the same procedure in 2D but seems by far cheaper to use just the angle. What do you prefer?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the uniform approach using Frenet Serret system is the elegant way. Setting up the transformation from sin and cos probably is computed from powers of e, the Frenet Serret system uses inner and outer products ( only addition and multiplication ) and 1 square root for the norm. I don't know which one wins the efficiency battle, the end result of the computation is the same.

Comment on lines +389 to +393
if constexpr (NNodes == 2) {
StructuralMechanicsElementUtilities::BuildElementSizeRotationMatrixFor3D2NTruss(T, global_size_T);
} else {
StructuralMechanicsElementUtilities::BuildElementSizeRotationMatrixFor3D3NTruss(T, global_size_T);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The global_size_T matrix consists of the number of dimensions blocks of matrix T. Using e.g.
a for loop over TNNodes with as body MathUtils::AddMatrix(global_size_T, T, inode*TDimension, inode*TDimension) this may be constructed without the need for separate implementations for the 2 or 3 node element.

Comment on lines +243 to +244
if (rN.size() != SystemSize)
rN.resize(SystemSize, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

The .resize checks for equal size itself before execution, I wonder why this check is repeated here and in many other places.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question, according to @RiccardoRossi the resize method adds an overhead to the operation

@AlejandroCornejo
Copy link
Member Author

Dear @WPK4FEM , how does it look now?

Copy link
Contributor

@WPK4FEM WPK4FEM left a comment

Choose a reason for hiding this comment

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

Dear Alejandro,
Thank you for all the work done here. I'm happy with the unification of 2 and 3D here. Functionality wise I see no issues,
Regards, Wijtze Pieter

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.

3 participants