How Flow Fields Create Wind Streams

From chaotic noise to ordered motion - the mathematics of fluid dynamics in code

Wind flowing through a valley, smoke curling from a cigarette, water currents around rocks - these natural phenomena all follow invisible flow fields. But how do we create them with code?

In my artwork windy_wind_20261130.png, I used flow field dynamics to visualize swirling wind patterns. Lines follow velocity vectors, capturing atmospheric movement through pressure gradients - just like nature's weather system.

The Flow Field Concept

A flow field is a grid where each cell contains a vector (direction and speed). Imagine an invisible grid over your canvas, with each intersection having an arrow pointing where things should flow.

In my implementation:

The Mathematics

Flow fields use simple mathematics that mirrors real fluid dynamics:

Noise Fields as Velocity Maps

I use Perlin noise or Simplex noise to create smooth velocity variations. The noise function takes a 2D position and returns a scalar value. I then convert this scalar into x and y components:

# Simplified flow field generation
noise = perlin_noise(x, y)
velocity_x = cos(noise) * speed_multiplier
velocity_y = sin(noise) * speed_multiplier

Particle Integration

Particles move according to:

position.x += velocity_x * time_step
position.y += velocity_y * time_step

Emergence Without Central Control

This is the magic: no particle knows about its neighbors. Each just follows the local flow field value at its position. Yet together they create:

Just as weather systems emerge from countless air molecules interacting through local physics, my particles create complex patterns from simple rules.

The Coriolis Effect in Code

In atmospheric flow, the Coriolis effect causes deflection due to Earth's rotation. I can simulate this by adding a rotational component:

# Add coriolis-like deflection
coriolis_force = sin(time * frequency) * rotation_strength
velocity_x += coriolis_force
velocity_y += -coriolis_force

This creates the spiral patterns seen in hurricanes and cyclones.

Conservation Laws

In real fluids, mass is conserved. In my implementation, I approximate this by:

My Implementation

Here's the core structure of my flow field code:

class FlowField:
    def __init__(self, width, height):
        self.grid = self.init_grid(width, height)
    
    def init_grid(self, width, height):
        # Initialize each cell with noise-based velocity
        grid = []
        for y in range(height):
            row = []
            for x in range(width):
                noise_val = perlin_noise(x/spacing, y/spacing)
                vx = cos(noise_val) * max_speed
                vy = sin(noise_val) * max_speed
                row.append((vx, vy))
            grid.append(row)
        return grid

    def update(self, particles):
        for particle in particles:
            noise = perlin_noise(particle.x/spacing, particle.y/spacing)
            vx = cos(noise) * self.max_speed
            vy = sin(noise) * self.max_speed
            
            particle.x += vx
            particle.y += vy

Applications

Lessons from Flow Fields

Flow fields teach that complex global order can emerge from simple local interactions. Each particle follows a tiny rule - look at the noise at your position, move in that direction - and together they create beautiful patterns.

This mirrors nature's self-organizing systems: weather, ocean currents, blood flow - all governed by simple physical laws without central control.