% LEP 14-4: Mass transfer effects in maneuvering a space satellite
%

Di=0.0025;
L=0.005;
Nu=0.0000494;
U=150;
DAB0=0.000069;
phi=0.4;
dp = (1.5*(Di^2)*L)^(1/3);
ac = 6*(1 -phi)/dp;
Re = dp*U/Nu;
Gamma = ((2*(Di/2)*L) + (2*(Di/2)^2))/dp^2;
Reprime = Re/((1 -phi)*Gamma);
DAB1 = DAB0*(450/298)^1.75;
Sc = Nu/DAB1;
Shprime = (Reprime)^(1/2)*(Sc)^(1/3);
kc = DAB1*(1-phi)*Gamma *Shprime/(dp*phi);
Pi=3.14;
A = Pi*Di*L + 2*Pi*(Di^2/4);
dp1 = sqrt(A/Pi);
ac1 = 6*(1 - phi)/dp1;
Re1 = dp1*U/Nu;
JD = ((0.765/ (Re1^0.82)) + (0.365/ (Re1^0.386)))/phi;
Shprime1 = Re1*(Sc)^(1/3)*JD;
kc1 = DAB1*Shprime1/(dp1); 

LB=linspace(0,0.2,100);
for i=1:100
X(i) = 1 - exp(-(kc*ac/U)*LB(i));
X1(i) = 1 - exp(-(kc1*ac1/U)*LB(i));
end
tiledlayout(2,2)
set (gcf,'Position',[0,0.5,800,500])
nexttile
plot(LB,X,'LineWidth',2);
set(gca,'ytick',linspace(0,1,5))
leg=legend('X');
ylabel('Conversion');
xlabel('L (m)');
axis([0 0.2 0 1])
title('Conversion using Thoenes-Kramers correlation')
leg.ItemTokenSize=[10,10];
grid on
nexttile
plot(LB,X1,'LineWidth',2);
set(gca,'ytick',linspace(0,1,5))
leg=legend('X');
ylabel('Conversion');
xlabel('L (m)');
axis([0 0.2 0 1])
title('Conversion using Colburn J_D factor')
leg.ItemTokenSize=[10,10];
grid on