[SMApp] Adding 3D truss elements#12894
Conversation
| // License: BSD License | ||
| // license: StructuralMechanicsApplication/license.txt | ||
| // | ||
| // Main authors: Alejandro Cornejo |
There was a problem hiding this comment.
Can you align your name with the license?Sorry for being so OCD
| // License: BSD License | ||
| // license: StructuralMechanicsApplication/license.txt | ||
| // | ||
| // Main authors: Alejandro Cornejo |
There was a problem hiding this comment.
The same for the others headers
|
Minor comments, just aesthetic |
|
Now the implementation has been unified in just one element file, taking full advantage of the |
WPK4FEM
left a comment
There was a problem hiding this comment.
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
...tions/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp
Outdated
Show resolved
Hide resolved
| 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(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Nice, the unification of 2D and 3D now shows clearly the difference between them here.
...tions/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp
Outdated
Show resolved
Hide resolved
| 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; | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
...tions/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp
Outdated
Show resolved
Hide resolved
| if constexpr (NNodes == 2) { | ||
| StructuralMechanicsElementUtilities::BuildElementSizeRotationMatrixFor3D2NTruss(T, global_size_T); | ||
| } else { | ||
| StructuralMechanicsElementUtilities::BuildElementSizeRotationMatrixFor3D3NTruss(T, global_size_T); | ||
| } |
There was a problem hiding this comment.
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.
...tions/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp
Outdated
Show resolved
Hide resolved
| if (rN.size() != SystemSize) | ||
| rN.resize(SystemSize, false); |
There was a problem hiding this comment.
The .resize checks for equal size itself before execution, I wonder why this check is repeated here and in many other places.
There was a problem hiding this comment.
Good question, according to @RiccardoRossi the resize method adds an overhead to the operation
|
Dear @WPK4FEM , how does it look now? |
WPK4FEM
left a comment
There was a problem hiding this comment.
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
📝 Description
This PR includes:
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.