Returns a spectrum instance with the non-linear wave-wave energy transfer ($S_{nl}$) tendency formulated by Donelan et al. (2012).
References:
Donelan, M. A., M. Curcic, S. S. Chen, and A. K. Magnusson, 2012: Modeling waves and wind stress, J. Geophys. Res. Oceans, 117, C00J23, doi:10.1029/2011JC007787.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(spectrum_type), | intent(in) | :: | spectrum | Spectrum instance |
||
type(spectrum_type), | intent(in) | :: | sds_tendency | Spectral dissipation tendency instance |
||
real(kind=rk), | intent(in) | :: | snl_coefficient | Linear coefficient of the dissipation function |
Result tendency instance
pure elemental function snl_DCCM2012(spectrum,sds_tendency,snl_coefficient)&
result(tendency)
!! Returns a spectrum instance with the non-linear wave-wave energy transfer
!! ($S_{nl}$) tendency formulated by Donelan et al. (2012).
!!
!! References:
!!
!! Donelan, M. A., M. Curcic, S. S. Chen, and A. K. Magnusson, 2012: Modeling
!! waves and wind stress, *J. Geophys. Res. Oceans*, **117**, C00J23,
!! doi:10.1029/2011JC007787.
use mod_spectrum,only:spectrum_type
use mod_const,only:twopi
type(spectrum_type),intent(in) :: spectrum
!! Spectrum instance
type(spectrum_type),intent(in) :: sds_tendency
!! Spectral dissipation tendency instance
real(kind=rk),intent(in) :: snl_coefficient
!! Linear coefficient of the dissipation function
type(spectrum_type) :: tendency
!! Result tendency instance
real(kind=rk),dimension(:,:),allocatable :: sds_spectrum
real(kind=rk),dimension(:,:),allocatable :: s_nl
real(kind=rk),dimension(:),allocatable :: f
real(kind=rk),dimension(:),allocatable :: th
real(kind=rk),dimension(:),allocatable :: k
real(kind=rk),dimension(:),allocatable :: dk
real(kind=rk),dimension(:),allocatable :: w1,w2
real(kind=rk) :: bf1,bf1a,bf2,dlnf
integer :: nfreq,nfreqs
integer :: ndir,ndirs
f = spectrum % getFrequency()
k = spectrum % getWavenumber()
dk = spectrum % getWavenumberSpacing()
th = spectrum % getDirections()
nfreqs = size(f)
ndirs = size(th)
tendency = spectrum
sds_spectrum = sds_tendency % getSpectrum()*spectrum % getSpectrum()
allocate(s_nl(nfreqs,ndirs))
s_nl = 0
allocate(w1(nfreqs),w2(nfreqs))
w1 = 0
w2 = 0
dlnf = (log(f(size(f)))-log(f(1)))/float(nfreqs-1)
bf1 = exp(-16*dlnf**2)
bf2 = exp(-64*dlnf**2)
bf1a = bf1/(bf1+bf2)
bf2 = bf2/(bf1+bf2)
bf1 = bf1a
do nfreq = 1,nfreqs-2
w1(nfreq) = snl_coefficient*bf1*k(nfreq+1)*dk(nfreq+1)/(k(nfreq)*dk(nfreq))
w2(nfreq) = snl_coefficient*bf2*k(nfreq+2)*dk(nfreq+2)/(k(nfreq)*dk(nfreq))
enddo
do concurrent(ndir=1:ndirs)
do nfreq = 1,nfreqs-2
s_nl(nfreq,ndir) = w1(nfreq)*sds_spectrum(nfreq+1,ndir)&
+ w2(nfreq)*sds_spectrum(nfreq+2,ndir)&
- snl_coefficient*sds_spectrum(nfreq,ndir)
enddo
enddo
tendency = s_nl
deallocate(w1,w2,s_nl,sds_spectrum)
endfunction snl_DCCM2012