Skip to main content

Wind Tunnel Testing

What is wind tunnel testing?​

Wind tunnel testing is measuring how air flows around an object, such as a car, aircraft, building or cyclist, by holding the object, or a scale model of it, still in a tunnel and blowing air past it at a controlled speed. Sensors record the forces, the surface pressures and the shape of the flow, and engineers chart them to improve the design.

A 3D chart in a dark navy theme of simulated airflow around a Formula 1 car model, seen from in front and to one side: streamlines are calm blue ahead of the car and turn orange and pink where the air is turbulent behind it, vortex cores trail from the front and rear wing tips, and a wake plane behind the car is outlined

Simulated airflow around a racing car: streamlines coloured by turbulence, vortex cores from the wing tips, and the plane where the wake is surveyed. Try the interactive version.

Key takeaways
  • A wind tunnel holds the model still and moves the air, so forces, pressures and flow can be measured precisely.
  • It measures forces on a balance, pressures through taps on the model, and the wake with a rake of probes behind it.
  • Streamlines show where the air goes, colour shows its speed, and vortex cores show where it spins.
  • A wake plane of total pressure shows where the air has lost energy behind the car: the "dirty air" a following car drives into.
  • Wind tunnels and CFD are used together: CFD explores many designs, the tunnel confirms the forces.

The same methods apply far beyond racing. Aircraft makers test wings and whole aircraft, architects test tall buildings for wind loads, and cyclists and skiers test their positions and clothing. This guide uses a racing car as its example because cars add a complication aircraft don't have: the ground.

How does a wind tunnel work?​

A wind tunnel is a duct with a fan in it. Most large tunnels are closed-circuit (also called closed-return or Göttingen-type): the air goes round and round a loop, so the fan only has to make up for the energy the air loses on each lap. Open-circuit tunnels (Eiffel-type) draw air in from the room and blow it out again; they are simpler and cheaper, but noisier and more affected by the room's air.

Plan view of a closed-circuit wind tunnel: a fan in the return leg drives the air round a loop; turning vanes guide it round the four corners; in the settling chamber a honeycomb and screens straighten it; the contraction speeds it up into the test section; the diffuser slows it down. Below, a side view of the test section: a car model on a rolling road that moves at the air speed, a strut from the roof to the force balance, pressure taps on the model, and a wake rake behind it

Follow the air round the loop:

  • Fan. Usually in the return leg, far from the model, so its swirl and noise have time to die away.
  • Turning vanes. Curved blades in each corner. Without them the air would separate from the outer wall and arrive at the model unevenly.
  • Settling chamber. The widest part, where the air is slowest. A honeycomb of small cells straightens it, and fine screens break up larger eddies, so the air reaching the model is smooth.
  • Contraction. The duct narrows, which speeds the air up and smooths it further. A contraction ratio (the settling chamber's area divided by the test section's) of 6 to 10 is enough for most small low-speed tunnels.
  • Test section. The model sits here, held by a strut or sting connected to a force balance, with windows and cameras around it.
  • Diffuser. The duct widens gradually after the test section, slowing the air and recovering pressure, so the fan uses less power.

Tunnels for cars add a rolling road: a belt under the model that moves at the same speed as the air, with the wheels spinning on it. On the road, the ground isn't moving relative to the air; in a tunnel with a fixed floor, a slow layer of air builds up on the floor and changes the flow under the car, which is where a modern racing car makes much of its downforce.

What does a wind tunnel measure?​

A wind tunnel test produces four kinds of data. Each needs a different chart.

MeasurementHow it is takenWhat it tells youUsual chart
Forces and momentsA force balance on the model's strut measures drag, lift or downforce, side force, and the moments about each axisHow much drag and downforce the shape makes, and the aero balance: the share of downforce on the front axleLine charts of each force against speed, ride height or yaw angle
Surface pressurePressure taps: small holes in the model's surface, piped to pressure sensorsWhere the surface is pushed or sucked, for example the suction under a wingPressure coefficient along a section, or a colour map on the surface
The wakeA wake rake: a comb of probes behind the model measuring total pressure, moved across a planeWhere the air has lost energy to drag, turbulence and vorticesA heatmap of total pressure across the plane
The flow itselfFlow visualisation: smoke, wool tufts, oil paint that streaks with the flow, or laser-based PIV (particle image velocimetry), which measures the velocity of tiny seeded particlesWhere the air goes, where it separates from the surface, and where it spinsStreamlines, vector plots and isosurfaces

Forces are usually reported as coefficients, which divide out the air speed and the model's size so different tests can be compared. The drag coefficient is the drag force divided by the dynamic pressure (½ × air density × speed²) and a reference area. The same works for downforce, side force and pressure: the pressure coefficient Cp is the local pressure minus the free-stream pressure, divided by the dynamic pressure.

Worked example: a 60% model at 50 m/s​

Formula 1's 2026 rules allow models up to 60% of full size and air speeds up to 50 m/s (180 km/h). How does that compare with the real car at 300 km/h (83.3 m/s)?

  • Dynamic pressure. At sea level, with air density 1.225 kg/m³: ½ × 1.225 × 50² = 1,531 Pa in the tunnel, against ½ × 1.225 × 83.3² = 4,253 Pa on track.
  • Forces. Force scales with dynamic pressure times area, and the model's area is 0.6² = 36% of the car's. So the model feels about 1,531 × 0.36 / 4,253 = 13% of the full car's forces at 300 km/h. Engineers compare coefficients, not forces.
  • Reynolds number. The Reynolds number, Re = density × speed × length / viscosity, compares the air's momentum with its stickiness, and it sets how thick the slow layer on the surface is and where the flow separates. The model's Re is 0.6 × 50 / 83.3 = 36% of the car's. The coefficients only match if the flow behaves the same at both Reynolds numbers, which is one reason teams also check their results on track.

How to read airflow visualisations​

Whether it comes from a wind tunnel's PIV system or from a CFD simulation, airflow data is usually shown in three ways. The interactive example on this page shows all three.

Streamlines are lines that follow the air: at every point, a streamline points the way the air is moving. In a steady flow, a streamline is the path a puff of smoke would take.

  • Where they bend, the body is pushing the air aside. Streamlines spread apart over the nose and squeeze together over the top and along the sides.
  • Colour shows speed. Air speeds up where streamlines squeeze together and slows where they spread apart. On this page, green is the free-stream speed, orange and red are faster, and blue and purple are slower.
  • Where they spiral, there's a vortex: air spinning around a line. Wing tips make vortices, because air leaks round the tip from the high-pressure side to the low-pressure side.
  • Where they wiggle and scatter, the flow is turbulent: full of random eddies. Behind a car, that's the wake.
  • One streamline tells you little. Look at the pattern, and remember that a seeded streamline only shows the air that passed through its seed point.

Vortex cores are shown as isosurfaces: surfaces through every point where a quantity has the same value, the 3D version of a contour line. The usual quantity for vortices is the Q-criterion, Q = ½(|Ω|² − |S|²), where Ω is the rate at which the air rotates and S the rate at which it is stretched. Where Q is positive, the air spins faster than it is stretched, so it's inside a vortex core. The threshold is a choice: a high value shows only the strongest cores, a low one shows more, and more noise.

  • Tubes trailing from wing tips are tip vortices. Their size and how far they last show how strong they are.
  • On a racing car, the wings make downforce, so they push air up rather than down. Each pair of tip vortices turns so that the air between them rises.

Wake planes are heatmaps across the tunnel at one distance behind the car. The usual quantity is the total pressure coefficient Cp0: 1 in undisturbed air, and lower where the air has lost energy to drag, turbulence or spinning. A wake rake measures it directly, and integrating the loss across the plane gives the drag that caused it.

  • The lowest values are in the vortex cores and directly behind the wheels and the car.
  • Moving the plane back, the wake spreads, rises and gradually recovers.

To describe a wake plane in one sentence, use this template:

"At [distance] behind the car, total pressure is lowest at [Cp0] in [where], the wake is about [width] wide and [height] high, and [which vortices] are visible as [where]."

For the example's default view: "At 1 m behind the rear wing, total pressure is lowest at −0.15 in the rear wing's tip vortices, the wake is about 2.5 m wide and 1 m high, and the wheel wakes and front wing vortices show either side of it, near the ground."

Wind tunnel testing for cars and Formula 1​

A car's aerodynamics is a trade between downforce, which presses the tyres into the track for more grip in corners, and drag, which slows the car on the straights. A road car designer mostly wants low drag, for efficiency and range; a racing car designer wants as much downforce as possible for each unit of drag, and a stable aero balance between the front and rear axles.

Formula 1 limits aerodynamic testing to control costs. Under the FIA's 2026 operational regulations:

LimitValue
Model sizeNo more than 60% of full size
Air speedNo more than 50 m/s, measured relative to the model
Testing periodsSix a year; the allowance resets each period
Wind tunnel, per period (full allowance)320 runs, 80 hours of wind-on time, 400 hours of occupancy
CFD, per period (full allowance)2,000 new geometries, and a cap on computing time
Sliding scale70% of the allowance for the champions, rising by 5 percentage points per place to 115% for tenth place

So the champion team gets 224 wind tunnel runs per period and the tenth-placed team 368.

The wake matters as much as the car's own downforce. A car following closely drives into the wake of the car in front, and its own wings and floor then make less downforce, which makes overtaking hard. Formula 1's 2022 rules were written to reduce the air thrown outwards from the car and to send the wake higher, so that a following car drives under the worst of it. The wake plane in the interactive example shows why: the energy lost by the car in front is concentrated in a few regions you can see.

Wind tunnel vs CFD: when to use each​

CFD (computational fluid dynamics) solves the equations of fluid flow on a computer, on a mesh of millions of cells around a digital model of the car. It doesn't replace the wind tunnel; the two answer different questions.

Wind tunnelCFDTrack testing
What you getMeasured forces and pressures on a physical model; flow images where cameras can seeThe whole flow field: velocity, pressure and turbulence everywhereThe real car's forces, from sensors and data logging
Best forConfirming forces; testing many small changes on one model quicklyUnderstanding why the flow behaves as it does; exploring many shapes before building anyChecking that tunnel and CFD results hold on the real car
LimitsScale model and lower Reynolds number; the walls and supports affect the flow; parts have to be madeResults depend on the mesh and the turbulence model, so they need checking against measurementsWeather, track and driver vary; few channels; expensive
How it's chartedForce and coefficient charts, pressure plots, wake heatmapsStreamlines, slices and isosurfaces in 3DLap traces and telemetry

Engineers call matching the three correlation. A team whose tunnel or CFD results don't correlate with the track can develop parts that look better in testing and are slower on the car.

Common wind tunnel testing mistakes​

Most wind tunnel errors come from a model or tunnel that doesn't behave like the real thing, or from charts that hide what the data says.

  • Ignoring the ground. Testing a car over a fixed floor gives the wrong flow under it. Use a rolling road and spinning wheels, or at least a moving belt under the car.
  • Ignoring blockage. A model that fills too much of the test section speeds up the air around it and inflates the forces. Keep the model's frontal area small compared with the test section, or correct for it.
  • Assuming a scale model behaves like the full car. A smaller model at a lower speed has a lower Reynolds number, and the flow can separate in different places. Check against CFD at full scale or the track.
  • Comparing forces instead of coefficients. Air density changes with temperature and pressure, so a force measured on a warm day isn't comparable with one on a cold day. Compare coefficients, corrected to the same conditions.
  • Picking an isosurface threshold to make a picture. A low Q threshold fills the screen with noise; a high one hides weak vortices. State the threshold, and keep it the same when comparing designs.
  • Saturated colour scales. If the colour scale stops at a value the data often exceeds, the strongest losses all look the same. Set the scale's range from the data, and show the colour key.
  • Reading one streamline. A streamline only shows the air that passed one seed point. Seed many, upstream of the model and around the features you care about.

How to visualise airflow in JavaScript, React or Angular​

Airflow data is large: thousands of streamline segments, isosurfaces of tens of thousands of triangles, and wake planes of thousands of cells. SciChart.js draws all of them with WebGL, together with a 3D model of the car, and lets you turn and zoom the scene.

The flow in this example is simulated, not measured or solved: smooth flow around ellipsoids that stand in for the car's body and wheels, four vortices from the wing tips, a slow wake behind the car and wheels, and seeded random eddies for the turbulence. It shows how to chart flow data; for real data, load your CFD or PIV results in its place. Drag to orbit the 3D view, scroll to zoom and double-click to reset. To move through the scene, click the 3D view and use W, A, S and D or the arrow keys to move forwards, back and sideways, and Q and E to move down and up; hold Shift to move faster. Switch the streamline colours between speed and turbulence, show the vortex cores or the turbulent wake as a surface and change its threshold, and move the wake plane along the car. Hover over the wake plane to read the total pressure. The car model (about 8 MB) loads in the background.

Here is the code. The flow model, the streamline tracer and the isosurface are plain JavaScript; SciChart.js draws the streamlines, the vortex surfaces, the car and the wake plane.

// Simulated airflow around a racing car: streamlines, vortex cores and a wake plane, charted with SciChart.js
const {
SciChart3DSurface,
SciChartSurface,
NumericAxis3D,
NumericAxis,
NumberRange,
EAutoRange,
Vector3,
XyzDataSeries3D,
PointLineRenderableSeries3D,
UniformHeatmapDataSeries,
UniformHeatmapRenderableSeries,
HeatmapColorMap,
BaseSceneEntity3D,
ESceneEntityType,
EMainLightMode,
OrbitModifier3D,
MouseWheelZoomModifier3D,
ResetCamera3DModifier,
CursorModifier,
SciChartJsNavyTheme
} = SciChart;
// or, for npm, import { SciChart3DSurface, ... } from "scichart"

// --- The simulated flow (plain JavaScript, no library needed) ---
// Car coordinates in metres: x across the car, y up from the ground, z along the car, with the nose at about
// z = -2.9 m and the rear wing at about z = 2 m. The air moves in +z, and every speed is a fraction of the
// free-stream speed (1 = the speed of the air far from the car). It is a made-up flow, not a CFD solution:
// smooth flow around ellipsoids standing in for the body and wheels, four vortices, a slow wake and
// pseudo-random turbulence in the wake.

// Ellipsoids: centre (x, y, z) and half-lengths (ax, ay, az), in metres
const BODIES = [
{ x: 0, y: 0.48, z: -0.45, ax: 0.78, ay: 0.4, az: 2.45 }, // chassis, sidepods and engine cover
{ x: -0.83, y: 0.35, z: -1.86, ax: 0.2, ay: 0.36, az: 0.36 }, // front wheels
{ x: 0.83, y: 0.35, z: -1.86, ax: 0.2, ay: 0.36, az: 0.36 },
{ x: -0.83, y: 0.35, z: 1.41, ax: 0.22, ay: 0.36, az: 0.36 }, // rear wheels
{ x: 0.83, y: 0.35, z: 1.41, ax: 0.22, ay: 0.36, az: 0.36 }
];
// Vortices: where each starts, how its core drifts per metre downstream (dx, dy), its strength (gamma, the
// circulation: + turns anticlockwise seen from behind) and its core radius. Wings that make downforce turn the
// air the opposite way to an aircraft wing, so each pair pushes the air between them upwards.
const VORTICES = [
{ x: -0.56, y: 0.86, z: 1.9, dx: 0.03, dy: 0.07, gamma: 0.5, rc: 0.08, grow: 0.01 }, // rear wing tips
{ x: 0.56, y: 0.86, z: 1.9, dx: -0.03, dy: 0.07, gamma: -0.5, rc: 0.08, grow: 0.01 },
{ x: -1.0, y: 0.18, z: -2.7, dx: -0.05, dy: 0.02, gamma: 0.45, rc: 0.09, grow: 0.006 }, // front wing tips, outside the tyres
{ x: 1.0, y: 0.18, z: -2.7, dx: 0.05, dy: 0.02, gamma: -0.45, rc: 0.09, grow: 0.006 }
];
const WAKES = [
{ x: 0, y: 0.45, z: 1.8, width: 0.7, height: 0.42, deficit: 0.5 }, // behind the rear wing and diffuser
{ x: -0.83, y: 0.32, z: -1.6, width: 0.22, height: 0.25, deficit: 0.3 }, // behind each wheel
{ x: 0.83, y: 0.32, z: -1.6, width: 0.22, height: 0.25, deficit: 0.3 },
{ x: -0.83, y: 0.32, z: 1.65, width: 0.24, height: 0.27, deficit: 0.35 },
{ x: 0.83, y: 0.32, z: 1.65, width: 0.24, height: 0.27, deficit: 0.35 }
];

const smoothstep = (from, to, t) => {
const s = Math.min(Math.max((t - from) / (to - from), 0), 1);
return s * s * (3 - 2 * s);
};

// Seeded gradient noise, so the turbulence looks the same every time
function createNoise(seed) {
let state = seed;
const random = () => {
state = (state * 16807) % 2147483647;
return (state - 1) / 2147483646;
};
const p = Array.from({ length: 256 }, (_, i) => i);
for (let i = 255; i > 0; i--) {
const j = Math.floor(random() * (i + 1));
[p[i], p[j]] = [p[j], p[i]];
}
const perm = new Uint8Array(512).map((_, i) => p[i & 255]);
const fade = (t) => t * t * t * (t * (t * 6 - 15) + 10);
const lerp = (a, b, t) => a + t * (b - a);
const grad = (hash, x, y, z) => {
const h = hash & 15;
const u = h < 8 ? x : y;
const v = h < 4 ? y : h === 12 || h === 14 ? x : z;
return (h & 1 ? -u : u) + (h & 2 ? -v : v);
};
return (x, y, z) => {
const fx = Math.floor(x);
const fy = Math.floor(y);
const fz = Math.floor(z);
const X = fx & 255;
const Y = fy & 255;
const Z = fz & 255;
x -= fx;
y -= fy;
z -= fz;
const u = fade(x);
const v = fade(y);
const w = fade(z);
const A = perm[X] + Y;
const AA = perm[A] + Z;
const AB = perm[A + 1] + Z;
const B = perm[X + 1] + Y;
const BA = perm[B] + Z;
const BB = perm[B + 1] + Z;
return lerp(
lerp(lerp(grad(perm[AA], x, y, z), grad(perm[BA], x - 1, y, z), u), lerp(grad(perm[AB], x, y - 1, z), grad(perm[BB], x - 1, y - 1, z), u), v),
lerp(
lerp(grad(perm[AA + 1], x, y, z - 1), grad(perm[BA + 1], x - 1, y, z - 1), u),
lerp(grad(perm[AB + 1], x, y - 1, z - 1), grad(perm[BB + 1], x - 1, y - 1, z - 1), u),
v
),
w
);
};
}
const noise = [createNoise(11), createNoise(23), createNoise(37)];
const EDDY_SIZE = 0.3; // metres

// The flow at one point: velocity (u, v, w), turbulent kinetic energy k (per unit free-stream speed squared),
// the loss of total pressure, and whether the point is inside the car
function flowAt(x, y, z, withTurbulence) {
let u = 0;
let v = 0;
let w = 1; // the free stream
let inside = false;
// Smooth flow around each ellipsoid, and around its mirror image under the ground, so no air flows through
// the ground. Each ellipsoid is a doublet (the flow around a sphere), stretched to the ellipsoid's shape.
for (const b of BODIES) {
for (const mirror of [1, -1]) {
const px = (x - b.x) / b.ax;
const py = (y - mirror * b.y) / b.ay;
const pz = (z - b.z) / b.az;
const r2 = px * px + py * py + pz * pz;
if (mirror === 1 && r2 < 1) inside = true;
const r5 = r2 * r2 * Math.sqrt(r2);
const strength = 0.5 / b.az;
u += b.ax * strength * (-3 * pz * px) / r5;
v += b.ay * strength * (-3 * pz * py) / r5;
w += b.az * strength * (r2 - 3 * pz * pz) / r5;
}
}
// Vortices: a Lamb-Oseen core (solid-body rotation in the middle, swirl falling as 1/r outside), with an
// opposite-turning image under the ground
let core = 0;
for (const vx of VORTICES) {
const s = z - vx.z;
if (s < -0.3) continue;
const along = Math.max(s, 0);
const on = smoothstep(-0.3, 0.2, s);
const cx = vx.x + vx.dx * along;
const cy = vx.y + vx.dy * along;
const rc = vx.rc + vx.grow * along;
const gamma = (vx.gamma * on) / (1 + 0.03 * along);
for (const mirror of [1, -1]) {
const rx = x - cx;
const ry = y - mirror * cy;
const r2 = Math.max(rx * rx + ry * ry, 1e-9);
const f = ((mirror * gamma) / (2 * Math.PI)) * (1 - Math.exp(-r2 / (rc * rc))) / r2;
u -= ry * f;
v += rx * f;
}
const r2 = (x - cx) * (x - cx) + (y - cy) * (y - cy);
core = Math.max(core, Math.exp(-r2 / (4 * rc * rc)) * Math.abs(gamma / vx.gamma) * on);
}
// Wakes: slower air behind the car and its wheels, spreading, rising and recovering downstream
let deficit = 0;
for (const wk of WAKES) {
const s = z - wk.z;
if (s < -0.3) continue;
const along = Math.max(s, 0);
const width = wk.width + 0.12 * along;
const height = wk.height + 0.08 * along;
const cy = wk.y + 0.06 * along;
const dx = (x - wk.x) / width;
const dy = (y - cy) / height;
deficit += ((smoothstep(-0.3, 0.4, s) * wk.deficit) / (1 + 0.3 * along)) * Math.exp(-dx * dx - dy * dy);
}
deficit = Math.min(deficit, 0.85);
w *= 1 - deficit;
const k = 0.35 * deficit * deficit + 0.05 * core;
// Turbulence: eddies from the curl of three noise fields (so they swirl rather than pull air in or push
// it out), as strong as the turbulent kinetic energy says
if (withTurbulence && k > 1e-4) {
const h = 0.05;
const q = (n, dx, dy, dz) => noise[n](x / EDDY_SIZE + dx, y / EDDY_SIZE + dy, z / EDDY_SIZE + dz);
const d = (n, axis) => (q(n, axis === 0 ? h : 0, axis === 1 ? h : 0, axis === 2 ? h : 0) - q(n, axis === 0 ? -h : 0, axis === 1 ? -h : 0, axis === 2 ? -h : 0)) / (2 * h);
const amplitude = 0.4 * Math.sqrt(2 * k);
u += amplitude * (d(2, 1) - d(1, 2));
v += amplitude * (d(0, 2) - d(2, 0));
w += amplitude * (d(1, 0) - d(0, 1));
}
const loss = Math.min(2 * deficit - deficit * deficit + 2 * k + 0.6 * core, 1.4);
return { u, v, w, k, loss, inside };
}

// --- The domain: the wind tunnel's test section, in metres ---
const X_RANGE = [-2, 2];
const Y_RANGE = [0, 2];
const Z_RANGE = [-4, 8];

// --- Streamlines: follow the air from seed points with fourth-order Runge-Kutta steps ---
function traceStreamline(x, y, z) {
const points = [];
const step = 0.03; // metres along the streamline
const direction = (px, py, pz) => {
const f = flowAt(px, py, pz, true);
const speed = Math.hypot(f.u, f.v, f.w);
return f.inside || speed < 0.02 ? null : [f.u / speed, f.v / speed, f.w / speed, speed, f.k];
};
for (let i = 0; i < 900; i++) {
const a = direction(x, y, z);
if (!a) break;
if (i % 2 === 0) points.push({ x, y, z, speed: a[3], k: a[4] });
const b = direction(x + (a[0] * step) / 2, y + (a[1] * step) / 2, z + (a[2] * step) / 2);
if (!b) break;
const c = direction(x + (b[0] * step) / 2, y + (b[1] * step) / 2, z + (b[2] * step) / 2);
if (!c) break;
const d = direction(x + c[0] * step, y + c[1] * step, z + c[2] * step);
if (!d) break;
x += (step * (a[0] + 2 * b[0] + 2 * c[0] + d[0])) / 6;
y += (step * (a[1] + 2 * b[1] + 2 * c[1] + d[1])) / 6;
z += (step * (a[2] + 2 * b[2] + 2 * c[2] + d[2])) / 6;
if (x < X_RANGE[0] || x > X_RANGE[1] || y < 0.005 || y > Y_RANGE[1] || z > Z_RANGE[1]) break;
}
return points;
}
const seeds = [];
// A rake of seeds upstream of the car, like smoke probes in a wind tunnel
for (let x = -1.35; x <= 1.36; x += 0.15) {
for (const y of [0.06, 0.18, 0.32, 0.48, 0.66, 0.86, 1.1]) seeds.push([x, y, Z_RANGE[0] + 0.1]);
}
// Rings of seeds around each vortex as it forms, so the streamlines show it spiralling
for (const vx of VORTICES) {
for (let i = 0; i < 6; i++) {
const angle = (i / 6) * 2 * Math.PI;
seeds.push([vx.x + 0.7 * vx.rc * Math.cos(angle), vx.y + 0.7 * vx.rc * Math.sin(angle), vx.z + 0.05]);
}
}
const streamlines = seeds.map(([x, y, z]) => traceStreamline(x, y, z)).filter((line) => line.length > 1);

// --- Surfaces: two fields on a grid, and their isosurfaces by marching tetrahedra ---
// Q-criterion, Q = ½(|rotation|² − |strain|²) of the velocity gradient: positive where the air spins faster than
// it is stretched, which is how CFD engineers find vortex cores. It is taken from the mean flow (without the
// turbulent eddies), as a steady CFD solution would give it.
// Turbulence intensity: the typical random swing in speed, as a fraction of the free-stream speed.
const GRID_STEP = 0.05;
const grid = { x0: -1.8, y0: 0, z0: -3, nx: 73, ny: 37, nz: 221 };
const nodes = grid.nx * grid.ny * grid.nz;
const index = (i, j, l) => (l * grid.ny + j) * grid.nx + i;
const gu = new Float32Array(nodes);
const gv = new Float32Array(nodes);
const gw = new Float32Array(nodes);
const gSpeed = new Float32Array(nodes);
const gTurbulence = new Float32Array(nodes);
const gInside = new Uint8Array(nodes);
for (let l = 0; l < grid.nz; l++) {
for (let j = 0; j < grid.ny; j++) {
for (let i = 0; i < grid.nx; i++) {
const f = flowAt(grid.x0 + i * GRID_STEP, grid.y0 + j * GRID_STEP, grid.z0 + l * GRID_STEP, false);
const n = index(i, j, l);
gu[n] = f.u;
gv[n] = f.v;
gw[n] = f.w;
gSpeed[n] = Math.hypot(f.u, f.v, f.w);
gTurbulence[n] = f.inside ? 0 : Math.sqrt((2 * f.k) / 3);
gInside[n] = f.inside ? 1 : 0;
}
}
}
const gQ = new Float32Array(nodes).fill(-1);
for (let l = 1; l < grid.nz - 1; l++) {
for (let j = 1; j < grid.ny - 1; j++) {
for (let i = 1; i < grid.nx - 1; i++) {
const n = index(i, j, l);
if (gInside[n]) continue;
// The velocity gradient J[a][b] = d(velocity a)/d(direction b), by central differences
const g = (a, d) => (a[n + d] - a[n - d]) / (2 * GRID_STEP);
const steps = [1, grid.nx, grid.nx * grid.ny];
const J = [gu, gv, gw].map((component) => steps.map((d) => g(component, d)));
gQ[n] = -0.5 * (J[0][0] ** 2 + J[1][1] ** 2 + J[2][2] ** 2) - (J[0][1] * J[1][0] + J[0][2] * J[2][0] + J[1][2] * J[2][1]);
}
}
}

// Marching tetrahedra: split each grid cell into six tetrahedra and cut each one where the field crosses the threshold
const CORNERS = [
[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0],
[0, 0, 1], [1, 0, 1], [0, 1, 1], [1, 1, 1]
];
const TETRAHEDRA = [
[0, 1, 3, 7], [0, 3, 2, 7], [0, 2, 6, 7],
[0, 6, 4, 7], [0, 4, 5, 7], [0, 5, 1, 7]
];
function buildIsosurface(field, threshold) {
const positions = [];
const normals = [];
const speeds = [];
const corner = [];
// A vertex where the edge from corner a to corner b crosses the threshold: its position, its normal (from the
// field's gradient, pointing outwards) and the air speed there
const emit = (a, b) => {
const t = (threshold - a.q) / (b.q - a.q);
positions.push(a.x + t * (b.x - a.x), a.y + t * (b.y - a.y), a.z + t * (b.z - a.z));
const gradient = [0, 1, 2].map((axis) => a.grad[axis] + t * (b.grad[axis] - a.grad[axis]));
const length = Math.hypot(...gradient) || 1;
normals.push(-gradient[0] / length, -gradient[1] / length, -gradient[2] / length);
speeds.push(a.speed + t * (b.speed - a.speed));
};
const gradientAt = (i, j, l) => {
const n = index(i, j, l);
const d = (step, ok) => (ok ? (field[n + step] - field[n - step]) / (2 * GRID_STEP) : 0);
return [d(1, i > 0 && i < grid.nx - 1), d(grid.nx, j > 0 && j < grid.ny - 1), d(grid.nx * grid.ny, l > 0 && l < grid.nz - 1)];
};
for (let l = 0; l < grid.nz - 1; l++) {
for (let j = 0; j < grid.ny - 1; j++) {
for (let i = 0; i < grid.nx - 1; i++) {
// Skip cells that are wholly above or below the threshold
let above = 0;
for (let c = 0; c < 8; c++) if (field[index(i + CORNERS[c][0], j + CORNERS[c][1], l + CORNERS[c][2])] > threshold) above++;
if (above === 0 || above === 8) continue;
for (let c = 0; c < 8; c++) {
const [ci, cj, cl] = [i + CORNERS[c][0], j + CORNERS[c][1], l + CORNERS[c][2]];
const n = index(ci, cj, cl);
corner[c] = {
x: grid.x0 + ci * GRID_STEP,
y: grid.y0 + cj * GRID_STEP,
z: grid.z0 + cl * GRID_STEP,
q: field[n],
speed: gSpeed[n],
grad: gradientAt(ci, cj, cl)
};
}
for (const tet of TETRAHEDRA) {
const ins = tet.filter((c) => corner[c].q > threshold).map((c) => corner[c]);
const outs = tet.filter((c) => corner[c].q <= threshold).map((c) => corner[c]);
if (ins.length === 1 || ins.length === 3) {
// One corner on its own: one triangle round it
const [lone, others] = ins.length === 1 ? [ins[0], outs] : [outs[0], ins];
for (const other of others) emit(lone, other);
} else if (ins.length === 2) {
// Two and two: a quad, as two triangles
emit(ins[0], outs[0]);
emit(ins[0], outs[1]);
emit(ins[1], outs[1]);
emit(ins[0], outs[0]);
emit(ins[1], outs[1]);
emit(ins[1], outs[0]);
}
}
}
}
}
return { positions, normals, speeds };
}

// --- Colours ---
const lerpColour = (stops, t) => {
const x = Math.min(Math.max(t, 0), 1) * (stops.length - 1);
const i = Math.min(Math.floor(x), stops.length - 2);
const f = x - i;
return stops[i].map((c, n) => Math.round(c + f * (stops[i + 1][n] - c)));
};
const argb = ([r, g, b], alpha = 255) => ((alpha << 24) | (r << 16) | (g << 8) | b) >>> 0;
// Speed, as a fraction of the free stream: slow air purple and blue, free stream green, fast air orange and red
const SPEED_STOPS = [[120, 80, 220], [50, 120, 245], [40, 200, 230], [120, 220, 110], [250, 220, 70], [250, 110, 60]];
const SPEED_RANGE = [0.2, 1.3];
const speedColour = (speed) => lerpColour(SPEED_STOPS, (speed - SPEED_RANGE[0]) / (SPEED_RANGE[1] - SPEED_RANGE[0]));
// Turbulence intensity, the typical size of the random swings in speed: calm air grey, turbulent air orange to yellow
const TURBULENCE_STOPS = [[90, 110, 150], [120, 120, 200], [230, 90, 160], [250, 150, 60], [255, 240, 120]];
const TURBULENCE_MAX = 0.25;
const turbulenceColour = (k) => lerpColour(TURBULENCE_STOPS, Math.sqrt((2 * k) / 3) / TURBULENCE_MAX);

// --- The 3D chart ---
const MODEL_SCALE = 0.3;
const WORLD_PER_METRE = 76.5 * MODEL_SCALE; // the car model is 153 units wide at scale 1, and the car is 2 m wide
const span = (range) => range[1] - range[0];
const { sciChart3DSurface, wasmContext } = await SciChart3DSurface.create(ui.chart3dDiv, {
theme: new SciChartJsNavyTheme(),
// One metre is the same length along every axis, so the car and the air keep their true shape
worldDimensions: new Vector3(span(X_RANGE) * WORLD_PER_METRE, span(Y_RANGE) * WORLD_PER_METRE, span(Z_RANGE) * WORLD_PER_METRE),
cameraOptions: { position: new Vector3(108, 55, -113), target: new Vector3(-14, -8, 18) },
lighting: { ambientLight: 0.3, lightMode: EMainLightMode.GlobalSpace, lightDirection: new Vector3(-1, -1, -1) },
xyAxisPlane: { isVisible: false },
zyAxisPlane: { isVisible: false }
});
const axis = (title, range) =>
new NumericAxis3D(wasmContext, { axisTitle: title, visibleRange: new NumberRange(range[0], range[1]), autoRange: EAutoRange.Never });
sciChart3DSurface.xAxis = axis("Across the car (m)", X_RANGE);
sciChart3DSurface.yAxis = axis("Height (m)", Y_RANGE);
sciChart3DSurface.zAxis = axis("Along the car (m)", Z_RANGE);
sciChart3DSurface.chartModifiers.add(new OrbitModifier3D(), new MouseWheelZoomModifier3D(), new ResetCamera3DModifier());

// Keyboard: move the camera across the scene without turning it. W / S or up / down move forwards and back, and
// A / D or left / right move sideways, all in the horizontal plane; Q / E move down and up; Shift moves faster.
// The camera and its target move together, so orbiting afterwards turns about the new spot.
const MOVES = {
w: [0, 1, 0], arrowup: [0, 1, 0], s: [0, -1, 0], arrowdown: [0, -1, 0],
a: [-1, 0, 0], arrowleft: [-1, 0, 0], d: [1, 0, 0], arrowright: [1, 0, 0],
q: [0, 0, -1], e: [0, 0, 1]
};
const heldKeys = new Set();
let fast = false;
let lastFrame = 0;
const moveCamera = (time) => {
if (heldKeys.size === 0) {
lastFrame = 0;
return;
}
const seconds = lastFrame ? Math.min((time - lastFrame) / 1000, 0.1) : 0;
lastFrame = time;
const camera = sciChart3DSurface.camera;
const { position, target } = camera;
// Forward is the way the camera looks, flattened onto the horizontal plane; right is at 90 degrees to it
const length = Math.hypot(target.x - position.x, target.z - position.z) || 1;
const forwardX = (target.x - position.x) / length;
const forwardZ = (target.z - position.z) / length;
let side = 0;
let ahead = 0;
let up = 0;
for (const key in MOVES) {
if (!heldKeys.has(key)) continue;
side += MOVES[key][0];
ahead += MOVES[key][1];
up += MOVES[key][2];
}
const step = (fast ? 360 : 120) * seconds; // world units per second
const dx = (ahead * forwardX + side * forwardZ) * step;
const dy = up * step;
const dz = (ahead * forwardZ - side * forwardX) * step;
camera.position = new Vector3(position.x + dx, position.y + dy, position.z + dz);
camera.target = new Vector3(target.x + dx, target.y + dy, target.z + dz);
requestAnimationFrame(moveCamera);
};
ui.chart3dBox.addEventListener("pointerdown", () => ui.chart3dBox.focus({ preventScroll: true }));
ui.chart3dBox.addEventListener("keydown", (event) => {
const key = event.key.toLowerCase();
fast = event.shiftKey;
if (!MOVES[key] || event.ctrlKey || event.metaKey || event.altKey) return;
event.preventDefault(); // stop the arrow keys scrolling the page
if (heldKeys.size === 0) requestAnimationFrame(moveCamera);
heldKeys.add(key);
});
ui.chart3dBox.addEventListener("keyup", (event) => {
fast = event.shiftKey;
heldKeys.delete(event.key.toLowerCase());
});
ui.chart3dBox.addEventListener("blur", () => heldKeys.clear());

// Streamlines: one PointLineRenderableSeries3D for all of them. isLineStrip: false draws each pair of points as
// a separate segment, so the streamlines don't join up, and every point carries its own colour.
const streamlineData = new XyzDataSeries3D(wasmContext);
const streamlineSeries = new PointLineRenderableSeries3D(wasmContext, {
dataSeries: streamlineData,
isLineStrip: false,
strokeThickness: 2
});
sciChart3DSurface.renderableSeries.add(streamlineSeries);
function colourStreamlines(mode) {
const xs = [];
const ys = [];
const zs = [];
const metadata = [];
for (const line of streamlines) {
for (let i = 0; i < line.length - 1; i++) {
for (const p of [line[i], line[i + 1]]) {
xs.push(p.x);
ys.push(p.y);
zs.push(p.z);
metadata.push({ vertexColor: argb(mode === "speed" ? speedColour(p.speed) : turbulenceColour(p.k)) });
}
}
}
streamlineData.clear();
streamlineData.appendRange(xs, ys, zs, metadata);
}

// The wake plane's outline in the 3D chart
const planeOutlineData = new XyzDataSeries3D(wasmContext);
const planeOutline = new PointLineRenderableSeries3D(wasmContext, {
dataSeries: planeOutlineData,
stroke: "#FFFFFF",
strokeThickness: 2,
opacity: 0.8
});
sciChart3DSurface.renderableSeries.add(planeOutline);

// Vortex cores and the turbulent wake: SciChart.js has no isosurface series, so this scene entity draws the
// triangles itself with the lit mesh drawing provider that ImmediateLitMeshContext uses. Vertices are in world
// coordinates, so each point is mapped from metres first.
let isosurface = null;
class IsosurfaceMesh extends BaseSceneEntity3D<any> {
type = ESceneEntityType.Custom;
// The triangles in world coordinates, as a native vertex list. Building it costs one call into
// WebAssembly per vertex attribute, so it is built once for each new isosurface and kept: every frame
// (for example while the chart is turned) only hands the finished list to the renderer.
vertices = null;
builtFor = null;
builtMapping = "";
constructor(context) {
super(context);
this.setNativeEntity(context.SCRTSceneEntity.implement(this));
}
Render() {
if (!this.isVisible || !this.currentRenderPassData || !isosurface || isosurface.positions.length === 0) return;
const wasm = this.webAssemblyContext;
const { xCalc, yCalc, zCalc, worldDimensions } = this.currentRenderPassData;
// The axes are linear, so two points give the mapping from metres to world coordinates for each axis
const linear = (calc, offset) => {
const at0 = calc.getCoordinate(0) - offset;
return [calc.getCoordinate(1) - offset - at0, at0];
};
const [ax, bx] = linear(xCalc, worldDimensions.x / 2);
const [ay, by] = linear(yCalc, 0);
const [az, bz] = linear(zCalc, worldDimensions.z / 2);
const mapping = [ax, bx, ay, by, az, bz].join();
if (this.builtFor !== isosurface || this.builtMapping !== mapping) {
this.vertices?.delete();
const { positions, normals, colours } = isosurface;
this.vertices = new wasm.VectorLitMeshVertex();
this.vertices.reserve(positions.length / 3);
const vertex = new wasm.SCRTLitMeshVertex();
vertex.u = 0;
vertex.v = 0;
vertex.selectionId = 0;
for (let i = 0; i < positions.length; i += 3) {
vertex.x = ax * positions[i] + bx;
vertex.y = ay * positions[i + 1] + by;
vertex.z = az * positions[i + 2] + bz;
vertex.nx = normals[i];
vertex.ny = normals[i + 1];
vertex.nz = normals[i + 2];
vertex.colorArgb = colours[i / 3];
this.vertices.push_back(vertex);
}
vertex.delete();
this.builtFor = isosurface;
this.builtMapping = mapping;
}
// Draw the kept list. This does what ImmediateLitMeshContext does, without rebuilding the list each frame
const params = new wasm.SCRTImmediateLitMeshDrawingParams();
params.renderMode = wasm.eTSRRenderMode.TSR_RENDERMODE_TRIANGLES;
params.useClipPlanes = false;
params.SetVertices(this.vertices);
const provider = new wasm.SCRTImmediateLitMeshDrawingProvider();
provider.DrawLitMesh(params);
provider.delete();
params.delete();
}
}
const isosurfaceMesh = new IsosurfaceMesh(wasmContext);
sciChart3DSurface.rootEntity.children.add(isosurfaceMesh);

// The car: a 3D model scene entity. The model is downloaded in the background (about 8 MB), and the scene
// redraws when it arrives. It is placed so that its own origin is at (0, 0, 0) in car coordinates.
class CarModel extends BaseSceneEntity3D<any> {
type = ESceneEntityType.SCRTSceneEntity;
constructor(context) {
super(context);
const model = new context.SCRTCADModelSceneEntity("AstonMartin/aston.glb.twi", "https://stagingdemo.scichart.com/fileshare/F1CarAssets");
model.SetModelScale(MODEL_SCALE);
// The world's origin is the middle of the domain, so move the car back by the domain's offset
model.SetPosition(new context.TSRVector3(0, 0, -((Z_RANGE[0] + Z_RANGE[1]) / 2) * WORLD_PER_METRE));
this.setNativeEntity(model);
}
get isLoaded() {
// The model reports its parts once it has arrived
try {
return JSON.parse(this.nativeEntity.GetNodeHierarchyJson()).nodes.length > 0;
} catch {
return false;
}
}
}
const car = new CarModel(wasmContext);
sciChart3DSurface.rootEntity.children.add(car);
ui.loading.textContent = "Loading the car model (about 8 MB)…";
const started = Date.now();
const waitForCar = setInterval(() => {
if (car.isLoaded) {
clearInterval(waitForCar);
ui.loading.style.display = "none";
sciChart3DSurface.invalidateElement();
} else if (Date.now() - started > 60000) {
clearInterval(waitForCar);
ui.loading.textContent = "The car model didn't load. The airflow is still shown.";
}
}, 200);

// --- The wake plane: total pressure across the tunnel at one distance along the car ---
// The total pressure coefficient Cp0 is 1 in undisturbed air. Lower values mean the air has lost energy, to
// turbulence, to a slower wake or to spinning in a vortex; it is what a wake rake measures in a wind tunnel.
const PLANE_STEP = 0.025;
const planeCols = Math.round(span(X_RANGE) / PLANE_STEP) + 1;
const planeRows = Math.round(1.6 / PLANE_STEP) + 1;
const { sciChartSurface: planeSurface, wasmContext: planeContext } = await SciChartSurface.create(ui.planeDiv, {
theme: new SciChartJsNavyTheme(),
title: "Wake plane, seen from behind",
titleStyle: { fontSize: 14 }
});
planeSurface.xAxes.add(new NumericAxis(planeContext, { axisTitle: "Across the car (m)", visibleRange: new NumberRange(X_RANGE[0], X_RANGE[1]), autoRange: EAutoRange.Never }));
planeSurface.yAxes.add(new NumericAxis(planeContext, { axisTitle: "Height (m)", visibleRange: new NumberRange(0, 1.6), autoRange: EAutoRange.Never }));
const CP0_STOPS = [[253, 231, 37], [248, 118, 92], [181, 54, 122], [81, 18, 124], [13, 10, 41]];
const CP0_RANGE = [-0.2, 1];
const planeColorMap = new HeatmapColorMap({
minimum: CP0_RANGE[0],
maximum: CP0_RANGE[1],
gradientStops: CP0_STOPS.map((c, i) => ({ offset: i / (CP0_STOPS.length - 1), color: `rgb(${c.join(",")})` }))
});
const planeData = new UniformHeatmapDataSeries(planeContext, {
xStart: X_RANGE[0] - PLANE_STEP / 2,
xStep: PLANE_STEP,
yStart: -PLANE_STEP / 2,
yStep: PLANE_STEP,
zValues: [[0]]
});
planeSurface.renderableSeries.add(new UniformHeatmapRenderableSeries(planeContext, { dataSeries: planeData, colorMap: planeColorMap }));
planeSurface.chartModifiers.add(
new CursorModifier({
showTooltip: true,
showAxisLabels: false,
tooltipDataTemplate: (seriesInfos) =>
seriesInfos
.filter((info) => info.isHit)
.map((info) => {
const row = Math.round(info.yValue / PLANE_STEP);
const col = Math.round((info.xValue - X_RANGE[0]) / PLANE_STEP);
const cp0 = planeValues[row]?.[col];
return `x ${info.xValue.toFixed(2)} m, height ${info.yValue.toFixed(2)} m: Cp0 ${Number.isFinite(cp0) ? cp0.toFixed(2) : "inside the car"}`;
})
})
);

let planeValues = [];
function updatePlane(z) {
const zValues = [];
let lowest = { cp0: Infinity, x: 0, y: 0 };
for (let row = 0; row < planeRows; row++) {
const y = row * PLANE_STEP;
const values = [];
for (let col = 0; col < planeCols; col++) {
const x = X_RANGE[0] + col * PLANE_STEP;
const f = flowAt(x, y, z, false);
const cp0 = f.inside ? NaN : 1 - f.loss;
values.push(cp0);
if (cp0 < lowest.cp0) lowest = { cp0, x, y };
}
zValues.push(values);
}
planeData.setZValues(zValues);
planeValues = zValues;
planeOutlineData.clear();
planeOutlineData.appendRange([X_RANGE[0], X_RANGE[1], X_RANGE[1], X_RANGE[0], X_RANGE[0]], [0, 0, 1.6, 1.6, 0], [z, z, z, z, z]);
return lowest;
}

// --- The controls ---
// Each surface's field, and its slider: Q on a log scale, turbulence intensity in per cent
const SURFACES = {
vortex: {
field: gQ,
slider: { min: 0.8, max: 2.4, step: 0.05, value: 1.3 },
threshold: (value) => Math.pow(10, value),
format: (threshold) => (threshold < 10 ? threshold.toFixed(1) : threshold.toFixed(0)),
// Coloured by the air speed through the core
colour: (speed) => argb(speedColour(speed)),
describe: (text) => `vortex cores, where Q is above ${text}`
},
turbulence: {
field: gTurbulence,
slider: { min: 0.1, max: 0.4, step: 0.01, value: 0.2 },
// One see-through colour, so the car and streamlines show through the wake
colour: () => argb([250, 150, 60], 110),
threshold: (value) => value,
format: (threshold) => `${Math.round(threshold * 100)}%`,
describe: (text) => `the turbulent wake, where turbulence intensity is above ${text}`
}
};
function updateIsosurface() {
const surface = SURFACES[ui.surfaceSelect.value];
ui.levelInput.disabled = !surface;
if (surface) {
const threshold = surface.threshold(Number(ui.levelInput.value));
ui.levelOutput.textContent = surface.format(threshold);
isosurface = buildIsosurface(surface.field, threshold);
isosurface.colours = isosurface.speeds.map(surface.colour);
} else {
isosurface = null;
ui.levelOutput.textContent = "";
}
sciChart3DSurface.invalidateElement();
}
function updateReadout(z, lowest) {
const where = z < -2.9 ? "in front of the car" : z <= 2 ? "alongside the car" : `${(z - 2).toFixed(1)} m behind the rear wing`;
ui.readout.textContent =
`Wake plane ${where}: lowest total pressure Cp0 = ${lowest.cp0.toFixed(2)}, ` +
`at ${lowest.x.toFixed(2)} m across and ${lowest.y.toFixed(2)} m above the ground. ` +
`Surface: ${SURFACES[ui.surfaceSelect.value]?.describe(ui.levelOutput.textContent) ?? "none"}.`;
}
function onPlaneChanged() {
const z = Number(ui.planeInput.value);
ui.planeOutput.textContent = `${z.toFixed(1)} m`;
updateReadout(z, updatePlane(z));
}
const setKey = (id, stops, min, max) => {
ui.key(id, "min").textContent = min;
ui.key(id, "max").textContent = max;
ui.key(id, "bar").style.background = `linear-gradient(to right, ${stops.map((c) => `rgb(${c.join(",")})`).join(", ")})`;
};
function onColourChanged() {
const mode = ui.colourSelect.value;
colourStreamlines(mode);
ui.key("lines", "label").textContent =
mode === "speed" ? "Streamlines: air speed, as a multiple of the free-stream speed" : "Streamlines: turbulence intensity";
if (mode === "speed") setKey("lines", SPEED_STOPS, `${SPEED_RANGE[0]}×`, `${SPEED_RANGE[1]}×`);
else setKey("lines", TURBULENCE_STOPS, "0%", `${TURBULENCE_MAX * 100}%`);
}
ui.key("plane", "label").textContent = "Wake plane: total pressure coefficient Cp0 (1 = undisturbed air)";
setKey("plane", CP0_STOPS, CP0_RANGE[0].toFixed(1), CP0_RANGE[1].toFixed(1));
ui.colourSelect.addEventListener("change", onColourChanged);
ui.streamlinesCheckbox.addEventListener("change", () => (streamlineSeries.isVisible = ui.streamlinesCheckbox.checked));
ui.surfaceSelect.addEventListener("change", () => {
const surface = SURFACES[ui.surfaceSelect.value];
if (surface) Object.assign(ui.levelInput, surface.slider);
updateIsosurface();
onPlaneChanged();
});
ui.carCheckbox.addEventListener("change", () => {
car.isVisible = ui.carCheckbox.checked;
sciChart3DSurface.invalidateElement();
});
ui.levelInput.addEventListener("input", () => {
updateIsosurface();
onPlaneChanged();
});
ui.planeInput.addEventListener("input", onPlaneChanged);
onColourChanged();
updateIsosurface();
onPlaneChanged();

Key points:

  • Streamlines: one PointLineRenderableSeries3D holds every streamline. With isLineStrip: false it draws each pair of points as a separate segment, so the lines don't join up, and a vertexColor in each point's metadata colours the line by speed or turbulence.
  • Vortex cores and the turbulent wake: SciChart.js has no isosurface series, so a custom scene entity draws the triangles with the lit mesh renderer behind ImmediateLitMeshContext, in world coordinates. It builds the native vertex list once for each new surface and keeps it, so turning the chart stays smooth even with 95,000 triangles. The marching-tetrahedra code that builds the surfaces is plain JavaScript. A colour with an alpha below 255 makes the surface see-through.
  • The car: a scene entity that loads a 3D model package in the background, placed so that one metre is the same length in the model and on the axes. worldDimensions keeps the axes at the same scale, so the car and the flow keep their true shapes.
  • Moving the camera from the keyboard: SciChart.js has no free-look modifier, so a key handler on the chart's element moves camera.position and camera.target together, across the horizontal plane relative to the way the camera faces. OrbitModifier3D then turns the view about the new spot.
  • The wake plane: a 2D UniformHeatmapRenderableSeries with a HeatmapColorMap, recomputed as the slider moves, and a CursorModifier tooltip that reads the value under the mouse.

See it in the demo app: JavaScript 3D model chart · React 3D model chart · Angular 3D model chart. Related techniques: the React immediate mesh 3D chart and the React vector field, a 2D version of a flow field drawn with arrows.

Go deeper: SciChart.js 3D line chart documentation, the immediate mesh 3D and uniform heatmap pages, and the learning center guides to the 3D surface plot, the heatmap and motorsport telemetry. For more on how SciChart is used in this sector, see SciChart for motorsport and automotive.

Frequently asked questions​

What is a wind tunnel?​

A wind tunnel is a duct in which a fan drives air past a fixed object, such as a car, aircraft, building or a scale model of one, at a steady, controlled speed. Because the object stays still, engineers can measure the forces on it, the pressures over its surface and the shape of the airflow around it far more precisely than on a moving vehicle.

How does a wind tunnel work?​

A fan moves the air. In a closed-circuit tunnel the air goes round a loop: turning vanes guide it round each corner, a honeycomb and fine screens straighten and smooth it, a contraction narrows the duct to speed it up, and it passes the model in the test section. A diffuser then widens the duct to slow the air before it returns to the fan.

What is wind tunnel testing for cars?​

Wind tunnel testing for cars measures a car's drag, downforce or lift, and the balance of downforce between the front and rear axles, at controlled speeds and ride heights. Car tunnels have a rolling road, a belt under the car that moves at the air speed, and spin the wheels, so the air between the car and the ground behaves as it does on the road.

How much wind tunnel time do F1 teams get?​

Under the FIA's 2026 regulations, a team with the full allowance gets 320 wind tunnel runs, 80 hours of wind-on time and 400 hours of tunnel occupancy in each of six testing periods a year, on a model no bigger than 60% scale and at no more than 50 m/s. The allowance slides with championship position, from 70% of it for the champions to 115% for tenth place.

Is CFD replacing wind tunnels?​

Not entirely. CFD (computational fluid dynamics) simulates the airflow on a computer and shows the whole flow field, so it is used to explore many designs quickly. Wind tunnels measure real forces on a physical model, which is still how engineers check that a simulation can be trusted. Most aerodynamic programmes use both and compare the results.

How do I visualise airflow in JavaScript?​

Trace streamlines through the velocity field with a fixed-step integrator such as fourth-order Runge-Kutta, and draw them as 3D lines coloured by speed. Show vortex cores as an isosurface of the Q-criterion, computed on a grid and meshed with marching cubes or marching tetrahedra, and show the wake as a heatmap on a plane. With SciChart.js, draw the streamlines with PointLineRenderableSeries3D, the isosurface as a custom lit mesh in the 3D scene, and the wake plane with UniformHeatmapRenderableSeries.

Sources​