0

I'm trying to simulate different potential vortexes in MATLAB. I got the flow function and the velocities and it is working for one single vortex. But I don't know how to vary the vortex from being in the origin. Can anybody help me?

[x,y] = meshgrid(-10:10);
Gamma = 5;%circulation
yc = 1; %aberration from the origin 
xc = 1; 
rc = sqrt((x-xc).^2+(y-yc).^2);
r = sqrt(x.^2 + y.^2);
u = - Gamma*(y-yc) / 2*pi*rc +2* Gamma* y / 2*pi*r -Gamma*(y-yc)/2*pi*rc;
v = Gamma * (x-xc) / 2*pi*rc-2* Gamma*x / 2*pi*r + Gamma*(x-xc)/2*pi*rc;

quiver(x,y,u,v);

I tried to transform the potential flow function for a potential vortex to cartesian coordinates to simulate four vortexes in a quadrat:

[x,y] = meshgrid(-8:0.1:8);
Gamma = 5;
spacing = 0.1;
yc = 1;
xc = 1; 
rc = sqrt((x+xc).^2+(y+yc).^2);
rc2 = sqrt((x+xc).^2+y.^2);
rc3 = sqrt(x.^2 +(y+yc).^2);
r = sqrt(x.^2 + y.^2);
u = Gamma/2*pi * (-(y+yc)./rc +(y+yc)./rc3 + y./rc2 - y./r);
v = Gamma/2*pi *(-(x+xc)./rc +(x+xc)./rc2 + x./rc3 - x./r); 
quiver(x,y,u,v);

Therewith I was able to simulate different vortexes but it seems that there is a source in the middle of the vortexes now. Vortexes with a unwanted source in the middle:

image

Wolfie
  • 27,562
  • 7
  • 28
  • 55
nobre55
  • 21
  • 3
  • 1
    Add a number to the position? – Ander Biguri Apr 13 '21 at 10:29
  • what do you mean adding a number? – nobre55 Apr 13 '21 at 10:56
  • 1
    `x=x+4`. If you want the position, `x`, to be somewhere else, well, add a number to it. That way whatever was zero, its now 4. The same with the other numbers. – Ander Biguri Apr 13 '21 at 11:28
  • yes, I tried that. In my code the number is called xc... – nobre55 Apr 13 '21 at 11:30
  • 2
    Its not very clear what you want. Now there is no source in the origin (0,0) but somewhere else. What is the question? why do you think this is wrong? Both of your example equations are slightly different, so of course they do different things. – Ander Biguri Apr 13 '21 at 11:47
  • I want to simulate four potential vortexes one in each corner of a quadrat. The two at the top two corners should be in opposite directions and the two at the bottom, too. I hope thats understandable :) – nobre55 Apr 13 '21 at 11:57
  • 1
    Unfortunately it is no for me no. That is not a code-question (stackoverflow is for code), so I have no idea how to help. Good luck. – Ander Biguri Apr 13 '21 at 12:07

0 Answers0