Initializes cblock to handle collisions. This extra block is expected to be coarser than the simulation block, but larger than the maximum object size. It is used to expedite neighbor searches.
With this subroutine, each MPI rank owns a complete and global view of the collision block.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(collision_obj), | intent(inout) | :: | this |
Collision utility |
||
| real(kind=wp), | intent(in) | :: | ds |
Target grid spacing |
||
| integer, | intent(in) | :: | ngc |
Number of ghost cells for collision block |
||
| type(block_obj), | intent(in), | optional | :: | block |
Optional block to conform to |
impure subroutine collision_obj_SetupCollisionBlock(this,ds,ngc,block) !> Initializes cblock to handle collisions. This ! extra block is expected to be coarser than the ! simulation block, but larger than the maximum ! object size. It is used to expedite neighbor ! searches. ! ! With this subroutine, each MPI rank owns a ! complete and global view of the collision block. implicit none class(collision_obj), intent(inout) :: this !! Collision utility real(wp), intent(in) :: ds !! Target grid spacing integer, intent(in) :: ngc !! Number of ghost cells for collision block type(block_obj), intent(in), & optional :: block !! Optional block to conform to ! work variables logical :: periods(3) integer :: lo(3) integer :: hi(3) real(wp):: xhi(3) real(wp):: xlo(3) if (present(block)) then xlo = block%pmin xhi = block%pmax periods = block%periods else if (associated(this%RP)) then xlo = this%RP%block%pmin xhi = this%RP%block%pmax periods = this%RP%block%periods else if (associated(this%PP)) then xlo = this%PP%block%pmin xhi = this%PP%block%pmax periods = this%PP%block%periods else call this%parallel%Stop("Cannot setup collision block without associated data") end if ! Number of grid points lo = [1,1,1] hi = floor((xhi-xlo)/ds) ! Create a uniform grid within each block call this%cblock%Initialize(ngc,this%parallel) ! Impose same periodicity as main simulation block call this%cblock%SetPeriodicity(periods) ! Create a uniform grid call this%cblock%SetupUniformGrid(xlo,xhi,lo,hi) if (associated(this%RP)) then ! Allocate neighbor list allocate(this%RPneighbors(lo(1)-ngc:hi(1)+ngc,lo(2)-ngc:hi(2)+ngc,lo(3)-ngc:hi(3)+ngc)) allocate(this%RPobjincell(lo(1)-ngc:hi(1)+ngc,lo(2)-ngc:hi(2)+ngc,lo(3)-ngc:hi(3)+ngc)) end if if (associated(this%IB)) then ! Allocate neighbor list allocate(this%IBneighbors(lo(1)-ngc:hi(1)+ngc,lo(2)-ngc:hi(2)+ngc,lo(3)-ngc:hi(3)+ngc)) allocate(this%IBobjincell(lo(1)-ngc:hi(1)+ngc,lo(2)-ngc:hi(2)+ngc,lo(3)-ngc:hi(3)+ngc)) end if if (associated(this%PP)) then ! Allocate neighbor list allocate(this%PPneighbors(lo(1)-ngc:hi(1)+ngc,lo(2)-ngc:hi(2)+ngc,lo(3)-ngc:hi(3)+ngc)) allocate(this%PPobjincell(lo(1)-ngc:hi(1)+ngc,lo(2)-ngc:hi(2)+ngc,lo(3)-ngc:hi(3)+ngc)) end if return end subroutine collision_obj_SetupCollisionBlock