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]
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.
class(spectrum_type),intent(in) :: self
!! Spectrum instance
real(kind=rk),dimension(:),intent(in) :: z
!! Distance from surface [m], negative downward
real(kind=rk),dimension(:,:),allocatable :: stokesDrift2d
!! Stokes drift array [m/s]
integer(kind=ik) :: n,ndir,ndirs
ndirs = size(self % getDirections())
allocate(stokesDrift2d(size(z),2))
stokesDrift2d = 0
do n = 1,size(z)
stokesDrift2d(n,:) = 0
do ndir = 1,ndirs
! x-component of Stokes drift
stokesDrift2d(n,1) = stokesDrift2d(n,1)&
+ sum(self % spec(:,ndir)*cos(self % th(ndir))&
*self % k*exp(2*self % k*z(n))&
*self % df*self % dth(ndir))
! y-component of Stokes drift
stokesDrift2d(n,2) = stokesDrift2d(n,2)&
+ sum(self % spec(:,ndir)*sin(self % th(ndir))&
*self % k*exp(2*self % k*z(n))&
*self % df*self % dth(ndir))
enddo
enddo
endfunction stokesDrift2d