Returns grid spacing array in y-direction including halo cells.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(domain_type), | intent(in) | :: | self | Domain instance |
||
integer(kind=ik), | intent(in), | dimension(2) | :: | halowidth | Integer width of halo region |
|
logical, | intent(in) | :: | periodic | If |
Grid spacing in y [m]
pure function getGridSpacingYWithHalo(self,halowidth,periodic) result(dy)
!! Returns grid spacing array in y-direction including halo cells.
class(domain_type),intent(in) :: self
!! Domain instance
integer(kind=ik),dimension(2),intent(in) :: halowidth
!! Integer width of halo region
logical,intent(in) :: periodic
!! If `.true.`, halo cells will be updated with values corresponding to
!! periodic boundary conditions
real(kind=rk),dimension(:,:),allocatable :: dy
!! Grid spacing in y [m]
associate(lb => self % lb,ub => self % ub,hw => halowidth)
allocate(dy(lb(1)-hw(1):ub(1)+hw(1),lb(2)-hw(2):ub(2)+hw(2)))
dy = 0
dy(lb(1):ub(1),lb(2):ub(2)) = self % dy
! Set halo values for periodic boundary conditions
if(periodic)then
dy(lb(1)-hw(1):lb(1)-1,:) = dy(ub(1)-hw(1)+1:ub(1),:)
dy(ub(1)+1:ub(1)+hw(1),:) = dy(lb(1):lb(1)+hw(1)-1,:)
dy(:,lb(2)-hw(2):lb(2)-1) = dy(:,ub(2)-hw(2)+1:ub(2))
dy(:,ub(2)+1:ub(2)+hw(2)) = dy(:,lb(2):lb(2)+hw(2)-1)
endif
endassociate
endfunction getGridSpacingYWithHalo