%depth = 30;  %meters
%PTO_k = 1750;  %lbs/m
%PTO_d = 12;  %inches

spring_length = 3.5;
pto_length = 2.0;
guide_length=2.5;


n_spring_nodes = spring_length/node_sp;
n_pto_nodes = pto_length/node_sp;
n_guide_nodes = guide_length/node_sp
n_tether_nodes = tether_length/node_sp;

 %Create .spec file
 fid = fopen('Parameters.spec','w');

 fprintf(fid,'#define TF %6.3f \n',tf);
 fprintf(fid,'#define DT %6.3f \n',dt);

 fprintf(fid,'#define AMP %6.3f \n',wave_amp);
 fprintf(fid,'#define PER %6.3f \n',wave_per);
 fprintf(fid,'#define WIND %6.3f \n',wind_spd);
 
 
 fprintf(fid,'#define DEPTH %6.3f \n',depth);
 
 fprintf(fid,'#define PTO_DAMPING %6.3f \n',PTO_b);
 fprintf(fid,'#define TETHER_EA %6.3f \n',4.45*PTO_k*tether_length);
 fprintf(fid,'#define TETHER_LENGTH %6.3f \n',tether_length);
 fprintf(fid,'#define N_TETHER_NODES %d \n',n_tether_nodes);
 
  fprintf(fid,'#define SPRING_LENGTH %6.3f \n',spring_length);
  fprintf(fid,'#define N_SPRING_NODES %d \n',n_spring_nodes);

  fprintf(fid,'#define PTO_LENGTH %6.3f \n',pto_length);
  fprintf(fid,'#define N_PTO_NODES %d \n',n_pto_nodes);
   
  fprintf(fid,'#define GUIDE_LENGTH %6.3f \n',guide_length);
  fprintf(fid,'#define N_GUIDE_NODES %d \n',n_guide_nodes);


 
 fclose(fid);
 clear fid
 
nodes_of_interest = 1:n_spring_nodes+n_pto_nodes+n_guide_nodes+n_tether_nodes;
  
cmd = ['save ',results_filenm,'-SPEC.mat depth PTO_k PTO_b spring_length pto_length guide_length n_pto_nodes n_guide_nodes n_tether_nodes node_sp'];
eval(cmd);   
