Tutorial: Lightweight optimisation using a gradient-based smeared approach#
Date: 4 February 2026
Author: Saullo G. P. Castro
Cite this tutorial as:
Castro, SGP. Methods for analysis and design of composites [Computer software]. https://doi.org/10.5281/zenodo.2871782
This tutorial minimises the mass of a simply supported rectangular laminated plate under biaxial compression, the design problem of Le Riche and Haftka (1993), with a buckling constraint multiplied by a target load factor. The design variables are continuous: the total thicknesses \(h_0\), \(h_{45}\) and \(h_{90}\) of the 0, \(\pm 45\) and 90 degree plies of a smeared laminate, whose bending stiffness is \(D = h^2 A/12\), the limit of many repetitions of the stacking sequence. \(h_{45}\) is the thickness of all the \(\pm 45\) plies together, half of it at \(+45\) and half at \(-45\) degrees, so that the laminate thickness, which gives the mass, is \(h = h_0 + h_{45} + h_{90}\). The steps are: define the smeared stiffnesses, the buckling load and its analytical gradient, compare the buckling load with the first row of Table 3 of Le Riche and Haftka, computed there for the actual stacking sequence, and run the gradient-based optimiser SLSQP of SciPy, with finite-difference and with analytical gradients of the constraint.
Required modules#
The tutorial uses numpy, scipy, installed e.g. with
python -m pip install numpy scipy
References#
Le Riche, R. and Haftka, R. T., Optimization of Laminate Stacking Sequence for Buckling Load Maximization by Genetic Algorithm, AIAA Journal, 31(5), 951-956, 1993. https://doi.org/10.2514/3.11710
Laminate plate geometry and applied loading:#
Fig. 1 of Le Riche and Haftka (1993), p. 951.
Constraint - Critical buckling load \(\lambda_b\), calculated analytically with:#
Le Riche and Haftka (1993), Eq. (1), p. 952. The paper prints the middle term of the numerator as \(2(D_{12} + 2D_{66})(m/a)^2\), without the factor \((n/b)^2\), a misprint: every term of the numerator must have the dimension of \(D_{11}(m/a)^4\). The equation below has the factor; with it, and with the stiffnesses of the actual stacking sequence, the buckling load factor of the first row of Table 3 is reproduced (relative difference 7.5e-7, tutorial opt-lightweight-discrete-ghost-layer).
Constraint - strain failure#
This constraint requires that all strain components remain below an allowable limit, assuming that \(\gamma_{xy}\) will be zero for this bi-axial loading, given that the laminate is balanced. Le Riche and Haftka (1993, p. 952) state that \(\gamma_{xy}\) is zero in their case. The ultimate allowable strains of the paper (p. 952) are \(\epsilon_1^{ua} = 0.008\), \(\epsilon_2^{ua} = 0.029\) and \(\gamma_{12}^{ua} = 0.015\), with a safety factor of 1.5.
The principal strains on each layer can be calculated solving first the laminate bi-axial strains \(\epsilon_x\) and \(\epsilon_y\); and later the in-plane strains of each layer: \(\epsilon_1^i\), \(\epsilon_2^i\) and \(\gamma_{12}^i\):
These are Eqs. (2) and (3) of Le Riche and Haftka (1993), p. 952. The shear strain printed there, \(\gamma_{12}^i = \sin^2\theta_i(\epsilon_y - \epsilon_x)\), does not follow from the strain transformation, which gives \(\gamma_{12}^i = 2\sin\theta_i\cos\theta_i(\epsilon_y - \epsilon_x) = \sin 2\theta_i(\epsilon_y - \epsilon_x)\) for \(\gamma_{xy} = 0\); the printed \(\sin^2\theta_i\) is most likely a misprint of \(\sin 2\theta_i\). The tutorial opt-lightweight-smeared-finite-diff-Le-Riche gives the references and uses the corrected expression. This tutorial has only the buckling constraint.
[1]:
# NOTE ultimate allowable strains, Le Riche and Haftka (1993), p. 952
epsilon_1_allowable = 0.008
epsilon_2_allowable = 0.029
gamma_12_allowable = 0.015
Optimization description#
Take as reference the first design case of Table 3 of Le Riche and Haftka (1993), p. 955:
Strain failure is the critical failure mode of all the laminates of Table 3 (p. 955): their failure load factor is below their buckling load factor.
We will set a target design load by means of a target lambda that will multiply the bi-axial loading state.
Defining the reference case#
Using the first stacking sequence of the Table 3 above.
The first row of Table 3 (p. 955) is the laminate \((90_2, \pm 45_4, 0_4, \pm 45, 0_4, \pm 45, 0_2)_s\) of 48 plies, with \(a = 20\) in, \(b = 5\) in, \(N_x = 1\) and \(N_y = 0.125\). The footnote of Table 3 gives the loads in lb, Fig. 8 (p. 956) in lb/in; they are loads per unit length, in lb/in here. The material data of the paper (p. 952) are \(E_1 = 18.50 \times 10^6\) psi, \(E_2 = 1.89 \times 10^6\) psi, \(G_{12} = 0.93 \times 10^6\) psi, \(\nu_{12} = 0.3\) and the ply thickness \(t = 0.005\) in. They are converted below exactly, with 1 psi = 1 lbf/in\(^2\) = 4.4482216152605 N/(0.0254 m)\(^2\) = 6894.757 Pa (the pound-force and the inch are defined exactly in SI units): \(E_1 = 127.553\) GPa, \(E_2 = 13.031\) GPa and \(G_{12} = 6.412\) GPa. The paper gives the rounded SI values 127.59, 13.03 and 6.41 GPa; its 127.59 GPa is a conversion slip, since \(18.50 \times 10^6\) psi is 127.55 GPa. With the exact conversions the buckling load factor of the first row of Table 3, computed for the actual stacking sequence, is reproduced to a relative difference of 7.5e-7 (tutorial opt-lightweight-discrete-ghost-layer); with the rounded SI values 127.55, 13.03 and 6.41 GPa the difference is 4.2e-5. The paper gives no density and no transverse shear moduli: \(\rho = 1600\) kg/m\(^3\) is chosen here, and \(G_{13}\) and \(G_{23}\), set equal to \(G_{12}\), do not enter \(A\) and \(D\).
[2]:
import numpy as np
# Table 03, first row
a_value = 20. # [in]
b_value = 5. # [in]
load_Nxx_unit = 1. # [lb/in]
load_Nyy_unit = 0.125 # [lb/in]
stack_ref_half = [90]*2 + [+45,-45]*4 + [0]*4 + [+45, -45] + [0]*4 + [+45, -45] + [0]*2
stack_ref = stack_ref_half + stack_ref_half[::-1] # symmetry condition
print('number of plies:', len(stack_ref))
# material properties, Le Riche and Haftka (1993), p. 952, converted from psi
psi = 4.4482216152605/0.0254**2 # [Pa], 1 lbf/in^2
E11 = 18.50e6*psi # [Pa]
E22 = 1.89e6*psi
nu12 = 0.3
G12 = 0.93e6*psi
G13 = G12 # NOTE not given in the paper, does not enter A and D
G23 = G12
rho = 1600 # kg/m^3
laminaprop = (E11, E22, nu12, G12, G13, G23)
ply_thickness = 0.005*25.4/1000 # [m]
h = ply_thickness*len(stack_ref)
number of plies: 48
[3]:
def get_Q_matrix(theta_deg):
"""
Calculate the transformed reduced stiffness matrix Q_bar for a given angle.
"""
nu21 = nu12 * E22 / E11
denom = 1 - nu12 * nu21
Q11 = E11 / denom
Q22 = E22 / denom
Q12 = nu12 * E22 / denom
Q66 = G12
c = np.cos(np.radians(theta_deg))
s = np.sin(np.radians(theta_deg))
c2 = c**2; s2 = s**2; c4 = c**4; s4 = s**4
Q_bar_11 = Q11*c4 + 2*(Q12 + 2*Q66)*s2*c2 + Q22*s4
Q_bar_22 = Q11*s4 + 2*(Q12 + 2*Q66)*s2*c2 + Q22*c4
Q_bar_12 = (Q11 + Q22 - 4*Q66)*s2*c2 + Q12*(s4 + c4)
Q_bar_66 = (Q11 + Q22 - 2*Q12 - 2*Q66)*s2*c2 + Q66*(s4 + c4)
Q_bar_44 = G23 * c2 + G13 * s2
Q_bar_55 = G13 * c2 + G23 * s2
Q_bar_45 = (G13 - G23) * c * s
Q_bar = np.array([
[Q_bar_11, Q_bar_12, 0, 0, 0, 0],
[Q_bar_12, Q_bar_22, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, Q_bar_44, Q_bar_45, 0],
[0, 0, 0, Q_bar_45, Q_bar_55, 0],
[0, 0, 0, 0, 0, Q_bar_66]
])
return Q_bar
Smeared stiffness#
The membrane stiffness of the smeared laminate is the thickness-weighted sum of the transformed reduced stiffnesses \(\bar{Q}_\theta\) of the plies, with the thickness \(h_{45}\) of the \(\pm 45\) plies split equally between \(+45\) and \(-45\) degrees:
and the bending stiffness is \(D = h^2 A/12\). The same thickness \(h\) gives the mass.
[4]:
class SmearedProp:
"""Smeared laminate with total thicknesses h0, h45 (the +-45 pairs) and h90"""
def __init__(self, h0, h45, h90):
self.angles = [0, 45, 90]
self.Q0 = get_Q_matrix(0)
self.Q90 = get_Q_matrix(90)
# NOTE half of h45 at +45 and half at -45
self.Q45_avg = (get_Q_matrix(45) + get_Q_matrix(-45))/2
self.h0 = h0
self.h45 = h45
self.h90 = h90
self.h = h0 + h45 + h90
self.A = h0*self.Q0 + h45*self.Q45_avg + h90*self.Q90
self.D = (self.h**2 / 12.0) * self.A
Analytical equation to calculate buckling#
[5]:
from numpy import pi
def calc_buckling_analytical(prop):
a = a_value*25.4/1000 # [m] along x
b = b_value*25.4/1000 # [m] along y
Nxx = load_Nxx_unit*4.448222/(25.4/1000) #[N/m]
Nyy = load_Nyy_unit*4.448222/(25.4/1000) #[N/m]
D11 = prop.D[0, 0]
D12 = prop.D[0, 1]
D22 = prop.D[1, 1]
D66 = prop.D[5, 5]
lambda_b_min = 1e30
for m in range(1, 21):
for n in range(1, 21):
lambda_b = (pi**2*(D11*(m/a)**4
+ 2*(D12 + 2*D66)*(m/a)**2*(n/b)**2
+ D22*(n/b)**4)/((m/a)**2*Nxx + (n/b)**2*Nyy)
)
lambda_b_min = min(lambda_b_min, lambda_b)
return lambda_b_min
Analytical buckling gradients#
For the critical half-wave numbers \((m, n)\), equation (1) is linear in \(D_{11}\), \(D_{12}\), \(D_{22}\) and \(D_{66}\), and the chain rule gives
with \(\bar{Q}_{45} = (\bar{Q}_{45} + \bar{Q}_{-45})/2\) for the \(\pm 45\) plies, because \(\partial h/\partial h_k = 1\) and \(\partial A/\partial h_k = \bar{Q}_k\).
[6]:
def calc_buckling_analytical_jac(prop):
a = a_value*25.4/1000 # [m] along x
b = b_value*25.4/1000 # [m] along y
Nxx = load_Nxx_unit*4.448222/(25.4/1000) #[N/m]
Nyy = load_Nyy_unit*4.448222/(25.4/1000) #[N/m]
D11 = prop.D[0, 0]
D12 = prop.D[0, 1]
D22 = prop.D[1, 1]
D66 = prop.D[5, 5]
lambda_b_min = 1e30
lambda_b_h0 = None
lambda_b_h45 = None
lambda_b_h90 = None
for m in range(1, 21):
for n in range(1, 21):
lambda_b = (pi**2*(D11*(m/a)**4
+ 2*(D12 + 2*D66)*(m/a)**2*(n/b)**2
+ D22*(n/b)**4)/((m/a)**2*Nxx + (n/b)**2*Nyy)
)
lambdas = [lambda_b_min, lambda_b]
argmin = np.argmin(lambdas)
lambda_b_min = lambdas[argmin]
den = (m/a)**2*Nxx + (n/b)**2*Nyy
lambda_b_D11 = pi**2*(m/a)**4/den
lambda_b_D12 = 2*pi**2*(m/a)**2*(n/b)**2/den
lambda_b_D22 = pi**2*(n/b)**4/den
lambda_b_D66 = 4*pi**2*(m/a)**2*(n/b)**2/den
# NOTE h = h0 + h45 + h90 and A = h0*Q0 + h45*(Q45 + Q-45)/2 + h90*Q90
D_h0 = prop.h/6*prop.A + prop.h**2/12*prop.Q0
D_h45 = prop.h/6*prop.A + prop.h**2/12*prop.Q45_avg
D_h90 = prop.h/6*prop.A + prop.h**2/12*prop.Q90
lambda_b_h0_new = (lambda_b_D11*D_h0[0, 0]
+ lambda_b_D12*D_h0[0, 1]
+ lambda_b_D22*D_h0[1, 1]
+ lambda_b_D66*D_h0[5, 5])
lambda_b_h45_new = (lambda_b_D11*D_h45[0, 0]
+ lambda_b_D12*D_h45[0, 1]
+ lambda_b_D22*D_h45[1, 1]
+ lambda_b_D66*D_h45[5, 5])
lambda_b_h90_new = (lambda_b_D11*D_h90[0, 0]
+ lambda_b_D12*D_h90[0, 1]
+ lambda_b_D22*D_h90[1, 1]
+ lambda_b_D66*D_h90[5, 5])
lambda_b_h0 = [lambda_b_h0, lambda_b_h0_new][argmin]
lambda_b_h45 = [lambda_b_h45, lambda_b_h45_new][argmin]
lambda_b_h90 = [lambda_b_h90, lambda_b_h90_new][argmin]
lambda_b_htheta = [lambda_b_h0, lambda_b_h45, lambda_b_h90]
return lambda_b_htheta
Verifying constraint functions#
Compare with column 2 of Table 3 (p. 955) below, first row.
[7]:
h0 = ply_thickness*np.sum(np.isclose(stack_ref, 0))
h45 = ply_thickness*np.sum(np.isclose(np.abs(stack_ref), 45)) # NOTE +45 and -45 plies
h90 = ply_thickness*np.sum(np.isclose(stack_ref, 90))
prop_ref = SmearedProp(*[h0, h45, h90])
lambda_cb_ref_analytical = calc_buckling_analytical(prop_ref)
print('lambda_cb_ref_analytical', lambda_cb_ref_analytical)
print()
print('%-38s %14s %14s %10s' % ('first row of Table 3', 'this notebook',
'Le Riche 1993', 'rel. diff.'))
value, ref = lambda_cb_ref_analytical, 14168.12
print('%-38s %14.2f %14.2f %10.1e' % ('buckling load factor', value, ref,
abs(value - ref)/ref))
lambda_cb_ref_analytical 12182.053373299575
first row of Table 3 this notebook Le Riche 1993 rel. diff.
buckling load factor 12182.05 14168.12 1.4e-01
Verifying the analytical gradient#
The gradient of the buckling load factor with respect to \(h_0\), \(h_{45}\) and \(h_{90}\), used by the optimiser, is compared with central finite differences at the reference design.
[8]:
x_check = np.array([h0, h45, h90])
grad = np.asarray(calc_buckling_analytical_jac(SmearedProp(*x_check)))
print('%-12s %16s %16s %10s' % ('variable', 'analytical',
'finite diff.', 'rel. diff.'))
for i, name in enumerate(('h0', 'h45', 'h90')):
dx = 1e-6*max(abs(x_check[i]), 1e-3)
xp, xm = x_check.copy(), x_check.copy()
xp[i] += dx
xm[i] -= dx
fd = (calc_buckling_analytical(SmearedProp(*xp))
- calc_buckling_analytical(SmearedProp(*xm)))/(2*dx)
print('%-12s % 16.6e % 16.6e %10.1e' % (name, grad[i], fd,
abs(grad[i] - fd)/abs(fd)))
variable analytical finite diff. rel. diff.
h0 5.141764e+06 5.141764e+06 8.2e-11
h45 6.641183e+06 6.641183e+06 7.4e-11
h90 6.385344e+06 6.385344e+06 4.4e-11
Defining design load#
[9]:
target_lambda = 10000
Defining objective function#
[10]:
def mass(x): # NOTE to be minimized
a = a_value*25.4/1000 # [m] along x
b = b_value*25.4/1000 # [m] along y
h = np.sum(x)
return rho*h*a*b # [kg]
Defining constraint functions#
[11]:
def calc_constr_buckling(x): # NOTE feasible when >= 0
prop = SmearedProp(*x)
lambda_b = calc_buckling_analytical(prop)
return lambda_b/target_lambda - 1
def calc_constr_buckling_jac(x):
prop = SmearedProp(*x)
lambda_b_h = calc_buckling_analytical_jac(prop)
return np.asarray(lambda_b_h)/target_lambda
test = np.asarray(2*[2, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
h0 = np.sum(test==0)*ply_thickness
h45 = np.sum(test==1)*ply_thickness
h90 = np.sum(test==2)*ply_thickness
prop = SmearedProp(*[h0, h45, h90])
lambda_cb = calc_buckling_analytical(prop)
print(lambda_cb)
14151.299249146214
Optimisation using SLSQP#
The mass is minimised from the mid-point of the bounds, once with the gradient of the buckling constraint computed by SLSQP with finite differences and once with the analytical gradient above. Each thickness lies between one and 48 ply thicknesses. The design variables passed to SLSQP are the thicknesses in units of the ply thickness, \(x_k = h_k/t_{ply}\) (continuous numbers of plies), so the gradient of the constraint is multiplied by \(t_{ply}\). With the thicknesses in metres, of order \(10^{-3}\), the stopping tests of SLSQP are badly scaled, and the line search ends with exit mode 8 (“Positive directional derivative for linesearch”) instead of converging.
[12]:
from scipy.optimize import minimize
from scipy.optimize import Bounds
def mass_plies(x_plies):
return mass(x_plies*ply_thickness)
def calc_constr_buckling_plies(x_plies): # NOTE feasible when >= 0
return calc_constr_buckling(x_plies*ply_thickness)
def calc_constr_buckling_plies_jac(x_plies):
return calc_constr_buckling_jac(x_plies*ply_thickness)*ply_thickness
n_var = 3
x0 = np.ones(n_var)*(1 + 48)/2
bounds = Bounds([1]*n_var, [48]*n_var)
x_opt = {}
for use_gradient in [False, True]:
constraint = {'type': 'ineq', 'fun': calc_constr_buckling_plies}
if use_gradient:
constraint['jac'] = calc_constr_buckling_plies_jac
print("SLSQP, analytical gradient of the buckling constraint: %s" % use_gradient)
res = minimize(
mass_plies,
x0,
method='SLSQP',
bounds=bounds,
constraints=[constraint],
options={'ftol': 1e-9, 'disp': True, 'maxiter': 200},
jac="2-point"
)
x_opt[use_gradient] = res.x*ply_thickness
print(' plies of 0, +-45 and 90:', res.x)
print()
SLSQP, analytical gradient of the buckling constraint: False
Optimization terminated successfully (Exit mode 0)
Current function value: 0.5395843780851962
Iterations: 21
Function evaluations: 81
Gradient evaluations: 20
plies of 0, +-45 and 90: [ 1. 39.15932376 1. ]
SLSQP, analytical gradient of the buckling constraint: True
Optimization terminated successfully (Exit mode 0)
Current function value: 0.5395843784410262
Iterations: 20
Function evaluations: 80
Gradient evaluations: 20
plies of 0, +-45 and 90: [ 1. 39.15932378 1. ]
Results#
Both runs reach the same design. The table also gives the reference laminate of Table 3 (48 plies) evaluated with the same smeared model, for comparison (it is not an optimum of this problem).
[13]:
x_ref = ply_thickness*np.array([np.sum(np.isclose(stack_ref, 0)),
np.sum(np.isclose(np.abs(stack_ref), 45)),
np.sum(np.isclose(stack_ref, 90))])
print('%-28s %12s %12s %12s %12s' % ('', 'finite diff.', 'analytical', 'rel. diff.',
'Table 3 ref.'))
for name, f in (('h0 [mm]', lambda x: 1000*x[0]),
('h45 [mm]', lambda x: 1000*x[1]),
('h90 [mm]', lambda x: 1000*x[2]),
('mass [kg]', mass),
('buckling load factor', lambda x: calc_buckling_analytical(SmearedProp(*x)))):
v_fd, v_an, v_ref = f(x_opt[False]), f(x_opt[True]), f(x_ref)
print('%-28s %12.6g %12.6g %12.1e %12.6g' % (name, v_fd, v_an,
abs(v_an - v_fd)/abs(v_fd), v_ref))
finite diff. analytical rel. diff. Table 3 ref.
h0 [mm] 0.127 0.127 2.2e-10 2.54
h45 [mm] 4.97323 4.97323 6.9e-10 3.048
h90 [mm] 0.127 0.127 3.5e-11 0.508
mass [kg] 0.539584 0.539584 6.6e-10 0.629263
buckling load factor 10000 10000 2.0e-09 12182.1
Why the 0 and 90 degree thicknesses stop at their lower bound#
For the critical half-wave numbers \((m, n)\), equation (1) with \(D = h^2 A/12\) reads
For a given total thickness \(h\), that is a given mass, \(\lambda_b\) is largest when all the thickness goes to the orientation with the largest \(c_k\). The cell below prints \(c_k\) for the critical mode of the optimum: the \(\pm 45\) plies have the largest value, so the optimiser removes the 0 and 90 degree plies down to their lower bound of one ply thickness, and the buckling constraint, active at the optimum, sets \(h_{45}\). The design is a vertex of the design space, a consequence of the smeared buckling model with buckling as the only constraint; the finite-difference tutorial adds the strain allowables as a second constraint.
[14]:
a = a_value*25.4/1000 # [m] along x
b = b_value*25.4/1000 # [m] along y
Nxx = load_Nxx_unit*4.448222/(25.4/1000) #[N/m]
Nyy = load_Nyy_unit*4.448222/(25.4/1000) #[N/m]
prop_opt = SmearedProp(*x_opt[True])
D = prop_opt.D
lambda_mn = {(m, n): pi**2*(D[0, 0]*(m/a)**4 + 2*(D[0, 1] + 2*D[5, 5])*(m/a)**2*(n/b)**2
+ D[1, 1]*(n/b)**4)/((m/a)**2*Nxx + (n/b)**2*Nyy)
for m in range(1, 21) for n in range(1, 21)}
m, n = min(lambda_mn, key=lambda_mn.get)
print('critical half-wave numbers m, n =', m, n)
for name, Q in (('0', prop_opt.Q0), ('+-45', prop_opt.Q45_avg), ('90', prop_opt.Q90)):
c = Q[0, 0]*(m/a)**4 + 2*(Q[0, 1] + 2*Q[5, 5])*(m/a)**2*(n/b)**2 + Q[1, 1]*(n/b)**4
print('c_k of the %-4s plies: %.4e' % (name, c))
critical half-wave numbers m, n = 3 1
c_k of the 0 plies: 2.7966e+14
c_k of the +-45 plies: 6.4587e+14
c_k of the 90 plies: 5.8338e+14
[ ]: