Home > wafo > spec > pmspec.m

pmspec

PURPOSE ^

Calculates (and plots) a Pierson-Moskowitz spectral density.

SYNOPSIS ^

S1=pmspec(w1,sdata,plotflag)

DESCRIPTION ^

 PMSPEC Calculates (and plots) a Pierson-Moskowitz spectral density.
  
  CALL:  S = pmspec(w,data,plotflag); 
         S = pmspec(wc,data,plotflag);
  
         S    = a struct containing the spectral density, see datastructures.
         w    = angular frequency (default linspace(0,wc,257))
         wc   = angular cutoff frequency (default 32/Tp)
         data = [Hm0 Tp]
                Hm0 = significant wave height (default 7 (m))
                Tp  = peak period (default 11 (sec))
     plotflag = 0, do not plot the spectrum (default).
                1, plot the spectrum.
 
   PMSPEC return the Pierson-Moskowitz spectral density:
 
      S(w) = 5*Hm0^2/(wp*wn^5)*exp(-5/4*wn^-4)
  where
      wp = 2*pi/Tp   and    wn = w/wp 
 
   This is a suitable model for fully developed sea, i.e. a sea state
   where the wind has been blowing long enough over a sufficiently open
   stretch of water, so that the high-frequency waves have reached an
   equilibrium. In the part of the spectrum where the frequency is
   greater than the peak frequency (w>wp), the energy distribution is
   proportional to w^-5.
   The spectrum is identical with ITTC (International Towing Tank 
   Conference), ISSC (International Ship and Offshore Structures Congress) 
   and Bretschneider, wave spectrum given Hm0 and Tm01. It is also identical
   with JONSWAP when the peakedness factor, gamma, is one.
   For this spectrum, the following relations exist between the mean
   period Tm01 = 2*pi*m0/m1, the peak period Tp and the mean
   zero-upcrossing period Tz:
 
            Tm01 = 1.086*Tz, Tp = 1.408*Tz and Tp=1.2965*Tm01
 
 
  Example: S = pmspec(1.5,[6.5 10]); wspecplot(S)
 
  See also  jonswap, torsethaugen, simpson

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function S1=pmspec(w1,sdata,plotflag)
002 %PMSPEC Calculates (and plots) a Pierson-Moskowitz spectral density.
003 % 
004 % CALL:  S = pmspec(w,data,plotflag); 
005 %        S = pmspec(wc,data,plotflag);
006 % 
007 %        S    = a struct containing the spectral density, see datastructures.
008 %        w    = angular frequency (default linspace(0,wc,257))
009 %        wc   = angular cutoff frequency (default 32/Tp)
010 %        data = [Hm0 Tp]
011 %               Hm0 = significant wave height (default 7 (m))
012 %               Tp  = peak period (default 11 (sec))
013 %    plotflag = 0, do not plot the spectrum (default).
014 %               1, plot the spectrum.
015 %
016 %  PMSPEC return the Pierson-Moskowitz spectral density:
017 %
018 %     S(w) = 5*Hm0^2/(wp*wn^5)*exp(-5/4*wn^-4)
019 % where
020 %     wp = 2*pi/Tp   and    wn = w/wp 
021 %
022 %  This is a suitable model for fully developed sea, i.e. a sea state
023 %  where the wind has been blowing long enough over a sufficiently open
024 %  stretch of water, so that the high-frequency waves have reached an
025 %  equilibrium. In the part of the spectrum where the frequency is
026 %  greater than the peak frequency (w>wp), the energy distribution is
027 %  proportional to w^-5.
028 %  The spectrum is identical with ITTC (International Towing Tank 
029 %  Conference), ISSC (International Ship and Offshore Structures Congress) 
030 %  and Bretschneider, wave spectrum given Hm0 and Tm01. It is also identical
031 %  with JONSWAP when the peakedness factor, gamma, is one.
032 %  For this spectrum, the following relations exist between the mean
033 %  period Tm01 = 2*pi*m0/m1, the peak period Tp and the mean
034 %  zero-upcrossing period Tz:
035 %
036 %           Tm01 = 1.086*Tz, Tp = 1.408*Tz and Tp=1.2965*Tm01
037 %
038 %
039 % Example: S = pmspec(1.5,[6.5 10]); wspecplot(S)
040 %
041 % See also  jonswap, torsethaugen, simpson
042 
043 % References:
044 %
045 
046 % Tested on: matlab 6.0, 5.3
047 % History:
048 % Revised pab April 2005
049 % -Changed parameterization to a generalized gamma formulation
050 % Revised pab 20.10.2001
051 % - initialized w to avoid Reference to uninitialized variable.
052 % - updated help header
053 % Revised by jr 03.04.2001
054 % - added wc to input
055 % - updated information
056 % By pab 01.12.99
057 
058 monitor=0;
059 w = [];
060 if nargin<3|isempty(plotflag)
061   plotflag=0;
062 end
063 if nargin<2|isempty(sdata)
064   sdata=[7 11];
065 end %
066 
067 if nargin<1|isempty(w1), 
068    wc = 32/sdata(2);
069 elseif length(w1)==1,
070    wc = w1; 
071 else
072    w = w1 ;
073 end
074 nw = 257;
075 if isempty(w),
076    w = linspace(0,wc,nw).'; 
077 end
078 
079 
080 n    = length(w);
081 S1   = createspec;
082 S1.S = zeros(n,1);
083 S1.w = w;
084 S1.norm=0; % The spectrum is not normalized
085 
086 
087 Hm0 = sdata(1);
088 if 0,
089   Tm01    = sdata(2);
090   Tp      = 1.2965*Tm01;
091   S1.note = sprintf('Pierson-Moskowitz, Hm0 = %g, Tm01 = %g', Hm0,Tm01);
092 else
093   Tp      = sdata(2);
094   S1.note = sprintf('Pierson-Moskowitz, Hm0 = %g, Tp = %g', Hm0,Tp);
095 end
096 
097 
098 if monitor
099   disp(S1.note)
100 end
101 
102 
103 if Hm0>0
104   % for w>0 % avoid division by zero
105   k = find(w>0);
106   if any(k)
107     if 0,% Old call kept just in case
108       Tm01 = Tp/1.2965;
109       w1   = 2*pi/Tm01;
110       S1.S(k)=0.11*Hm0^2*w1^4./(w(k).^5).*exp(-.44*(w1./w(k)).^4);
111     else
112       N = 5;
113       M = 4;
114       wp = 2*pi/Tp;
115       wn = w/wp;
116       B  = (N-1)/M;
117       G0 = (N/M).^(B)*(M/gamma(B)); % Normalizing factor related to Pierson-Moskovitz form
118       G1 = (Hm0/4)^2/wp*G0; % [m^2 s]
119       S1.S(k) = G1.*wn(k).^(-N).*exp(-(N/M)*wn(k).^(-M));
120     end
121   end
122 end
123 
124 
125 if plotflag
126   wspecplot(S1,plotflag)
127 end
128

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003