TMASPEC Calculates a JONSWAP spectral density for finite water depth CALL: S = tmaspec(w,data,h,plotflag); S = tmaspec(wc,data,h,plotflag); S = a struct containing the spectral density See datastructures w = angular frequency (default linspace(0,33/Tp,257)) wc = angular cutoff frequency (default 33/Tp) data = [Hm0 Tp gamma sa sb A], where Hm0 = significant wave height (default 7 (m)) Tp = peak period (default 11 (sec)) gamma = peakedness factor determines the concentraton of the spectrum on the peak frequency, 1 <= gamma <= 7. (default depending on Hm0, Tp, see below) sa,sb = spectral width parameters (default 0.07 0.09) A = alpha, normalization factor, (default -1) A<0 : A calculated by integration so that int S dw =Hm0^2/16 A==0: A = 5.061*Hm0^2/Tp^4*(1-0.287*log(gamma)) A>0 : A = A h = waterdepth (default 42) plotflag = 0, do not plot the spectrum (default). 1, plot the spectrum. For zero values, NaN's or parameters not specified in DATA the default values are used. The evaluated spectrum is S(w) = Sj(w)*phi(w,h) where Sj = jonswap spectrum phi = modification due to water depth The concept is base on a similarity law, and its validity is verified through analysis of 3 data sets from: TEXEL, MARSEN projects (North Sea) and ARSLOE project (Duck, North Carolina, USA) Example: S = tmaspec([],[0 0 1]) % Bretschneider spectrum Hm0=7, Tp=11 S = tmaspec(1.5,[0 0 1]) % The same, cut at wc = 1.5 See also jonswap, phi1, pmspec, torsethaugen
returns the constant acceleration of gravity | |
Calculates (and plots) a JONSWAP spectral density | |
Translates from frequency to wave number | |
Linearly spaced vector. | |
Convert number to string. (Fast version) |
001 function S1=tmaspec(w1,sdata,h,plotflag) 002 %TMASPEC Calculates a JONSWAP spectral density for finite water depth 003 % 004 % CALL: S = tmaspec(w,data,h,plotflag); 005 % S = tmaspec(wc,data,h,plotflag); 006 % 007 % S = a struct containing the spectral density See datastructures 008 % w = angular frequency (default linspace(0,33/Tp,257)) 009 % wc = angular cutoff frequency (default 33/Tp) 010 % data = [Hm0 Tp gamma sa sb A], where 011 % Hm0 = significant wave height (default 7 (m)) 012 % Tp = peak period (default 11 (sec)) 013 % gamma = peakedness factor determines the concentraton 014 % of the spectrum on the peak frequency, 1 <= gamma <= 7. 015 % (default depending on Hm0, Tp, see below) 016 % sa,sb = spectral width parameters (default 0.07 0.09) 017 % A = alpha, normalization factor, (default -1) 018 % A<0 : A calculated by integration so that int S dw =Hm0^2/16 019 % A==0: A = 5.061*Hm0^2/Tp^4*(1-0.287*log(gamma)) 020 % A>0 : A = A 021 % h = waterdepth (default 42) 022 % plotflag = 0, do not plot the spectrum (default). 023 % 1, plot the spectrum. 024 % 025 % For zero values, NaN's or parameters not specified in DATA the 026 % default values are used. 027 % 028 % The evaluated spectrum is 029 % S(w) = Sj(w)*phi(w,h) 030 % where 031 % Sj = jonswap spectrum 032 % phi = modification due to water depth 033 % 034 % The concept is base on a similarity law, and its validity is verified 035 % through analysis of 3 data sets from: TEXEL, MARSEN projects (North 036 % Sea) and ARSLOE project (Duck, North Carolina, USA) 037 % 038 % Example: 039 % S = tmaspec([],[0 0 1]) % Bretschneider spectrum Hm0=7, Tp=11 040 % S = tmaspec(1.5,[0 0 1]) % The same, cut at wc = 1.5 041 % 042 % See also jonswap, phi1, pmspec, torsethaugen 043 044 % References: 045 % Buows, E., Gunther, H., Rosenthal, W., and Vincent, C.L. (1985) 046 % 'Similarity of the wind wave spectrum in finite depth water: 1 spectral form.' 047 % J. Geophys. Res., Vol 90, No. C1, pp 975-986 048 % 049 % Hasselman et al. (1973) 050 % Measurements of Wind-Wave Growth and Swell Decay during the Joint 051 % North Sea Project (JONSWAP). 052 % Ergansungsheft, Reihe A(8), Nr. 12, deutschen Hydrografischen 053 % Zeitschrift. 054 055 % Tested on: matlab 6.0, 5.2 056 % History: 057 % revised jr 03.04.2001 058 % - added wc to input 059 % - updated information 060 % revised pab 22.09.2000, corrected water depth, i.e. changed 061 % S1.h=inf to S1.h=h 062 % revised es 25.05.00 - some modifications to help text 063 % by pab 16.02.2000 064 065 066 %NOTE: In order to calculate the short term statistics of the response, 067 % it is extremely important that the resolution of the transfer 068 % function is sufficiently good. In addition, the transfer function 069 % must cover a sufficietn range of wave periods, especially in the 070 % range where the wave spectrum contains most of its 071 % energy. VIOLATION OF THIS MAY LEAD TO MEANINGLESS RESULTS FROM THE 072 % CALCULATIONS OF SHORT TERM STATISTICS. The highest wave period 073 % should therefore be at least 2.5 to 3 times the highest peak 074 % period in the transfer function. The lowest period should be selected 075 % so that the transfer function value is low. This low range is 076 % especially important when studying velocities and accelerations. 077 078 monitor=0; 079 080 if nargin<4|isempty(plotflag) 081 plotflag=0; 082 end 083 if nargin<3|isempty(h) 084 h=42; 085 end 086 087 088 089 Hm0=7;Tp=11; gam=0; sa=0.07; sb=0.09; A=-1;% default values 090 data2=[Hm0 Tp gam sa sb A]; 091 nd2=length(data2); 092 if (nargin>1) & ~isempty(sdata), 093 nd=length(sdata); 094 ind=find(~isnan(sdata(1:min(nd,nd2)))); 095 if any(ind) % replace default values with those from input data 096 data2(ind)=sdata(ind); 097 end 098 end 099 if (nd2>0) & (data2(1)>0), Hm0 = data2(1);end 100 if (nd2>1) & (data2(2)>0), Tp = data2(2);end 101 if (nd2>2) & (data2(3)>=1) & (data2(3)<=7), gam = data2(3);end 102 if (nd2>3) & (data2(4)>0), sa = data2(4);end 103 if (nd2>4) & (data2(5)>0), sb = data2(5);end 104 if (nd2>5) , A = data2(6);end 105 w = []; 106 if nargin<1|isempty(w1), wc = 33/Tp; 107 elseif length(w1)==1, wc = w1; 108 else w = w1 ; end 109 nw = 257; 110 if isempty(w), w = linspace(0,wc,nw).'; end 111 112 % Old call 113 %if nargin<1|isempty(w) 114 % w=linspace(0,33/Tp,257).'; 115 %end 116 117 S1=jonswap(w,data2); 118 S1.h=h; 119 S1.norm=0; % The spectrum is not normalized 120 S1.note=['TMASPEC, Hm0 = ' num2str(Hm0) ', Tp = ' num2str(Tp) ,', h = ' num2str(h)]; 121 S1.S=S1.S.*phi1(S1.w,h); 122 123 return 124 125 126 127 128 129 130 131 function ph=phi1(w,h) 132 %PHI1 factor for transforming spectra to finite water depth spectra 133 % 134 % CALL: tr = phi1(w,h) 135 % 136 % w = angular frequency 137 % h = water depth 138 % 139 % Example: Transform a JONSWAP spectrum to a spectrum for waterdepth = 30 m 140 % S = jonswap; 141 % S1=S; S1.S=S1.S.*phi1(S1.w,30); 142 143 % reference 144 % Buows, E., Gunther, H., Rosenthal, W. and Vincent, C.L. (1985) 145 % 'Similarity of the wind wave spectrum in finite depth water: 1 spectral form.' 146 % J. Geophys. Res., Vol 90, No. C1, pp 975-986 147 148 % History: 149 % by pab 16.02.2000 150 g=gravity; 151 if h==inf, 152 ph=ones(size(w)); 153 return 154 end 155 ph=zeros(size(w)); 156 157 k1=w2k(w,0,inf); 158 dw1=2*w/g; % dw/dk|h=inf 159 k2=w2k(w,0,h); 160 161 dw2=ph; 162 ix=find(k1~=0); 163 164 dw2(ix)=dw1(ix)./(tanh(k2(ix)*h)+k2(ix)*h./cosh(k2(ix)*h).^2); % % dw/dk|h=h0 165 ph(ix)=(k1(ix)./k2(ix)).^3.*dw2(ix)./dw1(ix); 166 167 168 169
Comments or corrections to the WAFO group