mod_spectrum Module

module~~mod_spectrum~~UsesGraph module~mod_spectrum mod_spectrum json_module json_module json_module->module~mod_spectrum module~mod_utility mod_utility module~mod_utility->module~mod_spectrum module~mod_precision mod_precision module~mod_precision->module~mod_spectrum module~mod_precision->module~mod_utility module~mod_const mod_const module~mod_precision->module~mod_const datetime_module datetime_module datetime_module->module~mod_spectrum module~mod_const->module~mod_spectrum iso_c_binding iso_c_binding iso_c_binding->module~mod_spectrum iso_fortran_env iso_fortran_env iso_fortran_env->module~mod_precision
Help

Used By

module~~mod_spectrum~~UsedByGraph module~mod_spectrum mod_spectrum proc~snl_dccm2012 snl_DCCM2012 module~mod_spectrum->proc~snl_dccm2012 proc~sbf_dccm2012 sbf_DCCM2012 module~mod_spectrum->proc~sbf_dccm2012 proc~sin_dccm2012 sin_DCCM2012 module~mod_spectrum->proc~sin_dccm2012 module~mod_time_integration mod_time_integration module~mod_spectrum->module~mod_time_integration proc~sdt_dccm2012 sdt_DCCM2012 module~mod_spectrum->proc~sdt_dccm2012 module~mod_domain mod_domain module~mod_spectrum->module~mod_domain proc~sbf_jonswap sbf_JONSWAP module~mod_spectrum->proc~sbf_jonswap proc~sds_dccm2012 sds_DCCM2012 module~mod_spectrum->proc~sds_dccm2012 module~mod_domain->module~mod_time_integration
Help


Interfaces

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)


Derived Types

type, public :: spectrum_type

Spectrum class.

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

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

Constructor function for the spectrum object.

Type-Bound Procedures

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
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, public :: setCurrent => setCurrent1d, setCurrent2d
generic, public :: setSpectrum => setSpectrum1d, setSpectrum2d
generic, public :: assignment(=) => assign_array_1d, assign_array_2d
generic, public :: operator(+) => spectrum_add_spectrum, spectrum_add_real, real_add_spectrum
generic, public :: operator(-) => spectrum_sub_spectrum, spectrum_sub_real, real_sub_spectrum, spectrum_unary_minus
generic, public :: operator(*) => spectrum_mult_spectrum, spectrum_mult_real, spectrum_mult_real2d, real_mult_spectrum, real2d_mult_spectrum
generic, public :: operator(/) => spectrum_div_spectrum, spectrum_div_real, real_div_spectrum
generic, public :: operator(==) => eq
generic, public :: operator(/=) => neq
generic, public :: operator(>) => gt
generic, public :: operator(>=) => ge
generic, public :: operator(<) => lt
generic, public :: operator(<=) => le

Functions

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)

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]

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

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)

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)

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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

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

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]

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]

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]

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]

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]

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]

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]

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]

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]

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

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)

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

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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

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

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)

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)

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]

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]

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)

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)

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)

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

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

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

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

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

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

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_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_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_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_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 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 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 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_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 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 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)

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)

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 wavenumber(f, depth, water_density, grav, surface_tension)

Solves the linear water wave dispersion relationship using a Newton-Raphson iteration loop.

Arguments

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

Intrinsic frequency [Hz]

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

Mean water depth [m]

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

Water density [kg/m^3]

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

Gravitational acceleration [m/s^2]

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

Surface tension [N/m]

Return Value real(kind=rk)


Subroutines

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

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]

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]

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]

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]

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]

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]

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]

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

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

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