%	Irrotational, solenoidal flow in 2-D in the complex plane
%	w(z)=SUM 1/2pi)f(j)*log(z-z(j)), sum of line sources
%	Domain is between theta = 0 and theta = 2pi for all r > 0
    clear all
    clf reset
%    zj=0+0*i;
%    for j=1:2
%        zj=[zj 0+2*j*i 0-2*j*i];
%    end
%    fj=ones(1,length(zj));
    zj=[1 -1];
    fj=[1 -1];
    xm=[-2 2];
    ym=[-2 2];
    x=xm(1):0.02*(xm(2)-xm(1)):xm(2);
    y=ym(1):0.02*(ym(2)-ym(1)):ym(2);
    [X,Y]=meshgrid(x,y);
    z=X+i*Y;
    w=zeros(length(x),length(y));
    for j=1:length(fj)
        w=w+fj(j).*log(z-zj(j))./(2*pi);
    end
    figure(1)
    contour(X,Y,real(w),50,'r')
    hold on
    contour(X,Y,imag(w),13,'k')
    plot([0 1],[0 0],'k')
    axis image
    xlabel('x')
    ylabel('y')
    title('Potentials and Streamlines for w(z)=SUM (1/2pi)fj*log(z-zj)')
