Leap-Frogging Vortex Rings

Mathematica 4.2 version: 12/31/05;

Here is some Mathematica code to numerically solve this using the 4th order Runge-Kutta method:

(* runtime: 21 seconds, increase n for better resolution *)
n = 23; tmax = 0.85; dt = tmax/100; rcore = 0.1; Klist = {1, -1, 1, -1}; zlist = {-1 - 0.5I, -1 + 0.5I, -0.5 - 0.5I, -0.5 + 0.5I}; m = Length[zlist];
v[K_, z_, z0_] := Module[{r2 = Abs[z - z0]^2}, I K(z0 - z)/r2(1 - Exp[-r2/rcore^2])];
Runge[z_] := Module[{}, k1 = dt vtot[z]; k2 = dt vtot[z + k1/2]; k3 = dt vtot[z + k2/2]; k4 = dt vtot[z + k3]; (k1 + 2 k2 + 2 k3 + k4)/6];
vtot[zlist_] := Table[Sum[If[i == j, 0, v[Klist[[j]], zlist[[i]], zlist[[j]]]], {j, 1, m}], {i, 1, m}]; zlists = Transpose[Table[zlist += Runge[zlist], {t, 0, tmax, dt}]];
vtot[z_] := Plus @@ v[Klist, z, zlists[[All, t]]]; image = Table[z = x + I y; Do[z -= Runge[z], {t, 100, 1, -1}]; z, {y, -1.125, 1.125, 2.25/n}, {x, -0.35, 1.9, 2.25/n}];
ListDensityPlot[Map[Sign[Im[#]]Arg[#] &, image, {2}], Mesh -> False, Frame -> False, AspectRatio -> Automatic]



5 Responses to “Leap-Frogging Vortex Rings”

  1. 1 _ex_
    May 15, 2008 at 1:39 pm

    two questions: when I run the code in Mathematica it shows me a blurry image in blue tones. Did you apply post-processing to your images?
    Can you point me to the steps for get the animatin on the side?
    Thank you

  2. 2 nylander
    May 15, 2008 at 4:33 pm

    The code that I have provided here produces a blocky grayscale image in Mathematica 4.2. Higher versions of Mathematica will produce a blurry image in blue tones. Using higher values of n will increase the resolution of the image. Using Mathematica for this is not very efficient. That is why my final animation was created in C++.

  3. November 14, 2008 at 9:08 am

    how about this?
    I’m developing from zero. this is a flow over body at Re550 using vortex method.

    *I’m sorry, I’m writing my blog in Indonesian

  4. 4 Shears
    September 9, 2009 at 10:57 am

    One thing you could do to speed up the rendering is that you render only one (vertical) half of the image and then you copy, vertical flip and arrange it so the two parts form the whole image.

    • 5 nylander
      September 9, 2009 at 5:26 pm

      That is how I rendered the larger images, but the Mathematica code I gave was made to be as simple as possible, so that it would be easier for other people to understand. It is far from efficient. I recommend avoiding Mathematica entirely for large images.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Welcome !

You will find here some of my favorite hobbies and interests, especially science and art.

I hope you enjoy it!

Subscribe to the RSS feed to stay informed when I publish something new here.

I would love to hear from you! Please feel free to send me an email : bugman123-at-gmail-dot-com


Blog Stats

  • 544,795 hits

%d bloggers like this: