Home > wafo > spec > ohspec3.m

# ohspec3

## PURPOSE

Calculates Bimodal Ochi-Hubble spectral densities

## SYNOPSIS

[S, S1] = ohspec3(w,def,plotflag)

## DESCRIPTION

```  OHSPEC3 Calculates Bimodal Ochi-Hubble spectral densities
from mixed sea states

CALL:  [S S1] = ohspec3(w,def,plotflag);

S    = a struct containing the total spectral density
S1   = a 2D struct array containing the swell and wind generated
part of the spectral density
w    = angular frequency (default linspace(0,3,257))
def  = vector or a scalar containing numbers between 1 and 9.
1,2,3 : Swell dominated Sea state
4,5,6 : Wind sea dominated  Sea state
7,8,9 : Mixed wind-sea and swell systems with comparable energy.
plotflag = 0, do not plot the spectrum (default).
1, plot the  spectrum.

The OH spectrum is a six parameter spectrum.
Here 9 different parameterizations are defined representing
3 different type of sea states. Each of the of the 3 sea states are
parameterized with 3 different inter-modal distances. The exact parameters
are given below where the subscripts w = wind sea,  s = swell and
Hm0 = significant wave height, Tp = peak period,  L = spectral shape parameter

Target spectra parameters:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def     Hm0s    Hm0w     Tps     Tpw     Ls     Lw
ииииииииииииииииииииииииииииииииииииииииииииииииииии
1      5.5     3.5     14.3     9.1     3.0    6.5
2      6.5     2.0     14.3     6.7     3.5    4.0
3      5.5     3.5     22.2     6.5     3.0    6.0
4      2.0     6.5     14.3     9.1     3.0    6.5
5      2.0     6.5     14.3     6.7     4.0    3.5
6      2.0     6.5     22.2     6.5     2.0    7.0
7      4.1     5.0     14.3     9.1     2.1    2.5
8      4.1     5.0     14.3     6.7     2.1    2.5
9      4.1     5.0     22.2     6.5     2.1    2.5

Example: Create an array struct with all the parameterizations

S = ohspec3([],1:9);

## CROSS-REFERENCE INFORMATION

This function calls:
 ohspec Calculates (and plots) a Ochi-Hubble spectral density. ohspec3 Calculates Bimodal Ochi-Hubble spectral densities wspecplot Plot a spectral density hold Hold current graph. ishold Return hold state. linspace Linearly spaced vector. num2str Convert number to string. (Fast version)
This function is called by:
 ohspec3 Calculates Bimodal Ochi-Hubble spectral densities

## SOURCE CODE

```001 function [S, S1] = ohspec3ohspec3(w,def,plotflag)
002 % OHSPEC3 Calculates Bimodal Ochi-Hubble spectral densities
003 %         from mixed sea states
004 %
005 %  CALL:  [S S1] = ohspec3(w,def,plotflag);
006 %
007 %        S    = a struct containing the total spectral density
008 %        S1   = a 2D struct array containing the swell and wind generated
009 %               part of the spectral density
010 %        w    = angular frequency (default linspace(0,3,257))
011 %        def  = vector or a scalar containing numbers between 1 and 9.
012 %               1,2,3 : Swell dominated Sea state
013 %               4,5,6 : Wind sea dominated  Sea state
014 %               7,8,9 : Mixed wind-sea and swell systems with comparable energy.
015 %    plotflag = 0, do not plot the spectrum (default).
016 %               1, plot the  spectrum.
017 %
018 %  The OH spectrum is a six parameter spectrum.
019 %  Here 9 different parameterizations are defined representing
020 %  3 different type of sea states. Each of the of the 3 sea states are
021 %  parameterized with 3 different inter-modal distances. The exact parameters
022 %  are given below where the subscripts w = wind sea,  s = swell and
023 %  Hm0 = significant wave height, Tp = peak period,  L = spectral shape parameter
024 %
025 %             Target spectra parameters:
026 %    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
027 %   def     Hm0s    Hm0w     Tps     Tpw     Ls     Lw
028 %  ииииииииииииииииииииииииииииииииииииииииииииииииииии
029 %    1      5.5     3.5     14.3     9.1     3.0    6.5
030 %    2      6.5     2.0     14.3     6.7     3.5    4.0
031 %    3      5.5     3.5     22.2     6.5     3.0    6.0
032 %    4      2.0     6.5     14.3     9.1     3.0    6.5
033 %    5      2.0     6.5     14.3     6.7     4.0    3.5
034 %    6      2.0     6.5     22.2     6.5     2.0    7.0
035 %    7      4.1     5.0     14.3     9.1     2.1    2.5
036 %    8      4.1     5.0     14.3     6.7     2.1    2.5
037 %    9      4.1     5.0     22.2     6.5     2.1    2.5
038 %
039 % Example: Create an array struct with all the parameterizations
040 %
041 %     S = ohspec3([],1:9);
042 %
044
045 % References:
046 % Ochi, M.K. and Hubble, E.N. (1976)
047 % 'On six-parameter wave spectra.'
048 % In proc. 15th Conf. Coastal Engng.,1,pp301-328
049 %
050 % Rodriguez, G.R. and Soares, C.G. (2000)
051 % "Wave period distribution in mixed sea states"
052 % In proc. ETCE/OMAE2000 Joint Conference Energy for the new millenium.
053
054 % Tested on: matlab 5.2
055 % History:
056 % revised pab Apr2005
057 % fixed a bug: ohspec([],1:9,1) works correctly
058 % by pab 16.02.2000
059
060 monitor=0;
061
062 if nargin<3|isempty(plotflag)
063   plotflag=0;
064 end
065 if nargin<1|isempty(w)
066   w=linspace(0,3,257).';
067 end
068 if nargin<2|isempty(def)
069  def =1;
070 elseif length(def)>1
071   for ix=1:length(def),
072     [S(ix) S1(ix,1:2)]=ohspec3(w,def(ix));
073   end %
074   if plotflag
075      wspecplot(S,plotflag)
076   end
077   return
078 end
079
080 switch def
081   % Swell dominated sea states
082   case 1, Hm0i=[5.5 3.5]; Tpi=1./[0.07 0.11];Li=[3   6.5];
083   case 2, Hm0i=[6.5 2.0]; Tpi=1./[0.07 0.15];Li=[3.5 4];
084   case 3, Hm0i=[5.5 3.5]; Tpi=1./[0.045 0.155];Li=[3 6];
085     % Wind dominated sea states
086   case 4, Hm0i=[2 6.5]; Tpi=1./[0.07 0.11];Li=[3 6.5];
087   case 5, Hm0i=[2 6.5]; Tpi=1./[0.07 0.15];Li=[4 3.5];
088   case 6, Hm0i=[2 6.5]; Tpi=1./[0.045 0.155];Li=[2 7];
089     % Mixed Wind sea and swell systems with comparable energy
090   case 7, Hm0i=[4.1 5]; Tpi=1./[0.07 0.11];Li=[2.1 2.5];
091   case 8, Hm0i=[4.1 5]; Tpi=1./[0.07 0.15];Li=[2.1 2.5];
092   case 9, Hm0i=[4.1 5]; Tpi=1./[0.045 0.155];Li=[2.1 2.5];
093   otherwise
094     Hm0i=[5.5 3.5]; Tpi=1./[0.07 0.11];Li=[3   6.5];
095     def=1;
096 end
097
098 if 0, % the following make Hm0 the same for all the cases
099
100   switch def
101     % Swell dominated sea states
102   case 1, Hm0i=[5.5 3.5]*0.99184053150473; Tpi=1./[0.07 0.11];Li=[3   6.5];
103   case 2, Hm0i=[6.5 2.0]*0.95078090199753; Tpi=1./[0.07 0.15];Li=[3.5 4];
104   case 3, Hm0i=[5.5 3.5]*0.99184046072521; Tpi=1./[0.045 0.155];Li=[3 6];
105     % Wind dominated sea states
106   case 4, Hm0i=[2 6.5]*0.95078087556934; Tpi=1./[0.07 0.11];Li=[3 6.5];
107   case 5, Hm0i=[2 6.5]*0.95078087556934; Tpi=1./[0.07 0.15];Li=[4 3.5];
108   case 6, Hm0i=[2 6.5]*0.95078087556934; Tpi=1./[0.045 0.155];Li=[2 7];
109   end
110 end
111
112
113 for ix=1:2,
114   S1(ix)=ohspec(w,[Hm0i(ix), Tpi(ix),Li(ix)]);
115 end
116 S=S1(1);
117 S.S=S1(1).S+S1(2).S;
118
119 %S.note=['Ochi-Hubble3, Hm0 = ' num2str(Hm0i)  ', Tp = ' num2str(Tpi) , ' L = ' num2str(Li)];
120 S.note=['Ochi-Hubble3, def = ' num2str(def) ];
121 if monitor
122   disp(['Hm0, Tp      = ' num2str([Hm0i Tpi])])
123 end
124
125 if plotflag
126   ih=ishold;
127   wspecplot(S,plotflag)
128   hold on
129   wspecplot(S1,plotflag,'k--')
130   if ~ih,hold off,end
131 end
132```

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