3.4 Numerical example : optimum truss design
Given a truss as in the figure with the following parameters :
L=3m
[σU] = - [σL] = 16 ( kN/cm2 )
E = 2.104 ( kN/cm2 )
P=25 kN
P
2P
7
3
4
5
6
L
The bars are of hollow circular
1
2
sections in terms of inside radious
A
ri and thickness ti .
L
L
Design the cross sections of the bars
in order to minimize the weight of
the truss. Assume that the bars 1,2 have the same cross sections, the bars 3,4,5
also have the same ones and the same for the left. One more condition is the
thickness ti is greater than or equal to the radious ri .
Solution :
3.4.1 FEM solutions :
X1,X2,X3 are the cross-sectional areas of group 1( bars 1,2 ), 2 ( bars 3,4,5 ),
and 3 ( bars 6,7 ), respectively.
Here are the solutions from a Matlab program :
a. Truss form
Prof. Bui Cong Thanh
Optimization project
b. Stresses of bars :
Stresses of bars in term of variables X1,X2,X3.
Bar
Normal stress
1 25/2*(87960930222080*X2+124395540479019*X3)/(43980465111040*
2
3
4
5
6
7
X2*X3 +87960930222080*X1*X2+124395540479019*X1*X3)
25/2*(87960930222080*X2+124395540479019*X3)/(43980465111040*
X2*X3+87960930222080*X1*X2+124395540479019*X1*X3)
-621977702395095/35184372088832*(87960930222080*X2*X3+
+87960930222080*X1*X2+124395540479019*X1*X3)/X2/
(43980465111040*X2*X3+87960930222080*X1*X2
+124395540479019*X1*X3)
Comment
tension
tension
compression
0
-621977702395095/35184372088832*X1*(87960930222080*X2+
124395540479019*X3)/X2/(43980465111040*X2*X3+
87960930222080*X1*X2+124395540479019*X1*X3)
-50/X3
-1099511627776000/(43980465111040*X2*X3
+87960930222080*X1*X2+124395540479019*X1*X3)*X2
compression
compression
compression
c. Displacements :
Displacements
Node
x-direction
y-direction
1
2
0
3/16*(87960930222080*X2+124395540479019*
X3)/(43980465111040*X2*X3+87960930222080
*X1*X2 +124395540479019*X1*X3)
0
-3/703687441776640*
*(3868562622766813359059763200*X2^2
+10941947456012918357250539520*X2*X3
+10941947456012918357250539520*X1*X2
+15474250491067254579979202361*X1*X3
) /X2/(43980465111040*X2*X3+
87960930222080*X1*X2+
124395540479019*X1*X3)
3
3/8*(87960930222080*X2+124395540479019*X
3)/(43980465111040*X2*X3+87960930222080*
X1*X2+124395540479019*X1*X3)
16492674416640/(43980465111040*X2*X3+879
60930222080*X1*X2+124395540479019*X1*X3
)*X2
4
5
EMMC11 Nguyen Quoc Duan
0
0
3/703687441776640*(3868562622766813359
059763200*X2^2+1094194745601291835725
0539520*X2*X3+1094194745601291835725
0539520*X1*X2+1547425049106725457997
9202361*X1*X3)/X2/(43980465111040*X2*
X3+87960930222080*X1*X2+12439554047
9019*X1*X3)
-3/4/X3
- Comment 2/22 -
Prof. Bui Cong Thanh
Optimization project
3.4.2 Fully stress design :
Loop
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Results of variables
X1
X2
X3
10
20
30
0.5277 1.4635 3.125
0.4499 1.5735 3.125
0.4086 1.6318 3.125
0.3846 1.6658 3.125
0.3699 1.6866 3.125
0.3606 1.6998 3.125
0.3545 1.7084 3.125
0.3505
1.714 3.125
0.3479 1.7177 3.125
0.3461 1.7202 3.125
0.345 1.7219 3.125
0.3442
1.723 3.125
0.3436 1.7237 3.125
0.3433 1.7242 3.125
0.343 1.7246 3.125
0.3429 1.7248 3.125
0.3428
1.725 3.125
0.3427 1.7251 3.125
0.3426 1.7251 3.125
0.3426 1.7252 3.125
0.3426 1.7252 3.125
1
0.8443
13.6408
14.5329
15.0607
15.3875
15.5959
15.7313
15.8205
15.8796
15.9191
15.9456
15.9634
15.9753
15.9833
15.9888
15.9924
15.9949
15.9965
15.9977
15.9984
15.9989
15.9993
2
0.8443
13.6408
14.5329
15.0607
15.3875
15.5959
15.7313
15.8205
15.8796
15.9191
15.9456
15.9634
15.9753
15.9833
15.9888
15.9924
15.9949
15.9965
15.9977
15.9984
15.9989
15.9993
Stresses of bars
3
4
5
-1.1708
0
-0.597
-17.203
0 -6.9556
-16.5932
0
-5.876
-16.3326
0 -5.3333
-16.2
0 -5.0247
-16.1253
0 -4.8373
-16.0806
0 -4.7191
-16.0527
0 -4.6428
-16.0348
0 -4.5927
-16.0232
0 -4.5596
-16.0155
0 -4.5375
-16.0104
0 -4.5228
-16.007
0 -4.5129
-16.0047
0 -4.5062
-16.0032
0 -4.5017
-16.0021
0 -4.4987
-16.0014
0 -4.4966
-16.001
0 -4.4953
-16.0007
0 -4.4943
-16.0004
0 -4.4937
-16.0003
0 -4.4933
-16.0002
0
-4.493
6
-1.667
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
7
-0.2705
-3.3934
-3.8158
-4.0614
-4.2122
-4.3079
-4.3699
-4.4106
-4.4376
-4.4556
-4.4676
-4.4757
-4.4812
-4.4848
-4.4873
-4.489
-4.4901
-4.4909
-4.4914
-4.4917
-4.4919
-4.4921
Solution :
Areas of bars at optimum :
A1 = 0.342584 (cm2)
A2 = 0.342584 (cm2)
A3 = 1.72522 (cm2)
A4 = 1.72522 (cm2)
A5 = 1.72522 (cm2)
A6 = 3.125 (cm2)
A7 = 3.125 (cm2)
Cross-sectional area of bar 1,2 : X1 = 0.342584 (cm2)
Cross-sectional area of bar 3,4,5 : X2 = 1.72522 (cm2)
Cross-sectional area of bar 6,7 : X3 = 3.125 (cm2)
Radious of bar 1,2
: r1 = 1.56398 (cm)
Radious of bar 3,4,5
: r2 = 3.50971 (cm)
Radious of bar 6,7
: r3 = 4.72361 (cm)
Thickness of bar 1,2
: t1 = 0.312797 (cm)
Thickness of bar 3,4,5 : t2 = 0.701942 (cm)
EMMC11 Nguyen Quoc Duan
- Comment 3/22 -
Prof. Bui Cong Thanh
Thickness of bar 6,7
Optimization project
: t3 = 0.944721 (cm)
The volume of the truss : 4062 (cm3)
3.4.3 Sequential linear programming :
Loop
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Results of variables (cm2)
X1
X2
X3
10
20
30
0.0864 24.5753 22.8437
6.1713 19.3232 23.5126
0.0864 25.4037 23.5227
6.5229 19.1767 23.5227
0.0864 25.2642 23.5227
6.4765 19.2024 23.5227
0.0864
25.284 23.5227
6.4831 19.1987 23.5227
0.0864 25.2812 23.5227
6.4822 19.1993 23.5227
0.0864 25.2816 23.5227
6.4823 19.1992 23.5227
0.0864 25.2815 23.5227
6.4823 19.1992 23.5227
0.0864 25.2815 23.5227
6.4823 19.1992 23.5227
0.0864 25.2815 23.5227
6.4823 19.1992 23.5227
0.0864 25.2815 23.5227
6.4823 19.1992 23.5227
0.0864 25.2815 23.5227
1
0.8443
2.4895
1.1914
2.4136
1.1549
2.421
1.1595
2.42
1.1588
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
2
0.8443
2.4895
1.1914
2.4136
1.1549
2.421
1.1595
2.42
1.1588
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
1.1589
2.4201
Stresses of bars (kN/cm2)
3
4
5
6
-1.1708 0
-0.597 -1.6667
-1.4263 0 -0.0124 -2.1888
-1.2916 0 -0.5381 -2.1265
-1.3801 0 -0.0116 -2.1256
-1.2881 0 -0.5555 -2.1256
-1.3877 0 -0.0117 -2.1256
-1.2882 0
-0.553 -2.1256
-1.3866 0 -0.0117 -2.1256
-1.2881 0 -0.5534 -2.1256
-1.3868 0 -0.0117 -2.1256
-1.2882 0 -0.5533 -2.1256
-1.3868 0 -0.0117 -2.1256
-1.2882 0 -0.5534 -2.1256
-1.3868 0 -0.0117 -2.1256
-1.2882 0 -0.5534 -2.1256
-1.3868 0 -0.0117 -2.1256
-1.2882 0 -0.5534 -2.1256
-1.3868 0 -0.0117 -2.1256
-1.2882 0 -0.5534 -2.1256
-1.3868 0 -0.0117 -2.1256
-1.2882 0 -0.5534 -2.1256
-1.3868 0 -0.0117 -2.1256
7
-0.2705
-1.0756
-0.4379
-1.0451
-0.4223
-1.045
-0.4243
-1.045
-0.424
-1.045
-0.4241
-1.045
-0.4241
-1.045
-0.4241
-1.045
-0.4241
-1.045
-0.4241
-1.045
-0.4241
-1.045
F(cm3)
46971
41983
40004
43342
40052
43182
40054
43205
40054
43202
40054
43202
40054
43202
40054
43202
40054
43202
40054
43202
40054
43202
OPTIMUM
Optimum variables values :
Xopt = [ 6.4823 19.1992 23.5227] (cm2)
Areas of bars at optimum
A1 = 6.48232 (cm2)
A2 = 6.48232 (cm2)
A3 = 19.1992 (cm2)
A4 = 19.1992 (cm2)
A5 = 19.1992 (cm2)
A6 = 23.5227 (cm2)
A7 = 23.5227 (cm2)
Number of loop: 21
EMMC11 Nguyen Quoc Duan
- Comment 4/22 -
Prof. Bui Cong Thanh
Optimization project
Cross-sectional area of bar 1,2 : X1 = 6.48232 (cm2)
Cross-sectional area of bar 3,4,5 : X2 = 19.1992 (cm2)
Cross-sectional area of bar 6,7 : X3 = 23.5227 (cm2)
Radious of bar 1,2
Radious of bar 3,4,5
Radious of bar 6,7
: r1 = 6.80321 (cm)
: r2 = 11.7082 (cm)
: r3 = 12.9596 (cm)
Thickness of bar 1,2
: t1 = 1.36064 (cm)
Thickness of bar 3,4,5 : t2 = 2.34164 (cm)
Thickness of bar 6,7
: t3 = 2.59192 (cm)
The volume of optimum design
:
Fopt = 40054 (cm3)
3.4.4 Comparision between FSD and SLP :
Convergence :
- FSD gives the results convergen after the first loop to nearly the optimum.
- Euler’s stability conditions are active at optimum in SLP method. Moreover,
the Euler’s conditions are not continum. Hence, the optimum jumps between
two values after some loops.
Stress :
- FSD stresses are of limiting.
- SLP stresses are not because of Euler’s conditions.
Cost :
If we consider the stability conditions in SLP design, it is 10 times more
expensive than FSD.
EMMC11 Nguyen Quoc Duan
- Comment 5/22 -
Prof. Bui Cong Thanh
Optimization project
REFERENCES
[1]. Buøi Coâng Thaønh - “Taäp baøi giaûng moân hoïc Tính Toaùn Keát Caáu Toái
Öu” Ho Chi Minh City University of Polytechnology, Vietnam, 2000.
[2]. Uri Kirsch - “Optimum Structural Design”. McGraw-Hill Book Company,
USA, 1981.
[3]. Garret N. Vanderplaats - “Numerical Optimization Techniques for Engineering
Design”. McGraw-Hill Book Company, USA, 1984
[4] M.J.Fagan, Finite Element Analysis-Theory and practise, Longman Scientific &
technical,1992.
[5] Young W.Kwon, Hyochoong Bang - “The Finite Element Method using Matlab”,
CRC Press, 1997.
[6] Vincent Legat, Introduction to FEM – Lectures for EMMC11, 3/2006.
EMMC11 Nguyen Quoc Duan
- Comment 6/22 -
Prof. Bui Cong Thanh
Optimization project
APPENDIX A : BEAM
Matlab codes for Powell’s and exterior penalty function method
%
GEOETRY GRAPHIC SOLUTION
%-----------------------------------------------------------------------% % Objective function : Z = 3.68*t*h - 4.8*t^2
% % Design constraints :
%
g1 = 0.1-t;
%
g2 = 2*t-0.7*h;
% % Stability constraint :
%
g3 = h-72*t;
% % Behavior (stress) constraint :
%
g4=900*h/(0.7*h^4-(0.7*h-2*t)*(h-2.4*t)^3)/12-16;
% % Displacement constraint :
%
g5=243/(0.7*h^4-(0.7*h-2*t)*(h-2.4*t)^3)/12-0.9;
%------------------------------------------------------------------------clear all;
close all;
clc;
x=0:0.1:1; % x=t
y=0:0.1:30; % y=h
[X Y] = meshgrid(x,y);
f1 = objA(X,Y);
eq1 = eqcon1A(X,Y);
eq2 = eqcon2A(X,Y);
eq3 = eqcon3A(X,Y);
eq4 = eqcon4A(X,Y);
eq5 = eqcon5A(X,Y);
% -----------------------------------------------------------------------%
Plot g1 [ contour value is 0 ]
% -----------------------------------------------------------------------[C1,h1] = contour(x,y,eq1,[0,0],'r-');
clabel(C1,h1);
set(h1,'LineWidth',2)
grid on
hold on
k1 = gtext('g1=0.1-t'); % Click mouse to place 'g1' in the figure
set(k1,'FontName','Times','FontWeight','bold','FontSize',12,'Color','red')
% -----------------------------------------------------------------------%
Plot g2 [ contour value is 0 ]
% -----------------------------------------------------------------------[C2,h2] = contour(x,y,eq2,[0,0],'m-');
clabel(C2,h2);
set(h2,'LineWidth',2)
k2 = gtext('g2=2t-0.7h');
set(k2,'FontName','Times','FontWeight','bold','FontSize',12,'Color','magenta')
hold on;
% -----------------------------------------------------------------------%
Plot g3 [ contour value is 0 ]
EMMC11 Nguyen Quoc Duan
- Comment 7/22 -
Prof. Bui Cong Thanh
Optimization project
% -----------------------------------------------------------------------[C3,h3] = contour(x,y,eq3,[0,0],'b--');
clabel(C3,h3);
set(h3,'LineWidth',2)
k3 = gtext('g3=h-72t');
set(k3,'FontName','Times','FontWeight','bold','FontSize',12,'Color','blue')
hold on;
% -----------------------------------------------------------------------%
Plot g4 [ contour value is 0 ]
% -----------------------------------------------------------------------[C4,h4] = contour(x,y,eq4,[0,0],'g--');
clabel(C4,h4);
set(h4,'LineWidth',2)
k4 = gtext('g4=stress');
set(k4,'FontName','Times','FontWeight','bold','FontSize',12,'Color','green')
hold on;
% -----------------------------------------------------------------------%
Plot g5 [ contour value is 0 ]
% -----------------------------------------------------------------------[C5,h5] = contour(x,y,eq5,[0,0],'c--');
clabel(C5,h5);
set(h5,'LineWidth',2)
k5 = gtext('g5=Deflection');
set(k5,'FontName','Times','FontWeight','bold','FontSize',12,'Color','cyan')
hold on;
% -----------------------------------------------------------------------%
Plot objective function Z
% -----------------------------------------------------------------------for i=[0,18.8,50]
[C,h] = contour(x,y,f1,[i,i],'k-');
clabel(C,h);
set(h,'LineWidth',1)
end
k5 = gtext('Zmin=18.8 (cm2)');
set(k5,'FontName','Times','FontWeight','bold','FontSize',12,'Color','blue')
% -----------------------------------------------------------------------%
Legend
% -----------------------------------------------------------------------xlabel('Thickness t(cm)')
h = get(gca,'xlabel');
set(h,'FontSize',12,'FontName','VNI-Times','color','b');
ylabel('Height h(cm)')
h = get(gca,'ylabel');
set(h,'FontSize',12,'FontName','VNI-Times','color','b');
title('GEOMETRY GRAPHIC SOLUTION');
h = get(gca,'Title');
set(h,'FontSize',14,'FontName','VNI-Times','color','r');
hold off
% -----------------------------COMPLETED----------------------------------
EMMC11 Nguyen Quoc Duan
- Comment 8/22 -
Prof. Bui Cong Thanh
Optimization project
%*********************************************************************************************
%***
POWELL AND EXTERIOR PENALTY FUNCTION METHOD
***
%***
Nguyen Quoc Duan : I-2-1-b
***
%*********************************************************************************************
%
This is a practise exercise on Optimizing Structures
%
University of Liege - EMMC
%
( European Master in Mechanics of Constructions )
% Professor : Bui Cong Thanh (Faculty of Civil Engineering-HCMUT,Vietnam)
% Student : Nguyen Quoc Duan (EMMC11 - Ho Chi Minh City, Vietnam )
% PROBLEM : *************************************************************
% Optimize the weight of a simple beam with 2 variables :
**
% t (web thickness) and h (section height).
**
% Beam span : L = 1.8 m
**
% Concentrated load at midpan : P = 40 kN
**
% Limit stress : 16 kN/cm2
**
% Elastic modulus : E = 2.10^4 kN/cm2
**
%
% ************************************************************************
clear all; close all; clc;
disp(' The program is working. Please wait for a while, professor !');
disp('Units : kN-cm');
% Define symbolic variables
syms t h real ;
% OBJECTIVE FUNCTION : cross section area
Z=3.68*h*t-4.8*t^2 ; % Z --> minimum
% EXTERIOR PENALTY FUNCTION
% Initial data :
epsilon=0.001; % iteration tolerance
Xo=[0.25 19]; % initial vector of design variables
to=Xo(1);
% initial web thickness
ho=Xo(2);
% initial section height
rp=1;
% penalty multipier
X=[];
% coordinates matrix
X(1,:)=Xo;
S=[];
% search direction matrix
Zm=[];
ph=[];
Zm(1)=subs(Z,{t,h},X(1,:));
for q=1:5
for i=(3*q-1):(3*q)
% Exterior penalty functions :
P=expenalty(X(i-1,:));
% Pseudo-objective function :
EMMC11 Nguyen Quoc Duan
- Comment 9/22 -
Prof. Bui Cong Thanh
Optimization project
phi=Z+rp*P;
if q==1 & i==2
ph(1)=subs(phi,{t,h},X(1,:));
end
% The first two search directions
if q==1
S(3*q-2,:)=[1 0];
S(3*q-1,:)=[0 1];
else
S(3*q-2,:)=S(3*(q-1)-1,:);
S(3*q-1,:)=S(3*(q-1),:);
end
% Minimize
anpha=sym('anpha','real');
Xanpha=X(i-1,:)+anpha*S(i-1,:);
phiXanpha=subs(phi,{t,h},Xanpha);
anpha=solve(diff(phiXanpha,anpha));
%
anpha=double(anpha);
anphareal=[];
for j=1:length(anpha)
% loop for choosing real roots
if isreal(anpha(j))==1
anphareal=[anphareal;anpha(j)];
else
anphareal=anphareal;
end
end
anphareal=double(anphareal);
l=length(anphareal);
fi=[];
x=[];
for k=1:l
x(k,:)=X(i-1,:)+anphareal(k)*S(i-1,:);
fi(k)=double(subs(phi,{t,h},x(k,:)));
end
fi=double(fi);
phimin=min(fi);
k=find(fi==phimin);
anphamin=anphareal(k);
X(i,:)=X(i-1,:)+anphamin*S(i-1,:);
%output
Zm(i)=double(subs(Z,{t,h},X(i,:)));
ph(i)=double(subs(phi,{t,h},X(i,:)));
X
end
% The third search direction
for i=3*q+1
% Exterior penalty functions :
P=expenalty(X(i-1,:));
% Pseudo-objective function :
phi=Z+rp*P;
% The third search direction
Sq=X(3*q,:)-X(3*q-2,:);
S(3*q,:)=abs(Sq)/sqrt(Sq(1)^2+Sq(2)^2);
% Minimize
anpha=sym('anpha','real');
Xanpha=X(i-1,:)+anpha*S(i-1,:);
phiXanpha=subs(phi,{t,h},Xanpha);
anpha=solve(diff(phiXanpha,anpha));
%
anpha=double(anpha);
EMMC11 Nguyen Quoc Duan
- Comment 10/22 -
Prof. Bui Cong Thanh
Optimization project
anphareal=[];
for j=1:length(anpha)
% loop for choosing real roots
if isreal(anpha(j))==1
anphareal=[anphareal;anpha(j)];
else
anphareal=anphareal;
end
end
anphareal=double(anphareal);
l=length(anphareal);
fi=[];
x=[];
for k=1:l
x(k,:)=X(i-1,:)+anphareal(k)*S(i-1,:);
fi(k)=double(subs(phi,{t,h},x(k,:)));
end
fi=double(fi);
phimin=min(fi);
k=find(fi==phimin);
anphamin=anphareal(k);
X(i,:)=X(i-1,:)+anphamin*S(i-1,:);
% output
Zm(i)=double(subs(Z,{t,h},X(i,:)));
ph(i)=double(subs(phi,{t,h},X(i,:)));
X
end
e1=abs(X(i,1)-X(i-1,1));
e2=abs(X(i,2)-X(i-1,2));
if e1<epsilon & e2<epsilon
break
else
q=q
end
end
i=i
X=X
ph=ph'
Zm=Zm'
disp('******************************************************************************************');
disp('***
Completed !
***');
disp('*** THANK YOU FOR YOUR INTERESTING LECTURES, PROFESSOR ! ***');
disp('******************************************************************************************');
function P = expenalty(X)
% Compute the exterior penalty function
syms t h real
tq=X(1);
hq=X(2);
EMMC11 Nguyen Quoc Duan
- Comment 11/22 -
Prof. Bui Cong Thanh
Optimization project
% CONSTRAINT CONDITIONS :
% Design constraints :
g1 = 0.1-t;
g2 = 2*t-0.7*h;
% Stability constraint :
g3 = h-72*t;
% Behavior (stress) constraint :
g4=900*h/(0.7*h^4-(0.7*h-2*t)*(h-2.4*t)^3)/12-16;
% Displacement constraint :
g5=243/(0.7*h^4-(0.7*h-2*t)*(h-2.4*t)^3)/12-0.9;
% Numerical values of penalty functions
g1q=subs(g1,tq);
g2q=subs(g2,{t,h},{tq,hq});
g3q=subs(g3,{t,h},{tq,hq});
g4q=subs(g4,{t,h},{tq,hq});
g5q=subs(g5,{t,h},{tq,hq});
% Exterior penalty functions :
% p1
if g1q<0
p1=0;
else
p1=g1^2;
end
% p2
if g2q<0
p2=0;
else
p2=g2^2;
end
% p3
if g3q<0
p3=0;
else
p3=g3^2;
end
% p4
if g4q<0
p4=0;
else
p4=g4^2;
end
% p5
if g5q<0
p5=0;
else
p5=g5^2;
end
%P
P = p1+p2+p3+p4+p5;
EMMC11 Nguyen Quoc Duan
- Comment 12/22 -
Prof. Bui Cong Thanh
Optimization project
APPENDIX B : TRUSS
Matlab codes for FSD and SLP
%*************************************************************************
%***
FINITE ELEMENT ANALYSIS FOR PLANE TRUSS
%***
Nguyen Quoc Duan : I-2-1-b
***
%*************************************************************************
%
This is a practise exercise on Optimizing Structures
***
%
University of Liege - EMMC
%
( European Master in Mechanics of Constructions )
% Professor : Bui Cong Thanh (Faculty of Civil Engineering-HCMUT,Vietnam)
% Student : Nguyen Quoc Duan (EMMC11 - Ho Chi Minh City, Vietnam )
clear all; close all; clc;
disp(' The program is working. Please wait for a while, professor !');
disp ('DIMENSIONS IN : KN-cm ')
format short ;
% INITIAL DATA
L=300 ;
h=300 ;
P=25 ;
E=2e4 ;
sigU=16 ;
sigL=-16;
% L = 3m = 300 cm
% h = L = 300 cm
% P = 25 kN : concentrated load
% Elastic modulus of the material (kN/cm2)
% Upper bound of stresses (kN/cm2)
% Lower bound of stresses (kN/cm2)
% INPUT DATA
%------------------------------------------------------------------------%
control input data
%------------------------------------------------------------------------nel=7;
% number of elements
nnel=2;
% number of nodes per element
ndof=2;
% number of dofs per node
edof=nnel*ndof; % number of dofs per element
nnode=5;
% total number of nodes in system
sdof=nnode*ndof; % total system dofs
%------------------------------------------------------------------------%
nodal coordinates
%------------------------------------------------------------------------gcoord(1,1)=0.0 ;
gcoord(2,1)=L ;
gcoord(3,1)=2*L ;
gcoord(4,1)=L ;
gcoord(5,1)=2*L ;
gcoord(1,2)=0.0 ;
gcoord(2,2)=0.0 ;
gcoord(3,2)=0.0 ;
gcoord(4,2)=h ;
gcoord(5,2)=h ;
EMMC11 Nguyen Quoc Duan
- Comment 13/22 -
Prof. Bui Cong Thanh
Optimization project
X=zeros(nnode,1); % x-coordinates of nodes
Y=zeros(nnode,1); % y-coordinates of nodes
for inode=1:nnode
X(inode)=gcoord(inode,1);
Y(inode)=gcoord(inode,2);
end
%------------------------------------------------------------------------%
nodal connectivity
%------------------------------------------------------------------------nodes(1,1)=1;
nodes(2,1)=2;
nodes(3,1)=1;
nodes(4,1)=2;
nodes(5,1)=4;
nodes(6,1)=3;
nodes(7,1)=4;
nodes(1,2)=2;
nodes(2,2)=3;
nodes(3,2)=4;
nodes(4,2)=4;
nodes(5,2)=3;
nodes(6,2)=5;
nodes(7,2)=5;
% Length of bar
Lbar = zeros(nel,1);
for i=1:nel
Lbar(i)=sqrt((X(nodes(i,2))-X(nodes(i,1)))^2+...
+(Y(nodes(i,2))-Y(nodes(i,1)))^2);
end
%------------------------------------------------------------------------%
material and geometric properties
%------------------------------------------------------------------------syms X1 X2 X3 real
% cross-section area variables (cm2)
A=[X1 X1 X2 X2 X2 X3 X3]'; % cross-section area matrix of elements
% -----------------------------------------------------------------------%
MESH CONFIGURATION
% -----------------------------------------------------------------------figure;
h=gcf;
set(h,'name','Truss form');
set(h,'NumberTitle','off');
axis equal;
title('Undeformation Truss Form');
m=zeros(nel,2); % matrix of beginning nodes of the elements
n=zeros(nel,2); % matrix of ending nodes of the elements
for iel=1:nel
m(iel,:)=[X(nodes(iel,1)) Y(nodes(iel,1))];
n(iel,:)=[X(nodes(iel,2)) Y(nodes(iel,2))];
end
for iel=1:nel
x=[m(iel,1) n(iel,1)];
y=[m(iel,2) n(iel,2)];
if iel==1 | iel==2
EMMC11 Nguyen Quoc Duan
- Comment 14/22 -
Prof. Bui Cong Thanh
Optimization project
plot(x,y,'r','LineWidth',3);
elseif iel==3 | iel==4 | iel==5
plot(x,y,'b','LineWidth',3);
else
plot(x,y,'g','LineWidth',3);
end
% locate the order number of elements at the midpoint
text((x(1)+x(2))/2,(y(1)+y(2))/2,num2str(iel));
hold on;
end
% locate the order number of nodes
for inod=1:nnode
text(X(inod),Y(inod),num2str(inod));
end
%------------------------------------------------------------------------%
applied constraints
%------------------------------------------------------------------------bcdof(1)=1;
bcval(1)=0;
bcdof(2)=2;
bcval(2)=0;
bcdof(3)=6;
bcval(3)=0;
bcdof(4)=9;
bcval(4)=0;
% 1st dof (horizontal displ) is constrained
% whose described value is 0
% 2nd dof (vertical displ) is constrained
% whose described value is 0
% 6th dof (horizontal displ) is constrained
% whose described value is 0
% 9th dof (horizontal displ) is constrained
% whose described value is 0
%------------------------------------------------------------------------%
initialization to zero
%------------------------------------------------------------------------ff=sym(zeros(sdof,1));
% system force vector
kk=sym(zeros(sdof,sdof));
% system stiffness matrix
SS=sym(zeros(nel,sdof));
index=zeros(nnel*ndof,1);
% index vector
elforce=zeros(nnel*ndof,1);
% element force vector
eldisp=sym(zeros(nnel*ndof,1)); % element nodal displacement vector
k=sym(zeros(nnel*ndof,nnel*ndof)); % element stiffness matrix
stress=sym(zeros(nel,1));
% stress vector for every element
%-----------------------------------------------------------------------%
applied nodal force
%-----------------------------------------------------------------------ff(8)=-P;
% the 4th node has the force P in the downward direction
ff(10)=-2*P; % the 5th node has the force 2P in the downward direction
for iel=1:nel
% loop for the total number of elements
nd(1)=nodes(iel,1); % 1st connected node i for the (iel)-th element
nd(2)=nodes(iel,2); % 2nd connected node j for the (iel)-th element
x1=X(nd(1));
% x-coordinate of 1st node i
y1=Y(nd(1));
% y-coordinate of 1st node i
x2=X(nd(2));
% x-coordinate of 1st node j
y2=Y(nd(2));
% y-coordinate of 1st node j
EMMC11 Nguyen Quoc Duan
- Comment 15/22 -
Prof. Bui Cong Thanh
Optimization project
leng=(sqrt((x2-x1)^2+(y2-y1)^2)); % the length of the element
c=(x2-x1)/leng; % cosin between element and x-coordinate direction
s=(y2-y1)/leng; % sin between element and x-coordinate direction
index=feeldof(nd,nnel,ndof); % system dofs of the iel-th element
[k]=fetruss(E,leng,A(iel),c,s); % Compute stiffness matrix
[kk]=feasmbl(kk,k,index);
% Assembly into the system matrix
S=(E/leng)*[-c -s c s];
edof=length(index);
for i=1:edof
ii=index(i);
SS(iel,ii)=SS(iel,ii)+S(i); % stresses matrix
end
end
%------------------------------------------------------------------------%
apply constraints and solve the matrix
%------------------------------------------------------------------------[kk,ff]=feaplyc(kk,ff,bcdof,bcval); % apply the boundary conditions
displacement=simplify(kk\ff); % solution for nodal displacements
stress=simplify(SS*displacement); % stresses of bars
stress
displacement
save femtruss A stress Lbar;
disp('********************************************************************************************');
disp('***
Completed !
***');
disp('*** THANK YOU FOR YOUR INTERESTING LECTURES, PROFESSOR ! ***');
disp('********************************************************************************************');
%*************************************************************************
%***
OPTIMALITY CRITERIA METHOD : FULLY STRESS DESIGN
%***
Nguyen Quoc Duan : I-2-1-b
***
%*************************************************************************
%
This is a practise exercise on Optimizing Structures
***
%
University of Liege - EMMC
%
( European Master in Mechanics of Constructions )
% Professor : Bui Cong Thanh (Faculty of Civil Engineering-HCMUT,Vietnam)
% Student : Nguyen Quoc Duan (EMMC11 - Ho Chi Minh City, Vietnam )
% FSD is applicable to design for the truss.
clear all;close all; clc;
disp(' The program is working. Please wait for a while, professor !');
disp('Units : kN-cm');
format short ;
syms X1 X2 X3 real
EMMC11 Nguyen Quoc Duan
- Comment 16/22 -
Prof. Bui Cong Thanh
sigU=16;
sigL=-16;
Optimization project
% the limited tensive stress ( upper bound )
% the limited compressive stress ( lower bound )
% Load FEM results
% load stress and cross-sectional area variables: Stress and A
load femtruss;
%Initial point
Xo=[10 20 30];
iteration=0;
epsilon=0.0001;
error=1;
Xi=Xo; % vector of across section variables
Xh=Xi; % history matrix of all Xi
So=subs(stress,{X1,X2,X3},Xi)'; % stress in term of Xo
Sh=So; % history matrix of all stress
while error>epsilon
iteration=iteration+1;
fprintf('***** Iterative cycle %g *****\n',iteration)
disp('-------------------------------------')
%Compute stresses of bars in term of Xi
Area=subs(A,{X1,X2,X3},Xi);
S=subs(stress,{X1,X2,X3},Xi);
%REDESIGN THE STRUCTURE
% loop to optimize each bar
for i=1:length(S)
if S(i)>=0
Area(i)=Area(i)*S(i)/sigU;
else
Area(i)=Area(i)*S(i)/sigL;
end
end
% Condition for manufacturing
for i=1:length(A)
if Area(i)<0.0864
Area(i)=0.0864; % cm2
end
end
% Consider the same across sections
x1=max([Area(1) Area(2)]);
x2=max([Area(3) Area(4) Area(5)]);
x3=max([Area(6) Area(7)]);
Area=[x1 x1 x2 x2 x2 x3 x3]';
Xii=[x1 x2 x3];
Xh=[Xh;Xii];
Si=subs(stress,{X1,X2,X3},Xii)';
Sh=[Sh;Si];
error = sqrt(((Xii(1)-Xi(1))/Xi(1))^2+((Xii(2)-Xi(2))/Xi(2))^2+...
EMMC11 Nguyen Quoc Duan
- Comment 17/22 -
Prof. Bui Cong Thanh
Optimization project
+ ((Xii(3)-Xi(3))/Xi(3))^2);
Xi=Xii
if iteration >30
break
end
% maximum iterative loop = 30
end
% Output
disp('
OUTPUT RESULTS
');
disp('Optimum for variables');
disp('---------------------');
X=Xi
disp('History for variables');
disp('---------------------');
Xh
disp('Stresses of bars at optimum');
disp('---------------------------');
Si
disp('history of stresses of bars ');
disp('---------------------------');
Sh
disp('Areas of bars at optimum');
disp('---------------------------');
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
A1 = %g (cm2)\n',Area(1))
A2 = %g (cm2)\n',Area(2))
A3 = %g (cm2)\n',Area(3))
A4 = %g (cm2)\n',Area(4))
A5 = %g (cm2)\n',Area(5))
A6 = %g (cm2)\n',Area(6))
A7 = %g (cm2)\n',Area(7))
fprintf(' Number of loop: %g \n',iteration)
fprintf(' Cross-sectional area of bar 1,2 : X1 = %g (cm2)\n',X(1))
fprintf(' Cross-sectional area of bar 3,4,5 : X2 = %g (cm2)\n',X(2))
fprintf(' Cross-sectional area of bar 6,7 : X3 = %g (cm2)\n',X(3))
% Compute internal radious and thickness of circular bars
% Assuming that thickness is one-fifth internal radious
for i=1:length(X)
r(i)=sqrt(pi*X(i)*25/11);
t(i)=0.2*r(i);
end
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
Radious of bar 1,2
: r1 = %g (cm)\n',r(1))
Radious of bar 3,4,5
: r2 = %g (cm)\n',r(2))
Radious of bar 6,7
: r3 = %g (cm)\n',r(3))
Thickness of bar 1,2
: t1 = %g (cm)\n',t(1))
Thickness of bar 3,4,5 : t2 = %g (cm)\n',t(2))
Thickness of bar 6,7
: t3 = %g (cm)\n',t(3))
EMMC11 Nguyen Quoc Duan
- Comment 18/22 -
Prof. Bui Cong Thanh
Optimization project
disp('The volume of optimum design (cm3) ');
disp('------------------------------');
V=0;
for i=1:length(Area)
Vi=Lbar(i)*Area(i);
V=V+Vi;
end
V
disp('******************************************************************************************');
disp('***
Completed !
***');
disp('*** THANK YOU FOR YOUR INTERESTING LECTURES, PROFESSOR ! ***');
disp('******************************************************************************************');
%*************************************************************************
%***
SEQUENTIAL LINEAR PROGRAMMING
%***
Nguyen Quoc Duan : I-2-1-b
***
%*************************************************************************
%
This is a practise exercise on Optimizing Structures
***
%
University of Liege - EMMC
%
( European Master in Mechanics of Constructions )
% Professor : Bui Cong Thanh (Faculty of Civil Engineering-HCMUT,Vietnam)
% Student : Nguyen Quoc Duan (EMMC11 - Ho Chi Minh City, Vietnam )
clear all; close all; clc;
disp('Units : kN-cm');
format short
syms X1 X2 X3 real
X=[X1 X2 X3];
sigU=16;
% Upper bound of stresses ( kN/cm2 )
sigL=-16;
% Lower bound of stresses ( kN/cm2 )
E=2*10^4;
% Elastic modulus of material ( kN/cm2 )
% LOAD DATA
load femtruss; %load stress and cross-sectional area variables: S and A
muy=1.0; % factor of connection
eta=5/6; % ratio d/D
% OBJECTIVE FUNCTION
F=0;
for i=1:length(A)
F=A(i)*Lbar(i)+F; % weight of truss
end
% CONSTRAINTS
g=sym([]); % constraint matrix
% Stress constraints
Ssign=subs(stress,{X1,X2,X3},[1 1 1]);
for i=1:length(A)
EMMC11 Nguyen Quoc Duan
- Comment 19/22 -
Prof. Bui Cong Thanh
Optimization project
if Ssign(i)>=0
gi=stress(i)-sigU;
else
gi=stress(i)+sigL;
end
g=[g;gi];
end
clear gi;
% Geometry constraints
for j=1:length(X)
gj=-X(j)+0.0864;
g=[g;gj];
end
clear gj;
% Stability constraints
for k=1:length(A)
if Ssign(k)<0
gk=-stress(k)-(1/4*pi*E*A(k)*(1+eta^2)/(muy*Lbar(k))^2*(1-eta^2));
g=[g;gk];
end
end
clear gk;
% SEQUENTIAL LINEAR PROGRAMMING
% Initial data
X=[10 20 30];
iteration=0;
epsilon=0.0001;
error=1;
Xh=X; % history matrix of all Xi
So=subs(stress,{X1,X2,X3},X)'; % stress in term of Xo
Sh=So; % history matrix of all stress
Fo=subs(F,{X1,X2,X3},X);
Fh=Fo;
while abs(error)>epsilon
iteration=iteration+1;
fprintf('********** Iteration : %g ***********\n',iteration)
disp ('---------------------------------------')
Xo=X
for i=1:length(g)
gln=linear(g(i),Xo); % linearize the constraints
Xf(i,:)=coef(gln);
% compute coefficients matrix
end
Fln=linear(F,Xo);
% linear the objective function
Xf(i+1,:)=coef(Fln);
% compute coefficients matrix
% Linear optimum
X=linsystem(Xf);
X=X'
EMMC11 Nguyen Quoc Duan
- Comment 20/22 -
Prof. Bui Cong Thanh
Optimization project
Fi=subs(F,{X1,X2,X3},X)
Fh=[Fh;Fi];
Xh=[Xh;X];
Si=subs(stress,{X1,X2,X3},X)';
Sh=[Sh;Si];
error = sqrt(((X(1)-Xo(1))/Xo(1))^2+((X(2)-Xo(2))/Xo(2))^2+...
+ ((X(3)-Xo(3))/Xo(3))^2);
if iteration>20
break;
end
end
% OUTPUT
disp('
History of X
');
disp('-----------------------------------');
Xh
disp('History of objective function F ');
disp('-------------------------- -----');
Fh
disp(' History of stresses of bars ');
disp('-------------------------- -----');
Sh
% Optimum design
disp('
OPTIMUM DESIGN
');
disp('-----------------------------------');
disp('
Optimum variables values
');
if Fh(iteration) >= Fh(iteration+1)
Xopt=Xh(iteration+1,:)
else
Xopt=Xh(iteration,:)
end
disp('Areas of bars at optimum');
disp('---------------------------');
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
A1 = %g (cm2)\n',Xopt(1))
A2 = %g (cm2)\n',Xopt(1))
A3 = %g (cm2)\n',Xopt(2))
A4 = %g (cm2)\n',Xopt(2))
A5 = %g (cm2)\n',Xopt(2))
A6 = %g (cm2)\n',Xopt(3))
A7 = %g (cm2)\n',Xopt(3))
fprintf(' Number of loop: %g \n',iteration)
fprintf(' Cross-sectional area of bar 1,2 : X1 = %g (cm2)\n',Xopt(1))
fprintf(' Cross-sectional area of bar 3,4,5 : X2 = %g (cm2)\n',Xopt(2))
fprintf(' Cross-sectional area of bar 6,7 : X3 = %g (cm2)\n',Xopt(3))
EMMC11 Nguyen Quoc Duan
- Comment 21/22 -
Prof. Bui Cong Thanh
Optimization project
% Compute internal radious and thickness of circular bars
% Assuming that thickness is one-fifth internal radious
for i=1:length(Xopt)
r(i)=sqrt(pi*Xopt(i)*25/11);
t(i)=0.2*r(i);
end
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
fprintf('
Radious of bar 1,2
: r1 = %g (cm)\n',r(1))
Radious of bar 3,4,5
: r2 = %g (cm)\n',r(2))
Radious of bar 6,7
: r3 = %g (cm)\n',r(3))
Thickness of bar 1,2
: t1 = %g (cm)\n',t(1))
Thickness of bar 3,4,5 : t2 = %g (cm)\n',t(2))
Thickness of bar 6,7
: t3 = %g (cm)\n',t(3))
disp('The volume of optimum design (cm3) ');
disp('------------------------------');
Fopt=subs(F,{X1,X2,X3},Xopt)
disp('******************************************************************************************');
disp('***
Completed !
***');
disp('*** THANK YOU FOR YOUR INTERESTING LECTURES, PROFESSOR ! ***');
disp('******************************************************************************************');
EMMC11 Nguyen Quoc Duan
- Comment 22/22 -
© Copyright 2026 Paperzz