Main changes:

- Injection is now performed in parallalel (an IF statement could be
  required to avoid overhead when number of injected particles is
  below a margin).
- Added the possibility for multiple injections.
This commit is contained in:
Jorge Gonzalez 2020-10-25 08:08:18 +01:00
commit 73fc9f69c1
6 changed files with 80 additions and 76 deletions

View file

@ -74,31 +74,14 @@ MODULE moduleSolver
END SUBROUTINE doCollisions
!Scatter particles in the grid
SUBROUTINE doScatter
USE moduleSpecies
USE moduleMesh
INTEGER:: n
!Loops over the particles to scatter them
!$OMP DO
DO n=1, nPartOld
CALL mesh%vols(partOld(n)%e_p)%obj%scatter(partOld(n))
END DO
!$OMP END DO
END SUBROUTINE doScatter
SUBROUTINE doReset()
USE moduleSpecies
IMPLICIT NONE
INTEGER:: nn, n
INTEGER:: nPartNew
INTEGER, SAVE:: nPartNew
INTEGER, SAVE:: nInjIn, nOldIn
TYPE(particle), ALLOCATABLE:: partTemp(:)
TYPE(particle), ALLOCATABLE, SAVE:: partTemp(:)
!$OMP SECTIONS
!$OMP SECTION
@ -121,7 +104,10 @@ MODULE moduleSolver
CALL MOVE_ALLOC(partOld, partTemp)
nPartNew = nInjIn + nOldIn
ALLOCATE(partOld(1:nPartNew))
!$OMP END SINGLE
!$OMP SECTIONS
!$OMP SECTION
nn = 0
DO n = 1, nPartInj
IF (partInj(n)%n_in) THEN
@ -132,6 +118,8 @@ MODULE moduleSolver
END DO
!$OMP SECTION
nn = nInjIn
DO n = 1, nPartOld
IF (partTemp(n)%n_in) THEN
nn = nn + 1
@ -140,12 +128,31 @@ MODULE moduleSolver
END IF
END DO
!$OMP END SECTIONS
!$OMP SINGLE
nPartOld = nPartNew
!$OMP END SINGLE
END SUBROUTINE doReset
!Scatter particles in the grid
SUBROUTINE doScatter
USE moduleSpecies
USE moduleMesh
INTEGER:: n
!Loops over the particles to scatter them
!$OMP DO
DO n=1, nPartOld
CALL mesh%vols(partOld(n)%e_p)%obj%scatter(partOld(n))
END DO
!$OMP END DO
END SUBROUTINE doScatter
SUBROUTINE doOutput(t)
USE moduleMesh
USE moduleOutput