Spectrum class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
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 function for the spectrum object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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] |
Returns the spectral frequency moment of order n.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
||
integer, | intent(in) | :: | n | Moment order |
Returns the air_density [kg/m^3] of the spectrum
instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Air density [kg/m^3]
Returns the amplitude array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Amplitude [m]
Returns the current velocity in x-direction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Mean current velocity in x-direction [m/s]
Returns the current velocity in y-direction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Mean current velocity in y-direction [m/s]
Returns the mean water depth [m].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Mean water depth [m]
Returns the depth levels at which the current arrays are defined.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Depth levels of current fields [m]
Returns the directions [rad] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Directions [rad]
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Directions [rad]
Returns the mean surface elevation anomaly [m].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Mean surface elevation anomaly [m]
Returns the frequency [Hz] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Frequency [Hz]
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Frequency [Hz]
Returns the gravitational acceleration [m/s^2].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Gravitational acceleration [m/s^2]
Returns the phase speed [m/s] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Group speed [m/s]
Returns the group speed [m/s] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Group speed [m/s]
Returns the wave action spectrum, which corresponds to the the wave variance spectrum normalized by the intrinsic frequency.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Wave action array
Returns the wavelength [m] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Wavelength [m]
Returns the wavenumber [rad/m] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Wavenumber [rad/m]
Returns the wavenumber spacing [rad/m] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Wavenumber spacing [rad/m]
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Wavenumber [rad/m]
Returns the phase speed [m/s] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Phase speed [m/s]
Returns the phase speed [m/s] array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Phase speed [m/s]
Returns the spectrum array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Spectrum array
Returns the surface tension [N/m].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Surface tension [N/m]
Returns the water density [kg/m^3].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Water density [kg/m^3]
Returns the allocation status of the spectrum array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self |
|
Returns .true.
if only one frequency bin is allocated,
and .false.
otherwise.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
return value (boolean)
Returns .true.
if only one direction bin is allocated,
and .false.
otherwise.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
return value (boolean)
Returns the mean wave period [s].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the zero-crossing mean wave period [s]:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the mean square slope of the spectrum, which is the second moment of the wavenumber spectrum.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Directional mean square slope
Returns total wave momentum [kg/m/s] in x-direction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns total wave momentum [kg/m/s] in y-direction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns total advective flux [kg/m^2/s^2] in y-direction of momentum in y-direction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
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}.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns total advective flux [kg/m^2/s^2] in y-direction of momentum in y-direction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the omnidirectional spectrum that corresponds to the input directional spectrum, integrated over all directions.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Spectrum array
Returns the peakedness parameter that quantifies the sharpness of the spectral peak, following Goda (1970).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the peak frequency based on Young (1995).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the peak frequency based on simple discrete maximum location of the spectrum array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the saturation spectrum B(k) = F(k)k^4.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Saturation spectrum result
Sets the air density [kg/m^3].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in) | :: | air_density | Air density [kg/m^3] |
Sets the 1-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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] |
Sets the 2-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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] |
Sets the mean surface elevation value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in) | :: | depth | Mean water depth [m] |
Sets the mean surface elevation value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in) | :: | elevation | Mean surface elevation anomaly [m] |
Sets the gravitational acceleration [m/s^2].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in) | :: | grav | Gravitational acceleration [m/s^2] |
Sets the surface tension [N/m].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in) | :: | surface_tension | Surface tension [N/m] |
Sets the water density [kg/m^3].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in) | :: | water_density | Water density [kg/m^3] |
Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in), | dimension(:) | :: | spec | Input 1-d spectrum array |
Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in), | dimension(:,:) | :: | spec | Input 2-d spectrum array |
Returns the significant wave height [m].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the significant surface orbital velocity [m/s].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Exact solution of Stokes drift based on linear wave theory, given input
omnidirectional spectrum and distance from surface z
[m], negative
downward.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in), | dimension(:) | :: | z | Distance from surface [m], negative downward |
Stokes drift array [m/s]
Exact solution of Stokes drift based on linear wave theory, given input
directional spectrum and distance from surface z
[m], negative downward.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in), | dimension(:) | :: | z | Distance from surface [m], negative downward |
Stokes drift array [m/s]
Returns the Ursell number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Returns the spectral wavenumber moment of order n.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
||
integer, | intent(in) | :: | n | Moment order |
Returns the wavenumber spectrum array of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | Spectrum instance |
Spectrum array
Read a spectrum instance from a JSON file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self |
|
||
character(len=*), | intent(in) | :: | filename | JSON file name |
Writes a spectrum instance to a JSON file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self |
|
||
character(len=*), | intent(in) | :: | filename | JSON file name |
||
logical, | intent(in) | :: | minify | Logical switch to minify the JSON file |
Assigns a 1-d array of reals to a spectrum
instance. This procedure
overloads the assignment ('=') operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | l.h.s. |
||
real(kind=rk), | intent(in), | dimension(:) | :: | array | r.h.s. array of reals |
Assigns a 2-d array of reals to a spectrum
instance. This procedure
overloads the assignment ('=') operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | l.h.s. |
||
real(kind=rk), | intent(in), | dimension(:,:) | :: | array | r.h.s. array of reals |
Returns a sum of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Returns a difference between a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Returns a product of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Returns a division of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Returns a product of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Returns a spectrum instance with the spectrum array values being the sum of the two input spectrum instances.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a sum of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Subtracts one spectrum instance from another and returns the resulting spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a difference of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Returns a product of two spectrum instances.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a product of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Returns a product of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Returns a division of two spectrum instances.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a division of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Returns a negative value of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Logical equality comparison function. Overloads the ==
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical inequality comparison function. Overloads the /=
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical greater than comparison function. Overloads the >
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical greater than or equal comparison function. Overloads the >=
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical less than comparison function. Overloads the <
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical less than or equal comparison function. Overloads the <=
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Sets the 1-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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] |
Sets the 2-d current velocity field. This procedure is overloaded by the generic procedure setCurrent.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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] |
Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in), | dimension(:) | :: | spec | Input 1-d spectrum array |
Sets the 2-d spectrum array. This procedure is overloaded by the generic procedure setSpectrum.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | Spectrum instance |
||
real(kind=rk), | intent(in), | dimension(:,:) | :: | spec | Input 2-d spectrum array |
Assigns a 1-d array of reals to a spectrum
instance. This procedure
overloads the assignment ('=') operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | l.h.s. |
||
real(kind=rk), | intent(in), | dimension(:) | :: | array | r.h.s. array of reals |
Assigns a 2-d array of reals to a spectrum
instance. This procedure
overloads the assignment ('=') operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(inout) | :: | self | l.h.s. |
||
real(kind=rk), | intent(in), | dimension(:,:) | :: | array | r.h.s. array of reals |
Returns a spectrum instance with the spectrum array values being the sum of the two input spectrum instances.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a sum of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Returns a sum of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Subtracts one spectrum instance from another and returns the resulting spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a difference of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Returns a difference between a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Returns a negative value of the spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Returns a product of two spectrum instances.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a product of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Returns a product of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Returns a product of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Returns a product of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Returns a division of two spectrum instances.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Returns a division of a spectrum instance and a real number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
real(kind=rk), | intent(in) | :: | a | r.h.s. real number |
Returns a division of a real number and a spectrum instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | a | l.h.s. real number |
||
class(spectrum_type), | intent(in) | :: | self | r.h.s. spectrum instance |
Logical equality comparison function. Overloads the ==
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical inequality comparison function. Overloads the /=
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical greater than comparison function. Overloads the >
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical greater than or equal comparison function. Overloads the >=
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical less than comparison function. Overloads the <
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
Logical less than or equal comparison function. Overloads the <=
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(spectrum_type), | intent(in) | :: | self | l.h.s. spectrum instance |
||
class(spectrum_type), | intent(in) | :: | s2 | r.h.s. spectrum instance |
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