Lee Phillips’ Website


Subscribe:   RSS icon   twitter icon

2D Vortex Dynamics

Lee Phillips

This is a simulation of the evolution of a two-dimensional vortex system without viscosity. The vortices that you initialize are all identical in strength and size, varying only in sign: positive (blue) vortices have a clockwise circulation, negative (green) the opposite.

 

Click within the blue box to add or vorticies.

...Receiving data...

What is this?

The objects represented by the blue and green dots are rectilinear vortices as described in Milne-Thomson’s classic text in the first section of Chapter XIII. Each vortex is a solid body rotation up to its radius; beyond that the speed of the circular fluid motion drops off as 1/r, where r is the distance from the vortex center (where the velocity is zero). Optimistic theorists think of these as simple models of tornadoes.

In the absence of viscosity (friction) the vortices retain their size and circulation over time; the system evolution consists in the convection of each vortex by the total velocity field created by all the others. There are no boundaries.

What’s left out?

Plenty! The most important departures from reality in this inviscid, two-dimensional model are friction and 3D effects. Friction (dissipation, viscosity) will cause a vortex to spread out and weaken over time. Perhaps the most important three-dimensional phenomenon not captured in a 2D model is vortex stretching. This has its analogy in the familiar example of the ice skater spinning faster as the performer’s arms are brought closer to the body; an illustration of the conservation of angular momentum. Flow along the vortex axis in 3D causes it to become longer and narrower, and to spin faster. There is no way for this to happen in 2D.

Examples

Two vortices of the same sign will orbit around each other. If they have opposite signs, they represent the cross section of a smoke ring (vortex ring) and, like the rings ejected from the insouciant smoker’s mouth, will float langorously across the room. More ambitious cigar afficionados sometimes attempt the leapfrogging smoke ring: place one behind the other, the following pair closer together (representing a younger, hence smaller, ring), and watch them trade places.

How does this work?

The front end uses HTMX and its websocket extension to communicate with the server, and some plain javascript to animate the vortices and finesse the interface.

The page communicates over a websocket with a Julia program running on a server. That program does the fluid calculations and sends the solution back for insertion in the page. The part of the Julia program handling the communication amounts to just a few lines, calling functions from the HTTP.jl library. We don’t need any web frameworks or boilerplate.

To get the code do
git clone https://lee-phillips.org/vortex/code
I’ve no doubt it can be improved. If you have ideas, please send a patch or comment by email.

Websocket communication (secure and encrypted) goes through an Apache reverse proxy. The Julia program runs in a systemd-nspawn container.

I made another page using the same techniques that simulates the acoustics of a plucked string instrument.

Julia is the best programming language for science and engineering (and much else). It combines C-class performance with a powerful, high-level syntax. I wrote this book to teach people, including beginning programmers, how to use Julia to attack problems in biology, statistics, physics, signal processing, and other fields.


Share with Facebook Share with Twitter Share with Reddit Share with Slashdot lee-phillips.org is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com.
Quotilizer ... loading ...

Tenuously related: