| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(particle_t), | intent(inout) | :: | particle | |||
| integer, | intent(inout) | :: | igrid_particle | |||
| integer, | intent(inout) | :: | ipe_particle | |||
| logical, | intent(out) | :: | BC_applied |
subroutine apply_periodB(particle,igrid_particle,ipe_particle,BC_applied) use mod_global_parameters type(particle_t), intent(inout) :: particle integer, intent(inout) :: igrid_particle, ipe_particle logical,intent(out) :: BC_applied integer :: idim BC_applied = .false. ! get out if we don't have any periodic BC: if (.not. any(periodB(1:ndim))) return ! go through dimensions and try re-inject the particle at the other side do idim=1,ndim if (.not. periodB(idim)) cycle select case(idim) case (1) if (particle%x(1) .lt. xprobmin1) then particle%x(1) = particle%x(1) + (xprobmax1 - xprobmin1) BC_applied = .true. end if if (particle%x(1) .ge. xprobmax1) then particle%x(1) = particle%x(1) - (xprobmax1 - xprobmin1) BC_applied = .true. end if case (2) if (particle%x(2) .lt. xprobmin2) then particle%x(2) = particle%x(2) + (xprobmax2 - xprobmin2) BC_applied = .true. end if if (particle%x(2) .ge. xprobmax2) then particle%x(2) = particle%x(2) - (xprobmax2 - xprobmin2) BC_applied = .true. end if case (3) if (particle%x(3) .lt. xprobmin3) then particle%x(3) = particle%x(3) + (xprobmax3 - xprobmin3) BC_applied = .true. end if if (particle%x(3) .ge. xprobmax3) then particle%x(3) = particle%x(3) - (xprobmax3 - xprobmin3) BC_applied = .true. end if end select end do call find_particle_ipe(particle%x,igrid_particle,ipe_particle) end subroutine apply_periodB