spectrum_type Derived Type

type, public :: spectrum_type

type~~spectrum_type~~InheritsGraph type~spectrum_type spectrum_type timedelta timedelta timedelta->type~spectrum_type time_step datetime datetime datetime->type~spectrum_type start_time, end_time
Help


Spectrum class.

Inherited By

type~~spectrum_type~~InheritedByGraph type~spectrum_type spectrum_type type~domain_type domain_type type~spectrum_type->type~domain_type spectrum
Help

Source Code


Components

TypeVisibility AttributesNameInitial
type(datetime), private :: start_time

Simulation start time

type(datetime), private :: end_time

Simulation end time

type(timedelta), private :: time_step

Time step [s]

real(kind=rk), private, dimension(:,:), allocatable:: spec

2-d spectrum

real(kind=rk), private, dimension(:), allocatable:: f

Frequency [Hz]

real(kind=rk), private, dimension(:), allocatable:: df

Frequency spacing [Hz]

real(kind=rk), private, dimension(:), allocatable:: k

Wavenumber [rad/m]

real(kind=rk), private, dimension(:), allocatable:: dk

Wavenumber spacing [rad/m]

real(kind=rk), private, dimension(:), allocatable:: th

Direction [rad]

real(kind=rk), private, dimension(:), allocatable:: dth

Directional spacing [rad]

real(kind=rk), private, dimension(:), allocatable:: cp

Phase speed [m/s]

real(kind=rk), private, dimension(:), allocatable:: cg

Group speed [m/s]

real(kind=rk), private, dimension(:), allocatable:: u

Mean current velocity in x-direction [m/s]

real(kind=rk), private, dimension(:), allocatable:: v

Mean current velocity in y-direction [m/s]

real(kind=rk), private, dimension(:), allocatable:: z

Depth levels for current array [m]

real(kind=rk), private :: air_density

Air density [kg/m^3]

real(kind=rk), private :: depth

Mean water depth [m]

real(kind=rk), private :: elevation

Mean surface elevation [m]

real(kind=rk), private :: grav

Gravitational acceleration [m/s^2]

real(kind=rk), private :: surface_tension

Surface tension [N/m]

real(kind=rk), private :: water_density

Water density [kg/m^3]


Constructor

public interface spectrum_type

  • private pure elemental function constructor(fmin, fmax, df, ndirs, depth, grav, air_density, water_density, surface_tension) result(spectrum)

    Constructor function for the spectrum object.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: fmin

    Minimum frequency bin [Hz]

    real(kind=rk), intent(in) :: fmax

    Maximum frequency bin [Hz]

    real(kind=rk), intent(in) :: df

    Frequency increment, df = f(n+1)/f(n)

    integer, intent(in) :: ndirs

    Number of directional bins

    real(kind=rk), intent(in) :: depth

    Mean water depth [m]

    real(kind=rk), intent(in), optional :: grav

    Gravitational acceleration [m/s^2]

    real(kind=rk), intent(in), optional :: air_density

    Air density [kg/m^3]

    real(kind=rk), intent(in), optional :: water_density

    Water density [kg/m^3]

    real(kind=rk), intent(in), optional :: surface_tension

    Surface tension [N/m]

    Return Value type(spectrum_type)


Type-Bound Procedures

procedure, public, pass(self) :: frequencyMoment

  • private pure elemental function frequencyMoment(self, n)

    Returns the spectral frequency moment of order n.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    integer, intent(in) :: n

    Moment order

    Return Value real(kind=rk)

procedure, public, pass(self) :: getAirDensity

  • private pure elemental function getAirDensity(self) result(air_density)

    Returns the air_density [kg/m^3] of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

    Air density [kg/m^3]

procedure, public, pass(self) :: getAmplitude

  • private pure function getAmplitude(self) result(a)

    Returns the amplitude array.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Amplitude [m]

procedure, public, pass(self) :: getCurrent_u

  • private pure function getCurrent_u(self) result(u)

    Returns the current velocity in x-direction.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Mean current velocity in x-direction [m/s]

procedure, public, pass(self) :: getCurrent_v

  • private pure function getCurrent_v(self) result(v)

    Returns the current velocity in y-direction.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Mean current velocity in y-direction [m/s]

procedure, public, pass(self) :: getDepth

  • private pure elemental function getDepth(self) result(depth)

    Returns the mean water depth [m].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

    Mean water depth [m]

procedure, public, pass(self) :: getDepthLevels

  • private pure function getDepthLevels(self) result(z)

    Returns the depth levels at which the current arrays are defined.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Depth levels of current fields [m]

procedure, public, pass(self) :: getDirections

  • private pure function getDirections(self) result(th)

    Returns the directions [rad] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Directions [rad]

procedure, public, pass(self) :: getDirections2d

  • private pure function getDirections2d(self) result(th)

    Returns the directions [rad] array of the spectrum instance, reshaped to match the spectrum array shape. This method is most useful for conforming shape array in 2-d spectrum computations.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Directions [rad]

procedure, public, pass(self) :: getElevation

  • private pure elemental function getElevation(self) result(elevation)

    Returns the mean surface elevation anomaly [m].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

    Mean surface elevation anomaly [m]

procedure, public, pass(self) :: getFrequency

  • private pure function getFrequency(self) result(f)

    Returns the frequency [Hz] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Frequency [Hz]

procedure, public, pass(self) :: getFrequency2d

  • private pure function getFrequency2d(self) result(f)

    Returns the frequency [Hz] array of the spectrum instance, reshaped to match the spectrum array shape. This method is most useful for conforming shape array in 2-d spectrum computations.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Frequency [Hz]

procedure, public, pass(self) :: getGravity

  • private pure elemental function getGravity(self) result(grav)

    Returns the gravitational acceleration [m/s^2].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

    Gravitational acceleration [m/s^2]

procedure, public, pass(self) :: getGroupSpeed

  • private pure function getGroupSpeed(self) result(cg)

    Returns the phase speed [m/s] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Group speed [m/s]

procedure, public, pass(self) :: getGroupSpeed2d

  • private pure function getGroupSpeed2d(self) result(cg)

    Returns the group speed [m/s] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Group speed [m/s]

procedure, public, pass(self) :: getWaveAction

  • private pure function getWaveAction(self) result(wave_action)

    Returns the wave action spectrum, which corresponds to the the wave variance spectrum normalized by the intrinsic frequency.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Wave action array

procedure, public, pass(self) :: getWavelength

  • private pure function getWavelength(self) result(lambda)

    Returns the wavelength [m] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Wavelength [m]

procedure, public, pass(self) :: getWavenumber

  • private pure function getWavenumber(self) result(k)

    Returns the wavenumber [rad/m] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Wavenumber [rad/m]

procedure, public, pass(self) :: getWavenumberSpacing

  • private pure function getWavenumberSpacing(self) result(dk)

    Returns the wavenumber spacing [rad/m] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Wavenumber spacing [rad/m]

procedure, public, pass(self) :: getWavenumber2d

  • private pure function getWavenumber2d(self) result(k)

    Returns the wavenumber [rad/m] array of the spectrum instance, reshaped to match the spectrum array shape. This method is most useful for conforming shape array in 2-d spectrum computations.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Wavenumber [rad/m]

procedure, public, pass(self) :: getPhaseSpeed

  • private pure function getPhaseSpeed(self) result(cp)

    Returns the phase speed [m/s] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Phase speed [m/s]

procedure, public, pass(self) :: getPhaseSpeed2d

  • private pure function getPhaseSpeed2d(self) result(cp)

    Returns the phase speed [m/s] array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Phase speed [m/s]

procedure, public, pass(self) :: getSpectrum

  • private pure function getSpectrum(self) result(spec)

    Returns the spectrum array.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Spectrum array

procedure, public, pass(self) :: getSurfaceTension

  • private pure elemental function getSurfaceTension(self) result(surface_tension)

    Returns the surface tension [N/m].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

    Surface tension [N/m]

procedure, public, pass(self) :: getWaterDensity

  • private pure elemental function getWaterDensity(self) result(water_density)

    Returns the water density [kg/m^3].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

    Water density [kg/m^3]

procedure, public, pass(self) :: isAllocated

  • private pure elemental function isAllocated(self)

    Returns the allocation status of the spectrum array.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    domain instance

    Return Value logical

procedure, public, pass(self) :: isMonochromatic

  • private pure elemental function isMonochromatic(self)

    Returns .true. if only one frequency bin is allocated, and .false. otherwise.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value logical

    return value (boolean)

procedure, public, pass(self) :: isOmnidirectional

  • private pure elemental function isOmnidirectional(self)

    Returns .true. if only one direction bin is allocated, and .false. otherwise.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value logical

    return value (boolean)

procedure, public, pass(self) :: meanPeriod

  • private pure elemental function meanPeriod(self)

    Returns the mean wave period [s].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: meanPeriodZeroCrossing

  • private pure elemental function meanPeriodZeroCrossing(self)

    Returns the zero-crossing mean wave period [s]:

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: meanSquareSlope

  • private pure elemental function meanSquareSlope(self)

    Returns the mean square slope of the spectrum, which is the second moment of the wavenumber spectrum.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: meanSquareSlopeDirectional

  • private pure function meanSquareSlopeDirectional(self) result(mss)

    For each directional frequency bin, computes the mean square slope of all all waves longer than that bin, projected to the direction of that bin.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Directional mean square slope

procedure, public, pass(self) :: momentum_x

  • private pure elemental function momentum_x(self)

    Returns total wave momentum [kg/m/s] in x-direction.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: momentum_y

  • private pure elemental function momentum_y(self)

    Returns total wave momentum [kg/m/s] in y-direction.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: momentumFlux_xx

  • private pure elemental function momentumFlux_xx(self)

    Returns total advective flux [kg/m^2/s^2] in y-direction of momentum in y-direction.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: momentumFlux_xy

  • private pure elemental function momentumFlux_xy(self)

    Returns total advective flux [kg/m^2/s^2] in x-direction of momentum in y-direction and vice versa (flux in y-direction of momentum in y-direction), because \int{CgxMy} == \int{CgyMx}.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: momentumFlux_yy

  • private pure elemental function momentumFlux_yy(self)

    Returns total advective flux [kg/m^2/s^2] in y-direction of momentum in y-direction.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: omnidirectionalSpectrum

  • private pure function omnidirectionalSpectrum(self) result(spec)

    Returns the omnidirectional spectrum that corresponds to the input directional spectrum, integrated over all directions.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:), allocatable

    Spectrum array

procedure, public, pass(self) :: peakedness

  • private pure elemental function peakedness(self)

    Returns the peakedness parameter that quantifies the sharpness of the spectral peak, following Goda (1970).

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: peakFrequency

  • private pure elemental function peakFrequency(self)

    Returns the peak frequency based on Young (1995).

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: peakFrequencyDiscrete

  • private pure elemental function peakFrequencyDiscrete(self)

    Returns the peak frequency based on simple discrete maximum location of the spectrum array.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: saturationSpectrum

  • private pure function saturationSpectrum(self)

    Returns the saturation spectrum B(k) = F(k)k^4.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Saturation spectrum result

procedure, public, pass(self) :: setAirDensity

  • private pure elemental subroutine setAirDensity(self, air_density)

    Sets the air density [kg/m^3].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in) :: air_density

    Air density [kg/m^3]

procedure, public, pass(self) :: setCurrent1d

  • private pure subroutine setCurrent1d(self, u, z)

    Sets the 1-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: u

    Current velocity in x-direction [m/s]

    real(kind=rk), intent(in), dimension(:):: z

    Depth levels for the velocity array [m]

procedure, public, pass(self) :: setCurrent2d

  • private pure subroutine setCurrent2d(self, u, v, z)

    Sets the 2-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: u

    Current velocity in x-direction [m/s]

    real(kind=rk), intent(in), dimension(:):: v

    Current velocity in y-direction [m/s]

    real(kind=rk), intent(in), dimension(:):: z

    Depth levels for the velocity array [m]

procedure, public, pass(self) :: setDepth

  • private pure elemental subroutine setDepth(self, depth)

    Sets the mean surface elevation value.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in) :: depth

    Mean water depth [m]

procedure, public, pass(self) :: setElevation

  • private pure elemental subroutine setElevation(self, elevation)

    Sets the mean surface elevation value.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in) :: elevation

    Mean surface elevation anomaly [m]

procedure, public, pass(self) :: setGravity

  • private pure elemental subroutine setGravity(self, grav)

    Sets the gravitational acceleration [m/s^2].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in) :: grav

    Gravitational acceleration [m/s^2]

procedure, public, pass(self) :: setSurfaceTension

  • private pure elemental subroutine setSurfaceTension(self, surface_tension)

    Sets the surface tension [N/m].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in) :: surface_tension

    Surface tension [N/m]

procedure, public, pass(self) :: setWaterDensity

  • private pure elemental subroutine setWaterDensity(self, water_density)

    Sets the water density [kg/m^3].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in) :: water_density

    Water density [kg/m^3]

procedure, public, pass(self) :: setSpectrum1d

  • private pure subroutine setSpectrum1d(self, spec)

    Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: spec

    Input 1-d spectrum array

procedure, public, pass(self) :: setSpectrum2d

  • private pure subroutine setSpectrum2d(self, spec)

    Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:,:):: spec

    Input 2-d spectrum array

procedure, public, pass(self) :: significantWaveHeight

  • private pure elemental function significantWaveHeight(self)

    Returns the significant wave height [m].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: significantSurfaceOrbitalVelocity

  • private pure elemental function significantSurfaceOrbitalVelocity(self) result(uorb)

    Returns the significant surface orbital velocity [m/s].

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: stokesDrift

  • private pure function stokesDrift(self, z)

    Exact solution of Stokes drift based on linear wave theory, given input omnidirectional spectrum and distance from surface z [m], negative downward.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: z

    Distance from surface [m], negative downward

    Return Value real(kind=rk), dimension(:), allocatable

    Stokes drift array [m/s]

procedure, public, pass(self) :: stokesDrift2d

  • private pure function stokesDrift2d(self, z)

    Exact solution of Stokes drift based on linear wave theory, given input directional spectrum and distance from surface z [m], negative downward.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: z

    Distance from surface [m], negative downward

    Return Value real(kind=rk), dimension(:,:), allocatable

    Stokes drift array [m/s]

procedure, public, pass(self) :: ursellNumber

  • private pure elemental function ursellNumber(self)

    Returns the Ursell number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk)

procedure, public, pass(self) :: wavenumberMoment

  • private pure elemental function wavenumberMoment(self, n)

    Returns the spectral wavenumber moment of order n.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    integer, intent(in) :: n

    Moment order

    Return Value real(kind=rk)

procedure, public, pass(self) :: wavenumberSpectrum

  • private pure function wavenumberSpectrum(self) result(spec)

    Returns the wavenumber spectrum array of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    Spectrum instance

    Return Value real(kind=rk), dimension(:,:), allocatable

    Spectrum array

procedure, public, pass(self) :: readJSON

  • private subroutine readJSON(self, filename)

    Read a spectrum instance from a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    spectrum instance

    character(len=*), intent(in) :: filename

    JSON file name

procedure, public, pass(self) :: writeJSON

  • private subroutine writeJSON(self, filename, minify)

    Writes a spectrum instance to a JSON file.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    spectrum instance

    character(len=*), intent(in) :: filename

    JSON file name

    logical, intent(in) :: minify

    Logical switch to minify the JSON file

procedure, private, pass(self) :: assign_array_1d

  • private pure subroutine assign_array_1d(self, array)

    Assigns a 1-d array of reals to a spectrum instance. This procedure overloads the assignment ('=') operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in), dimension(:):: array

    r.h.s. array of reals

procedure, private, pass(self) :: assign_array_2d

  • private pure subroutine assign_array_2d(self, array)

    Assigns a 2-d array of reals to a spectrum instance. This procedure overloads the assignment ('=') operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in), dimension(:,:):: array

    r.h.s. array of reals

procedure, private, pass(self) :: real_add_spectrum

  • private pure elemental function real_add_spectrum(a, self) result(spec)

    Returns a sum of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: real_sub_spectrum

  • private pure elemental function real_sub_spectrum(a, self) result(spec)

    Returns a difference between a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: real_mult_spectrum

  • private pure elemental function real_mult_spectrum(a, self) result(spec)

    Returns a product of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: real_div_spectrum

  • private pure elemental function real_div_spectrum(a, self) result(spec)

    Returns a division of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: real2d_mult_spectrum

  • private pure function real2d_mult_spectrum(a, self) result(spec)

    Returns a product of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in), dimension(:,:):: a

    l.h.s. real 2-d array

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_add_spectrum

  • private pure elemental function spectrum_add_spectrum(self, s2) result(spec)

    Returns a spectrum instance with the spectrum array values being the sum of the two input spectrum instances.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_add_real

  • private pure elemental function spectrum_add_real(self, a) result(spec)

    Returns a sum of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_sub_spectrum

  • private pure elemental function spectrum_sub_spectrum(self, s2) result(spec)

    Subtracts one spectrum instance from another and returns the resulting spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_sub_real

  • private pure elemental function spectrum_sub_real(self, a) result(spec)

    Returns a difference of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_mult_spectrum

  • private pure elemental function spectrum_mult_spectrum(self, s2) result(spec)

    Returns a product of two spectrum instances.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_mult_real

  • private pure elemental function spectrum_mult_real(self, a) result(spec)

    Returns a product of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_mult_real2d

  • private pure function spectrum_mult_real2d(self, a) result(spec)

    Returns a product of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in), dimension(:,:):: a

    r.h.s. real 2-d array

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_div_spectrum

  • private pure elemental function spectrum_div_spectrum(self, s2) result(spec)

    Returns a division of two spectrum instances.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_div_real

  • private pure elemental function spectrum_div_real(self, a) result(spec)

    Returns a division of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

procedure, private, pass(self) :: spectrum_unary_minus

  • private pure elemental function spectrum_unary_minus(self) result(spec)

    Returns a negative value of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

procedure, private, pass(self) :: eq

  • private pure elemental function eq(self, s2)

    Logical equality comparison function. Overloads the == operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

procedure, private, pass(self) :: neq

  • private pure elemental function neq(self, s2)

    Logical inequality comparison function. Overloads the /= operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

procedure, private, pass(self) :: gt

  • private pure elemental function gt(self, s2)

    Logical greater than comparison function. Overloads the > operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

procedure, private, pass(self) :: ge

  • private pure elemental function ge(self, s2)

    Logical greater than or equal comparison function. Overloads the >= operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

procedure, private, pass(self) :: lt

  • private pure elemental function lt(self, s2)

    Logical less than comparison function. Overloads the < operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

procedure, private, pass(self) :: le

  • private pure elemental function le(self, s2)

    Logical less than or equal comparison function. Overloads the <= operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

generic, public :: setCurrent => setCurrent1d, setCurrent2d

  • private pure subroutine setCurrent1d(self, u, z)

    Sets the 1-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: u

    Current velocity in x-direction [m/s]

    real(kind=rk), intent(in), dimension(:):: z

    Depth levels for the velocity array [m]

  • private pure subroutine setCurrent2d(self, u, v, z)

    Sets the 2-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: u

    Current velocity in x-direction [m/s]

    real(kind=rk), intent(in), dimension(:):: v

    Current velocity in y-direction [m/s]

    real(kind=rk), intent(in), dimension(:):: z

    Depth levels for the velocity array [m]

generic, public :: setSpectrum => setSpectrum1d, setSpectrum2d

  • private pure subroutine setSpectrum1d(self, spec)

    Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:):: spec

    Input 1-d spectrum array

  • private pure subroutine setSpectrum2d(self, spec)

    Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    Spectrum instance

    real(kind=rk), intent(in), dimension(:,:):: spec

    Input 2-d spectrum array

generic, public :: assignment(=) => assign_array_1d, assign_array_2d

  • private pure subroutine assign_array_1d(self, array)

    Assigns a 1-d array of reals to a spectrum instance. This procedure overloads the assignment ('=') operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in), dimension(:):: array

    r.h.s. array of reals

  • private pure subroutine assign_array_2d(self, array)

    Assigns a 2-d array of reals to a spectrum instance. This procedure overloads the assignment ('=') operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(inout) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in), dimension(:,:):: array

    r.h.s. array of reals

generic, public :: operator(+) => spectrum_add_spectrum, spectrum_add_real, real_add_spectrum

  • private pure elemental function spectrum_add_spectrum(self, s2) result(spec)

    Returns a spectrum instance with the spectrum array values being the sum of the two input spectrum instances.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure elemental function spectrum_add_real(self, a) result(spec)

    Returns a sum of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

  • private pure elemental function real_add_spectrum(a, self) result(spec)

    Returns a sum of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure elemental function spectrum_sub_spectrum(self, s2) result(spec)

    Subtracts one spectrum instance from another and returns the resulting spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure elemental function spectrum_sub_real(self, a) result(spec)

    Returns a difference of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

  • private pure elemental function real_sub_spectrum(a, self) result(spec)

    Returns a difference between a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure elemental function spectrum_unary_minus(self) result(spec)

    Returns a negative value of the spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure elemental function spectrum_mult_spectrum(self, s2) result(spec)

    Returns a product of two spectrum instances.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure elemental function spectrum_mult_real(self, a) result(spec)

    Returns a product of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

  • private pure function spectrum_mult_real2d(self, a) result(spec)

    Returns a product of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in), dimension(:,:):: a

    r.h.s. real 2-d array

    Return Value type(spectrum_type)

  • private pure elemental function real_mult_spectrum(a, self) result(spec)

    Returns a product of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure function real2d_mult_spectrum(a, self) result(spec)

    Returns a product of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in), dimension(:,:):: a

    l.h.s. real 2-d array

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

generic, public :: operator(/) => spectrum_div_spectrum, spectrum_div_real, real_div_spectrum

  • private pure elemental function spectrum_div_spectrum(self, s2) result(spec)

    Returns a division of two spectrum instances.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

  • private pure elemental function spectrum_div_real(self, a) result(spec)

    Returns a division of a spectrum instance and a real number.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    real(kind=rk), intent(in) :: a

    r.h.s. real number

    Return Value type(spectrum_type)

  • private pure elemental function real_div_spectrum(a, self) result(spec)

    Returns a division of a real number and a spectrum instance.

    Arguments

    Type IntentOptional AttributesName
    real(kind=rk), intent(in) :: a

    l.h.s. real number

    class(spectrum_type), intent(in) :: self

    r.h.s. spectrum instance

    Return Value type(spectrum_type)

generic, public :: operator(==) => eq

  • private pure elemental function eq(self, s2)

    Logical equality comparison function. Overloads the == operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

generic, public :: operator(/=) => neq

  • private pure elemental function neq(self, s2)

    Logical inequality comparison function. Overloads the /= operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

generic, public :: operator(>) => gt

  • private pure elemental function gt(self, s2)

    Logical greater than comparison function. Overloads the > operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

generic, public :: operator(>=) => ge

  • private pure elemental function ge(self, s2)

    Logical greater than or equal comparison function. Overloads the >= operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

generic, public :: operator(<) => lt

  • private pure elemental function lt(self, s2)

    Logical less than comparison function. Overloads the < operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

generic, public :: operator(<=) => le

  • private pure elemental function le(self, s2)

    Logical less than or equal comparison function. Overloads the <= operator.

    Arguments

    Type IntentOptional AttributesName
    class(spectrum_type), intent(in) :: self

    l.h.s. spectrum instance

    class(spectrum_type), intent(in) :: s2

    r.h.s. spectrum instance

    Return Value logical

Source Code

type :: spectrum_type

  !! Spectrum class.

  private

  type(datetime) :: start_time !! Simulation start time
  type(datetime) :: end_time   !! Simulation end time
  type(timedelta) :: time_step !! Time step [s]

  real(kind=rk),dimension(:,:),allocatable :: spec !! 2-d spectrum

  real(kind=rk),dimension(:),allocatable :: f   !! Frequency [Hz]
  real(kind=rk),dimension(:),allocatable :: df  !! Frequency spacing [Hz]
  real(kind=rk),dimension(:),allocatable :: k   !! Wavenumber [rad/m]
  real(kind=rk),dimension(:),allocatable :: dk  !! Wavenumber spacing [rad/m]
  real(kind=rk),dimension(:),allocatable :: th  !! Direction [rad]
  real(kind=rk),dimension(:),allocatable :: dth !! Directional spacing [rad]
  real(kind=rk),dimension(:),allocatable :: cp  !! Phase speed [m/s]
  real(kind=rk),dimension(:),allocatable :: cg  !! Group speed [m/s]
  real(kind=rk),dimension(:),allocatable :: u   !! Mean current velocity in x-direction [m/s]
  real(kind=rk),dimension(:),allocatable :: v   !! Mean current velocity in y-direction [m/s]
  real(kind=rk),dimension(:),allocatable :: z   !! Depth levels for current array [m]

  real(kind=rk) :: air_density     !! Air density [kg/m^3]
  real(kind=rk) :: depth           !! Mean water depth [m]
  real(kind=rk) :: elevation       !! Mean surface elevation [m]
  real(kind=rk) :: grav            !! Gravitational acceleration [m/s^2]
  real(kind=rk) :: surface_tension !! Surface tension [N/m]
  real(kind=rk) :: water_density   !! Water density [kg/m^3]

  contains

  ! Public type-bound methods
  procedure,public,pass(self) :: frequencyMoment
  procedure,public,pass(self) :: getAirDensity
  procedure,public,pass(self) :: getAmplitude
  procedure,public,pass(self) :: getCurrent_u
  procedure,public,pass(self) :: getCurrent_v
  procedure,public,pass(self) :: getDepth
  procedure,public,pass(self) :: getDepthLevels
  procedure,public,pass(self) :: getDirections
  procedure,public,pass(self) :: getDirections2d
  procedure,public,pass(self) :: getElevation
  procedure,public,pass(self) :: getFrequency
  procedure,public,pass(self) :: getFrequency2d
  procedure,public,pass(self) :: getGravity
  procedure,public,pass(self) :: getGroupSpeed
  procedure,public,pass(self) :: getGroupSpeed2d
  procedure,public,pass(self) :: getWaveAction
  procedure,public,pass(self) :: getWavelength
  procedure,public,pass(self) :: getWavenumber
  procedure,public,pass(self) :: getWavenumberSpacing
  procedure,public,pass(self) :: getWavenumber2d
  procedure,public,pass(self) :: getPhaseSpeed
  procedure,public,pass(self) :: getPhaseSpeed2d
  procedure,public,pass(self) :: getSpectrum
  procedure,public,pass(self) :: getSurfaceTension
  procedure,public,pass(self) :: getWaterDensity
  procedure,public,pass(self) :: isAllocated
  procedure,public,pass(self) :: isMonochromatic
  procedure,public,pass(self) :: isOmnidirectional
  procedure,public,pass(self) :: meanPeriod
  procedure,public,pass(self) :: meanPeriodZeroCrossing
  procedure,public,pass(self) :: meanSquareSlope
  procedure,public,pass(self) :: meanSquareSlopeDirectional
  procedure,public,pass(self) :: momentum_x
  procedure,public,pass(self) :: momentum_y
  procedure,public,pass(self) :: momentumFlux_xx
  procedure,public,pass(self) :: momentumFlux_xy
  procedure,public,pass(self) :: momentumFlux_yy
  procedure,public,pass(self) :: omnidirectionalSpectrum
  procedure,public,pass(self) :: peakedness
  procedure,public,pass(self) :: peakFrequency
  procedure,public,pass(self) :: peakFrequencyDiscrete
  procedure,public,pass(self) :: saturationSpectrum
  procedure,public,pass(self) :: setAirDensity
  procedure,public,pass(self) :: setCurrent1d
  procedure,public,pass(self) :: setCurrent2d
  procedure,public,pass(self) :: setDepth
  procedure,public,pass(self) :: setElevation
  procedure,public,pass(self) :: setGravity
  procedure,public,pass(self) :: setSurfaceTension
  procedure,public,pass(self) :: setWaterDensity
  procedure,public,pass(self) :: setSpectrum1d
  procedure,public,pass(self) :: setSpectrum2d
  procedure,public,pass(self) :: significantWaveHeight
  procedure,public,pass(self) :: significantSurfaceOrbitalVelocity
  procedure,public,pass(self) :: stokesDrift
  procedure,public,pass(self) :: stokesDrift2d
  procedure,public,pass(self) :: ursellNumber
  procedure,public,pass(self) :: wavenumberMoment
  procedure,public,pass(self) :: wavenumberSpectrum
  procedure,public,pass(self) :: readJSON
  procedure,public,pass(self) :: writeJSON

  ! Private methods used to overload arithmetic operators
  procedure,private,pass(self) :: assign_array_1d
  procedure,private,pass(self) :: assign_array_2d
  procedure,private,pass(self) :: real_add_spectrum
  procedure,private,pass(self) :: real_sub_spectrum
  procedure,private,pass(self) :: real_mult_spectrum
  procedure,private,pass(self) :: real_div_spectrum
  procedure,private,pass(self) :: real2d_mult_spectrum
  procedure,private,pass(self) :: spectrum_add_spectrum
  procedure,private,pass(self) :: spectrum_add_real
  procedure,private,pass(self) :: spectrum_sub_spectrum
  procedure,private,pass(self) :: spectrum_sub_real
  procedure,private,pass(self) :: spectrum_mult_spectrum
  procedure,private,pass(self) :: spectrum_mult_real
  procedure,private,pass(self) :: spectrum_mult_real2d
  procedure,private,pass(self) :: spectrum_div_spectrum
  procedure,private,pass(self) :: spectrum_div_real
  procedure,private,pass(self) :: spectrum_unary_minus
  procedure,private,pass(self) :: eq
  procedure,private,pass(self) :: neq
  procedure,private,pass(self) :: gt
  procedure,private,pass(self) :: ge
  procedure,private,pass(self) :: lt
  procedure,private,pass(self) :: le

  ! Generic procedures
  generic,public :: setCurrent => setCurrent1d,setCurrent2d
  generic,public :: setSpectrum => setSpectrum1d,setSpectrum2d

  ! Generic operators
  generic :: assignment(=) => assign_array_1d,&
                              assign_array_2d
  generic :: operator(+)   => spectrum_add_spectrum,&
                              spectrum_add_real,&
                              real_add_spectrum
  generic :: operator(-)   => spectrum_sub_spectrum,&
                              spectrum_sub_real,&
                              real_sub_spectrum,&
                              spectrum_unary_minus
  generic :: operator(*)   => spectrum_mult_spectrum,&
                              spectrum_mult_real,&
                              spectrum_mult_real2d,&
                              real_mult_spectrum,&
                              real2d_mult_spectrum
  generic :: operator(/)   => spectrum_div_spectrum,&
                              spectrum_div_real,&
                              real_div_spectrum
  generic :: operator(==)  => eq
  generic :: operator(/=)  => neq
  generic :: operator(>)   => gt
  generic :: operator(>=)  => ge
  generic :: operator(<)   => lt
  generic :: operator(<=)  => le

endtype spectrum_type