| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(inout) | :: | mg |
Tree containing full grid |
||
| integer, | intent(in) | :: | lvl |
Update coarse values at lvl-1 |
subroutine update_coarse(mg, lvl) type(mg_t), intent(inout) :: mg !< Tree containing full grid integer, intent(in) :: lvl !< Update coarse values at lvl-1 integer :: i, id, nc, nc_c nc = mg%box_size_lvl(lvl) nc_c = mg%box_size_lvl(lvl-1) ! Compute residual do i = 1, size(mg%lvls(lvl)%my_ids) id = mg%lvls(lvl)%my_ids(i) call residual_box(mg, id, nc) end do ! Restrict phi and the residual call mg_restrict_lvl(mg, mg_iphi, lvl) call mg_restrict_lvl(mg, mg_ires, lvl) call mg_fill_ghost_cells_lvl(mg, lvl-1, mg_iphi) ! Set rhs_c = laplacian(phi_c) + restrict(res) where it is refined, and ! store current coarse phi in old. do i = 1, size(mg%lvls(lvl-1)%my_parents) id = mg%lvls(lvl-1)%my_parents(i) ! Set rhs = L phi call mg%box_op(mg, id, nc_c, mg_irhs) ! Add the fine grid residual to rhs mg%boxes(id)%cc(1:nc_c, mg_irhs) = mg%boxes(id)%cc(1:nc_c,& mg_irhs) + mg%boxes(id)%cc(1:nc_c, mg_ires) ! Story a copy of phi mg%boxes(id)%cc(:, mg_iold) = mg%boxes(id)%cc(:, mg_iphi) end do end subroutine update_coarse