This routine fills the fine faces before prolonging. It is the face equivalent of fix_conserve
| Type | Intent | Optional | 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 |
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