Number of collisions per collision pair

Now the number of collisions is calculated per species pair. This allows
that the randomly particles selected for collisions do not have
collisions assigned.
This commit is contained in:
Jorge Gonzalez 2022-04-23 19:00:33 +02:00
commit 4e9514876e
10 changed files with 111 additions and 46 deletions

View file

@ -243,8 +243,6 @@ MODULE moduleSolver
v_prime = v_minus + fn * crossProduct(v_minus, B)
v_plus = v_minus + 2.D0 * fn / (1.D0 + fn**2 * B**2)*crossProduct(v_prime, B)
PRINT *, v_minus, v_plus
END IF
!Half step for electrostatic
@ -459,6 +457,7 @@ MODULE moduleSolver
INTEGER, SAVE:: nPartNew
INTEGER, SAVE:: nInjIn, nOldIn, nWScheme, nCollisions, nSurfaces
TYPE(particle), ALLOCATABLE, SAVE:: partTemp(:)
INTEGER:: s
!$OMP SECTIONS
!$OMP SECTION
@ -545,7 +544,10 @@ MODULE moduleSolver
!Erase the list of particles inside the cell
DO e = 1, mesh%numVols
mesh%vols(e)%obj%totalWeight = 0.D0
CALL mesh%vols(e)%obj%listPart_in%erase()
DO s = 1, nSpecies
CALL mesh%vols(e)%obj%listPart_in(s)%erase()
END DO
END DO
@ -553,7 +555,10 @@ MODULE moduleSolver
!Erase the list of particles inside the cell in coll mesh
DO e = 1, meshColl%numVols
meshColl%vols(e)%obj%totalWeight = 0.D0
CALL meshColl%vols(e)%obj%listPart_in%erase()
DO s = 1, nSpecies
CALL meshColl%vols(e)%obj%listPart_in(s)%erase()
END DO
END DO
@ -687,6 +692,7 @@ MODULE moduleSolver
REAL(8):: newWeight
TYPE(particle), POINTER:: newPart
INTEGER:: p
INTEGER:: sp
newWeight = part%weight / nSplit
@ -699,12 +705,14 @@ MODULE moduleSolver
ALLOCATE(newPart)
!Copy data from original particle
newPart = part
!Add particle to list of new particles from weighting scheme
CALL OMP_SET_LOCK(lockWScheme)
CALL partWScheme%add(newPart)
CALL OMP_UNSET_LOCK(lockWScheme)
!Add particle to cell list
CALL OMP_SET_lock(vol%lock)
CALL vol%listPart_in%add(newPart)
sp = part%species%n
CALL vol%listPart_in(sp)%add(newPart)
CALL OMP_UNSET_lock(vol%lock)
END DO