disp('test_spray')
sourcestrength_tune=.3;%scales droplet mass flux, 0.5=midway between Andreas/Fairall and de Leeuw 
feedback_tune=1;%doesn't change droplet contribution to enthaply flux, but changes balance between droplet Hs and Hl 
zu=25;%reference height for bulk data
ts=29;%SST
ta=28;%Air T
s=.9;%saturation ratio (Rel Hum (%) /100)
P=1000;%atmos pressure
u=[10 20 30 40 50 60];%selected test wind speeds
for i=1:length(u)
    [hsd, hld , hss, hll, tau,feed_x, massf,uf, hs_tot,hl_tot, dta, hseps,bowd,hsde]=spray_param_3b(sourcestrength_tune,feedback_tune,u(i),zu,ts,ta,s,P,-999,-999,-999);
    hsdrp(i)=hsd;%droplet sensible heat
    hldrp(i)=hld;%droplet latent heat
    hssd(i)=hss;%direct sensible heat
    hlld(i)=hll;%direct latent heat
    tau_p(i)=tau;%direct stress
    feed_p(i)=feed_x;%feedback coeff
    massflux_p(i)=massf;%total droplet mass flux    
    u10(i)=uf;%10-m wind speed
    hs_tot_p(i)=hs_tot;%total sensible heat flux=hssd+hsdrp+hs_eps-hldrp+rho*cp*U*Ch*dtf
    hl_tot_p(i)=hl_tot;%total latent flux = hlld+hldrp-rho*cp*U*Ch*dtf
    dta_p(i)=dta;%subgrid cooling of droplet evap layer
    hseps_p(i)=hseps;%TKE dissipation flux in droplet evap layer
    bowd_p(i)=bowd;%bowen ratio for total droplet enthalpy flux
    hsde_p(i)=hsde;%total droplet enthalpy flux
end;
figure;plot(u10,tau_p./u.^2,[u10(1) u10(6)],[1.02e-3 1.01e-3]);xlabel('U_{10} (m/s)');ylabel('C_d, C_k');
figure;plot(u10,tau_p./u10.^2./((hs_tot_p+hl_tot_p)./(hssd+hlld)*1e-3));xlabel('U_{10} (m/s)');ylabel('C_d/C_k');
figure;plot(u,hssd,u,hs_tot_p,'-x',u,hsde_p,'-o');xlabel('U_{10} (m/s)');ylabel('Heat Flux (W/m^2)');
figure;plot(u,dta_p);xlabel('U_{10} (m/s)');ylabel('Doplet Layer Cooling (C)');

%print results
%s=0.9  source=0.3 feedtune=1.0 z=25 
[      u'       hsdrp'      hldrp'   hssd'   hlld'   feed_p'  massflux_p'    u10']
%   10.000      0.003       0.022	 7.387	 74.219     0.001	0.000	   9.214
%   20.000      0.147       1.656	14.558	146.276     0.030	0.000	  18.160
%   30.000      1.810      17.860	21.582	216.853     0.152	0.000	  26.922
%   40.000     11.220      75.390	28.474	286.102     0.280	0.002	  35.519
%   50.000     44.332     215.435	35.299	354.676     0.355	0.008	  44.033
%   60.000    124.793     501.536	42.359	425.611     0.413	0.021	  52.839


