close all
clear all

basedir = '../HamiltonRuns/';

%configdir = 'ASIS_Mooring_70_PO_StaticExport-Dynamic_BuoyantTether_ASIS_Buoy_L-E_Hose/';
configdir = 'ASIS_Mooring_80_d110/';

Depth = 110;
Wind = 0;
WaveAmp = 5/2;
PeakPeriod = 16;

currents = [.60 .80 1.0];


filename = 'ResultsSummary.mat';

for i = 1:length(currents)
dir = [basedir configdir 'Results_c' num2str(100*currents(i)) 'u_d' num2str(Depth) '_w' num2str(Wind) '_Hs' num2str(2*WaveAmp) '_Tp' num2str(PeakPeriod) '/'];
load([dir filename]);
 
 
 
[AnchorHorizForce_mean(i) AnchorHorizForce_max(i) AnchorHorizForce_min(i) AnchorHorizForce_std(i)] = ComputeMeanMaxMin(MooringRiserResults.NodeNHorizForce/4.45);
[AnchorVertForce_mean(i) AnchorVertForce_max(i) AnchorVertForce_min(i) AnchorVertForce_std(i)] = ComputeMeanMaxMin(-MooringRiserResults.NodeNVertForce/4.45);

end

figure('Position',[ 300    200   1357    902])
ah1 = subplot(2,1,1)
plot(currents,AnchorHorizForce_max,'-x');
hold all
plot(currents,AnchorHorizForce_mean,'-x');
plot(currents,AnchorHorizForce_min,'-x');
legend('Max','Mean','Min');
xlabel('Current Speed (m/s)');
ylabel('Horizontal Anchor Force (lbs)');
title([configdir '  Anchor Loads:  Depth = ' num2str(Depth) 'm   Wind = ' num2str(Wind) 'kts   Hs = ' num2str(2*WaveAmp) 'm   Tp = ' num2str(PeakPeriod) 's'],'interpreter','none');
grid on
ah2 = subplot(2,1,2)
plot(currents,AnchorVertForce_max,'-x');
hold all
plot(currents,AnchorVertForce_mean,'-x');
plot(currents,AnchorVertForce_min,'-x');
legend('Max','Mean','Min');
xlabel('Current Speed (m/s)');
ylabel('Vertical Anchor Force (lbs)');
grid on;


print([basedir configdir 'DynamicAnchorLoads' '_d' num2str(Depth) '_w' num2str(Wind) '_Hs' num2str(2*WaveAmp) '_Tp' num2str(PeakPeriod) '.pdf'],'-landscape','-bestfit');
