Tubular Column Design Optimization

Main.TubularColumn History

Hide minor edits - Show changes to output

February 19, 2023, at 10:41 PM by 10.35.117.248 -
Added lines 6-7:

%width=550px%Attach:tubular_column_design.png
January 30, 2023, at 04:16 PM by 10.35.117.248 -
Changed line 9 from:
%width=550px%Attach:tubular_column.png
to:
%width=400px%Attach:tubular_column.png
Added lines 4-5:

A tubular column is a structural element that consists of a hollow cylinder made of metal, concrete, or other material. It is commonly used in construction to support beams and other building elements and is also used in bridges and other structures. Tubular columns are generally stronger and more efficient than solid columns as they are able to resist torsion, bending, and shear forces.
Changed lines 141-142 from:
m.Obj(cost)
to:
m.Minimize(cost)
Changed line 207 from:
m.Obj(cost)
to:
m.Minimize(cost)
June 21, 2020, at 04:47 AM by 136.36.211.159 -
Deleted lines 274-292:

----

(:html:)
 <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
(:htmlend:)
December 03, 2019, at 11:18 PM by 99.203.27.130 -
Changed line 156 from:
Thanks to <a href='https://www.linkedin.com/in/aldoduke'>Al Duke</a> for providing a solution with a contour plot.
to:
Thanks to [[https://www.linkedin.com/in/aldoduke|Al Duke]] for providing a solution with a contour plot.
December 03, 2019, at 11:16 PM by 99.203.27.130 -
Changed line 156 from:
Thanks to Al Duke for providing a solution with a contour plot.
to:
Thanks to <a href='https://www.linkedin.com/in/aldoduke'>Al Duke</a> for providing a solution with a contour plot.
December 01, 2019, at 02:22 PM by 136.36.211.159 -
Added lines 43-44:
'''Starting Code'''
Added lines 65-66:

'''Solution Report'''
December 01, 2019, at 02:18 PM by 136.36.211.159 -
Added lines 153-154:

%width=550px%Attach:tubular_contour.png
December 01, 2019, at 02:17 PM by 136.36.211.159 -
Changed lines 193-194 from:
#%% Equations (constraints, etc. Why is cost not an intermediate variable?
# Because it is the objective?
)
to:
#%% Equations (constraints, etc. Cost could be an intermediate variable)
Changed lines 215-216 from:
f = lambda d, t: 2 * d + 5 * p * l * np.pi * ((d+t)**2 - (d-t)**2)/4 # cost function
to:
f = lambda d, t: 2 * d + 5 * p * l * np.pi * ((d+t)**2 - (d-t)**2)/4
Changed lines 220-221 from:
d, t = np.meshgrid(np.arange(xmin, xmax + xstep, xstep), np.arange(ymin, ymax + ystep, ystep))
to:
d, t = np.meshgrid(np.arange(xmin, xmax + xstep, xstep), \
                 
np.arange(ymin, ymax + ystep, ystep))
Changed lines 232-233 from:
# Determine buckling constraint line. This is tougher because we cannot solve 
#
directly for t from d. Used scipy.optimize.fsolve to find roots
to:
# Determine buckling constraint line. This is tougher because we cannot
solve directly for t from d. Used scipy.optimize.fsolve to find roots
Changed line 237 from:
   fb = lambda t : o_y - np.pi**2 * E *((d3+t)**4 - (d3-t)**4) / (64 * l**2 * d3 * t)
to:
   fb = lambda t : o_y-np.pi**2*E*((d3+t)**4-(d3-t)**4)/(64*l**2*d3*t)
December 01, 2019, at 02:13 PM by 136.36.211.159 -
Added lines 43-63:
Starting code with constants and variables is included below. Fill in the Intermediates, Equations, and Objective Function along with the other necessary commands to solve and analyze this problem.

(:source lang=python:)
from gekko import GEKKO

m = GEKKO()

#%% Constants
pi = m.Const(3.14159,'pi')
P = 2300        # compressive load (kg_f)
o_y = 450      # yield stress (kg_f/cm^2)
E = 0.65e6      # elasticity (kg_f/cm^2)
p = 0.0020      # weight density (kg_f/cm^3)
l = 300        # length of the column (cm)

#%% Variables
d = m.Var(value=8.0,lb=2.0,ub=14.0) # mean diameter (cm)
t = m.Var(value=0.3,lb=0.2,ub=0.8)  # thickness (cm)
cost = m.Var()
(:sourceend:)

Changed lines 95-96 from:
See [[https://gekko.readthedocs.io/en/latest/|GEKKO documentation]] and [[https://apmonitor.com/wiki/index.php/Main/GekkoPythonOptimization|additional example problems]].
to:
See [[https://gekko.readthedocs.io/en/latest/|GEKKO documentation]] and [[https://apmonitor.com/wiki/index.php/Main/GekkoPythonOptimization|additional example problems]]. 

(:toggle hide mycode1 button show="Show Gekko Source Code":)
(:div id=mycode1:)
Added lines 147-268:
(:divend:)

(:toggle hide mycode2 button show="Show Gekko + Contour Plot Source Code":)
(:div id=mycode2:)

Thanks to Al Duke for providing a solution with a contour plot.

(:source lang=python:)
# -*- coding: utf-8 -*-
"""
BYU Intro to Optimization. Column design
https://apmonitor.com/me575/index.php/Main/TubularColumn
Contour plot additions by Al Duke 11/30/2019
"""
from gekko import GEKKO
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import fsolve

m = GEKKO()

#%% Constants
pi = m.Const(3.14159,'pi')
P = 2300 # compressive load (kg_f)
o_y = 450 # allowable yield stress (kg_f/cm^2)
E = 0.65e6 # elasticity (kg_f/cm^2)
p = 0.0020 # weight density (kg_f/cm^3)
l = 300 # length of the column (cm)

#%% Variables (the design variables available to the solver)
d = m.Var(value=8.0,lb=2.0,ub=14.0) # mean diameter (cm)
t = m.Var(value=0.3,lb=0.2 ,ub=0.8) # thickness (cm)
cost = m.Var()

#%% Intermediates (computed by solver from design variables and constants)
d_i = m.Intermediate(d - t)
d_o = m.Intermediate(d + t)
W = m.Intermediate(p*l*pi*(d_o**2 - d_i**2)/4) # weight (kgf)
o_i = m.Intermediate(P/(pi*d*t)) # induced stress

# second moment of area of the cross section of the column
I = m.Intermediate((pi/64)*(d_o**4 - d_i**4))

# buckling stress (Euler buckling load/cross-sectional area)
o_b = m.Intermediate((pi**2*E*I/l**2)*(1/(pi*d*t)))

#%% Equations (constraints, etc. Why is cost not an intermediate variable?
# Because it is the objective?)
m.Equations([
o_i - o_y <= 0,
o_i - o_b <= 0,
cost == 5*W + 2*d
])

#%% Objective
m.Obj(cost)

#%% Solve and print solution
m.options.SOLVER = 1
m.solve()

print('Optimal cost: ' + str(cost[0]))
print('Optimal mean diameter: ' + str(d[0]))
print('Optimal thickness: ' + str(t[0]))

minima = np.array([d[0], t[0]])

#%% Contour plot
# create a cost function as a function of the design variables d and t
f = lambda d, t: 2 * d + 5 * p * l * np.pi * ((d+t)**2 - (d-t)**2)/4 # cost function

xmin, xmax, xstep = 2, 14, .2 # diameter
ymin, ymax, ystep = .2, .8, .05 # thickness

d, t = np.meshgrid(np.arange(xmin, xmax + xstep, xstep), np.arange(ymin, ymax + ystep, ystep))
z = f(d, t)

# Determine the compressive stress constraint line.
#stress = P/(pi*d*t) # induced axial stress
t_stress = np.arange(ymin, ymax, .025) # use finer step to get smoother constraint line
d_stress = []
for tt in t_stress:
    dd = P/(np.pi * tt * o_y)
    d_stress.append(dd)

# Determine buckling constraint line. This is tougher because we cannot solve
# directly for t from d. Used scipy.optimize.fsolve to find roots
d_buck = []
t_buck = []
for d3 in np.arange(6, xmax, .005):
    fb = lambda t : o_y - np.pi**2 * E *((d3+t)**4 - (d3-t)**4) / (64 * l**2 * d3 * t)
    tr = np.array([0.3])
    roots = fsolve(fb, tr)
    if roots[0] != 0:
        if roots[0] >= .1 and roots[0]<=1.:
            t_buck.append(roots[0])
            d_buck.append(d3)

# Create contour plot
plt.style.use('ggplot') # to make prettier plots
fig, ax = plt.subplots(figsize=(10, 6))

CS = ax.contour(d, t, z, levels=15,)
ax.clabel(CS, inline=1, fontsize=10)
ax.set_xlabel('mean diameter $d$')
ax.set_ylabel('half thickness $t$')

ax.set_xlim((xmin, xmax))
ax.set_ylim((ymin, ymax))

# Add constraint lines and optimal marker
ax.plot(d_stress, t_stress, "->", label="Stress constraint")
ax.plot(d_buck, t_buck, "->", label="Buckling constraint" )

minima_ = minima.reshape(-1, 1)
ax.plot(*minima_, 'r*', markersize=18, label="Optimum")
ax.text(10,.25,"Contours = Cost (objective)\nConstraint line markers point\ntowards feasible space.")
plt.title('Column Design')
plt.legend()
plt.show()
(:sourceend:)
(:divend:)
Deleted lines 71-72:
(:toggle hide solution button show="Show Python Solution":)
(:div id=solution:)
Deleted line 123:
(:divend:)
December 20, 2018, at 02:52 PM by 173.117.150.72 -
Changed lines 74-77 from:
%width=200px%Attach:gekko.png See [[https://gekko.readthedocs.io/en/latest/|GEKKO documentation]] and [[https://apmonitor.com/wiki/index.php/Main/GekkoPythonOptimization|additional example problems]].
to:
%width=150px%Attach:gekko.png

See
[[https://gekko.readthedocs.io/en/latest/|GEKKO documentation]] and [[https://apmonitor.com/wiki/index.php/Main/GekkoPythonOptimization|additional example problems]].
December 20, 2018, at 02:51 PM by 173.117.150.72 -
Changed line 74 from:
%width=200px%Attach:gekko.png
to:
%width=200px%Attach:gekko.png See [[https://gekko.readthedocs.io/en/latest/|GEKKO documentation]] and [[https://apmonitor.com/wiki/index.php/Main/GekkoPythonOptimization|additional example problems]].
December 20, 2018, at 02:48 PM by 173.117.150.72 -
Changed line 72 from:
(:toggle hide solution button show="Show Solution":)
to:
(:toggle hide solution button show="Show Python Solution":)
Added line 74:
%width=200px%Attach:gekko.png
December 20, 2018, at 02:46 PM by 173.117.150.72 -
Added lines 67-122:

----

'''Solution Help'''

(:toggle hide solution button show="Show Solution":)
(:div id=solution:)
(:source lang=python:)
from gekko import GEKKO

m = GEKKO()

#%% Constants
pi = m.Const(3.14159,'pi')
P = 2300        # compressive load (kg_f)
o_y = 450      # yield stress (kg_f/cm^2)
E = 0.65e6      # elasticity (kg_f/cm^2)
p = 0.0020      # weight density (kg_f/cm^3)
l = 300        # length of the column (cm)

#%% Variables
d = m.Var(value=8.0,lb=2.0,ub=14.0) # mean diameter (cm)
t = m.Var(value=0.3,lb=0.2,ub=0.8)  # thickness (cm)
cost = m.Var()

#%% Intermediates
d_i = m.Intermediate(d - t)
d_o = m.Intermediate(d + t)
W = m.Intermediate(p*l*pi*(d_o**2 - d_i**2)/4) # weight (kgf)
o_i = m.Intermediate(P/(pi*d*t))    # induced stress

# second moment of area of the cross section of the column
I = m.Intermediate((pi/64)*(d_o**4 - d_i**4))

# buckling stress (Euler buckling load/cross-sectional area)
o_b = m.Intermediate((pi**2*E*I/l**2)*(1/(pi*d*t)))

#%% Equations
m.Equations([
        o_i - o_y <= 0,
        o_i - o_b <= 0,
        cost == 5*W + 2*d
        ])

#%% Objective
m.Obj(cost)

#%% Solve and print solution
m.options.SOLVER = 1
m.solve()

print('Optimal cost: ' + str(cost[0]))
print('Optimal mean diameter: ' + str(d[0]))
print('Optimal thickness: ' + str(t[0]))
(:sourceend:)
(:divend:)
December 20, 2018, at 02:39 PM by 173.117.150.72 -
Changed line 33 from:
{$\frac{\pi^2 E I}{l^2}  \frac{1}{\pi d t}$}
to:
{$\frac{\pi^2 E I}{l^2}  \frac{1}{\pi \, d \, t}$}
December 20, 2018, at 02:28 PM by 173.117.150.72 -
Added lines 5-6:
The objective is to optimize the cost of building the column, using variables ''d'', the mean diameter of the column (cm), and ''t'', the thickness of the column (cm).
Changed lines 11-12 from:
The objective is to optimize the cost of building the column, using variables ''d'', the mean diameter of the column (cm), and ''t'', the thickness of the column (cm). Due to available materials the diameter must be ≤ 14.0 cm and ≥ 2.0 cm. Similarly, the thickness must be ≤ 0.8 cm and ≥ 0.2 cm. Safety requires that the induced stress is less than the yield stress and that the induced stress is less than the buckling stress. The cost of the column is equal to the expression 5''W'' + 2''d'' with ''W'' being the weight in [[https://en.wikipedia.org/wiki/Kilogram-force|kilograms force (kg'_f_')]].
to:
Due to available materials the diameter must be ≤ 14.0 cm and ≥ 2.0 cm. Similarly, the thickness must be ≤ 0.8 cm and ≥ 0.2 cm. Safety requires that the induced stress is less than the yield stress and that the induced stress is less than the buckling stress. The cost of the column is equal to the expression 5''W'' + 2''d'' with ''W'' being the weight in [[https://en.wikipedia.org/wiki/Kilogram-force|kilograms force (kg'_f_')]].

'''Weight'''
Added lines 17-18:
'''Outer Diameter'''
Added lines 21-22:
'''Inner Diameter'''
Changed lines 25-31 from:
Induced stress =  {`\frac{P}{\pi\,d \, t}`}

Buckling stress = Euler buckling load/cross sectional area = {`\frac{\pi^2 \, E \, I}{l^2}  \frac{1}{\pi \, d \,t}`}

''I'' = second moment of area of the cross section of the column.

{$=\frac{\pi}{64} (d_0^4- d_i^4 )$}
to:
'''Induced stress'''

{$\frac{P}{\pi\,d \, t}$}

'''Buckling stress'''

Buckling stress =
Euler buckling load/cross sectional area

{$\frac{\pi^2 E I}{l^2}  \frac{1}{\pi d t}$}

'''Second moment'''

Second moment
of area of the cross section of the column.

{$I=\frac{\pi}{64} \left(d_0^4- d_i^4\right)$}
December 20, 2018, at 02:22 PM by 173.117.150.72 -
Added lines 5-6:
%width=550px%Attach:tubular_column.png
Changed lines 8-9 from:
The objective is to optimize the cost of building the column, using variables ''d'', the mean diameter of the column (cm), and ''t'', the thickness of the column (cm). Due to available materials the diameter must be ≤ 14.0 cm and ≥ 2.0 cm. Similarly, the thickness must be ≤ 0.8 cm and ≥ 0.2 cm. Safety requires that the induced stress is less than the yield stress and that the induced stress is less than the buckling stress. The cost of the column is equal to the expression 5''W'' + 2''d'' with ''W'' being the weight in [[https://en.wikipedia.org/wiki/Kilogram-force|kilograms force]].
to:

The objective is to optimize the cost of building the column, using variables ''d'', the mean diameter of the column (cm), and ''t'', the thickness of the column (cm). Due to available materials the diameter must be ≤ 14.0 cm and ≥ 2.0 cm. Similarly, the thickness must be ≤ 0.8 cm and ≥ 0.2 cm. Safety requires that the induced stress is less than the yield stress and that the induced stress is less than the buckling stress. The cost of the column is equal to the expression 5''W'' + 2''d'' with ''W'' being the weight in [[https://en.wikipedia.org/wiki/Kilogram-force|kilograms force (kg'_f_')]].
Deleted lines 25-26:

Attach:tubular_column.png
December 20, 2018, at 02:21 PM by 173.117.150.72 -
Added lines 1-68:
(:title Tubular Column Design Optimization:)
(:keywords nonlinear, optimization, engineering optimization, structure optimization, engineering design, gekko, tutorial, python:)
(:description Engineering design of a tubular column to stay within constraints and meet an optimal criteria. Optimization principles are used to design the system.:)

''P'' is the compressive load of 2300 kg'_f_'. The material used to make the column has a module of elasticity (''E'') of 0.65x10'^6^' and a weight density (''ρ'') of 0.0020 kg'_f_'/cm'^3^'. The column has a yield stress (''σ'_y_''') of 450 kg'_f_'/cm'^2^' and a length (''l'') of 300 cm.
The objective is to optimize the cost of building the column, using variables ''d'', the mean diameter of the column (cm), and ''t'', the thickness of the column (cm). Due to available materials the diameter must be ≤ 14.0 cm and ≥ 2.0 cm. Similarly, the thickness must be ≤ 0.8 cm and ≥ 0.2 cm. Safety requires that the induced stress is less than the yield stress and that the induced stress is less than the buckling stress. The cost of the column is equal to the expression 5''W'' + 2''d'' with ''W'' being the weight in [[https://en.wikipedia.org/wiki/Kilogram-force|kilograms force]].

{$W=\rho l \pi \frac{\left(d_o^2- d_i^2\right)}{4}$}

{$d_o=d+t$}

{$d_i=d - t$}

Induced stress =  {`\frac{P}{\pi\,d \, t}`}

Buckling stress = Euler buckling load/cross sectional area = {`\frac{\pi^2 \, E \, I}{l^2}  \frac{1}{\pi \, d \,t}`}

''I'' = second moment of area of the cross section of the column.

{$=\frac{\pi}{64} (d_0^4- d_i^4 )$}

[[Attach:tubular.pdf | Full Tubular Design Assignment (PDF)]]

Attach:tubular_column.png

Turn in a report with the following sections:

# Title Page with Summary. The Summary should be short (less than 50 words), and give the main optimization results.

# Procedure: Give a brief description of your model. You are welcome to refer to the assignment which should be in the Appendix.  Also include:
## A table with the analysis variables, design variables, analysis functions and design functions.

# Results: Briefly describe the results of optimization (values). Also include:
## A table showing the optimum values of variables and functions, indicating binding constraints and/or variables at bounds (highlighted)
## A table giving the various starting points which were tried along with the optimal objective values reached from that point.

# Discussion of Results: Briefly discuss the optimum and design space around the optimum. Do you feel this is a global optimum? Also include and briefly discuss:
## A “zoomed out” contour plot showing the design space (both feasible and infeasible) for diameter and thickness, with the feasible region shaded and optimum marked.
## A “zoomed in” contour plot of the design space (mostly feasible space) for diameter and thickness, with the feasible region shaded and optimum marked.

# Appendix:
## Listing of your model with all variables and equations
## Solver output with details of the convergence to the optimal values

Any output from the software is to be integrated into the report (either physically or electronically pasted) as given in the sections above. Tables and figures should all have explanatory captions. Do not just staple pages of output to your assignment: all raw output is to have notations made on it. For graphs, you are to shade the feasible region and mark the optimum point. For tables of design values, you are to indicate, with arrows and comments, any variables at bounds, any binding constraints, the objective, etc. (You need to show that you understand the meaning of the output you have included.)

----

Attach:collaborative50.png This assignment can be completed in collaboration with others. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].

----

(:html:)
 <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
(:htmlend:)