下面的代码可在原始位置基于自由流速度和涡流强度创建矢量场。
然后,我尝试通过对线积分的面积求和来计算循环量
方法:
1)从速度场中分离向量。例如:line1_2是来自矩阵u的水平向量,line2是来自矩阵u的垂直向量
2)使用trapz,并在行上获取面积,并将分辨率作为一个因素。 approach
3)对所有面积求和,对于任何闭合形状,它应等于C的分子(在这种情况下为1000)。如果面积1/2/3/4等于1000,则我们可以试一下。 / p>
我的方法没有给出正确的值来总结它应该是什么,任何想法都将不胜感激。
对于速度场中的闭合形状,基本上需要做一个线积分或一个面积积分。 (斯托克定理)
谢谢
U_i = 10; % free stream velocity
C = 1000/(2*3.14);% vortex strength
meshfactor = 100;
[x,y] = meshgrid(-U_i:U_i/meshfactor:U_i);
% streamline= -U_i*y + G/(4*3.14)*log(y.^2 + x .^2)
% potential = -U_i*x - G/(2*pi)*atan(y/x)
% u and v components % note: substituted gamma/2i into the variable (line 2)
u = U_i - C*y./(2*(x.^2 + y.^2)); %%define the velocity component in the x
v = C*x./(2*(x.^2 + y.^2)); %%define the velocity component in the y
u(isnan(u)) = 0;
v(isnan(v)) = 0;
%prompt user for input of point coordinates in vector form, ie "[3,3]"
prompt1= 'pt1';
pt1 = input(prompt1);
prompt2= 'pt2';
pt2 = input(prompt2);
prompt3= 'pt3';
pt3 = input(prompt3);
prompt4= 'pt4';
pt4 = input(prompt4);
%% define line 1-2 in the horizontal, goes from left to right
line_1 = pt1(1):U_i/meshfactor:1;pt2(1);
yvec=u(pt1(2),pt1(1):pt2(1));
area_1 = U_i/meshfactor*trapz(yvec);
%% define line 2-3 in the vertical, goes from left to right
line_2 = pt2(2):U_i/meshfactor:1;pt3(2);
yvec2=v(pt2(2):pt3(2),pt2(1));
area_2 = U_i/meshfactor*trapz(yvec2);
%% define line 3-4 in the horizontal, goes from right to left
line_3 = pt4(1):U_i/meshfactor:1;pt3(1);
yvec3=u(pt4(2),pt4(1):pt3(1));
area_3 = U_i/meshfactor*trapz(yvec3);
%% define line 4-1 in the vertical, goes from left to right
line_4 = pt1(2):U_i/meshfactor:1;pt4(2);
yvec4=v(pt1(2):pt4(2),pt1(1));
area_4 = U_i/meshfactor*trapz(yvec4);
circulation = area_1 + area_2 + area_3 + area_4
figure
hold on
title((sprintf(' Unifrom flow with vortex at origin \n Vortex Strength = %0.0f, Free Stream Velocity = %0.0f',C,U_i)));
quiver(x,y,u,v);
hold off