The routine that actually fills the ghost cells
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(inout) | :: | mg | |||
| integer, | intent(in) | :: | id | |||
| integer, | intent(in) | :: | nc | |||
| integer, | intent(in) | :: | iv | |||
| logical, | intent(in) | :: | dry_run |
subroutine set_ghost_cells(mg, id, nc, iv, dry_run) type(mg_t), intent(inout) :: mg integer, intent(in) :: id integer, intent(in) :: nc integer, intent(in) :: iv logical, intent(in) :: dry_run real(dp) :: bc(1) integer :: nb, nb_id, nb_rank, bc_type do nb = 1, mg_num_neighbors nb_id = mg%boxes(id)%neighbors(nb) if (nb_id > mg_no_box) then ! There is a neighbor nb_rank = mg%boxes(nb_id)%rank if (nb_rank /= mg%my_rank) then call fill_buffered_nb(mg, mg%boxes(id), nb_rank, nb, nc, iv,& dry_run) else if (.not. dry_run) then call copy_from_nb(mg%boxes(id), mg%boxes(nb_id), nb, nc, iv) end if else if (nb_id == mg_no_box) then ! Refinement boundary call fill_refinement_bnd(mg, id, nb, nc, iv, dry_run) else if (.not. dry_run) then ! Physical boundary if (mg%phi_bc_data_stored .and. iv == mg_iphi) then ! Copy the boundary conditions stored in the ghost cells of the ! right-hand side call box_get_gc(mg%boxes(id), nb, nc, mg_irhs, bc) bc_type = nb_id else if (associated(mg%bc(nb, iv)%boundary_cond)) then call mg%bc(nb, iv)%boundary_cond(mg%boxes(id), nc, iv, nb,& bc_type, bc) else bc_type = mg%bc(nb, iv)%bc_type bc = mg%bc(nb, iv)%bc_value end if end if call box_set_gc(mg%boxes(id), nb, nc, iv, bc) call bc_to_gc(mg, id, nc, iv, nb, bc_type) end if end do end subroutine set_ghost_cells