Friday, October 7, 2016

Free download MATLAB file for finite element analysis of beams and columns + solved example + visualization

Visit http://CivilEngineeringBible.com for newer posts

Here I developed a MATLAB code for solving beam problems using Finite Element Technique with the ability of plotting deformed shape. Results of this code include nodal displacements; axial forces, bending moments, and shear forces for members; reaction forces at supports.

Below are some of the results:
three-story, two-span bending frame with dead load and lateral load.


 one-story, one-span bending frame with lateral load.

Results are verified with Abaqus and analytical methods.

For m-files (functions) contact me via: hosseinali.sut@gmail.com


Tuesday, February 23, 2016

Plate bending dynamic finite element analysis MATLAB code for elastic media (isotropic and anisotropic)

Visit http://CivilEngineeringBible.com for newer posts

Here is a MATLAB code for dynamic analysis of plate bending problems
The results are in excellent accordance with Abaqus results as shown below:

Results of Abaqus:










Results of my MATLAB code:

 


You can also watch the dynamic response of this code on youtube:






And for the following impact load

Wave front for the Isotropic plate is as follows:








Wave front for the Anisotropic plate is as follows:







Wednesday, April 8, 2015

Random Surface Roughness Generation using MATLAB program

Visit http://CivilEngineeringBible.com for newer posts and files
Today, I developed a MATLAB function to generate a random surface roughness for future study of a thermomechanical rough contact in Abaqus. here are results for different values of Ra and Rq (Roughness amplitude parameters):



For initial mesh Abaqus is used, for random generation of surface roughness MATLAB is used and for post processing Tecplot is used. if you need any further information feel free to contact me via my email address: Hosseinali.sut@gmail.com

Wednesday, March 25, 2015

3D elastic Finite Element MATLAB code + Abaqus Verification

Visit http://CivilEngineeringBible.com for newer posts and files
I wrote a finite element code for three-dimensional analysis of elastic body using MATLAB programming language.
Here is a video of the results + its verification with Abaqus:




Output results are shown in Tecplot; hexahedron elements are used; Basic conjugate gradient method (BCG) is used to solve linear solutions to be able to solve large number of nodes and elements.
Contact me via email (hosseinali.sut@gmail.com) for MATLAB files (functions):
main.m
basicconjugategradientsolution.m
B.m
rNrkb.m

2D elastic Finite Element MATLAB code + Abaqus Verification

Visit http://CivilEngineeringBible.com for newer posts and files
I wrote a finite element code (FEM Program) for two-dimensional analysis of elastic body using MATLAB programming language.
Here is a video of the results + its verification with Abaqus:


4-node elements ,4 Gauss points for numerical integration are used;.

Contact me via email (hosseinali.sut@gmail.com) for MATLAB files (functions).

*** Here is a solve example using both Abaqus and Code:
Normal Stress in X-direction, Abaqus result:


Normal Stress in X-direction, Code result:


Shear Stress in XY-direction, Abaqus result:


Shear Stress in XY-direction, Code result:


Normal Stress in Y-direction, Abaqus result:


Normal Stress in Y-direction, Code result:

Liver Mesh file

Visit http://CivilEngineeringBible.com for newer posts and files
Here is a liver mesh with tetrahedron elements that I generated.



Contact me via email (hosseinali.sut@gmail.com) for liver mesh files (nodes + elements).

3D Large Deformation Finite Element Analysis using MATLAB Code

Visit http://CivilEngineeringBible.com for newer posts and files
Here is the MATLAB code for 3D FEM analysis of a large deformation problem.



Both Total and Updated Lagrangian Descriptions are programmed; Tetrahedron elements are used.
Do not hesitate to contact me via email (hosseinali.sut@gmail.com) for MATLAB files:
main.m
At.m
BL.m
Gtensor.m
Volume.m

Finite Element Analysis of a Contact Problem using MATLAB Code

Visit http://CivilEngineeringBible.com for newer posts and files
Here is the results of my FEM MATLAB code for large deformation contact problem:
Both Penalty and Lagrange Multiplier methods are programmed.



Do not hesitate to contact me via email (hosseinali.sut@gmail.com) for MATLAB files:
At.m
Bbar.m
BL.m
FX.m
GreenSt.m
Gvector.m
J.m
main.m
MG.m
readdata.m
spk2c.m

FEM MATLAB code for Newmark 1D dynamic analysis of a 4 DOFs structure

Visit http://CivilEngineeringBible.com for newer posts and files
Here is the result of my MATLAB code for dynamic analysis of a four degrees of freedom structure:

Newmark method is used in this program.



Feel free to contact me via email (hosseinali.sut@gmail.com) for MATLAB files:
newmark_1d.m

Free download MATLAB file for Finite Element beam analysis using beam elements + solved examples

Visit http://CivilEngineeringBible.com for newer posts and files
Many structural systems used in practice consist of long slender members that are subjected to loading normal to their longitudinal axis and must resist bending and shear forces. They are called beams. Beams are governed by a fourth-order  differential equation.
beam element
Assumed degrees of freedom for a beam element used in this code.
Example1:
Consider a simple cantilever beam with a circular cross-section of 10 in diameter and a length of 400in. E = 30e6 psi. Load = 1000 lbs in downward direction at the right end of the beam.
Analytical solution for the mximum deflection and slope at the right end of the beam is as follows:
Slope = P(L^2)/2*EI =  0.0054
Deflection = P(L^3)/3*EI = 1.44866
and Finite Element result generated by MATLAB program is shown below:


Example2:
Consider a simply supported beam with a circular cross-section of 10 in diameter and a length of 400 in. The Young’s Modulus of the beam is 30e6. Load = 1000 lbs in downward direction at the right end of the beam.
Analytical solution -> Maximum deflection at the center of the beam is:
deflection = Ymax = P(L^3)/(48*EI) = 0.090541
slope = 0.0
and Finite Element results generated by MATLAB program for two element model and 4 element model are shown below:




Feel free to contact me via email (hosseinali.sut@gmail.com) for more details.
MATLAB Code is:
main.m *****************************
%%
% Developed by Massoud Hosseinali (hosseinali.sut@gmail.com) – 2015
% Finite element MATLAB program for beam analysis
%%
clear all;clc;close all;
Nodes = load(‘nodes.txt’); % coordinate of node
Elements = load(‘elements.txt’);    % first node, second node, E, I
numnode = length(Nodes); %Holds number of nodes
numelem = size(Elements,1); %Holds number of elements
K = zeros(2*numnode,2*numnode);
F = zeros(2*numnode, 1);
U = zeros(2*numnode, 1);
act = [ 2 3 4 5 6 7 8 10 ]; %Hold active DOFs
for ie = 1:numelem
DOFs = [2*Elements(ie, 1)-1, 2*Elements(ie, 1), 2*Elements(ie, 2)-1, 2*Elements(ie, 2)]; %Holds element’s DOFs
L = abs(Nodes(Elements(ie,2)) – Nodes(Elements(ie,1)));  %Holds length of element
E = Elements(ie,3); %Holds modolus of elasticiy of element
I = Elements(ie,4); %Holds moment of inertia of element
K(DOFs,DOFs) = K(DOFs,DOFs) + (E*I/(L^3))*[12 6*L -12 6*L; 6*L 4*L^2 -6*L 2*L^2; -12 -6*L 12 -6*L; 6*L 2*L^2 -6*L 4*L^2]; % Calculates the element stiffness matrix and assembles it to the global stiffness matrix
end
F(5) = -1000;
U(act) = K(act,act)\F(act); % Solves linear solutions
icounter= 0;
for ie = 1:numelem
DOFs = [2*Elements(ie, 1)-1, 2*Elements(ie, 1), 2*Elements(ie, 2)-1, 2*Elements(ie, 2)]; %Holds element’s DOFs
L = abs(Nodes(Elements(ie,2)) – Nodes(Elements(ie,1)));  %Holds length of element
for s = 0:(0.1*L):L
icounter = icounter  + 1;
slratio = s/L;
%Shape functions
N1 = (1-3*slratio^2+2*slratio^3);
N2 = L*(slratio-2*slratio^2+slratio^3);
N3 = (3*slratio^2-2*slratio^3);
N4 = L*(-slratio^2+slratio^3);
N = [N1 N2 N3 N4];
x(icounter) = s + Nodes(Elements(ie,1));
v(icounter) = N*U(DOFs);
end
end
hold all
plot(x,v);
plot(Nodes, U(1:2:end,1), ‘o’, ‘MarkerSize’, 10, ‘Color’, ‘Black’)
xlabel(‘X’)
ylabel(‘Deflection’)
grid on
Elements.txt (Sample) *******************
1 2 30e6 490.8739
2 3 30e6 490.8739
3 4 30e6 490.8739
4 5 30e6 490.8739
Nodes.txt (Sample) *******************
0
100
200
300
400