%======================================================================
% .. Nozzle profiles
%    nozzle.m - cb1 - jan. 2017
%======================================================================
%addpath c:\allusr\cb1_matlab\matlabcb1;
clear all;
entete;
set(0,'defaultaxesfontname','palatino','defaultaxesfontsize',14);
clc; 




load profile_primary.txt;
xc = profile_primary(:,1);
rc = profile_primary(:,2);

figure(1);
axes('units','centimeters','position',[2. 2. 12. 4.]);
hold on;

in = 197;
Dp = rc(in)*2;
e = rc(in+1)-rc(in);
disp(['Tuyère interne Dp = ',num2str(Dp),' mm  e = ',num2str(e),' mm']);

%.. profil interne convergent
plot(xc(2:in),rc(2:in),'-r');

%.. profil externe convergent
plot(xc(in:end),rc(in:end),'-b');

yl = {'0.0','','','','','','','','','','0.1'};
set(gca,'xlim',[-0.05 0.55],'xtick',[0:0.1:0.5]);
set(gca,'ylim',[0 0.1],'ytick',[0:0.01:0.1],'yticklabel',yl);

xlabel('$x_c$');
ylabel('$r_c$');

print -depsc nozzlefg1.eps



load profile_secondary_short.txt;
x1 = profile_secondary_short(:,1);
r1 = profile_secondary_short(:,2);


load profile_secondary_long.txt;
x2 = profile_secondary_long(:,1);
r2 = profile_secondary_long(:,2);


figure(2);
axes('units','centimeters','position',[2. 2. 12. 4.]);
hold on;

%.. profil interne secondaire tronqué
%plot(x1,r1,'c');

%.. profil interne secondaire coplanaire
plot(x2,r2,'b');

%.. profil primaire complet
plot(xc(2:end),rc(2:end),'-r');

yl = {'0.0','','','','','','','','','','0.1','','','','','','','','','','0.2'};
set(gca,'xlim',[-0.05 0.55],'xtick',[0:0.1:0.5]);
set(gca,'ylim',[0 0.2],'ytick',[0:0.01:0.2],'yticklabel',yl);

xlabel('$x_c$');
ylabel('$r_c$');

Ds = r2(end)*2;
disp(['Tuyère secondaire Ds = ',num2str(Ds),' mm']);

print -depsc nozzlefg2.eps

%======================================================================
%======================================================================

