Complete FEM implementation for 2D elasticity problems with truss, triangular and quadrilateral elements
This code provides a complete implementation of the linear finite element method for 2D elasticity problems. The goal of this code is to understand the logic behind well-known finite element software such as Abaqus, ANSYS, etc. The input is an Excel file that must be filled in by the user. The output includes the displacements and forces of each node and the stress components in each triangular and quadrilateral element and the internal force for truss elements; it also shows the overall shape of the structure before and after loading graphically. The program automatically detects the element type based on the filled-in Excel sheet. Automatic triangle mesh generation is also provided for rectangular domains, where only the number of elements in the longitudinal and transverse directions of the rectangle need to be selected in the program. By default, it solves for the plane stress state, but it can be easily changed to plane strain in the code.
Below are 3 sample examples solved using this code.
We have a truss as shown below.
To analyze it, we need to enter its properties in the Excel file, which is named "input_sample_truss.xlsx" and exists in the repo. The results include the displacements and forces of each node and the internal force in each element as follows.
The overall shape of the truss, before and after loading, is also shown below.
Consider the following beam with the following specifications.
The Excel files for solving this problem are named "input_sample_triangle.xlsx" and "input_sample_quadrilateral.xlsx" and exist in the repo. Due to the large number of nodes and elements, we do not show the tables related to them here. The following figures show the beam before and after loading in the triangular and quadrilateral element cases.
It is worth noting that non-rectangular quadrilateral elements can also be used, but the results for quadrilateral elements seem to be incorrect. I would be happy if someone could correct it and let me know. [email protected]