Home > tidal_ellipse > cBEpm.m

cBEpm

PURPOSE ^

SYNOPSIS ^

function [BEp, BEm]=cBEpm(g, f, sigma, nu, kappa, z, h)

DESCRIPTION ^

Evaluate the theoretical vertical profiles (or Bottom Ekman spiral profiles) 
of tidal currents in the two rotary directions driven by half-unit of sea 
surface gradients in the two directions respectively. Eddy viscosity is 
assumed as vertically invariant. See tidal_ellipse.ps for more details.


inputs:

        g,  the gravity acceleration, 
        f,  the Coriolis parameter,   
       nu,  the eddy viscosity
     kappa, the bottom frictional coefficient
       z,   the vertical coordinates, can be a vector but must be
            within [0 -h];
       h,   the water depth, must be positive.

       Note: except for z, all other inputs must be scalars.

outputs:

   BEp and BEm, the same dimensions of z,  the outputs for the vertical 
                velocity profiles driven respectively by a unit of sea 
                surface slope in the positive rotation direction and negative
                rotation direction for when the eddy viscosity is vertically 
                invariant. See the associated  document for more details.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [BEp, BEm]=cBEpm(g, f, sigma, nu, kappa, z, h)
0002 %
0003 %Evaluate the theoretical vertical profiles (or Bottom Ekman spiral profiles)
0004 %of tidal currents in the two rotary directions driven by half-unit of sea
0005 %surface gradients in the two directions respectively. Eddy viscosity is
0006 %assumed as vertically invariant. See tidal_ellipse.ps for more details.
0007 %
0008 %
0009 %inputs:
0010 %
0011 %        g,  the gravity acceleration,
0012 %        f,  the Coriolis parameter,
0013 %       nu,  the eddy viscosity
0014 %     kappa, the bottom frictional coefficient
0015 %       z,   the vertical coordinates, can be a vector but must be
0016 %            within [0 -h];
0017 %       h,   the water depth, must be positive.
0018 %
0019 %       Note: except for z, all other inputs must be scalars.
0020 %
0021 %outputs:
0022 %
0023 %   BEp and BEm, the same dimensions of z,  the outputs for the vertical
0024 %                velocity profiles driven respectively by a unit of sea
0025 %                surface slope in the positive rotation direction and negative
0026 %                rotation direction for when the eddy viscosity is vertically
0027 %                invariant. See the associated  document for more details.
0028 
0029 if length(g)>1  | length(f)>1     | length(sigma)>1 | ...
0030    length(nu)>1 | length(kappa)>1 | length(h)>1
0031    error('inputs of g,f,sigma, nu, kappa, and h should be all scalars!')
0032 end
0033 
0034 if any(z/h>0) | any(z/h<-1)
0035    disp('z must be negative and must be within [0 -h]')
0036 end
0037 
0038 delta_e = sqrt(2*nu/f);  %Ekman depth
0039   alpha = (1+i)/delta_e*sqrt(1+sigma/f);
0040   beta  = (1+i)/delta_e*sqrt(1-sigma/f);
0041 
0042 BEp = get_BE(g, alpha, h, z, nu, kappa);
0043 BEm = get_BE(g, beta,  h, z,  nu, kappa);
0044 
0045 
0046 %subfunction
0047 %______________________________________________
0048 function   BE=get_BE(g, alpha, h, z, nu, kappa)
0049 
0050        z = z(:);      
0051      z_h = z/h;     
0052       ah = alpha*h;
0053       az = alpha*z;
0054      ah2 = ah*2;
0055    anu_k = alpha*nu/kappa;    
0056    nu_kh = nu/(kappa*h);
0057      
0058     if abs(ah) < 1    %series solution
0059      T = 10;
0060      C = -g*h*h/(nu*(1+anu_k*tanh_v5_2(ah)))*2;   
0061      A1 = (1-z_h.*z_h)/2+nu_kh;
0062      B1 = exp(-ah)/(1+exp(-ah2)); 
0063      B  = B1;
0064        series_sum=A1*B1;
0065 
0066      for t = 2:T;      
0067          t2=2*t;
0068          A = (1-z_h.^t2)./t2+nu_kh;   
0069          B = B*ah*ah/(t2-1)/(t2-2);
0070          series_sum = series_sum+A*B;
0071      end
0072 
0073       BE = C*series_sum;
0074 
0075      else             %finite solution
0076 
0077           c = -g*h*h/nu;
0078           denom=(exp(az-ah)+exp(-(az+ah)))./(1+exp(-2*ah)); 
0079                                  % =cosh(az)/cosh(ah);
0080                  %but this a better way to evaluate it.
0081 
0082       numer=1+anu_k*tanh_v5_2(ah);
0083      % BE=c*(1-denom/numer);
0084           BE = c*((1-denom/numer)/(ah*ah));
0085      end
0086          
0087 %end of subfunction
0088 %
0089 %Note tanh_v5_2 is a copy of tanh from Matlab v5.2, which has worked well!
0090 %It seems that Matlab v5.3 has some bug(s) in tanh function! It cannot deal
0091 %with large argument. try z=7.7249e02*(1+i), tanh(z) and tanh_v5_2(z) to
0092 %see the difference.
0093 
0094 %Authorship Copyright:
0095 %
0096 %    The author of this program retains the copyright of this program, while
0097 % you are welcome to use and distribute this program as long as you credit
0098 % the author properly and respect the program name itself. Particularly,
0099 % you are expected to retain the original author's name in this original
0100 % version of the program or any of its modified version that you might make.
0101 % You are also expected not to essentially change the name of the programs
0102 % except for adding possible extension for your own version you might create,
0103 % e.g. ap2ep_xx is acceptable.  Any suggestions are welcome and enjoying my
0104 % program(s)!
0105 %
0106 %
0107 %Author Info:
0108 %_______________________________________________________________________
0109 %  Zhigang Xu, Ph.D.
0110 %  (pronounced as Tsi Gahng Hsu)
0111 %  Research Scientist
0112 %  Coastal Circulation
0113 %  Bedford Institute of Oceanography
0114 %  1 Challenge Dr.
0115 %  P.O. Box 1006                    Phone  (902) 426-2307 (o)
0116 %  Dartmouth, Nova Scotia           Fax    (902) 426-7827
0117 %  CANADA B2Y 4A2                   email zhigangx@emerald.bio.dfo.ca
0118 %                                         zhigang_xu_98@yahoo.com
0119 %_______________________________________________________________________
0120 %
0121 %Release Date: Nov. 2000
0122

Generated on Wed 30-Nov-2005 15:40:57 by m2html © 2003