close all
clear all


a = 1;
rho = 1025;
g = 9.81;

fh1 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);

fh2 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);

fh3 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);

fh4 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);

fh5 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);

fh6 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);

fh7 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);

fh8 = figure('Position',[520   173   766   925],'PaperOrientation','portrait','PaperPosition',[1.5 1.5 4.25 5.5]);


for draft = [4 2 1 .6 .4 .2 .1];

  V = pi*draft*a^2;
  
  filename = ['t_cyl_d' num2str(draft)]

  FD_coefs = Readwdra3dResults([filename '.out']);
    
  figure(fh1)
  plot(FD_coefs.T*sqrt(g/a),real(FD_coefs.F{3,3})/(rho*V))
  hold all
  
  figure(fh2)
  plot(FD_coefs.T*sqrt(g/a),imag(FD_coefs.F{3,3})./(rho*V*FD_coefs.w))
  hold all
  
  figure(fh3)
  plot(FD_coefs.T*sqrt(g/a),real(FD_coefs.F{7,3})./(rho*V*(FD_coefs.w).^2))
  hold all
  
  figure(fh4)
  plot(FD_coefs.T*sqrt(g/a),imag(FD_coefs.F{7,3})./(rho*V*(FD_coefs.w).^2))
  hold all
  
  figure(fh5)
  plot(FD_coefs.T*sqrt(9.81),real(FD_coefs.F{5,5})/(rho*V*a^2))
  hold all
  
  figure(fh6)
  plot(FD_coefs.T*sqrt(g/a),imag(FD_coefs.F{5,5})./(rho*V*a^2*FD_coefs.w))
  hold all
  
  
  figure(fh7)
  plot(FD_coefs.T*sqrt(g/a),real(FD_coefs.F{7,5})./(rho*V*a*(FD_coefs.w).^2))
  hold all
  
  figure(fh8)
  plot(FD_coefs.T*sqrt(g/a),imag(FD_coefs.F{7,5})./(rho*V*a*(FD_coefs.w).^2))
  hold all
  
  
end

figure(fh1)
xlim([0 80]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$ \frac{\mu_{33}}{\rho V} $'],'interpreter','latex','fontsize',18)
title('Heave Added Mass');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);
print('-dpdf','HeaveAddedMass');
  
figure(fh2)
xlim([0 80]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$ \frac{\lambda_{33}}{\omega \rho V} $'],'interpreter','latex','fontsize',18)
title('Heave Damping');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);
print('-dpdf','HeaveDamping');


figure(fh3)
xlim([0 80]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$  \frac{F_{33}^R}{\rho V \omega^2}$'],'interpreter','latex','fontsize',18)
title('Heave Exciting Force (real part)');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);  
print('-dpdf','HeaveExcitingForce_Re');


figure(fh4)
xlim([0 40]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$ \frac{F_{33}^I}{\rho V \omega^2}$'],'interpreter','latex','fontsize',18)
title('Heave Exciting Force (imag part)');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);
print('-dpdf','HeaveExcitingForce_Im');

   
figure(fh5)
xlim([0 30]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$ \frac{\mu_{55}}{\rho V a^2} $'],'interpreter','latex','fontsize',18)
title('Pitch Added Mass');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);
print('-dpdf','RollAddedMass');
   
   
figure(fh6)
xlim([0 30]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$ \frac{\lambda_{55}}{\omega \rho V a^2}  $'],'interpreter','latex','fontsize',18)
title('Pitch Damping');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);
print('-dpdf','RollDamping');
   
   
figure(fh7)
xlim([0 30]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$  \frac{F_{55}^R}{\rho V a \omega^2}$'],'interpreter','latex','fontsize',18)
title('Pitch Exciting Force (real part)');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);
print('-dpdf','RollExcitingForce_Re');

   
figure(fh8)
xlim([0 80]);
xlabel(['$ T \sqrt{\frac{g}{a}} $'],'interpreter','latex','fontsize',18)
ylabel(['$  \frac{F_{55}^R}{\rho V a \omega^2}$'],'interpreter','latex','fontsize',18)
title('Pitch Exciting Force (imag part)');
legend('d/a = 4', ...
       'd/a = 2', ...
       'd/a = 1', ...
       'd/a = .6', ...
       'd/a = .4', ...
       'd/a = .2', ...
       'd/a = .1', ...
       'Location','NorthEast'...
       );
set(gca, 'Units', 'normalized', 'Position', [0.15 0.2 0.75 0.7]);
print('-dpdf','RollExcitingForce_Im');

