% Schematic16n17n18.m %
clf;clear;figure(1)
figure1=figure(1);
axes('Visible','off','Parent',figure1);
hold('all');
xl=0.0; xr=1.0;n=128;x=linspace(xl,xr,n);[xx,yy]=meshgrid(x,x);

S(1:n,1:n)=0;h=1/128;gam=2*h;
for j=1:n
    for i=1:n
      x = (i-0.5)*h;
      y = (j-0.5)*h;
theta=atan2(x-0.5,y-0.5);
S(i,j) = -tanh((sqrt((x-0.5)^2+(y-0.5)^2) ...
 -(0.3*(0.9+0.1*cos(theta*theta)*sin(theta))+0.00*cos(7*theta)))...
 /(sqrt(2.0)*gam));  
    end
end

[CC,h]=contour(xx,yy,S',[ 0 0]);
m2=size(CC,2);
plot(CC(1,2:m2),CC(2,2:m2),'k-','linewidth',1.5)
hold on
plot([0.0 1 ],[1 1],'k-','linewidth',1.0)
plot([0 1],[0 0],'k-','linewidth',1.0)
plot([0 0],[0 1],'k-','linewidth',1.0)
plot([1 1],[0 1],'k-','linewidth',1.0)
box on
patch(CC(1,2:m2),CC(2,2:m2),[0.8627 0.8627 0.8627])
text('Interpreter','latex','String','$$\Omega$$','Position',[0.075 0.098 12.247],'FontSize',29);
text('Interpreter','latex','String','fluid 2','Position',[0.3707 0.5789 12.2474],'FontSize',25);
text('Interpreter','latex','String','fluid 1','Position',[0.6885 0.0891 12.2474],'FontSize',25);
text('Interpreter','latex','String','$$\rho_2,$$','Position',[0.4225 0.4517 12.2474],'FontSize',25);
text('Interpreter','latex','String','$$\rho_1,$$','Position',[0.4078 0.1418 12.2474],'FontSize',25);
text('Interpreter','latex','String','$$\eta_2$$','Position',[0.5365 0.45172 12.2474],'FontSize',25);
text('Interpreter','latex','String','$$\eta_1$$','Position',[0.5365 0.1388 12.2474],'FontSize',25);
axis image
axis([0.0 1 0 1.0])
figure
hold on
plot(CC(1,2:m2),CC(2,2:m2),'k-','linewidth',1.5)
patch(CC(1,2:m2),CC(2,2:m2),[0.8627 0.8627 0.8627])
[CC2,h]=contour(xx,yy,S',linspace(-0.7,0.7,3));
hold on
plot([0.0 1 ],[1 1],'k-','linewidth',1.0)
plot([0 1],[0 0],'k-','linewidth',1.0)
plot([0 0],[0 1],'k-','linewidth',1.0)
plot([1 1],[0 1],'k-','linewidth',1.0)
text('Interpreter','latex','String','$$\Omega$$','Position',[0.075 0.098 12.247],'FontSize',29);
text('Interpreter','latex','String','$$\phi=1$$','Position',[0.6969 0.1418 12.2474],'FontSize',25);
text('Interpreter','latex','String','$$\phi=-1$$','Position',[0.4286 0.5687 12.2474],'FontSize',25);
text('Interpreter','latex','String','$$\phi=0$$','Position',[0.0957 0.7821 12.2474],'FontSize',25);
text('Interpreter','latex','String','$$\Omega$$','Position',[0.0745 0.0979 12.24749],'FontSize',29);
annotation('arrow',[0.5589 0.625],[0.5976 0.6785]);
annotation('arrow',[0.6946 0.6446],[0.2380 0.3190]);
annotation('arrow',[0.3356 0.4017],[0.7190 0.6619]);
box on
axis image
axis([0.0 1 0 1.0])   
axis off
figure
hold on
plot(CC(1,2:m2),CC(2,2:m2),'k-','linewidth',1.5)
patch(CC(1,2:m2),CC(2,2:m2),[0.8627 0.8627 0.8627])
cc1=CC(:,2:11:m2);
for i=1:size(cc1,2)-1
    plot([0.5 cc1(1,i)],[0.5 cc1(2,i)],'k-','linewidth',0.2);
    plot([0.5 cc1(1,i+1)],[0.5 cc1(2,i+1)],'k-','linewidth',0.2); 
    plot([cc1(1,i) cc1(1,i+1)],[cc1(2,i) cc1(2,i+1)],'k-','linewidth',0.2); 
end
plot(cc1(1,:),cc1(2,:),'ko','linewidth',1.0)
hold on
plot([0.0 1 ],[1 1],'k-','linewidth',1.0)
plot([0 1],[0 0],'k-','linewidth',1.0)
plot([0 0],[0 1],'k-','linewidth',1.0)
plot([1 1],[0 1],'k-','linewidth',1.0)
text('Interpreter','latex','String','$$X_l$$','Position',[0.7383 0.1739 12.2474],'FontSize',23);
text('Interpreter','latex','String','$$X_{l+1}$$','Position',[0.8114 0.2616 12.2474],'FontSize',23);
text('Interpreter','latex','String','$$\Omega$$','Position',[0.0745 0.0979 12.2474],'FontSize',29);
annotation('arrow',[0.6696 0.628571428571429],[0.2714 0.30952380952381]);
annotation('arrow',[0.716014285714286 0.657142857142857],[0.335680952380952 0.352380952380952]);
box on
axis image
axis([0.0 1 0 1.0])   
axis off
text('Interpreter','latex','String','$$A(X)$$','Position',[0.0482 0.7470 12.2474],'FontSize',25);
annotation('arrow',[0.3357 0.4214],[0.6761 0.5952]);
set(gcf,'PaperPositionMode','auto')   
