VMT_ComputeDispCoef

PURPOSE ^

Driver function to extract VMT data for computation of the longitudinal

SYNOPSIS ^

function [k,kc,Ey,Q] = VMT_ComputeDispCoef(z,A,V)

DESCRIPTION ^

 Driver function to extract VMT data for computation of the longitudinal
 dispersion coefficient.

 P.R. Jackson, USGS 11-17-10

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [k,kc,Ey,Q] = VMT_ComputeDispCoef(z,A,V)
0002 % Driver function to extract VMT data for computation of the longitudinal
0003 % dispersion coefficient.
0004 %
0005 % P.R. Jackson, USGS 11-17-10
0006 
0007 %% Define the processing steps
0008 extrp = 1;  %extrapolate profiles to the bed and water surface
0009 extend_to_banks = 1;  %extend data to shore
0010 shoretype = 'triangular';
0011 
0012 %% Extract the required data
0013 
0014 % Compute the starting and ending distances
0015 b = [nanmean(nanmean(V.mcsEast,2)) nanmean(nanmean(V.mcsNorth,2)) 0];  %vector with the mean flow components and zero vertical
0016 for zi = 1:z
0017     %Determine the starting banks
0018     
0019     a = [A(zi).Nav.totDistEast(end) A(zi).Nav.totDistNorth(end) 0];
0020     c = cross(a,b);
0021     if c(3) > 0
0022         left_start_bank(zi) = 1;
0023     elseif c(3) < 0
0024         left_start_bank(zi) = 0;
0025     else
0026         left_start_bank(zi) = nan;
0027     end
0028     
0029     %Get the shore distances  (define start shore as left shore looking DS)
0030     if left_start_bank(zi) == 1
0031         startSDist(zi) = A(zi).Q.startDist(1);
0032         endSDist(zi)   = A(zi).Q.endDist(1);
0033     elseif left_start_bank(zi) == 0
0034         startSDist(zi) = A(zi).Q.endDist(1);
0035         endSDist(zi)   = A(zi).Q.startDist(1);
0036     else
0037         errordlg('Starting Bank Cannot Be Determined')
0038     end
0039 end
0040 startDist = min(startSDist)  %Take the minimum distances because VMT uses the closest points to shore as a start and end
0041 endDist   = min(endSDist)
0042 
0043 % Check the starting and ending distance for zero values
0044 
0045 if startDist == 0 | endDist == 0;
0046     disp('Edge Distance of ZERO was detected--Manually enter distances in (m)')
0047     prompt = {'Start Distance (m)','End Distance (m)'};
0048     dlg_title = 'Edge Distances (manual)';
0049     num_lines = 1;
0050     def = {num2str(startDist),num2str(endDist)};
0051     answer = inputdlg(prompt,dlg_title,num_lines,def);
0052     [startDist, status1] = str2num(answer{1});
0053     [endDist, status2]   = str2num(answer{2});
0054 end
0055     
0056 
0057 % Define the input vectors
0058 beddepth  = V.mcsBed';
0059 travdist  = V.mcsDist(1,:)';
0060 vertdepth = V.mcsDepth(:,1);
0061 downstvel = V.vpSmooth'/100;  %old (uses the streawise velocity) V.uSmooth'/100;  % in m/s  Now uses the primary velocity ZSD definition  V.vpSmooth'/100
0062 
0063 %Remove edge nans (caused by interpolation near boundary)
0064 indx = find(~isnan(beddepth) & sum(isnan(downstvel),2) ~= length(vertdepth));
0065 addstart = travdist(indx(1));
0066 addend   = travdist(end) - travdist(indx(end));
0067 beddepth = beddepth(indx(1):indx(end));
0068 travdist = travdist(indx(1):indx(end));
0069 travdist = travdist - travdist(1);  %Resets zero at first point
0070 downstvel = downstvel(indx(1):indx(end),:);
0071 
0072 %Tack on extra to the edges to accoutn for the missing edge data
0073 startDist = startDist + addstart;
0074 endDist   = endDist + addend;
0075 
0076 %% Call the script to compute the dispersion coeficient
0077 [k,kc,Ey,Q] = ADCP_DispCoef(beddepth,travdist,vertdepth,downstvel,startDist,endDist,extrp,extend_to_banks,shoretype);
0078 
0079

Generated on Thu 21-Aug-2014 10:40:31 by m2html © 2005