already_fine Subroutine

public subroutine already_fine(sFi, ichild, fine_min1, fine_min2, fine_min3, fine_max1, fine_max2, fine_max3)

Uses

  • proc~~already_fine~~UsesGraph proc~already_fine already_fine module~mod_forest mod_forest proc~already_fine->module~mod_forest module~mod_global_parameters mod_global_parameters proc~already_fine->module~mod_global_parameters module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants module~mod_physicaldata mod_physicaldata module~mod_global_parameters->module~mod_physicaldata module~mod_variables mod_variables module~mod_global_parameters->module~mod_variables mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

This routine fills the fine faces before prolonging. It is the face equivalent of fix_conserve

Arguments

Type IntentOptional Attributes Name
type(state) :: sFi
integer, intent(in) :: ichild
logical :: fine_min1
logical :: fine_min2
logical :: fine_min3
logical :: fine_max1
logical :: fine_max2
logical :: fine_max3

Called by

proc~~already_fine~~CalledByGraph proc~already_fine already_fine proc~prolong_2nd prolong_2nd proc~prolong_2nd->proc~already_fine proc~prolong_grid prolong_grid proc~prolong_grid->proc~prolong_2nd proc~refine_grids refine_grids proc~refine_grids->proc~prolong_grid proc~amr_coarsen_refine amr_coarsen_refine proc~amr_coarsen_refine->proc~refine_grids proc~resettree resettree proc~resettree->proc~amr_coarsen_refine proc~resettree_convert resettree_convert proc~resettree_convert->proc~amr_coarsen_refine proc~settree settree proc~settree->proc~amr_coarsen_refine proc~main main proc~main->proc~resettree_convert proc~main->proc~settree proc~timeintegration timeintegration proc~main->proc~timeintegration proc~timeintegration->proc~resettree program~agile agile program~agile->proc~main

Source Code

  subroutine already_fine(sFi,ichild,fine_min1,fine_min2,fine_min3,fine_max1,&
     fine_max2,fine_max3)
    use mod_forest
    use mod_global_parameters
    type(tree_node_ptr) :: tree
    type(state) :: sFi
    integer, intent(in) :: ichild
    logical :: fine_min1,fine_min2,fine_min3,fine_max1,fine_max2,fine_max3

    integer :: ineighbor,ipe_neighbor,ibufnext
    integer :: iside,iotherside,i1,i2,i3,nx1,nx2,nx3

    ! Size of the block face
    nx1=ixMhi1-ixMlo1+1;nx2=ixMhi2-ixMlo2+1;nx3=ixMhi3-ixMlo3+1;

    ! Initialise everything to zero and false
    fine_min1=.false.;fine_min2=.false.;fine_min3=.false.;
    fine_max1=.false.;fine_max2=.false.;fine_max3=.false.;
    sFi%ws=zero


    ! This face communication is not needed in 1D
   do iside=1,2
      i1=kr(1,1)*(2*iside-3);i2=kr(2,1)*(2*iside-3);i3=kr(3,1)*(2*iside-3);
      ! This is not necessary at the pole.
      ! We are inside a loop over the children, so the grid index is ichild
      if (neighbor_pole(i1,i2,i3,ichild)/=0) cycle

      ! Get old ipe and igrid of neighbour from array fake_neighbor
      ! Then plug it into the structure pfaces and get the faces
      ineighbor   =old_neighbor(1,i1,i2,i3,ichild)
      ipe_neighbor=old_neighbor(2,i1,i2,i3,ichild)

      iotherside=3-iside
      if (ineighbor>0) then
        if (iside==1) then ! left side
          if (ipe_neighbor==mype) then
            sFi%ws(ixMlo1-1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,1)=pface(iotherside,1,&
               ineighbor)%face(1,1:nx2,1:nx3)
          else
            ibufnext=ibuf_recv+isize(1)
            sFi%ws(ixMlo1-1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,&
               1)=reshape(source=recvbuffer(ibuf_recv:ibufnext-1),&
               shape=shape(sFi%ws(ixMlo1-1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,1)))
            ibuf_recv=ibufnext
          end if
          fine_min1=.true.
        else ! right side
          if (ipe_neighbor==mype) then
            sFi%ws(ixMhi1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,1)=pface(iotherside,1,&
               ineighbor)%face(1,1:nx2,1:nx3)
          else
            ibufnext=ibuf_recv+isize(1)
            sFi%ws(ixMhi1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,&
               1)=reshape(source=recvbuffer(ibuf_recv:ibufnext-1),&
               shape=shape(sFi%ws(ixMhi1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,1)))
            ibuf_recv=ibufnext
          end if
          fine_max1=.true.
        end if
      end if
    end do
    do iside=1,2
      i1=kr(1,2)*(2*iside-3);i2=kr(2,2)*(2*iside-3);i3=kr(3,2)*(2*iside-3);
      ! This is not necessary at the pole.
      ! We are inside a loop over the children, so the grid index is ichild
      if (neighbor_pole(i1,i2,i3,ichild)/=0) cycle

      ! Get old ipe and igrid of neighbour from array fake_neighbor
      ! Then plug it into the structure pfaces and get the faces
      ineighbor   =old_neighbor(1,i1,i2,i3,ichild)
      ipe_neighbor=old_neighbor(2,i1,i2,i3,ichild)

      iotherside=3-iside
      if (ineighbor>0) then
        if (iside==1) then ! left side
          if (ipe_neighbor==mype) then
            sFi%ws(ixMlo1:ixMhi1,ixMlo2-1,ixMlo3:ixMhi3,2)=pface(iotherside,2,&
               ineighbor)%face(1:nx1,1,1:nx3)
          else
            ibufnext=ibuf_recv+isize(2)
            sFi%ws(ixMlo1:ixMhi1,ixMlo2-1,ixMlo3:ixMhi3,&
               2)=reshape(source=recvbuffer(ibuf_recv:ibufnext-1),&
               shape=shape(sFi%ws(ixMlo1:ixMhi1,ixMlo2-1,ixMlo3:ixMhi3,2)))
            ibuf_recv=ibufnext
          end if
          fine_min2=.true.
        else ! right side
          if (ipe_neighbor==mype) then
            sFi%ws(ixMlo1:ixMhi1,ixMhi2,ixMlo3:ixMhi3,2)=pface(iotherside,2,&
               ineighbor)%face(1:nx1,1,1:nx3)
          else
            ibufnext=ibuf_recv+isize(2)
            sFi%ws(ixMlo1:ixMhi1,ixMhi2,ixMlo3:ixMhi3,&
               2)=reshape(source=recvbuffer(ibuf_recv:ibufnext-1),&
               shape=shape(sFi%ws(ixMlo1:ixMhi1,ixMhi2,ixMlo3:ixMhi3,2)))
            ibuf_recv=ibufnext
          end if
          fine_max2=.true.
        end if
      end if
    end do
    do iside=1,2
      i1=kr(1,3)*(2*iside-3);i2=kr(2,3)*(2*iside-3);i3=kr(3,3)*(2*iside-3);
      ! This is not necessary at the pole.
      ! We are inside a loop over the children, so the grid index is ichild
      if (neighbor_pole(i1,i2,i3,ichild)/=0) cycle

      ! Get old ipe and igrid of neighbour from array fake_neighbor
      ! Then plug it into the structure pfaces and get the faces
      ineighbor   =old_neighbor(1,i1,i2,i3,ichild)
      ipe_neighbor=old_neighbor(2,i1,i2,i3,ichild)

      iotherside=3-iside
      if (ineighbor>0) then
        if (iside==1) then ! left side
          if (ipe_neighbor==mype) then
            sFi%ws(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo3-1,3)=pface(iotherside,3,&
               ineighbor)%face(1:nx1,1:nx2,1)
          else
            ibufnext=ibuf_recv+isize(3)
            sFi%ws(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo3-1,&
               3)=reshape(source=recvbuffer(ibuf_recv:ibufnext-1),&
               shape=shape(sFi%ws(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo3-1,3)))
            ibuf_recv=ibufnext
          end if
          fine_min3=.true.
        else ! right side
          if (ipe_neighbor==mype) then
            sFi%ws(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMhi3,3)=pface(iotherside,3,&
               ineighbor)%face(1:nx1,1:nx2,1)
          else
            ibufnext=ibuf_recv+isize(3)
            sFi%ws(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMhi3,&
               3)=reshape(source=recvbuffer(ibuf_recv:ibufnext-1),&
               shape=shape(sFi%ws(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMhi3,3)))
            ibuf_recv=ibufnext
          end if
          fine_max3=.true.
        end if
      end if
    end do

  end subroutine already_fine