Wave spectra
- ffpack.lsm.waveSpectra.gaussianSwellSpectrum(w, wp, Hs, sigma)
Gaussian Swell spectrum, typically used to model long period swell seas [Guidance2016A].
- Parameters
w (scalar) – Wave frequency.
wp (scalar) – Peak wave frequency.
Hs (scalar) – Significant wave height.
sigma (scalar) – peakedness parameter for Gaussian spectral width.
- Returns
rst – The wave spectrum density value at wave frequency w.
- Return type
scalar
- Raises
ValueError – If w is not a scalar. If wp is not a scalar. If Hs is not a scalar. If sigma is not a scalar.
Examples
>>> from ffpack.lsm import gaussianSwellSpectrum >>> w = 0.02 >>> wp = 0.51 >>> Hs = 20 >>> sigma = 0.07 >>> rst = gaussianSwellSpectrum( w, wp, Hs, sigma )
References
- Guidance2016A
Guidance Notes on Selecting Design Wave by Long Term Stochastic Method
- ffpack.lsm.waveSpectra.isscSpectrum(w, wp, Hs)
ISSC spectrum, also known as Bretschneider or modified Pierson-Moskowitz.
- Parameters
w (scalar) – Wave frequency.
wp (scalar) – Peak wave frequency.
Hs (scalar) – Significant wave height.
- Returns
rst – The wave spectrum density value at wave frequency w.
- Return type
scalar
- Raises
ValueError – If w is not a scalar. If wp is not a scalar. If Hs is not a scalar.
Examples
>>> from ffpack.lsm import isscSpectrum >>> w = 0.02 >>> wp = 0.51 >>> Hs = 20 >>> rst = isscSpectrum( w, wp, Hs )
- ffpack.lsm.waveSpectra.jonswapSpectrum(w, wp, alpha=0.0081, beta=1.25, gamma=3.3, g=9.81)
JONSWAP (Joint North Sea Wave Project) spectrum is an empirical relationship that defines the distribution of energy with frequency within the ocean.
- Parameters
w (scalar) – Wave frequency.
wp (scalar) – Peak wave frequency.
alpha (scalar, optional) – Intensity of the Spectra.
beta (scalar, optional) – Shape factor, fixed value 1.25.
gamma (scalar, optional) – Peak enhancement factor.
g (scalar, optional) – Acceleration due to gravity, a constant. 9.81 m/s2 in SI units.
- Returns
rst – The wave spectrum density value at wave frequency w.
- Return type
scalar
- Raises
ValueError – If w is not a scalar. If wp is not a scalar.
Examples
>>> from ffpack.lsm import jonswapSpectrum >>> w = 0.02 >>> wp = 0.51 >>> rst = jonswapSpectrum( w, wp, alpha=0.0081, beta=1.25, gamma=3.3, g=9.81 )
- ffpack.lsm.waveSpectra.ochiHubbleSpectrum(w, wp1, wp2, Hs1, Hs2, lambda1, lambda2)
Ochi-Hubble spectrum covers shapes of wave spectra associated with the growth and decay of a storm, including swells. [Guidance2016B].
- Parameters
w (scalar) – Wave frequency.
wp1 (scalar) – Peak wave frequency.
wp2 (scalar) – Peak wave frequency.
Hs1 (scalar) – Significant wave height.
Hs2 (scalar) – Significant wave height.
lambda1 (scalar) –
lambda2 (scalar) –
- Returns
rst – The wave spectrum density value at wave frequency w.
- Return type
scalar
- Raises
ValueError – If w is not a scalar. If wp1 or wp2 is not a scalar. If Hs1 or Hs2 is not a scalar. If lambda1 or lambda2 is not a scalar. If wp1 is not smaller than wp2.
Notes
Hs1 should normally be greater than Hs2 since most of the wave energy tends to be associated with the lower frequency component.
Examples
>>> from ffpack.lsm import ochiHubbleSpectrum >>> w = 0.02 >>> wp1 = 0.4 >>> wp2 = 0.51 >>> Hs1 = 20 >>> Hs2 = 15 >>> lambda1 = 7 >>> lambda2 = 10 >>> rst = ochiHubbleSpectrum( w, wp1, wp2, Hs1, Hs2, lambda1, lambda2 )
References
- Guidance2016B
Guidance Notes on Selecting Design Wave by Long Term Stochastic Method
- ffpack.lsm.waveSpectra.piersonMoskowitzSpectrum(w, Uw, alpha=0.0081, beta=0.74, g=9.81)
Pierson Moskowitz spectrum is an empirical relationship that defines the distribution of energy with frequency within the ocean.
- Parameters
w (scalar) – Wave frequency.
Uw (scalar) – Wind speed at a height of 19.5m above the sea surface.
alpha (scalar, optional) – Intensity of the Spectra.
beta (scalar, optional) – Shape factor.
g (scalar, optional) – Acceleration due to gravity, a constant. 9.81 m/s2 in SI units.
- Returns
rst – The wave spectrum density value at wave frequency w.
- Return type
scalar
- Raises
ValueError – If w is not a scalar. If wp is not a scalar.
Examples
>>> from ffpack.lsm import piersonMoskowitzSpectrum >>> w = 0.51 >>> Uw = 20 >>> rst = piersonMoskowitzSpectrum( w, Uw, alpha=0.0081, ... beta=1.25, g=9.81 )
Wind spectra
- ffpack.lsm.windSpectra.apiSpectrum(f, u0, z=10)
API spectrum is implemented according to [API2007].
- Parameters
f (scalar) – Frequency ( Hz ).
u0 (scalar) – 1 hour mean wind speed ( m/s ) at 10 m above sea level.
- Returns
rst – Power spectrum density ( m^2 s^-2 Hz^-1 ).
- Return type
scalar
- Raises
ValueError – If n is not a scalar. If uz is not a scalar.
Examples
>>> from ffpack.lsm import apiSpectrum >>> f = 2 >>> u0 = 10 >>> rst = apiSpectrum( f, u0 )
References
- API2007
API, 2007. Recommended practice 2A-WSD (RP 2A-WSD): Recommnded practice for planning, designing and constructing fixed offshore platforms - working stress design.
- ffpack.lsm.windSpectra.davenportSpectrumWithDragCoef(n, delta1, kappa=0.005, normalized=True)
Davenport spectrum in the original paper by Davenport [Davenport1961].
- Parameters
n (scalar) – Frequency ( Hz ) when normalized=False. Normalized frequency when normalized=True.
delta1 (scalar) – Velocity ( m/s ) at standard reference height of 10 m.
kappa (scalar, optional) – Drag coefficient referred to mean velocity at 10 m. Default value 0.005 corresponding to open unobstructed country [Davenport1961]. The recommended value for heavilly built-up urban centers with tall buildings is 0.05. The recommended value for country broken by low clustered obstructions is between 0.015 and 0.02.
normalized (bool, optional) – If normalized is set to False, the power spectrum density will be returned.
- Returns
rst – Power spectrum density ( m^2 s^-2 Hz^-1 ) when normalized=False. Normalized power spectrum density when normalized=True.
- Return type
scalar
- Raises
ValueError – If n is not a scalar. If delta1 is not a scalar.
Examples
>>> from ffpack.lsm import davenportSpectrumWithDragCoef >>> n = 2 >>> delta1 = 10 >>> rst = davenportSpectrumWithDragCoef( n, delta1, kappa=0.005, ... normalized=True )
References
- ffpack.lsm.windSpectra.davenportSpectrumWithRoughnessLength(n, uz, z=10, z0=0.03, normalized=True)
Davenport spectrum in the paper by Hiriart et al. [Hiriart2001].
- Parameters
n (scalar) – Frequency ( Hz ) when normalized=False. Normalized frequency when normalized=True.
uz (scalar) – Mean wind speed ( m/s ) measured at height z.
z (scalar, optional) – Height above the ground ( m ), default to 10 m.
z0 (scalar, optional) – Roughness length ( m ), default to 0.03 m corresponding to open exposure case in [Ho2003].
normalized (bool, optional) – If normalized is set to False, the power spectrum density will be returned.
- Returns
rst – Power spectrum density ( m^2 s^-2 Hz^-1 ) when normalized=False. Normalized power spectrum density when normalized=True.
- Return type
scalar
- Raises
ValueError – If n is not a scalar. If uz is not a scalar.
Examples
>>> from ffpack.lsm import davenportSpectrumWithRoughnessLength >>> n = 2 >>> uz = 10 >>> rst = davenportSpectrumWithRoughnessLength( n, uz, z=10, z0=0.03, ... normalized=True )
References
- Hiriart2001
Hiriart, D., Ochoa, J.L. and Garcia, B., 2001. Wind power spectrum measured at the San Pedro Mártir Sierra. Revista Mexicana de Astronomia y Astrofisica, 37(2), pp.213-220.
- Ho2003
Ho, T.C.E., Surry, D. and Morrish, D.P., 2003. NIST/TTU cooperative agreement-windstorm mitigation initiative: Wind tunnel experiments on generic low buildings. London, Canada: BLWTSS20-2003, Boundary-Layer Wind Tunnel Laboratory, Univ. of Western Ontario.
- ffpack.lsm.windSpectra.ec1Spectrum(n, uz, sigma=0.03, z=10, tcat=0, normalized=True)
EC1 spectrum is implemented according to Annex B [EN1991-1-42005].
- Parameters
n (scalar) – Frequency ( Hz ) when normalized=False. Normalized frequency when normalized=True.
uz (scalar) – Mean wind speed ( m/s ) measured at height z.
sigma (scalar, optional) – Standard derivation of wind.
z (scalar, optional) – Height above the ground ( m ), default to 10 m.
tcat (scalar, optional) – Terrain category, could be 0, 1, 2, 3, 4 Default to 0 (sea or coastal area exposed to the open sea) in EC1 Table 4.1.
normalized (bool, optional) – If normalized is set to False, the power spectrum density will be returned.
- Returns
rst – Power spectrum density ( m^2 s^-2 Hz^-1 ) when normalized=False. Normalized power spectrum density when normalized=True.
- Return type
scalar
- Raises
ValueError – If n is not a scalar. If uz is not a scalar. If tcat is not int or not within range of 0 to 4
Examples
>>> from ffpack.lsm import ec1Spectrum >>> n = 2 >>> uz = 10 >>> rst = ec1Spectrum( n, uz, sigma=0.03, z=10, tcat=0, normalized=True )
References
- EN1991-1-42005
EN1991-1-4, 2005. Eurocode 1: Actions on structures.
- ffpack.lsm.windSpectra.iecSpectrum(f, vhub, sigma=0.03, z=10, k=1, normalized=True)
IEC spectrum is implemented according to [IEC2005].
- Parameters
f (scalar) – Frequency ( Hz ) when normalized=False. Normalized frequency when normalized=True.
vhub (scalar) – Mean wind speed ( m/s ).
sigma (scalar, optional) – Standard derivation of the turblent wind speed component.
z (scalar, optional) – Height above the ground ( m ), default to 10 m.
k (scalar, optional) – Wind speed direction, could be 1, 2, 3 ( 1 = longitudinal, 2 = lateral, and 3 = upward ) Default to 1 (longitudinal).
normalized (bool, optional) – If normalized is set to False, the power spectrum density will be returned.
- Returns
rst – Single-sided velocity component power spectrum density ( m^2 s^-2 Hz^-1 ) when normalized=False. Normalized single-sided velocity component power spectrum density when normalized=True.
- Return type
scalar
- Raises
ValueError – If n is not a scalar. If uz is not a scalar. If k is not int or not within range of 1 to 3
Examples
>>> from ffpack.lsm import iecSpectrum >>> n = 2 >>> vhub = 10 >>> rst = iecSpectrum( n, vhub, sigma=0.03, z=10, k=1, normalized=True )
References
- IEC2005
IEC, 2005. IEC 61400-1, Wind turbines - Part 1: Design requirements.
Sequence spectra
- ffpack.lsm.sequenceSpectra.periodogramSpectrum(data, fs)
Power spectral density with scipy.signal.periodogram.
- Parameters
data (1darray) – Sequence to calculate power spectral density.
fs (scalar) – Sampling frequency.
- Returns
freq (1darray) – frequency components.
psd (1darray) – Power spectral density.
- Raises
ValueError – If data is not a 1darray. If fs is not a scalar.
Examples
>>> from ffpack.lsm import periodogramSpectrum >>> data = [ 2, 5, 3, 6, 2, 4, 1, 6, 1, 3, 1, 5, 3, 6, 3, 6, 4, 5, 2 ] >>> fs = 2 >>> freq, psd = periodogramSpectrum( data, fs )
- ffpack.lsm.sequenceSpectra.welchSpectrum(data, fs, nperseg=1024)
Power spectral density with scipy.signal.welch.
- Parameters
data (1darray) – Sequence to calculate power spectral density.
fs (scalar) – Sampling frequency.
nperseg (scalar) – Length of each segment. Defaults to 1024.
- Returns
freq (1darray) – frequency components.
psd (1darray) – Power spectral density.
- Raises
ValueError – If data is not a 1darray. If fs is not a scalar.
Examples
>>> from ffpack.lsm import welchSpectrum >>> data = [ 2, 5, 3, 6, 2, 4, 1, 6, 1, 3, 1, 5, 3, 6, 3, 6, 4, 5, 2 ] >>> fs = 2 >>> freq, psd = welchSpectrum( data, fs, nperseg=1024 )
Cycle counting matrix
- ffpack.lsm.cycleCountingMatrix.astmRainflowCountingMatrix(data, resolution=0.5)
Calculate ASTM rainflow counting matrix.
- Parameters
data (1d array) – Sequence data to calculate rainflow counting matrix.
resolution (bool, optional) – The desired resolution to round the data points.
- Returns
rst (2d array) – A matrix contains the counting results.
matrixIndexKey (1d array) – A sorted array contains the index keys for the counting matrix.
- Raises
ValueError – If the data dimension is not 1. If the data length is less than 2.
Notes
The default round function will round half to even: 1.5, 2.5 => 2.0:
Examples
>>> from ffpack.lsm import astmRainflowCountingMatrix >>> data = [ -2.0, 1.0, -3.0, 5.0, -1.0, 3.0, -4.0, 4.0, -2.0 ] >>> rst, matrixIndexKey = astmRainflowCountingMatrix( data )
- ffpack.lsm.cycleCountingMatrix.astmRainflowRepeatHistoryCountingMatrix(data, resolution=0.5)
Calculate ASTM simplified rainflow counting matrix for repeating histories.
- Parameters
data (1d array) – Sequence data to calculate simplified rainflow counting matrix for repeating histories.
resolution (bool, optional) – The desired resolution to round the data points.
- Returns
rst (2d array) – A matrix contains the counting results.
matrixIndexKey (1d array) – A sorted array contains the index keys for the counting matrix.
- Raises
ValueError – If the data dimension is not 1. If the data length is less than 2.
Notes
The default round function will round half to even: 1.5, 2.5 => 2.0:
Examples
>>> from ffpack.lsm import astmRainflowRepeatHistoryCountingMatrix >>> data = [ -2.0, 1.0, -3.0, 5.0, -1.0, 3.0, -4.0, 4.0, -2.0 ] >>> rst, matrixIndexKey = astmRainflowRepeatHistoryCountingMatrix( data )
- ffpack.lsm.cycleCountingMatrix.astmRangePairCountingMatrix(data, resolution=0.5)
Calculate ASTM range pair counting matrix.
- Parameters
data (1d array) – Sequence data to calculate range pair counting matrix.
resolution (bool, optional) – The desired resolution to round the data points.
- Returns
rst (2d array) – A matrix contains the counting results.
matrixIndexKey (1d array) – A sorted array contains the index keys for the counting matrix.
- Raises
ValueError – If the data dimension is not 1. If the data length is less than 2.
Notes
The default round function will round half to even: 1.5, 2.5 => 2.0:
Examples
>>> from ffpack.lsm import astmRangePairCountingMatrix >>> data = [ -2.0, 1.0, -3.0, 5.0, -1.0, 3.0, -4.0, 4.0, -2.0 ] >>> rst, matrixIndexKey = astmRangePairCountingMatrix( data )
- ffpack.lsm.cycleCountingMatrix.astmSimpleRangeCountingMatrix(data, resolution=0.5)
Calculate ASTM simple range counting matrix.
- Parameters
data (1d array) – Sequence data to calculate range counting matrix.
resolution (bool, optional) – The desired resolution to round the data points.
- Returns
rst (2d array) – A matrix contains the counting results.
matrixIndexKey (1d array) – A sorted array contains the index keys for the counting matrix.
- Raises
ValueError – If the data dimension is not 1. If the data length is less than 2.
Notes
The default round function will round half to even: 1.5, 2.5 => 2.0.
Examples
>>> from ffpack.lsm import astmSimpleRangeCountingMatrix >>> data = [ -2.0, 1.0, -3.0, 5.0, -1.0, 3.0, -4.0, 4.0, -2.0 ] >>> rst, matrixIndexKey = astmSimpleRangeCountingMatrix( data )
- ffpack.lsm.cycleCountingMatrix.fourPointCountingMatrix(data, resolution=0.5)
Calculate Four point cycle counting matrix.
- Parameters
data (1d array) – Sequence data to calculate rainflow counting matrix.
resolution (bool, optional) – The desired resolution to round the data points.
- Returns
rst (2d array) – A matrix contains the counting results.
matrixIndexKey (1d array) – A sorted array contains the index keys for the counting matrix.
- Raises
ValueError – If the data dimension is not 1. If the data length is less than 2.
Notes
The default round function will round half to even: 1.5, 2.5 => 2.0:
Examples
>>> from ffpack.lsm import fourPointCountingMatrix >>> data = [ -2.0, 1.0, -3.0, 5.0, -1.0, 3.0, -4.0, 4.0, -2.0 ] >>> rst, matrixIndexKey = fourPointCountingMatrix( data )
- ffpack.lsm.cycleCountingMatrix.johannessonMinMaxCountingMatrix(data, resolution=0.5)
Calculate Johannesson minMax cycle counting matrix.
- Parameters
data (1d array) – Sequence data to calculate rainflow counting matrix.
resolution (bool, optional) – The desired resolution to round the data points.
- Returns
rst (2d array) – A matrix contains the counting results.
matrixIndexKey (1d array) – A sorted array contains the index keys for the counting matrix.
- Raises
ValueError – If the data dimension is not 1. If the data length is less than 2.
Notes
The default round function will round half to even: 1.5, 2.5 => 2.0:
Examples
>>> from ffpack.lsm import johannessonMinMaxCountingMatrix >>> data = [ -2.0, 1.0, -3.0, 5.0, -1.0, 3.0, -4.0, 4.0, -2.0 ] >>> rst, matrixIndexKey = johannessonMinMaxCountingMatrix( data )
- ffpack.lsm.cycleCountingMatrix.rychlikRainflowCountingMatrix(data, resolution=0.5)
Calculate Rychlik rainflow counting matrix.
- Parameters
data (1d array) – Sequence data to calculate rainflow counting matrix.
resolution (bool, optional) – The desired resolution to round the data points.
- Returns
rst (2d array) – A matrix contains the counting results.
matrixIndexKey (1d array) – A sorted array contains the index keys for the counting matrix.
- Raises
ValueError – If the data dimension is not 1. If the data length is less than 2.
Notes
The default round function will round half to even: 1.5, 2.5 => 2.0:
Examples
>>> from ffpack.lsm import rychlikRainflowCountingMatrix >>> data = [ -2.0, 1.0, -3.0, 5.0, -1.0, 3.0, -4.0, 4.0, -2.0 ] >>> rst, matrixIndexKey = rychlikRainflowCountingMatrix( data )