EXPERIMENT
EXPERIMENT
EXPERIMENT NO. 0
AIM. To perform addition, subtraction and multiplication of matrices using C+
+.
Code:
#include<stdio.h>
#include<conio.h>
Void main()
{
File *fin, *fout;
Float A[10][10],B[10][10], SUM[10][10],SUB[10][10], Multi[10][10];
Int I,j,k;
fin=fopen(“infile2.dat”,”r”);
fout=(“outfile2.dat”,”w”);
fscanf(fun,”%d”,&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
fscanf(fin,”%d”,&A[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
fscanf(fin,”%d”,&B[10][10];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
SUM[i][j]=A[i][j]+B[i][j];
}
}
fprintf(fout,”The value of SUM of matrix A & B is :\n”);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
AJAY
22001504001 [Type here]
Page |2
{
fprintf(fout,”%2.2f”,SUM[i][j]);
fprintf(fout,”\t”);
}
fprintf(fout,”\n”);
}
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
SUB[i][j]=A[i][j]-B[i][j];
}
}
fprintf(fout,”The value of SUB of matrix A & B is :\n”);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
fprintf(fout,”%2.2f”,SUB[i][j]);
fprintf(fout,”\t”);
}
fprintf(fout,”\n”);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
AJAY
22001504001 [Type here]
Page |3
MULTI[i][j]+=A[i][k]*B[k][j];
}
}
fprintf(fout,”The value of MULTIPLE of matrix A & B is :\n”);
For(i=0;i<n;i++)
{
For(j=0;j<n;j++)
{
fprintf(fout,”%2.2f”,MULTI[i][j]);
fprintf(four”\t”);
}
fprintf(four,”\n”);
}
getch();
return0;
Input file
3
123
456
789
123
456
789
Output file
The value of SUM of matrix A & B is:
2.00. 4.00. 6.00
8.00. 10.00. 12.00
14.00 16.00 18.00
The value of SUB of matrix A & B is:
1. 0.00. 0.00
0.00. 0.00. 0.00
0.00. 0.00. 0.00
The value of MULTIPLE of matrix A & B is :
AJAY
22001504001 [Type here]
Page |4
AJAY
22001504001 [Type here]
Page |5
EXPERIMENT NO. 1
AIM: A C++ programme for one dimensional stress analysis using direct
approach: It includes-Input data file or interactive input, Element stiffness
matrix and assembly, Modification for Boundary conditions, Solver for bounded
symmetric stiffness matrix, Results-output data file, Validate the code, use the
validated code for solving different problems.
THEORY: The finite element method (FEM) is based on the idea of building a
complicated object with simple blocks, or, dividing a complicated object into
small and manageable pieces.
Steps in Process (for Stress/Strain Analysis) :
In general, the steps involved in the FEM analysis of a typical problem can be
summarized as follows:
1. Introduce the mathematical problem defined in a domain;
2. Discretize the domain into finite elements;
AJAY
22001504001 [Type here]
Page |6
3. Derive the element equations over each finite element in the domain;
4. Assemble the element equations to obtain equations for the entire problem;
5. Impose boundary conditions of the problem; 6. Solve the global system of
equations.
C++ Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<time.h>
#include<fstream.h>
#include<iostream.h>
FILE *fin,*fout;
int t_elem,t_nodes,node_elem,no_fix,no_mat,no_prop,no_dof;
int connect[10][10],prescribed_node[10],e_mat_no[10];
float prescribed_value[10],mat_prop[5][5],coordinate[20];
float astiff[20][20],fload[10];
void data();
void stiff();
void boundry();
void gauss();
void result();
int main()
{
data();
stiff();
boundry();
gauss();
result();
}
void data()
{
char filename[20],dummy[60];
int i,j,inode,load_point;
float load_value;
fin=fopen("prob_1.txt","r");
fout=fopen("output_1.dat","w");
AJAY
22001504001 [Type here]
Page |7
fprintf(fout,"\t******************** FEM_ONED
***********************************\n");
fscanf(fin,"%d %d %d %d %d %d
%d",&t_elem,&t_nodes,&node_elem,&no_fix,&no_mat,&no_prop,&no_dof);
fprintf(fout,"Total elements= %d\n Total nodes= %d\n",t_elem,t_nodes);
fprintf(fout,"No. of nodes per elements= %d\n No. of prescribed nodes=
%d\n",node_elem,no_fix);
fprintf(fout,"No. of materials= %d\n No. of material properties=
%d\n",no_mat,no_prop);
fprintf(fout,"No. of degree of freedom= %d\n",no_dof);
for(i=0;i<t_elem;i++)
{
fscanf(fin,"%d",&e_mat_no[i]);
fprintf(fout,"\nMaterial No.= %d",e_mat_no[i]);
for(j=0;j<node_elem;j++)
{
fscanf(fin,"%d",&connect[i][j]);
fprintf(fout,"\n Node %d of element no. %d= %d",j,i,connect[i][j]);
}
fprintf(fout,"\n");
}
fprintf(fout,"\n\n\t COORDINATES\n");
for(i=0;i<t_nodes;i++)
{
fscanf(fin,"%d %f",&inode,&coordinate[i]);
fprintf(fout,"\t%d\t%f\n",inode,coordinate[i]);
}
for(i=0;i<no_fix;i++)
{
fscanf(fin,"%d",&prescribed_node[i]);
fprintf(fout,"\n%d prescribed node is node no
%d",i+1,prescribed_node[i]);
for(j=0;j<no_dof;j++)
{
fscanf(fin,"%f",&prescribed_value[j]);
AJAY
22001504001 [Type here]
Page |8
AJAY
22001504001 [Type here]
Page |9
astiff[irow][jcol]=astiff[irow][jcol]+e_stiff[inode][jnode];
fprintf(fout,"\nstiffness matrix");
for(int inode=0;inode<t_nodes;inode++)
{
fprintf(fout,"\n");
for(int jnode=0;jnode<t_nodes;jnode++)
fprintf(fout,"%f\t",astiff[inode][jnode]);
}
}
}
}
}
void boundry()
{
int i,j,fn,inode;
float s1;
for(i=0;i<no_fix;i++)
{
fn=prescribed_node[i];
for(inode=0;inode<t_nodes;inode++)
{
s1=astiff[inode][fn]*prescribed_value[i];
fload[inode]=fload[inode]-s1;
astiff[inode][fn]=0;
}
astiff[fn][fn]=-1;
}
fprintf(fout,"\n\n\t\t Stiffness Matrix\n");
for(inode=0;inode<t_nodes;inode++)
{
for(int jnode=0;jnode<t_nodes;jnode++)
{
fprintf(fout,"\t%5.2f",astiff[inode][jnode]);
}
fprintf(fout,"\n");
}
}
void gauss()
{
int i,j,k;
for(k=0;k<t_nodes-1;k++)
{
AJAY
22001504001 [Type here]
P a g e | 10
for(i=k+1;i<t_nodes;i++)
{
astiff[k][i]/=astiff[k][k];
fload[k]/=astiff[k][k];
}
astiff[k][k]=1.0;
for(int j=k+1;j<t_nodes;j++)
{
for(int i=k+1;i<t_nodes;i++)
{
astiff[i][j]-=astiff[i][k]*astiff[k][j];
fload[i]-=astiff[i][k]*fload[k];
}
}
}
fload[t_nodes-1]/=astiff[t_nodes-1][t_nodes-1];
for(k=t_nodes-2;k>=0;k--)
{
for(int j=k+1;j<t_nodes;j++)
{
fload[k]-=astiff[k][j]*fload[j];
}
}
}
void result()
{
int i,j;
float rxn[10],disp[10];
for(i=0;i<t_nodes;i++)
{
rxn[i]=0;
for(j=0;j<no_fix;j++)
{
if(i==prescribed_node[j])
{
rxn[i]=fload[i];
disp[i]=prescribed_value[i];
}
else disp[i]=fload[i];
}
}
// REACTION & DISPLACEMENT CALCULATION //
AJAY
22001504001 [Type here]
P a g e | 11
fprintf(fout,"\
n*********************RESULTS***************************\n");
fprintf(fout,"______________________________________________________
\n");
fprintf(fout,"Node\t\tReaction\t\tDisplacement\n");
fprintf(fout,"______________________________________________________
");
for(i=0;i<t_nodes;i++)
{
fprintf(fout,"\n%d\t\t%5.2f\t\t\t %2.5f\n",i,rxn[i],disp[i]);
}
//STRAIN AND STRESS CALCULATION //
float eps, stress[50];
fprintf(fout,"______________________________________________________
\n");
fprintf(fout,"Element \t Strain\t Stress(N/mmsq)\n");
fprintf(fout,"______________________________________________________
");
for (i=0;i<t_elem;i++)
{
eps=(disp[i+1]-disp[i])/(coordinate[connect[i][1]]-
coordinate[connect[i][0]]);
stress[i]=eps* mat_prop[e_mat_no[i]][1];
fprintf(fout,"\n%d\t\t%5.8f\t %5.5f\n",i,eps,stress[i]);
}
fprintf(fout,"**********************END****************************
**");}
INPUT FILE:
3421121
001
012
023
00
1 100
2 200
3 300
00
100
200000
AJAY
22001504001 [Type here]
P a g e | 12
00
10
20
3 5000
OUTPUT:
Total nodes= 4
No. of nodes per elements= 2
No. of prescribed nodes= 1
No. of materials= 1
No. of material properties= 2
No. of degree of freedom= 1
Material No.= 0
Node 0 of element no. 0= 0
Node 1 of element no. 0= 1
Material No.= 0
Node 0 of element no. 1= 1
Node 1 of element no. 1= 2
Material No.= 0
Node 0 of element no. 2= 2
Node 1 of element no. 2= 3
COORDINATES
0 0.000000
1 100.000000
2 200.000000
3 300.000000
1 prescribed node is node no 0
Prescribed value is 0.000000
0 property of 0 material=100.000000
1 property of 0 material=200000.000000
LOADING DATA
Node Load
0 0.000000
1 0.000000
2 0.000000
3 5000.000000
Stiffness Matrix
-1.00 -200000.00 0.00 0.00
0.00 400000.00 -200000.00 0.00
0.00 -200000.00 400000.00 -200000.00
0.00 0.00 -200000.00 200000.00
*********************RESULTS***************************
______________________________________________________
AJAY
22001504001 [Type here]
P a g e | 13
AJAY
22001504001 [Type here]
P a g e | 14
PROBLEM 2:
INPUT FILE:
3421321
AJAY
22001504001 [Type here]
P a g e | 15
001
112
223
00
1 300
2 800
3 1000
0
0
40 200000
20 200000
30 200000
00
10
20
3 1000
OUTPUT:
******************** FEM_ONED
***********************************
One dimensional Finite Element Analysis (Direct Approach)
****************************************************************
**
Total elements= 3
Total nodes= 4
No. of nodes per elements= 2
No. of prescribed nodes= 1
No. of materials= 3
No. of material properties= 2
No. of degree of freedom= 1
Material No.= 0
Node 0 of element no. 0= 0
Node 1 of element no. 0= 1
Material No.= 1
Node 0 of element no. 1= 1
Node 1 of element no. 1= 2
Material No.= 2
Node 0 of element no. 2= 2
2 800.000000
3 1000.000000
1 prescribed node is node no 0
Prescribed value is 0.000000
0 property of 0 material=40.000000
1 property of 0 material=200000.000000
0 property of 1 material=20.000000
1 property of 1 material=200000.000000
0 property of 2 material=30.000000
1 property of 2 material=200000.000000
LOADING DATA
Node Load
0 0.000000
1 0.000000
2 0.000000
3 1000.000000
Stiffness Matrix
-1.00 -26666.67 0.00 0.00
0.00 34666.66 -8000.00 0.00
0.00 -8000.00 38000.00 -30000.00
0.00 0.00 -30000.00 30000.00
*********************RESULTS***************************
Node Reaction Displacement
______________________________________________________
0 -1000.00 0.00000
1 0.00 0.03750
2 0.00 0.16250
3 0.00 0.19583
______________________________________________________
Element Strain Stress(N/mmsq)
______________________________________________________
0 0.00012500 24.99999
1 0.00025000 49.99998
2 0.00016667 33.333333
**********************END******************************
AJAY
22001504001 [Type here]
P a g e | 17
AJAY
22001504001 [Type here]
P a g e | 18
PROBLEM 3:
2000 N
10000 N
100 100 150
INPUT FILE:
3 4 2 1 2 2 1
0 0 1
0 1 2
1 2 3
0 0
1 100
2 200
3 350
0 0
200 200000
100 200000
0 0
1 20000
2 0
3 10000
AJAY
22001504001 [Type here]
P a g e | 19
OUTPUT:
******************** FEM_ONED
***********************************
Total elements= 3
Total nodes= 4
No. of nodes per elements= 2
No. of prescribed nodes= 1
No. of materials= 2
No. of material properties= 2
No. of degree of freedom= 1
Material No.= 0
Node 0 of element no. 0= 0
Node 1 of element no. 0= 1
Material No.= 0
Node 0 of element no. 1= 1
Node 1 of element no. 1= 2
Material No.= 0
Node 0 of element no. 2= 2
Node 1 of element no. 2= 3
Material No.= 0
Node 0 of element no. 3= 3
Node 1 of element no. 3= 4
COORDINATES
0 0.000000
1 100.000000
2 200.000000
3 300.000000
AJAY
22001504001 [Type here]
P a g e | 20
4 450.000000
1 prescribed node is node no 0
Prescribed value is 0.000000
0 property of 0 material=100.000000
1 property of 0 material=200000.000000
LOADING DATA
Node Load
0 0.000000
1 500.000000
2 1000.000000
3 5000.000000
4 2000.000000
Stiffness Matrix
-1.00 -200000.00 0.00 0.00 0.00
0.00 400000.00 -200000.00 0.00 0.00
0.00 -200000.00 400000.00 -200000.00 0.00
0.00 0.00 -200000.00 333333.31 -133333.33
0.00 0.00 0.00 -133333.33 133333.33
*********************RESULTS***************************
__________________________________________________
Node Reaction Displacement
______________________________________________________
0 -7000.01 0.00000
1 0.00 0.03500
2 0.00 0.07000
3 0.00 0.10500
4 0.00 0.12000
______________________________________________________
Element Strain Stress(N/mmsq)
______________________________________________________
0 0.00035000 70.00008
1 0.00035000 70.00008
2 0.00035000 70.00005
3 0.00010000 20.00000
**********************END******************************
AJAY
22001504001 [Type here]
P a g e | 21
PROBLEM 4:
INPUT FILE:
3421221
001
AJAY
22001504001 [Type here]
P a g e | 22
10000 N
012
123
00
1 200
2 400
3 600
00
200 200000
100 200000
00
1 20000
2 15000
3 10000
OUTPUT:
******************** FEM_ONED
***********************************
One dimensional Finite Element Analysis (Direct Approach)
****************************************************************
**
Total elements= 3
Total nodes= 4
No. of nodes per elements= 2
No. of prescribed nodes= 1
No. of materials= 2
No. of material properties= 2
No. of degree of freedom= 1
Stiffness Matrix
-1.00 -200000.00 0.00 0.00
0.00 400000.00 -200000.00 0.00
0.00 -200000.00 300000.00 -100000.00
0.00 0.00 -100000.00 100000.00
*********************RESULTS***************************
______________________________________________________
Node Reaction Displacement
______________________________________________________
0 -25000.07 0.00000
1 0.00 0.12500
2 0.00 0.25000
AJAY
22001504001 [Type here]
P a g e | 23
3 0.00 0.35000
______________________________________________________
Element Strain Stress(N/mmsq)
______________________________________________________
0 0.00062500 125.00037
1 0.00062500 125.00014
2 0.00050000 99.99999
**********************END******************************
AJAY
22001504001 [Type here]
P a g e | 24
PROBLEM 5:
INPUT FILE:
4521121
001
012
023
034
00
1 100
2 200
3 300
4 450
00
100
200000
00
1 500
2 1000
2000 N
3 5000
4 2000
OUTPUT:
******************** FEM_ONED
***********************************
One dimensional Finite Element Analysis (Direct Approach)
****************************************************************
**
Total elements= 4
Total nodes= 5
AJAY
22001504001 [Type here]
P a g e | 25
______________________________________________________
0 -7000.01 0.00000
1 0.00 0.03500
2 0.00 0.07000
3 0.00 0.10500
4 0.00 0.12000
______________________________________________________
Element Strain Stress(N/mmsq)
______________________________________________________
0 0.00035000 70.00008
1 0.00035000 70.00008
2 0.00035000 70.00005
3 0.00010000 20.00000
**********************END******************************
EXPERIMENT NO. 2
AJAY
22001504001 [Type here]
P a g e | 27
place when a body acquires compressive strain due to any thermal expansion or
contraction.
If a rod is heated or cooled, the linear dimensions of the rod get increased or
decreased due
to the property of the rod i.e. coefficient of linear expansion. If the rod is
restricted to increase or
decrease in dimensions, stress-induced in the bar which is known as thermal
stress.
In this program, we use penalty approach instead of direct method as we applied
in 1st program
as a solver for solving our equations. This program is based upon interactive
console input i.e.
input data is typed on monitor screen with the help of keyboard and hence no
input file prepared
in this program.
C++ CODE:
#include <iostream.h>
#include <math.h>
#include <stdio.h>
#include <fstream.h>
#include <conio.h>
void output(char* outfile, fstream& f)
// C++ PROGRAM TO CALCULATE A ONE DIMENSIONAL
// FINITED ELEMENT PROBLEM WITH TEMPERATURE BASED ON
THE
// PENALTY APPROACH. //
// PROGRAM VARIABLES//
// s[][]= ELEMENT STIFFNESS MATRIX
// ne=ELEMENT NUMBER
// nl=LOAD NUMBER
// nd=DISPLACEMENT NUMBER
// a[]= ELEMENT AREA
// alp[]= ELEMENT COEFFICEINT OF THERMAL EXPANSION
// dt[]= NODAL TEMPERATURE DIFFERENCE
// r= REACTION
// stress[]= STRESS VECTOR
// eal= EA/LENGTH (STIFFNESS)
// el= ELEMENT LENGTH
// x21= ELEMENT COORDIDANE DIFFERENCE
AJAY
22001504001 [Type here]
P a g e | 28
float x[50],a[50],u[10],dt[50],s[50][10],f[50],load[10],outf[10],f1[10];
float e[50],alp[50],stress[50],react[10],c,x21,eal,eps,r,tl,el,sum,cnst;
fstream fout;
char outfile[20];
cout <<"============================================\n\n";
cout <<" ONED\n";
cout <<"One dimensional Finite Element Analysis\n";
cout <<" with Temperature effects\n\n";
cout <<"============================================\n\n";
cout <<"Enter data seperated by a space,";
cout <<"data in exponential form i.e. 30e6 is accepted\n\n";
cout <<"Number of elements?\n";
cin >>ne;
cout <<"Number of loads?\n";
cin >>ln;
cout <<"Number of known displacements?\n";
cin >>dn;
nn=ne+1;
nbw=2;
cout <<"Use 0 for non thermal problem\n";
cout <<"Area\tE\tAlpha\tTemp rise\n";
for (i=1;i<=ne;i++)
{
cout<<"\nElement #"<<i<<"\n";
cin >>a[i]>>e[i]>>alp[i]>>dt[i];
}
cout <<"Coordinate input\n";
AJAY
22001504001 [Type here]
P a g e | 29
for (i=1;i<=nn;i++)
{
cout<<"Node # "<<i<<" ";
cin >>x[i];
}
AJAY
22001504001 [Type here]
P a g e | 30
eal=e[i]*a[i]/el;
tl=e[i]*alp[i]*dt[i]*a[i]*el/x21;
f[i1]=f[i1]-tl;
f[i2]=f[i2]+tl;
s[i1][1]=s[i1][1]+eal;
s[i2][1]=s[i2][1]+eal;
s[i1][2]=s[i1][2]-eal;
cout<<"\n******ELEMENT STIFFNESS BEFORE BCs*****\n";
cout<<s[i1][1]<<"\t"<<s[i1][2]<<"\n"<<s[i2][1];
cout<<"\ns[i1][1]=\t"<<i1<<"\t"<<s[i1][1];
cout<<"\ns[i2][1]=\t"<<i2<<"\t"<<s[i2][1];
cout<<"\ns[i1][2]=\t"<<i1<<"\t"<<s[i1][2];
cout<<"\n\t"<<f[i1]<<"\n\t"<<f[i2]<<"\n";
cout<<"\n\nf[i1]=\t"<<i1<<"\t"<<f[i1];
cout<<"\nf[i2]=\t"<<i2<<"\t"<<f[i2]<<"\n";
}
// MODIFY FOR BOUNDARY CONDITIONS USING PENALTY
APPROACH//
cnst=s[1][1]*100000;
for (i=1;i<=dn;i++)
{
n=nu[i];
s[n][1]=s[n][1]+cnst;
f[n]=f[n]+cnst*u[i];
}
for (i=1;i<=ne;i++)
{
cout<<"\n******ELEMENT STIFFNESS AFTER BCs*****\n";
i1=i;
i2=i+1;
cout<<"\ns[i1][1]="<<s[i1][1];
cout<<"\ns[i2][1]="<<s[i2][1];
cout<<"\ns[i1][2]="<<s[i1][2];
cout<<"\n\nf[i1]="<<f[i1];
cout<<"\nf[i2]="<<f[i2];
}
n=nn;
cout<<"Forward elimination";
for (k=1;k<=n-1;k++)
AJAY
22001504001 [Type here]
P a g e | 31
{
cout<<".";
nbk=n-k+1;
if (nbk>nbw) nbk=nbw;
for (i=k+1;i<=nbk+k-1;i++)
{
i1=i-k+1;
c=s[k][i1]/s[k][1];
for (j=i;j<=nbk+k-1;j++)
{
j1=j-i+1;
j2=j-k+1;
s[i][j1]=s[i][j1]-c*s[k][j2];
}
f[i]=f[i]-c*f[k];
}
}
cout<<"\nBack Substitution\n";
f[n]=f[n]/s[n][1];
for (ii=1;ii<=n-1;ii++)
{
i=n-ii;
nbi=n-i+1;
if (nbi>nbw) nbi=nbw;
sum=0;
for(j=2;j<=nbi;j++)
{
sum=sum+s[i][j]*f[i+j-1];
}
f[i]=(f[i]-sum)/s[i][1];
}
cout.precision(10);
fout <<"\n============================================\n\n";
fout <<" ONED\n";
fout <<"One dimensional Finite Element Analysis\n";
fout <<" with Temperature effects\n\n";
fout <<"============================================\n\n";
fout <<"Number of nodes, elements, loads, displacements\n";
fout <<"\t"<<nn<<"\t\t"<<ne<<"\t"<<ln<<"\t"<<dn<<"\n";
AJAY
22001504001 [Type here]
P a g e | 32
cout <<i<<"\t"<<f[i]<<"\n";
}
// STRAIN DUE TO LOAD ONLY CALCULATION
if (ln>0)
{
cout <<"Element #\tStrain due to load only\n";
fout <<"Element #\tStrain due to load only\n";
for (i=1;i<=ne;i++)
{
eps=(f[i+1]-f[i])/(x[i+1]-x[i]);
cout <<i<<"\t\t"<<eps<<"\n";
fout <<i<<"\t\t"<<eps<<"\n";
}
}
// STRESS CALCULATION //
cout <<"Element #\tStress\n";
fout <<"Element #\tStress\n";
for (i=1;i<=ne;i++)
{
AJAY
22001504001 [Type here]
P a g e | 33
eps=(f[i+1]-f[i])/(x[i+1]-x[i]);
stress[i]=e[i]*(eps-alp[i]*dt[i]);
cout <<i<<"\t\t"<<stress[i]<<"\n";
fout <<i<<"\t\t"<<stress[i]<<"\n";
}
// REACTION CALCULATION //
cout <<"Node #\tReaction\n";
fout <<"Node #\tReaction\n";
for (i=1;i<=dn;i++)
{
n=nu[i];
r=cnst*(u[i]-f[n]);
react[i]=r;
cout <<n<<"\t"<<r<<"\n";
fout <<n<<"\t"<<r<<"\n";
}
// LOAD OUTPUT //
cout <<"Node #\tForce\n";
fout <<"Node #\tForce\n";
for (i=1;i<=ln;i++)
{
cout<<load[i]<<"\t"<<outf[i]<<"\n";
fout<<load[i]<<"\t"<<outf[i]<<"\n";
}
fout.close();
{
getch();
}
return 0;
}
AJAY
22001504001 [Type here]
P a g e | 34
PROBLEM 1:
AJAY
22001504001 [Type here]
P a g e | 35
OUTPUT:
============================================
ONED
One dimensional Finite Element Analysis
with Temperature effects
============================================
Number of nodes, elements, loads, displacements
3212
Nodal data
Node # 1 x coordinate = 0
Node # 2 x coordinate = 100
Node # 3 x coordinate = 220
Element data
Element # Area E Alpha Temperature rise
AJAY
22001504001 [Type here]
P a g e | 36
AJAY
22001504001 [Type here]
P a g e | 37
PROBLEM 2:
OUTPUT:
============================================
ONED
One dimensional Finite Element Analysis
with Temperature effects
============================================
Number of nodes, elements, loads, displacements
4322
Nodal data
Node # 1 x coordinate = 0
Node # 2 x coordinate = 308
Node # 3 x coordinate = 418
Node # 4 x coordinate = 528
Element data
Element # Area E Alpha Temperature rise
1 440 70000 0 0
2 220 100000 0 0
3 77 200000 0 0
Results....
Node # Displacement
1 4.838893e-08
2 0.004839
AJAY
22001504001 [Type here]
P a g e | 38
3 0.032258
4 4.516111e-07
Element # Strain due to load only
1 1.571069e-05
2 0.000249
3 -0.000293
Element # Stress
1 1.099748
2 24.926769
3 -58.650791
Node # Reaction
1 -483.889343
4 -4516.11084
Node # Force
2 -5000
3 10000
AJAY
22001504001 [Type here]
P a g e | 39
PROBLEM 3:
OUTPUT:
============================================
ONED
One dimensional Finite Element Analysis
with Temperature effects
============================================
Number of nodes, elements, loads, displacements
9820
Nodal data
Node # 1 x coordinate = 0
Node # 2 x coordinate = 200
Node # 3 x coordinate = 300
Node # 4 x coordinate = 550
Node # 5 x coordinate = 700
AJAY
22001504001 [Type here]
P a g e | 40
Node # Reaction
Node # Force
1 -600000
9 600000
PROBLEM 4:
AJAY
22001504001 [Type here]
P a g e | 42
OUTPUT:
============================================
ONED
One dimensional Finite Element Analysis
with Temperature effects
============================================
AJAY
22001504001 [Type here]
P a g e | 43
2 50
PROBLEM 5:
OUTPUT:
============================================
ONED
One dimensional Finite Element Analysis
with Temperature effects
============================================
Number of nodes, elements, loads, displacements
6502
Nodal data
Node # 1 x coordinate = 0
Node # 2 x coordinate = 200
Node # 3 x coordinate = 400
Node # 4 x coordinate = 600
Node # 5 x coordinate = 800
Node # 6 x coordinate = 1000
Element data
AJAY
22001504001 [Type here]
P a g e | 44
Results....
Node # Displacement
1 -1.63549634e-06
2 -0.0435512625
3 -0.0598950982
4 -0.055296082
5 -0.0342338718
6 1.6354960053e-06
Element # Stress
1 -165.1851348877
2 -137.7072753906
3 -116.5550003052
4 -99.9271697998
5 -86.6221389771
Node # Reaction
1 915423
6 -915422.75
AJAY
22001504001 [Type here]
P a g e | 45
AJAY
22001504001 [Type here]
P a g e | 46
AJAY
22001504001 [Type here]
P a g e | 47
AJAY
22001504001 [Type here]
P a g e | 48
AJAY
22001504001 [Type here]
P a g e | 49
AJAY
22001504001 [Type here]
P a g e | 50
AJAY
22001504001 [Type here]
P a g e | 51
AJAY
22001504001 [Type here]
P a g e | 52
AJAY
22001504001 [Type here]
P a g e | 53
AJAY
22001504001 [Type here]
P a g e | 54
AJAY
22001504001 [Type here]
P a g e | 55
AJAY
22001504001 [Type here]
P a g e | 56
AJAY
22001504001 [Type here]
P a g e | 57
EXPERIMENT NO. 6
AIM: Using commercial software solve Truss problem obtain Displacement
Magnitude and
Resultant forces.
PROCEDURE:
1. First of all enter the open source software LISA 8.0.
2. Select the Analysis <Static 2D> option.
3. Using below problem of Truss having 3-Elements & 3-Nodes, length 1 m
each and
having an angle 45 degree.
4. Select new Node option from command bar and insert coordinates of x & y
axis. By
clicking Add button insert these co-ordinates: x=0 y=0, x=0 y=1, x=1 y=1.
5. Now select new Element option on command bar, Select Line2 for
connecting all nodes.
6. Now select Mesh tools and then node/element list.
7. Select node/element list and select all the element in the list and then click on
edit
option and after that click on truss option.
8. Add materials: first click on general section and give Area =0.0006 ,L= 1m,
E= 210E9,
Poission’s ratio= 0.3, density= 7000,for Element No. 1 & 2;
AJAY
22001504001 [Type here]
P a g e | 58
AJAY
22001504001 [Type here]
P a g e | 59
AJAY
22001504001 [Type here]
P a g e | 60
EXPERIMENT NO. 7
AIM: Using commercial software solve Cantilever Truss problem obtain
Displacement
Magnitude and Resultant forces & Tensile Forces.
PROCEDURE:
1. First of all enter the open source software LISA 8.0.
2. Select the Analysis <Static 2D> option.
3. First change the ft into meter and lb in newton by appropriate values.
4. Now, select new node option and give coordinates as per given problem.
5. Add materials: select <Circular bar> assign Diameter=0.01 and then give
value of E=
200E9, Poission’s ratio= 0.3, density= 7000.
6. Add load and constraints as per required problem.
7. Now click on save option and press the [=] solver from command manager.
8. After that different types of stresses, displacement results are shown at left
side of screen
and respective animation after clicking on table icon you can tabulate all the
data and can
save in excel also.
9. Solved & Animated results are ready.
Fig. Cantilever Truss
AJAY
22001504001 [Type here]
P a g e | 61
AJAY
22001504001 [Type here]
P a g e | 62
AJAY
22001504001 [Type here]
P a g e | 63
EXPERIMENT NO. 8
AIM: Using commercial software solve Stadium Truss problem obtain
Displacement
magnitude and Resultant forces & Tensile Forces.
PROCEDURE:
1. First of all enter the open source software LISA 8.0.
2. Now, select new node option and give coordinates as per given problem and
connect
them accordingly.
3. Add materials: select <Circular bar> assign Area=0.0008 and then give value
of E=
200E9, Poisson’s ratio= 0.3 and density= 7000.
4. Add load and constraints as per required problem.
5. Now click on save option and press the [=] solver from command manager.
6. After that different types of stresses, displacement results are shown at left
side of
screen and respective animation after clicking on table icon you can tabulate all
the
data and can save in excel also.
7. Solved & Animated results are ready.
AJAY
22001504001 [Type here]
P a g e | 64
AJAY
22001504001 [Type here]
P a g e | 65
AJAY
22001504001 [Type here]
P a g e | 66
EXPERIMENT NO. 9
AJAY
22001504001 [Type here]
P a g e | 67
AJAY
22001504001 [Type here]
P a g e | 68
AJAY
22001504001 [Type here]
P a g e | 69
AJAY
22001504001 [Type here]