mg_phi_bc_store_lvl Subroutine

private subroutine mg_phi_bc_store_lvl(mg, lvl, nc)

Arguments

Type IntentOptional Attributes Name
type(mg_t), intent(inout) :: mg
integer, intent(in) :: lvl
integer, intent(in) :: nc

Calls

proc~~mg_phi_bc_store_lvl~3~~CallsGraph proc~mg_phi_bc_store_lvl~3 mg_phi_bc_store_lvl proc~box_set_gc~3 box_set_gc proc~mg_phi_bc_store_lvl~3->proc~box_set_gc~3

Called by

proc~~mg_phi_bc_store_lvl~3~~CalledByGraph proc~mg_phi_bc_store_lvl~3 mg_phi_bc_store_lvl proc~mg_phi_bc_store~3 mg_phi_bc_store proc~mg_phi_bc_store~3->proc~mg_phi_bc_store_lvl~3

Source Code

  subroutine mg_phi_bc_store_lvl(mg, lvl, nc)
    type(mg_t), intent(inout) :: mg
    integer, intent(in)       :: lvl
    integer, intent(in)       :: nc
    real(dp)                  :: bc(nc, nc)
    integer                   :: i, id, nb, nb_id, bc_type

    do i = 1, size(mg%lvls(lvl)%my_ids)
       id = mg%lvls(lvl)%my_ids(i)
       do nb = 1, mg_num_neighbors
          nb_id = mg%boxes(id)%neighbors(nb)
          if (nb_id < mg_no_box) then
             ! Physical boundary
             if (associated(mg%bc(nb, mg_iphi)%boundary_cond)) then
                call mg%bc(nb, mg_iphi)%boundary_cond(mg%boxes(id), nc,&
                    mg_iphi, nb, bc_type, bc)
             else
                bc_type = mg%bc(nb, mg_iphi)%bc_type
                bc      = mg%bc(nb, mg_iphi)%bc_value
             end if

             ! Store the boundary condition type. This is not globally set in
             ! the tree, but all negative values are treated the same in
             ! other parts of the code
             mg%boxes(id)%neighbors(nb) = bc_type

             ! Store ghost cell data in the right-hand side
             call box_set_gc(mg%boxes(id), nb, nc, mg_irhs, bc)
          end if
       end do
    end do
  end subroutine mg_phi_bc_store_lvl