0% found this document useful (0 votes)
9 views70 pages

EXPERIMENT

important experiments

Uploaded by

sandarbh12345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views70 pages

EXPERIMENT

important experiments

Uploaded by

sandarbh12345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 70

Page |1

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

30.00. 36.00. 42.00


66.00. 81.00. 96.00
102.00. 126.00. 150.00

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");

fprintf(fout,"\n\t One dimensional Finite Element Analysis (Direct


Approach)\n");
fprintf(fout,"\n\
t***********************************************************
*******\n\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

fprintf(fout,"\nPrescribed value is %f\n",prescribed_value[j]);


}
}
for(i=0;i<no_mat;i++)
for(j=0;j<no_prop;j++)
{
fscanf(fin,"%f",&mat_prop[i][j]);
fprintf(fout,"\n%d property of %d material=%f\n",j,i,mat_prop[i][j]);
}
for(i=0;i<t_nodes;i++)
{
fload[i]=0.0;
}
fprintf(fout,"\n\n\t LOADING DATA");
fprintf(fout,"\n\tNode Load");
for(i=0;i<t_nodes;i++)
{
fscanf(fin,"%d %f",&load_point,&load_value);
fload[i]=load_value;
fprintf(fout,"\n\t %d\t\t%f",load_point,load_value);
}
}
void stiff()
{
int material;
float e_stiff[2][2],area,ymod,ln;
for(int i=0;i<t_elem;i++)
{
material=e_mat_no[i];
area=mat_prop[material][0];
ymod=mat_prop[material][1];
ln=coordinate[connect[i][1]]-coordinate[connect[i][0]];
e_stiff[0][0]=(area*ymod)/ln;
e_stiff[0][1]=-e_stiff[0][0];
e_stiff[1][0]=-e_stiff[0][0];
e_stiff[1][1]=e_stiff[0][0];
for(int inode=0;inode<node_elem;inode++)
{
int irow=connect[i][inode];
for(int jnode=0;jnode<node_elem;jnode++)
{
int jcol=connect[i][jnode];

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

Node Reaction Displacement


______________________________________________________
0 -5000.00 0.00000
1 0.00 0.02500
2 0.00 0.05000
3 0.00 0.07500
______________________________________________________
Element Strain Stress(N/mmsq)
______________________________________________________
0 0.00025000 50.00000
1 0.00025000 50.00000
2 0.00025000 50.00000
**********************END******************************

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

Node 1 of element no. 2= 3


COORDINATES
0 0.000000
1 300.000000
AJAY
22001504001 [Type here]
P a g e | 16

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
***********************************

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
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

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
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
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
AJAY
22001504001 [Type here]
P a g e | 26

______________________________________________________
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

AIM: Write a programme for One Dimensional Thermal stress problem. It


includes interactive
input for program variables, Element Stiffness matrix and assembly,
Modification for boundary
conditions, Solver for simultaneous system equations, Stress calculation,
Reaction calculation, and
output data file, Validate the code, use the validated code for solving different
problems.
THEORY: When the external force applied on a body which leads to any sort of
deformity is
caused due to change in temperature, the resultant stress thus created can be
termed as thermal
stress. In other words, thermal stress definition states that formation of
corresponding stress takes

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

// tl= ENERGY DUE TO DELTA T


// f[]= APPLIED LOAD AT NODE
// u[]= PRESCRIBED DISPLACEMENT AT NODE.
// cnst= STIFFNESS VALUE AT [1][1]*10000: PENALTY APPROACH
// nbw= BANDWIDTH = 2
{
outfile="out2_8.dat";
f.open(outfile, ios::out);
}
int main()
{
int ne,ln,dn,nn,nbw,i,i1,i2,j1,j2,n,k,nbk,ii,j,nu[10],nbi,ll;

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];
}

cout <<"Input Node # Displacement\n";


for (i=1;i<=dn;i++)
{
cin >>nu[i]>>u[i];
}
for (i=1;i<=nbw;i++)
{
f[i]=0.0;
for (j=1;j<=nbw;j++)
{
s[i][j]=0.0;
}
}
if (ln==0) goto stiff;
cout <<"Enter known loads\n";
for (i=1;i<=ln;i++)
{
cout<<"Node # ";
cin >>ll;
load[i]=ll;
cout<<"Applied load ";
cin >>f[ll];
outf[i]=f[ll]; //f1[i];
}
output(outfile, fout);
stiff: //STIFFNESS MATRIX//
for (i=1;i<=ne;i++)
{
i1=i;
i2=i+1;
x21=x[i2]-x[i1];
el=fabs(x21);

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

fout <<"Nodal data\n";


for (i=1;i<=nn;i++)
{
fout<<"Node # "<<i<<" x coordinate = "<<x[i]<<"\n";
}
fout <<"Element data\n";
fout <<"Element #\tArea\t\tE\tAlpha\tTemperature rise\n";
for (i=1;i<=ne;i++)
{
fout <<i<<"\t\t"<<a[i]<<"\t"<<e[i]<<"\t"<<alp[i]<<"\t\t"<<dt[i]<<"\n";
}
cout <<"\nResults....\n\n";
fout <<"\nResults....\n\n";
cout <<"Node #\tDisplacement\n";
fout <<"Node #\tDisplacement\n";
for (i=1;i<=nn;i++)
{
fout <<i<<"\t"<<f[i]<<"\n";

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

1 706.859985 210000 1.1e-05 60


2 1256.599976 70000 2.4e-05 60
Results....
Node # Displacement
1 -7.217539e-07
2 -0.006176
3 6.787654e-07
Element # Strain due to load only
1 -6.175394e-05
2 5.147329e-05
Element # Stress
1 -151.568329
2 -97.196877
Node # Reaction
1 107137.578125
3 -100756.335937
Node # Force
2 15000

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 # 6 x coordinate = 950


Node # 7 x coordinate = 1100
Node # 8 x coordinate = 1300
Node # 9 x coordinate = 1500
Element data
Element # Area E Alpha Temperature rise
1 113010 200000 0 0
2 5027 200000 0 0
3 7854 200000 0 0
4 5027 200000 0 0
5 7854 200000 0 0
6 5027 200000 0 0
7 7854 200000 0 0
8 113010 200000 0 0
Results....
Node # Displacement
1 -0.157438
2 -0.152129
3 -0.092451
4 6.164823e-07
5 0.089517
6 0.18501
7 0.274527
8 0.350922
9 0.356231
Element # Strain due to load only
1 2.654627e-05
2 0.000597
3 0.00037
4 0.000597
5 0.000382
6 0.000597
7 0.000382
8 2.654627e-05
Element # Stress
1 5.309254
2 119.355469
3 73.961464
4 119.355766
5 76.394356
6 119.355743
7 76.394348
8 5.309254
AJAY
22001504001 [Type here]
P a g e | 41

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
============================================

Number of nodes, elements, loads, displacements


3212
Nodal data
Node # 1 x coordinate = 0
Node # 2 x coordinate = 15
Node # 3 x coordinate = 25
Element data
Element # Area E Alpha Temperature rise
1 2 10000000 1.28e-05 60
2 3 2.9e+08 6.5e-06 60
Results....
Node # Displacement
1 -1.518638e-07
2 -0.003667
3 1.522388e-07
Element # Strain due to load only
1 -0.000244
2 0.000367
Element # Stress
1 -10124.25293
2 -6766.173828
Node # Reaction
1 20248.505859
3 -20298.511719
Node # Force

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

Element # Area E Alpha Temperature rise


1 5541.8 2.02e5 1.2e-5 50
2 5541.8 2.02e5 1.2e-5 50
3 5541.8 2.02e5 1.2e-5 50
4 5541.8 2.02e5 1.2e-5 50
5 5541.8 2.02e5 1.2e-5 50

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

Introduction to LISA Finite Element Analysis Software


Version 8.0.0
LISA is a user-friendly finite element analysis package for Windows with an
integrated modeler,
multi-threaded solver and graphical post-processor.
The finite element method, therefore, has three main stages:
1) build the model
2) solve the model

AJAY
22001504001 [Type here]
P a g e | 45

3) display the results


These can be broken down further:
 Build the model
o create nodes in positions to represent the object’s shape
 either create in LISA or
 import from an existing CAD model
 refine as required.
o create finite elements (beams, plates, bricks, etc) between the nodes
o assign material properties to the elements
o assign constraints to selected nodes
o assign applied forces to the appropriate nodes.
 Solve the model
o define the type of analysis you want e.g. static linear, vibrational modes,
dynamic
response with time, etc.
o let LISA’s Solver do the work.
 Display the results
o open the results file and select which parameters you want to display e.g.
displacement,
principal stress, temperature, voltage,
o display as 2D or 3D contour plots, and/or as tables of numerical values,
o before inferring anything from the results, they must first be validated,
o validation requires confirming mesh convergence has occurred and that values
are in line
with expectations from hand calculations, experiments or past experience,
o mesh convergence requires refining the mesh repeatedly and solving until the
results no
longer change appreciably.

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.

INTRODUTION: Truss Element:-


A truss is an assembly of beams or other elements that creates a rigid structure.
In engineering, a truss is a structure that "consists of two-force members only,
where the members
are organized so that the assemblage as a whole behaves as a single object". A
"two-force member"
is a structural component where force is applied to only two points. Although
this rigorous
definition allows the members to have any shape connected in any stable
configuration, trusses
typically comprise five or more triangular units constructed with straight
members whose ends are
connected at joints referred to as nodes. External forces and reactions to those
forces are considered
to act only at the nodes and result in forces in the members that are either tensile
or compressive

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

9. Add material: Area= 0.000848, E= 210E9, Poission’s ratio= 0.3,


Density=7000 ; for
Element No. 3;
10. Select Node-1 and add new displacement as x=y=z=0, Select node-2 fixed
y=z=0
Select Node-3 roller support at 45 degree.
11. Solved & Animated results are ready.

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.

Fig. Stadium Truss.

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]

You might also like