-
Notifications
You must be signed in to change notification settings - Fork 12
/
VMT_CompMeanXS_UVW.m
35 lines (26 loc) · 1.02 KB
/
VMT_CompMeanXS_UVW.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function [A,V] = VMT_CompMeanXS_UVW(z,A,V)
% 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
%% Rotate velocities into u, v, and w components
% Determine the direction of streamwise velocity (u)
%V.phi = 180-V.theta; %Taken as perpendicular to the mean XS
% Determine the deviation of a vector from streamwise velocity
V.psi = (V.phi-V.mcsDir);
% Determine streamwise (u), transverse (v), and vertical (w) velocities
V.u = cosd(V.psi).*V.mcsMag;
V.v = sind(V.psi).*V.mcsMag;
V.w = V.mcsVert;
for zi = 1 : z
A(zi).Comp.u = cosd(V.psi).*A(zi).Comp.mcsMag;
A(zi).Comp.v = sind(V.psi).*A(zi).Comp.mcsMag;
A(zi).Comp.w = A(zi).Comp.mcsVert;
A(zi).Comp.psi = V.phi-A(zi).Wat.vDir;
A(zi).Comp.u1 = cosd(A(zi).Comp.psi).*A(zi).Wat.vMag;
A(zi).Comp.v1 = sind(A(zi).Comp.psi).*A(zi).Wat.vMag;
A(zi).Comp.w1 = A(zi).Wat.vVert;
end