For completion of the report, the problem statement is given below taken from the project handout.
The problem described above was solved for the following values of the angle (in degrees)
Where is the distortion angle between the first and the second elements as shown in the above diagram. The method of finite elements was implemented in Matlab to solve for the displacements at the nodes. Gaussian points were used for the integration step (this is also called the integration rule). After the global stiffness matrix was assembled from the two elements stiffness matrices, the system equations given by were solved using the direct linear system solver.
Two elements were used each having nodes. of these nodes are at the corners, and the other are at the mid point of the element edges. The following diagram shows the global coordinates of the elements nodes. The origin of the global coordinate system is at the lower left corner as shown in the diagram below.
is the overall length of the beam, which is meters, and is the height of the beam (which is meters).
The vertical and horizontal displacement of each node was solved for using the finite elements method for each of the different values of the angle and the vertical displacement at the right bottom edge of the beam was compared to the expected theoretical value in order to see the effect of the element distortion on the accuracy of the finite element result using the element selected.
The idea is that a good finite element should produce the same displacement at its nodes regardless of how it was fitted to the physical region in place. This report was to determine if the element selected would still produce good results when deformed. The first step was to map each element local node number to a global node number. Local element numbers go from to since there are only nodes per element, but the global node numbers enumerates over all the nodes in all the elements.
Local element node numbering is made in the standard anti clock wise direction by numbering the corner nodes first from to , followed by numbering the middle nodes also in the anti clock wise sense from to .
The following diagram shows the mapping between the local element node numbers and the global node numbers. The top diagram shows the global node numbers and the lower diagram shows each element local node numbers.
Based on the the above, the table elem_map_nodes was constructed. This table gives the global node number (the entries inside the table) for an element number (the row of the table) and the node number within that specific element (the column in the table). For example, for element with local node number the table above shows that the global node number is .
There is also a need to lookup the global coordinates given the global node number. This is needed when finding the Jacobian.
The following table called global_coordinates_tbl was constructed for this purpose. In this table, and is the amount of shift in meters of the global node and . These are the only two nodes which shift location when changing the angle . When is zero, there will be no distortion of the elements.
There are two degrees of freedom at each node. These are , representing the horizontal and vertical displacement of a node. Hence there is a need for a lookup table called elem_map_dofs which gives the degree of freedom number of each element's local node. This table is used for assembling the global stiffness matrix.
Using the method in the project handout, the following table was generated.
The following diagram, generated in the Matlab program, gives the degree of freedom number corresponding to each element node (). These DOF numbers represent the position of the unknowns in the solution of the . This means that there are a total of degrees of freedom initially. However, due to boundary conditions constraints, the total number of degrees of freedom reduces to .
The above was a general description of the problem and the geometry and data structures used in the Matlab implementation. Next is a discussion of the analytical derivation and the post processing stage which starts after solving for the displacements, followed by discussion of how stress was calculated at the element nodes from the stress value at the four Gaussian points.
Since an 8 node element is used, then there will be 8 shape functions. In ANSYS, the element used is called PLANE183. This element is a serendipity element, which means it has nodes only on the edges and no node in the middle of the element.
The following are the 8 shape functions used
The global coordinates are now expressed as functions of the natural coordinates using
Where is the number of nodes of each element (which is ) and are the global coordinates of these nodes. Expanding the above gives the result below.
The result below is shown for some element number . In this expansion, means the global coordinate of the node in the element.
Similarly, means the global coordinate of the node in the element. These are read in the Matlab code using the global_coordinates_tbl table, which gives the global coordinates of each global node and by using elem_map_nodes table to map the element node number to the global node number.
The Jacobian is evaluated at each Gaussian integration point during the integration step. It has the form
Each of the above derivatives is evaluated and used in the Matlab code.
The above is now used to find the Jacobian and its determinant and also find and the matrix . To find the matrix the derivatives of each shape function is taken w.r.t. and .
This below gives the result of this computation
With the above, the matrix matrix was calculated giving
And calculate the element stiffness matrix given by
The elements stiffness matrices are then combined to make the global stiffness matrix and then the system was solved for the unknowns which are the nodal displacements in the and direction.
In the above is the load vector, which in this problem contains only one nonzero entry, which is the vertical load of at the middle of the right edge of the beam.
In the above, the matrix is
And the matrix is
Where is the inverse of the Jacobian matrix . And the matrix is
The following diagram shows the internal structure of the global stiffness matrix, found using the spy() command in Matlab. It shows the bands along the diagonals and illustrates how sparse the matrix is.
The above concludes the solve stage. The next stage is the post processing, where stress calculations are performed.
This is a discussion of how the stress at the elements nodes was found. Initially the direct method was used to find the stress at any point in the element.
This method was found to be accurate as long as there was no distortion. Once the angle was increased, this method did not produce stress results which agreed with ANSYS. Therefore, this method was not used, and instead a new implementation was made based on the extrapolation method.
This method is described in reference [1], pages 230232. This method is more complicated that the direct method, but it is much more accurate. It uses two coordinates systems. The original natural coordinates system of the element , which extends from across the length and height of the element, and a new coordinates systems called which extends across what is called the Gaussian element.
Therefore, when the value of is one. And when then also.
The following diagram shows this layout more clearly.
Therefore, the relation between coordinates system and coordinates system is as follows
The following diagram shows the mapping at two different points for illustration
Now that the mapping between and is determined, the next step was to find at each point where the stress needs to be found at by extrapolating the stress value from the Gaussian points to that point of interest. The reason for doing all of the above, is because are used when evaluating the shape functions described below, and not the original values.
Therefore, for each point where the stress needs to be found, say point , its coordinates in the system are found first, and then the following extrapolation formula is applied

Where is the stress at the Gaussian point (which was found using the direct method based on the full shape functions of the main element).
In the above, are the shape functions used for extrapolation. These are not the same shape functions used in the original element. These shape functions are based on node Gaussian element and are given by
For example, to find the stress at point , the first step is to determine this point's coordinates. Since then and since then . Applying the extrapolation formula above gives
Since the stresses at four Gaussian points are known, the stress at the point is now found from the above. The above method was found to produce more accurate result for than using the direct method to find and the result found for the stress at the nodes agreed with those found by ANSYS.
The following diagram shows the coordinates of all the element points used to calculate the stresses at using this method. A total of points was used per element. These are the nodes of the element, and also the center of the element and the Gaussian points themselves giving a total of points. These are used to generate the stress contour. This was done for both elements. The generated stress contour agreed with ANSYS results.
The results are listed by the angle used to distort the elements with. For each angle, the deflection and stress contour and tables are generated using Matlab and also using ANYS to compare with side by side.
The following angles are used (in degrees) . When trying to use degrees distortion, ANSYS complained and gave number of computational error messages relating to the element shape. It is not clear why ANSYS did not accept such large angle, since the Matlab implementation worked. But since ANSYS did not produce result for this case, the angle degrees was the maximum distortion used for both Matlab and ANSYS.
For each angle, a short summary of the result in the form of a table is first given that compares Matlab and ANSYS result. This short summary contains only the deflection at the bottom right corner, which is node . After this, the full result and stress plots are given.
The following figure shows the deformation found
The following table shows Matlab result for the direct stress found at each node for each element.
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
The following shows the direct stress contour generated in Matlab
The following figure shows the deformation found
The following table shows ANSYS result for the direct stress found at each node for each element.
The following shows the direct stress contour generated in ANSYS
The following figure shows the deformation found
The following table shows Matlab result for the direct stress found at each node for each element.
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
The following shows the direct stress contour generated in Matlab
The following figure shows the deformation found
The following table shows ANSYS result for the direct stress found at each node for each element.
The following shows the direct stress contour generated in ANSYS
The following figure shows the deformation found
The following table shows Matlab result for the direct stress found at each node for each element.
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
The following shows the direct stress contour generated in Matlab
The following figure shows the deformation found
The following table shows ANSYS result for the direct stress found at each node for each element.
The following shows the direct stress contour generated in ANSYS
The following figure shows the deformation found
The following table shows Matlab result for the direct stress found at each node for each element.
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
The following shows the direct stress contour generated in Matlab
The following figure shows the deformation found
The following table shows ANSYS result for the direct stress found at each node for each element.
The following shows the direct stress contour generated in ANSYS
The following figure shows the deformation found
The following table shows Matlab result for the direct stress found at each node for each element.
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
The following shows the direct stress contour generated in Matlab
The following figure shows the deformation found
The following table shows ANSYS result for the direct stress found at each node for each element.
The following shows the direct stress contour generated in ANSYS
The following figure shows the deformation found
The following table shows Matlab result for the direct stress found at each node for each element.
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
global node #  N/m^2  
center  
Gauss point 1  
Gauss point 2  
Gauss point 3  
Gauss point 4  
The following shows the direct stress contour generated in Matlab
The following figures show the deformation found
The following table shows ANSYS result for the direct stress found at each node for each element.
The following shows the direct stress contour generated in ANSYS
It is clear from the above result that the node element used did not behave well at all when it became distorted.
The element used is a serendipity element^{1} . These elements are known not to give good results when they distorted^{2} . There are a number of distortions that an element could have, such as an edge distortion or angular distortion and others. In this report we only looked at angular distortion.
As the angular distortion increased, the result became less accurate. The inaccuracy also accelerated when the angle was above based on the diagram generated below. At angle , the vertical deflection reported by the finite element Matlab program (and ANSYS as well) was meters where the theoretical result should be close to meters. This is over error. A signification error in accuracy. The following graph shows how the error in the vertical deflection changed as a function of the distortion angle.
From the above one can see that to keep the error below , the angular distortion should not be more than about as the element behaves very badly after that. ANSYS will not even accept the analysis when trying angle of and gave number of errors relating to element shape. This means this element is not suitable for modeling physical regions which are highly irregular. This element is suitable for fitting in physical region which has straight edges and mostly rectangular regions. Curved regions and other such regions would need to be modeled using other elements.
When it comes to post processing and stress recovery, which the term used for calculating stresses in the post processing stage, there are three methods that can be used. These are
Once distortion is added, it produced bad result in stress values when compared to ANSYS results.
When making the contour plots for , one can see that the stress along the same line between the two elements is no longer smooth as the angle increases. ANSYS shows this to be smooth transition in the stress contour, but this must be because ANSYS did averaging across element boundaries.
In the Matlab implementation, No stress averaging was made between nodes across elements, hence the distortion (contour lines) is more clear in the stress contour along the line between the two elements as the following plot shows when the angle is . This shows clearly that stress across elements is not smooth and changes abruptly now.
The more angular distortion there is, the sharper this distortion in the stress contour between the two element became. This is due to the element becoming less accurate as it distorts. Comparing the above plot to the one when the angle was zero (no distortion) one can see that in the no distortion case the stress across the elements is smooth and has same values at the nodes connecting the two elements.
In conclusion, it is recommended that this element be used only when there is no distortion in the geometry.
The following is the APDL script used for ANSYS analysis. ANSYS version 16.02, student version was used.
The following is the listing of the m file for Matlab implementation. For making the contour plot, an external m file was used from Mathworks file exchange called tricontf and is included in the zip file. This function is not listed here.
To run the Matlab program, the command is nma_project_EMA_471