Computes the mean cross section velocity components (Primary and secondary) from individual transects that have been previously mapped to a common grid and averaged. The Primary velocity is defined as the component of the flow in the direction of the discharge (i.e. rotated from the streamwise direction so the secrondary discharge is zero). This is referred to as the "zero net cross-stream discharge definition" (see Lane et al. 2000, Hydrological Processes 14, 2047-2071) (adapted from code by J. Czuba) P.R. Jackson, USGS, 12-9-08
0001 function [A,V,log_text] = VMT_CompMeanXS_PriSec(z,A,V) 0002 % Computes the mean cross section velocity components (Primary 0003 % and secondary) from individual transects that have been previously mapped 0004 % to a common grid and averaged. The Primary velocity is defined as the 0005 % component of the flow in the direction of the discharge (i.e. rotated 0006 % from the streamwise direction so the secrondary discharge is zero). 0007 % 0008 % This is referred to as the "zero net cross-stream discharge definition" 0009 % (see Lane et al. 2000, Hydrological Processes 14, 2047-2071) 0010 % 0011 % (adapted from code by J. Czuba) 0012 % 0013 % P.R. Jackson, USGS, 12-9-08 0014 0015 0016 %% Rotate velocities into p and s components for the mean transect 0017 % calculate dy and dz for each meaurement point 0018 dy=mean(diff(V.mcsDist(1,:)));%m 0019 dz=mean(diff(V.mcsDepth(:,1)));%m 0020 0021 % calculate the bit of discharge for each imaginary cell around the 0022 % velocity point 0023 qyi=V.v.*dy.*dz;%cm*m^2/s 0024 qxi=V.u.*dy.*dz;%cm*m^2/s 0025 0026 % sum the streamwise and transverse Q and calculate the angle of the 0027 % cross section 0028 V.Qy=nansum(nansum(qyi));%cm*m^2/s 0029 V.Qx=nansum(nansum(qxi));%cm*m^2/s 0030 0031 % Deviation from streamwise direction in geographic angle 0032 V.alphasp=atand(V.Qy./V.Qx); 0033 0034 % Difference in degrees between the tangent vector of the ZSD plane and the 0035 % normal vector of the mean cross section 0036 V.phisp = V.phi-V.alphasp; 0037 0038 % rotate the velocities so that Qy is effectively zero 0039 qpi=qxi.*cosd(V.alphasp)+qyi.*sind(V.alphasp); 0040 qsi=-qxi.*sind(V.alphasp)+qyi.*cosd(V.alphasp); 0041 0042 V.Qp=nansum(nansum(qpi));%cm*m^2/s 0043 V.Qs=nansum(nansum(qsi));%cm*m^2/s 0044 %disp(['Secondary Discharge after Rotation (ZSD definition; m^3/s) = ' num2str(V.Qs/100)]) 0045 log_text = [' Qs after rotation (ZSD; m^3/s) = ' num2str(V.Qs/100)]; 0046 0047 V.vp=qpi./(dy.*dz);%cm/s 0048 V.vs=qsi./(dy.*dz);%cm/s 0049 0050 %% Transform each individual transect 0051 0052 for zi = 1 : z 0053 0054 % calculate the bit of discharge for each imaginary cell around the 0055 % velocity point 0056 A(zi).Comp.qyi=A(zi).Comp.v.*dy.*dz;%cm*m^2/s 0057 A(zi).Comp.qxi=A(zi).Comp.u.*dy.*dz;%cm*m^2/s 0058 0059 % rotate the velocities so that Qy is effcetively zero 0060 A(zi).Comp.qpi=A(zi).Comp.qxi.*cosd(V.alphasp)+A(zi).Comp.qyi.*sind(V.alphasp); 0061 A(zi).Comp.qsi=-A(zi).Comp.qxi.*sind(V.alphasp)+A(zi).Comp.qyi.*cosd(V.alphasp); 0062 0063 A(zi).Comp.Qp=nansum(nansum(A(zi).Comp.qpi));%cm*m^2/s 0064 A(zi).Comp.Qs=nansum(nansum(A(zi).Comp.qsi));%cm*m^2/s 0065 0066 A(zi).Comp.vp=A(zi).Comp.qpi./(dy.*dz);%cm/s 0067 A(zi).Comp.vs=A(zi).Comp.qsi./(dy.*dz);%cm/s 0068 0069 end 0070 0071 0072 %% Determine velocity deviations from the p direction 0073 0074 V.mcsDirDevp = V.phisp-V.mcsDir; 0075 0076 for zi = 1:z 0077 A(zi).Comp.mcsDirDevp = V.phisp - A(zi).Comp.mcsDir; 0078 end