u0 = ubar;
uu = ustd;
% Preston tube and other calculations
dia_p = 0.001; % Preston Tube diameter, m
dp = rho_hg*g*0.001*0.052; %mean(u_dat(1,:,2));
% Patel(JFM) Method - Doesn't work for wind tunnel for some reason
x_star = log10(dp*dia_p^2/(4*rho_air*nu*nu))
%y_star1 = x_star/2 + 0.037
y_star2 = 0.8287 - 0.1381*x_star + 0.1437*x_star^2 - 0.0060*x_star^3
%str = sprintf('y+2*log(1.95*y + 4.10) - %g',x_star); y_star3 = solve(str)
y_star = y_star2;
tau_w = 4*rho_air*nu^2*10^(y_star)/dia_p^2;
u_tau = sqrt(tau_w/rho_air)
%% Law of the wall computations
kappa = 0.41;
const_a = 5.0;
epsilon = 0.0001;
z_pos = z_dat*0.001 - epsilon; % z_pos is in m
%
%% Clausen Chart Method
f = inline('u_tau*( log(z_pos*u_tau/1.5100e-005)/0.41 + 5.0)','u_tau','z_pos');
u_tau = lsqcurvefit(f,0.4,z_pos(15:36),u0(15:36))
tau_w = u_tau*u_tau*rho_air;
%
z_plus = z_pos*u_tau/nu;
u_plus = u0/u_tau;
u_plus_calc = log(z_plus)/kappa + const_a;
figure;
semilogx(z_plus(1:num_pos),u_plus(1:num_pos),'*r');
hold on;
semilogx(z_plus(1:num_pos),u_plus_calc(1:num_pos),'-b');
title('Boundary Layer Velocity Profile at U_{inf}=15.8 m/s and Law of the Wall')
xlabel('Non-dimensional Wall Normal Location, z^{+}')
ylabel('Boundary Layer Velocity, U m/s')
hold off;
%figure;
%semilogx(z_plus,uu,'*b');
%title('Turbulence Intensities at U_{inf}=15.8 m/s');
%xlabel('Non-dimensional Wall Normal Location, z^+')
%ylabel('Turbulence Intensity, uu = sqrt((U-U0)^2); m/s');