Get ghost cells for a fine neighbor
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_box_t), | intent(in) | :: | box | |||
| integer, | intent(in) | :: | nb |
Direction of fine neighbor |
||
| integer, | intent(in) | :: | di(2) |
Index offset of fine neighbor |
||
| integer, | intent(in) | :: | nc | |||
| integer, | intent(in) | :: | iv | |||
| real(kind=dp), | intent(out) | :: | gc(nc) |
subroutine box_gc_for_fine_neighbor(box, nb, di, nc, iv, gc) type(mg_box_t), intent(in) :: box integer, intent(in) :: nb !< Direction of fine neighbor integer, intent(in) :: di(2) !< Index offset of fine neighbor integer, intent(in) :: nc, iv real(dp), intent(out) :: gc(nc) real(dp) :: tmp(0:nc/2+1), grad(2-1) integer :: i, hnc hnc = nc/2 ! First fill a temporary array with data next to the fine grid select case (nb) case (mg_neighb_lowx) tmp = box%cc(1, di(2):di(2)+hnc+1, iv) case (mg_neighb_highx) tmp = box%cc(nc, di(2):di(2)+hnc+1, iv) case (mg_neighb_lowy) tmp = box%cc(di(1):di(1)+hnc+1, 1, iv) case (mg_neighb_highy) tmp = box%cc(di(1):di(1)+hnc+1, nc, iv) case default error stop end select ! Now interpolate the coarse grid data to obtain values 'straight' next to ! the fine grid points do i = 1, hnc grad(1) = 0.125_dp * (tmp(i+1) - tmp(i-1)) gc(2*i-1) = tmp(i) - grad(1) gc(2*i) = tmp(i) + grad(1) end do end subroutine box_gc_for_fine_neighbor