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
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.
class(spectrum_type),intent(in) :: self
!! Spectrum instance
real(kind=rk),dimension(:,:),allocatable :: mss
!! Directional mean square slope
real(kind=rk),dimension(:,:),allocatable :: wavenumber_spectrum
real(kind=rk),dimension(:,:),allocatable :: dir_projection
integer :: nfreq,nfreqs
integer :: ndir,ndirs
nfreqs = size(self % f)
ndirs = size(self % th)
wavenumber_spectrum = self % wavenumberSpectrum()
! Compute projection of each wave direction onto every other direction
allocate(dir_projection(ndirs,ndirs))
do concurrent(ndir = 1:ndirs)
dir_projection(:,ndir) = abs(cos(self % th(ndir)-self % th(:)))
enddo
allocate(mss(nfreqs,ndirs))
mss = 0
do ndir = 1,ndirs
do nfreq = 2,nfreqs
mss(nfreq,ndir) = mss(nfreq-1,ndir) &
+ sum(wavenumber_spectrum(nfreq-1,:)*dir_projection(:,ndir))&
* self % k(nfreq-1)**2 * self % dk(nfreq-1)
enddo
enddo
deallocate(dir_projection,wavenumber_spectrum)
endfunction meanSquareSlopeDirectional