swiift.api.spectra ================== .. py:module:: swiift.api.spectra .. autoapi-nested-parse:: Consistant implementations of usual spectral formulations. Spectra are defined as function of the frequency. Definitions are taken from [1]_. .. rubric:: References .. [1] Stansberg, Carl Trygve & Contento, G. & Hong, S.W. & Irani, M. & Ishida, S. & Mercier, R.. (2002). The specialist committee on waves final report and recommendations to the 23rd ITTC. Proceedings of the 23rd ITTC. 505-736. Classes ------- .. autoapisummary:: swiift.api.spectra.PiersonMoskowitz swiift.api.spectra.Bretschneider swiift.api.spectra.JONSWAP Module Contents --------------- .. py:class:: PiersonMoskowitz Bases: :py:obj:`_PMFamily` Class encapsulating the Pierson--Moskowitz spectrum. .. py:method:: from_swh(swh, gravity) :classmethod: Build a spectrum parameterised by the SWH. :param swh: Significant wave height, in m. :type swh: float :param gravity: Acceleration of gravity, in m s**-2. :type gravity: float :returns: Initialised spectrum object. :rtype: PiersonMoskowitz .. py:method:: from_peak_frequency(peak_frequency, gravity) :classmethod: Build a spectrum parameterised by the peak frequency. :param peak_frequency: Peak frequency, in Hz. :type peak_frequency: float :param gravity: Acceleration of gravity, in m s^-2. :type gravity: float :returns: Initialised spectrum object. :rtype: PiersonMoskowitz .. py:class:: Bretschneider Bases: :py:obj:`_PMFamily` Class encapsulating the Bretschneider spectrum. .. py:method:: from_peak_frequency_swh(peak_frequency, swh) :classmethod: Build a spectrum parameterised by peak frequency and SWH. :param peak_frequency: Peak frequency, in Hz. :type peak_frequency: float :param swh: Significant wave height, in m. :type swh: float :returns: Initialised spectrum. :rtype: Bretschneider .. py:class:: JONSWAP Bases: :py:obj:`_UnimodalSpectrum` Class encapsulating the JONSWAP spectrum. The JONSWAP spectrum modifies the PM spectrum by introducing a peak enhancement factor. .. attribute:: peakedness :type: float .. attribute:: _base_spectrum :type: PiersonMoskowitz .. py:property:: peak_frequency :type: float Peak frequency. :returns: Peak frequency, in Hz. :rtype: float .. py:method:: swh() Significant wave height. The SWH is computed with a cubic approximation. :returns: Significant wave height, in m. :rtype: float .. py:method:: from_parameters(peak_frequency, peakedness, gravity) :classmethod: Build a spectrum. Peak frequency and gravity are used to instantiate the underlying Pierson--Moskowitz spectrum, while peakedness is specific to the JONSWAP formulation. :param peak_frequency: Peak frequency, in Hz. :type peak_frequency: float :param peakedness: Peakedness (base of the peak enhancement factor). :type peakedness: float :param gravity: Acceleration of gravity, in m s^-2. :type gravity: float :returns: Initialised spectrum. :rtype: JONSWAP .. py:method:: density(frequency) Spectral density as a function of frequency. :param frequency: Frequency at which to evaluate the density. :type frequency: array_like :returns: **density** -- The density in m^2 s. :rtype: float or np.ndarray