Sampling the design space

A limited simulation budget spread evenly over the designs of interest.

Outcome: Choose design variables and their ranges; spread runs with a Latin hypercube or Sobol sequence, and say what each does; hold out validation designs before any training.

Builds on From runs to arrays

Simulations are expensive, so each one should add information. The design variables (what changes from run to run) and their ranges come first: the surrogate will be trusted only inside the ranges. The design of experiments places a limited number of runs in that box.

A regular grid (a full factorial design) looks natural but scales badly: 10 levels for each of 5 variables is 10510^5 runs, and each level of each variable is repeated 10,000 times. Purely random points are simple to draw but tend to leave clumps and gaps. Space-filling designs spread a fixed number of runs evenly. Two are common.

DefinitionLatin hypercube

A design that cuts each variable’s range into NN equal slices, then places NN samples so that every slice of every variable holds exactly one of them, with the slices paired at random.

Seen along any one axis, the samples of a Latin hypercube are evenly spread (McKay, Beckman and Conover 1979). A maximin variant searches among such designs for one whose two closest samples are as far apart as possible (Morris and Mitchell 1995); the simplest search draws many and keeps the best. The site’s aircraft has two design variables, angle of attack α\alpha (-2° to 8°) and wing sweep Λ\Lambda (20° to 36°); the ticks along the axes of Figure 2-2 show one sample in every slice of each.

152025303540-404812angle of attack α (°)sweep Λ (°)
36 training runs8 validation runstraining boxtest grid (later lesson)
Figure 2-2. The 44 simulated designs, 36 for training and 8 for validation; the crosses are the test grid of a later lesson, testing on unseen designs, and those outside the box were never covered by training data.

A Sobol sequence (Sobol’ 1967) is a deterministic low-discrepancy sequence, built digit by digit in base 2. Discrepancy measures how unevenly points fill the box (lower is more even). Any prefix of the sequence stays evenly spread, so points can be added later, which suits budgets that grow; the balance is exact only at powers of two (32, 64, 128 runs).

A rule of thumb for the number of runs in a first design, for smooth scalar outputs, is about ten runs per design variable (Loeppky, Sacks and Welch, Technometrics 2009). Rough responses, many variables or full fields usually need more, and the check that counts is the error on held-out runs (see train, validation and test).

Example 2-3. Three ways to place 44 runs, with SciPy
import numpy as np
from scipy.stats import qmc

# Ranges of alpha and sweep, in degrees.
lo, hi = [-2.0, 20.0], [8.0, 36.0]

# 44 points each: Latin hypercube, Sobol, plain random.
# rng= needs SciPy 1.15+; older versions call it seed=.
# SciPy scrambles Sobol by default, hence a seed for it too.
lhs = qmc.LatinHypercube(d=2, rng=0).random(n=44)1
sobol = qmc.Sobol(d=2, rng=0).random_base2(m=6)[:44]2
plain = np.random.default_rng(0).random((44, 2))

# Discrepancy: how unevenly the points fill the box.
for name, pts in [("LHS", lhs), ("Sobol", sobol),
                  ("random", plain)]:
    print(name, round(qmc.discrepancy(pts), 4))3

# Scale to degrees and hold out every fifth design now.
designs = qmc.scale(lhs, lo, hi)
val = designs[4::5]4
train = np.delete(designs, np.s_[4::5], axis=0)
print(train.shape, val.shape)  # (36, 2) (8, 2)
  1. A Latin hypercube of 44 points in the unit square: one point in each of the 44 slices of each axis.
  2. The first 44 of 26=642^6 = 64 Sobol points. A prefix stays evenly spread, but the balance is exact only at a power of two.
  3. qmc.discrepancy computes the centred discrepancy by default and returns its square (no square root is taken); lower is more even.
  4. Every fifth design (rows 4, 9, …, 39), 8 of the 44, is held out before anything is trained, as in the aircraft’s own split. np.delete keeps the other 36 for training.

Example 2-3 prints squared discrepancies of 0.0008 for the Latin hypercube, 0.0006 for Sobol and 0.0059 for plain random points: taking the square roots, the two space-filling designs are about three times more even, for these seeds.

Each design point then has to become a mesh, in one of two common ways: changing the parameters of the CAD model (computer-aided design: the designer’s exact 3D geometry file) and re-meshing every design, or morphing one baseline mesh, moving its nodes to the new shape. Morphing keeps one topology (the same nodes, connected the same way), which suits POD (a field compression taught in the next unit) and models that predict per node, but it limits how far the shape can move before the cells distort.

What stays fixed across the runs, the surrogate cannot learn (from runs to arrays). If it must cover other sizes, speeds, fluids or enclosures, they have to vary in the data, over the range of Re\mathrm{Re} it will meet. One 2026 benchmark, AeroZoo, varies boundary conditions and enclosures as well as shapes.

Not every run has to be expensive: many cheap runs (a coarse mesh, a simpler physics model) can be mixed with a few accurate ones (cheap and expensive data). And the surrogate itself can choose where to simulate next (choosing the next simulation).