CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   How to Create a Multiple Point Vortice Vector Field (https://www.cfd-online.com/Forums/main/121490-how-create-multiple-point-vortice-vector-field.html)

AHutchison July 29, 2013 23:38

How to Create a Multiple Point Vortice Vector Field
 
I want to create a vector field with multiple point vortices in a checkerboard arrangement with alternating rotational directions. I have written a code in python to create a single point vortex in the middle of my grid (see below) but would like to know how to go about creating this multiple point vector field.

Code:

  from math import *
from pylab import *
# Set limits and number of points in grid
xmax = 10
xmin = -xmax
NX = 30
ymax = 10
ymin = -ymax
NY = 30
# Make grid and calculate vector components
x1 = linspace(xmin, xmax, NX)
y1 = linspace(ymin, ymax, NY)
X1, Y1 = meshgrid(x1, y1)
S21 = -(X1)**2 - (Y1)**2 # This is the radius squared
Bx1 = -Y1/S21
By1 = +X1/S21
figure()
QP = quiver(X1,Y1,Bx1,By1)
quiverkey(QP, 0.85, 1.05, 1.0, '1 mT', labelpos='N')
# Set the left, right, bottom, top limits of axes
dx = (xmax - xmin)/(NX-1)
dy = (ymax - ymin)/(NY-1)
axis([xmin-dx, xmax+dx, ymin-dy, ymax+dy])
show()
end

Thanks in advance!


All times are GMT -4. The time now is 05:35.