Returns a 3-d array with group speed values [m/s].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(domain_type), | intent(in) | :: | self | Domain instance |
||
integer(kind=ik), | intent(in), | dimension(2) | :: | halowidth | Integers indicating how many cells to allocate for halo points |
|
logical, | intent(in) | :: | periodic | If |
Group speed [m/s] array
pure function getGroupSpeed(self,halowidth,periodic) result(cg)
!! Returns a 3-d array with group speed values [m/s].
class(domain_type),intent(in) :: self
!! Domain instance
real(kind=rk),dimension(:,:,:),allocatable :: cg
!! Group speed [m/s] array
integer(kind=ik),dimension(2),intent(in) :: halowidth
!! Integers indicating how many cells to allocate for halo points
logical,intent(in) :: periodic
!! If `.true.`, halo cells will be updated with values corresponding to
!! periodic boundary conditions
integer(kind=ik) :: i,j
associate(lb => self % lb,ub => self % ub,hw => halowidth)
allocate(cg(self % nfreqs,lb(1)-hw(1):ub(1)+hw(1),lb(2)-hw(2):ub(2)+hw(2)))
do concurrent(i=lb(1):ub(1),j=lb(2):ub(2))
cg(:,i,j) = self % spectrum(i,j) % getGroupSpeed()
enddo
! Set halo values for periodic boundary conditions
if(periodic)then
cg(:,lb(1)-hw(1):lb(1)-1,:) = cg(:,ub(1)-hw(1)+1:ub(1),:)
cg(:,ub(1)+1:ub(1)+hw(1),:) = cg(:,lb(1):lb(1)+hw(1)-1,:)
cg(:,:,lb(2)-hw(2):lb(2)-1) = cg(:,:,ub(2)-hw(2)+1:ub(2))
cg(:,:,ub(2)+1:ub(2)+hw(2)) = cg(:,:,lb(2):lb(2)+hw(2)-1)
endif
endassociate
endfunction getGroupSpeed