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 two constraints: the buckling load and the strain allowables of the plies, both 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 and the constraint functions, compare them 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 gradients.

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

Le Riche, R., Optimization of Composite Structures by Genetic Algorithms, PhD dissertation, Virginia Polytechnic Institute and State University, Blacksburg, VA, 1994. http://hdl.handle.net/10919/38270

Kassapoglou, C., Design and Analysis of Composite Structures: With Applications to Aerospace Structures, 2nd ed., Wiley, 2013. https://doi.org/10.1002/9781118536933

Barbero, E. J., Introduction to Composite Materials Design, 3rd ed., CRC Press, 2017. https://doi.org/10.1201/9781315296494

Laminate plate geometry and applied loading:#

image.png

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

\[\frac{\lambda_b(m, n)}{\pi^2} = \frac{\left[D_{11} (m/a)^4 + 2 (D_{12} + 2 D_{66}) (m/a)^2 (n/b)^2 + D_{22} (n/b)^4\right]}{((m/a)^2 Nxx + (n/b)^2 Nyy)}\ (1)\]

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, which the failure function below applies to the loads.

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\):

image-1.png

The equations above are Eqs. (2) and (3) of Le Riche and Haftka (1993), p. 952. Their expression for the shear strain, printed there as \(\gamma_{12}^i = \sin^2\theta_i(\epsilon_y - \epsilon_x)\), which Le Riche (1994, Chapter 4, p. 58) repeats, does not follow from the strain transformation: at \(\theta_i = 90°\) the ply axes are the laminate axes and \(\gamma_{12}^i = \gamma_{xy} = 0\), whereas the expression gives \(\epsilon_y - \epsilon_x\). The transformation of the engineering strains from the laminate axes to the ply axes (Kassapoglou 2013, Eq. (3.36), p. 44; Barbero 2017, Eqs. (5.39) and (5.40), p. 163; Le Riche 1994, Appendix B, Eq. (B.15), p. 174) gives

\[\gamma_{12}^i = 2 \sin\theta_i \cos\theta_i (\epsilon_y - \epsilon_x) + (\cos^2\theta_i - \sin^2\theta_i)\gamma_{xy}\]

with \(\gamma_{xy} = 0\) here, and this notebook uses it. For \(\gamma_{xy} = 0\) it is \(\sin 2\theta_i(\epsilon_y - \epsilon_x)\): the printed \(\sin^2\theta_i\) is most likely a misprint of \(\sin 2\theta_i\). At \(\theta_i = 45°\) the expression of the paper gives half of this value, and at \(90°\) it gives the value of the \(45°\) plies. For a laminate with both \(\pm 45\) and 90 degree plies, as here, the largest \(|\gamma_{12}^i|\) over the plies is therefore \(|\epsilon_y - \epsilon_x|\) with either expression, and the failure load factor does not change (checked below).

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

image-2.png

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 failure load factor of the first row of Table 3 is reproduced to a relative difference of 4.6e-8 (checked below), and the buckling load factor of the actual stacking sequence to 7.5e-7 (tutorial opt-lightweight-discrete-ghost-layer); with the rounded SI values 127.55, 13.03 and 6.41 GPa the differences are 5.1e-5 and 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:

\[A = h_0 \bar{Q}_0 + \frac{h_{45}}{2} \left(\bar{Q}_{45} + \bar{Q}_{-45}\right) + h_{90} \bar{Q}_{90}, \qquad h = h_0 + h_{45} + h_{90}\]

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

Function to calculate strain failure criterion#

[6]:
import scipy.optimize as opt

def calc_failure_load_Haftka(prop):
    def strain_MS(lbd):
        Nxx = -load_Nxx_unit*4.448222/(25.4/1000) #[N/m]
        Nyy = -load_Nyy_unit*4.448222/(25.4/1000) #[N/m]
        Nxx = lbd*Nxx*1.5
        Nyy = lbd*Nyy*1.5
        vecN = np.asarray([Nxx, Nyy])
        A11 = prop.A[0, 0]
        A12 = prop.A[0, 1]
        A22 = prop.A[1, 1]
        exx, eyy = np.linalg.inv(np.array([[A11, A12], [A12, A22]])) @ vecN
        margin_of_safety = 1e15
        for thetadeg in prop.angles:
            cost = np.cos(np.deg2rad(thetadeg))
            sint = np.sin(np.deg2rad(thetadeg))
            epsilon_i_1 = cost**2*exx + sint**2*eyy
            epsilon_i_2 = sint**2*exx + cost**2*eyy
            gamma_i_12 = 2*sint*cost*(eyy - exx) # NOTE gamma_xy = 0
            ms_new = min(
                    epsilon_1_allowable/abs(epsilon_i_1) - 1,
                    epsilon_2_allowable/abs(epsilon_i_2) - 1,
                    gamma_12_allowable/abs(gamma_i_12) - 1
                    )
            margin_of_safety = min(margin_of_safety, ms_new)
        return margin_of_safety
    lbd_init = 100
    positiveMS = opt.NonlinearConstraint(strain_MS, 0., np.inf, jac='2-point')
    res = opt.minimize(strain_MS, lbd_init, tol=1e-6, bounds=((100, None),),
            constraints=[positiveMS], jac='2-point')
    if not res.success:
        raise RuntimeError(res.message)
    return res.x[0]

Verifying constraint functions#

Compare with columns 2 and 3 of Table 3 (p. 955) below, first row.

a5c933dc-2b18-441b-a012-1c1245f893ca.png

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

lambda_cs_ref = calc_failure_load_Haftka(prop_ref)
print('lambda_cs_ref', lambda_cs_ref)
print()
print('%-38s %14s %14s %10s' % ('first row of Table 3', 'this notebook',
                                 'Le Riche 1993', 'rel. diff.'))
for name, value, ref in (('buckling load factor', lambda_cb_ref_analytical,
                          14168.12),
                         ('failure load factor', lambda_cs_ref, 13518.66)):
    print('%-38s %14.2f %14.2f %10.1e' % (name, value, ref,
                                          abs(value - ref)/ref))
lambda_cb_ref_analytical 12182.053373299575
lambda_cs_ref 13518.659375437137

first row of Table 3                    this notebook  Le Riche 1993 rel. diff.
buckling load factor                         12182.05       14168.12    1.4e-01
failure load factor                          13518.66       13518.66    4.6e-08
/home/saullogiovanip/align2026/runs/w7LR-20261106-091218/tmp/ipykernel_99217/308541800.py:24: RuntimeWarning: divide by zero encountered in divide
  gamma_12_allowable/abs(gamma_i_12) - 1

Which strain limits the reference laminate#

The load factor at which each strain of each ply orientation reaches its allowable, with the shear strain of the paper, \(\sin^2\theta_i(\epsilon_y - \epsilon_x)\), and with the transformation, \(2\sin\theta_i\cos\theta_i(\epsilon_y - \epsilon_x)\). The fibre strain \(\epsilon_1\) of the 0 degree plies governs, so the failure load factor of Table 3 is reproduced with both expressions; the shear limit is also the same, reached in the 90 degree plies with the expression of the paper and in the \(\pm 45\) plies with the transformation.

[8]:
def load_factors_per_ply(prop, shear):
    """Load factors at which eps1, eps2 and gamma12 reach the allowables"""
    vecN = -1.5*np.asarray([load_Nxx_unit, load_Nyy_unit])*4.448222/(25.4/1000)
    A = np.array([[prop.A[0, 0], prop.A[0, 1]], [prop.A[0, 1], prop.A[1, 1]]])
    exx, eyy = np.linalg.solve(A, vecN)
    for thetadeg in prop.angles:
        c = np.cos(np.deg2rad(thetadeg))
        s = np.sin(np.deg2rad(thetadeg))
        eps1 = c**2*exx + s**2*eyy
        eps2 = s**2*exx + c**2*eyy
        gamma12 = (s**2 if shear == 'paper' else 2*s*c)*(eyy - exx)
        lf_gamma = gamma_12_allowable/abs(gamma12) if abs(gamma12) > 1e-12 else np.inf
        print('%-14s %4d %12.2f %12.2f %12.4g' % (shear, thetadeg,
              epsilon_1_allowable/abs(eps1), epsilon_2_allowable/abs(eps2), lf_gamma))

print('%-14s %4s %12s %12s %12s' % ('gamma12', 'ply', 'eps1', 'eps2', 'gamma12'))
for shear in ('paper', 'transformation'):
    load_factors_per_ply(prop_ref, shear)
gamma12         ply         eps1         eps2      gamma12
paper             0     13518.66    222834.50          inf
paper            45     34659.55    125640.87    4.156e+04
paper            90     61471.59     49005.14    2.078e+04
transformation    0     13518.66    222834.50          inf
transformation   45     34659.55    125640.87    2.078e+04
transformation   90     61471.59     49005.14          inf

Defining design load#

[9]:
target_lambda = 10000

Defining objective function#

[10]:
#def objective_Workshop1(x): # NOTE to be minimized
#    stack = discrete_stack_from_continuous_x(x)
#    prop = laminated_plate(stack=stack, plyt=ply_thickness, laminaprop=laminaprop)
#    lambda_cb = calc_buckling_FE(prop)
#    lambda_cs = calc_failure_load_Haftka(prop)
#    p = 0.08 # NOTE Le Riche and Haftka (1993), p. 955
#    obj = (1 - p)*min(lambda_cs, lambda_cb)
#    return 1/obj

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_total = np.sum(x)
    return rho*h_total*a*b # [kg]

Defining constraint functions#

[11]:
def calc_constr_buckling(x): # NOTE feasible when >= 0
    prop = SmearedProp(*x)
    lambda_cb = calc_buckling_analytical(prop)
    return lambda_cb/target_lambda - 1

def calc_constr_failure(x): # NOTE feasible when >= 0
    prop = SmearedProp(*x)
    lambda_cs = calc_failure_load_Haftka(prop)
    return lambda_cs/target_lambda - 1

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; 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). 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”) with both constraints slightly violated.

[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_failure_plies(x_plies): # NOTE feasible when >= 0
    return calc_constr_failure(x_plies*ply_thickness)

n_var = 3
x0 = np.ones(n_var)*(1 + 48)/2
bounds = Bounds([1]*n_var, [48]*n_var)

constraints = [{'type': 'ineq', 'fun': calc_constr_buckling_plies},
               {'type': 'ineq', 'fun': calc_constr_failure_plies}]

print("Starting SLSQP Optimization with Scipy...")

res = minimize(
    mass_plies,
    x0,
    method='SLSQP',
    bounds=bounds,
    constraints=constraints,
    options={'ftol': 1e-6, 'disp': True, 'maxiter': 200},
    jac="2-point"
)

print("Best solution found, plies of 0, +-45 and 90: %s" % res.x)
x_opt = res.x*ply_thickness
Starting SLSQP Optimization with Scipy...
/home/saullogiovanip/align2026/runs/w7LR-20261106-091218/tmp/ipykernel_99217/308541800.py:24: RuntimeWarning: divide by zero encountered in divide
  gamma_12_allowable/abs(gamma_i_12) - 1
Optimization terminated successfully    (Exit mode 0)
            Current function value: 0.5713031699561171
            Iterations: 27
            Function evaluations: 109
            Gradient evaluations: 27
Best solution found, plies of 0, +-45 and 90: [12.97488942 29.5888335   1.01510014]

Checking the optimization result:

[13]:
prop_opt = SmearedProp(*x_opt)
ms_buckling_opt = calc_buckling_analytical(prop_opt)/target_lambda - 1
ms_failure_opt = calc_failure_load_Haftka(prop_opt)/target_lambda - 1
print('mass', mass(x_opt))
print('ms_buckling_opt', ms_buckling_opt)
print('ms_failure_opt', ms_failure_opt)

lambda_cb_opt_analytical = calc_buckling_analytical(prop_opt)
print('lambda_cb_opt_analytical', lambda_cb_opt_analytical)

lambda_cs_opt = calc_failure_load_Haftka(prop_opt)
print('lambda_cs_opt', lambda_cs_opt)
mass 0.5713031699561171
ms_buckling_opt -1.1432998991978138e-10
ms_failure_opt -5.8036435990338475e-08
lambda_cb_opt_analytical 9999.9999988567
lambda_cs_opt 9999.99941963564
/home/saullogiovanip/align2026/runs/w7LR-20261106-091218/tmp/ipykernel_99217/308541800.py:24: RuntimeWarning: divide by zero encountered in divide
  gamma_12_allowable/abs(gamma_i_12) - 1

Both constraints are active at the optimum: the buckling load and the strain allowables both limit the design at the target load factor. The 90 degree plies are close to their lower bound of one ply thickness.

[ ]: