box_gc_for_fine_neighbor Subroutine

private subroutine box_gc_for_fine_neighbor(box, nb, di, nc, iv, gc)

Get ghost cells for a fine neighbor

Arguments

Type IntentOptional 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)

Called by

proc~~box_gc_for_fine_neighbor~~CalledByGraph proc~box_gc_for_fine_neighbor box_gc_for_fine_neighbor proc~buffer_for_fine_nb buffer_for_fine_nb proc~buffer_for_fine_nb->proc~box_gc_for_fine_neighbor proc~fill_refinement_bnd fill_refinement_bnd proc~fill_refinement_bnd->proc~box_gc_for_fine_neighbor proc~buffer_refinement_boundaries buffer_refinement_boundaries proc~buffer_refinement_boundaries->proc~buffer_for_fine_nb proc~set_ghost_cells set_ghost_cells proc~set_ghost_cells->proc~fill_refinement_bnd proc~mg_fill_ghost_cells_lvl mg_fill_ghost_cells_lvl proc~mg_fill_ghost_cells_lvl->proc~buffer_refinement_boundaries proc~mg_fill_ghost_cells_lvl->proc~set_ghost_cells proc~mg_ghost_cell_buffer_size mg_ghost_cell_buffer_size proc~mg_ghost_cell_buffer_size->proc~buffer_refinement_boundaries proc~mg_ghost_cell_buffer_size->proc~set_ghost_cells proc~mg_allocate_storage mg_allocate_storage proc~mg_allocate_storage->proc~mg_ghost_cell_buffer_size proc~mg_fas_fmg mg_fas_fmg proc~mg_fas_fmg->proc~mg_fill_ghost_cells_lvl proc~mg_fas_vcycle mg_fas_vcycle proc~mg_fas_fmg->proc~mg_fas_vcycle proc~update_coarse update_coarse proc~mg_fas_fmg->proc~update_coarse proc~mg_fas_vcycle->proc~mg_fill_ghost_cells_lvl proc~smooth_boxes smooth_boxes proc~mg_fas_vcycle->proc~smooth_boxes proc~mg_fas_vcycle->proc~update_coarse proc~mg_fill_ghost_cells mg_fill_ghost_cells proc~mg_fill_ghost_cells->proc~mg_fill_ghost_cells_lvl proc~smooth_boxes->proc~mg_fill_ghost_cells_lvl proc~update_coarse->proc~mg_fill_ghost_cells_lvl proc~diffusion_solve diffusion_solve proc~diffusion_solve->proc~mg_fas_fmg proc~diffusion_solve->proc~mg_fas_vcycle proc~diffusion_solve_acoeff diffusion_solve_acoeff proc~diffusion_solve_acoeff->proc~mg_fas_fmg proc~diffusion_solve_acoeff->proc~mg_fas_vcycle proc~diffusion_solve_vcoeff diffusion_solve_vcoeff proc~diffusion_solve_vcoeff->proc~mg_fas_fmg proc~diffusion_solve_vcoeff->proc~mg_fas_vcycle

Source Code

  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