# VMT_CompMeanXS_UVW

## PURPOSE

Computes the mean cross section velocity components (U,V,W)

## SYNOPSIS

function [A,V] = VMT_CompMeanXS_UVW(z,A,V)

## DESCRIPTION

     Computes the mean cross section velocity components (U,V,W)
     from individual transects that have been previously mapped to a common
     grid and averaged.

     (adapted from code by J. Czuba)

     P.R. Jackson, USGS, 12-9-08

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- VMT_ProcessTransects Driver program to process multiple transects at a single cross-section

## SOURCE CODE

    0001 function [A,V] = VMT_CompMeanXS_UVW(z,A,V)
    0002 % Computes the mean cross section velocity components (U,V,W)
    0003 % from individual transects that have been previously mapped to a common
    0004 % grid and averaged.
    0005 %
    0006 % (adapted from code by J. Czuba)
    0007 %
    0008 % P.R. Jackson, USGS, 12-9-08
    0009
    0010
    0011 %% Rotate velocities into u, v, and w components
    0012 % Determine the direction of streamwise velocity (u)
    0013 %V.phi = 180-V.theta;  %Taken as perpendicular to the mean XS
    0014
    0015 % Determine the deviation of a vector from streamwise velocity
    0016 V.psi = (V.phi-V.mcsDir);
    0017
    0018 % Determine streamwise (u), transverse (v), and vertical (w) velocities
    0019 V.u = cosd(V.psi).*V.mcsMag;
    0020 V.v = sind(V.psi).*V.mcsMag;
    0021 V.w = V.mcsVert;
    0022
    0023 for zi = 1 : z
    0024
    0025     A(zi).Comp.u = cosd(V.psi).*A(zi).Comp.mcsMag;
    0026     A(zi).Comp.v = sind(V.psi).*A(zi).Comp.mcsMag;
    0027     A(zi).Comp.w = A(zi).Comp.mcsVert;
    0028
    0029     A(zi).Comp.psi = V.phi-A(zi).Wat.vDir;
    0030     A(zi).Comp.u1 = cosd(A(zi).Comp.psi).*A(zi).Wat.vMag;
    0031     A(zi).Comp.v1 = sind(A(zi).Comp.psi).*A(zi).Wat.vMag;
    0032     A(zi).Comp.w1 = A(zi).Wat.vVert;
    0033
    0034 end
    0035