Mark Stock

Vic2d

Vic2d is a multithreaded two-dimensional fluid simulator. It uses a vortex-in-cell velocity solver with a 4th-order semi-Lagrangian method-of-characterstics and 4th-order interpolation scheme for advection. A similar method was mentioned in a 1969 paper, but does not appear to have been used since then. Unlike Stam's stable fluids method, it is not unconditionally stable, but it does have the ability to take large time steps with very little numerical diffusion and subsequent loss of energy (which can't be said of the popular "Stable Fluids" method). Vic2d is a collection of C and Fortran files and requires only gcc, gfortran, and the PNG libraries to compile. I wrote the base code in 2004 and have been using and updating it since then.

Files

You should get the current version of vic2d from the github page. You will need a C compiler and a Fortran compiler. If you are not using gcc and gfortran (because you are building on OSX or using MinGW), you will need to edit Makefile accordingly. On most Unixes, the following is all that should be necessary:

% git clone https://github.com/markstock/vic2d.git
% cd vic2d
% make
% vic2d -help

Features

Vic2d supports the following options (and more):

12GB of RAM will allow you to run vic2d on domains up to 12288 x 12288 or 16384 x 9216 with full-color scalar tracking. Reynolds numbers can exceed 1B and Courant Numbers can exceed 20 easily.

Images

Simple random vorticity, runs with CN~=12
vic2d -x 512 -y 512 -randvortscale 100.0 -vd 1.e-5 -vprint -dt 0.1 -every 10 -step 100
Vertical-to-horizontal instability, Re=1M
vic2d -x 1024 -y 1024 -vd 1.e-6 -t -tf columns_1025.png -b 1. -cn 1.
Movie at YouTube
Square RTI in B/W, showing simple buoyancy, Re=100M
vic2d -x 4096 -y 4096 -t -tf sin_4097.png -td 1.e-8 -b -1 -vd 1.e-8 -dt 0.001
Movie at YouTube
Flow over cylinder at Re=9500
vic2d -x 512 -y 512 -dt 0.005 -vd 0.000105263158 -open -fs 1. 0. -vprint -vscale 100.
Movie at YouTube
Flow over cylinder at Re=1000
vic2d -x 1024 -y 1024 -dt 0.005 -vd 1.e-3 -open -fs 1. 0. -vprint
Movie at YouTube
Flow over cylinder at Re=140
vic2d -x 1024 -y 1024 -dt 0.005 -vd 0.00714285714 -open -fs 1. 0. -vprint
Movie at YouTube
Flow over DLA at Re=10k
vic2d -x 256 -y 256 -dt 0.005 -vd 1.e-4 -open -fs 1. 0. -mf dla_257h.png -vprint -vscale 50.
Movie at YouTube
Gravity-driven flow in horizontal channel, Re=100k
vic2d -x 2048 -y 1152 -px -grav -0.2 1.0 -vd 1e-5 -t -tf run27_1153x2049_bwspread4.png -td 2e-7 -c -cf run27_1153x2049.png -cd 1e-7 -cn 10
Movie at YouTube
Buoyant simulation, RTI-like, very high resolution, Re=100M
vic2d -x 12288 -y 12288 -vd 1.e-8 -t -tf run19_12289_bwspread5.png -td 1.e-8 -c -cf run19_12289.png -cd 1.e-8 -cn 50 -every 20
Magma 19, at markjstock.com


Future plans

Future versions of vic2d may include the following:

Please e-mail me if you'd like to see some particular feature in vic2d, or if you use it to make something creative.

Vic2d in practice

Vic2d is being used to generate Povray image maps for gas giant planets for the open-source space game Oolite.

Gas giant texture created with vic2d and rendered in Povray by A. Bramble.
Galaxy annoucement and download

Thanks

I would like to thank John Adams, Paul Swarztrauber and Roland Sweet for FISHPACK 4.0, John Adams for MUDPACK 5.0, all the developers of libpng, and N. Bin Zafar for countless discussions.