Reducing overhead when no collisions are present
Particles are added to lists only if there are MCC collisions. Hopefully this will reduce overhead when OpenMP is used and no collisions are active.
This commit is contained in:
parent
1c5b887a6d
commit
7ce1b7a4dd
13 changed files with 142 additions and 114 deletions
|
|
@ -480,6 +480,8 @@ MODULE moduleMesh
|
|||
|
||||
!Logical to indicate if an specific mesh for MC Collisions is used
|
||||
LOGICAL:: doubleMesh
|
||||
!Logical to indicate if MCC collisions are performed
|
||||
LOGICAL:: doMCC
|
||||
!Complete path for the two meshes
|
||||
CHARACTER(:), ALLOCATABLE:: pathMeshColl, pathMeshParticle
|
||||
|
||||
|
|
@ -644,15 +646,18 @@ MODULE moduleMesh
|
|||
Xi = self%phy2log(part%r)
|
||||
!Checks if particle is inside 'self' cell
|
||||
IF (self%inside(Xi)) THEN
|
||||
part%vol = self%n
|
||||
part%cell = self%n
|
||||
part%Xi = Xi
|
||||
part%n_in = .TRUE.
|
||||
!Assign particle to listPart_in
|
||||
CALL OMP_SET_LOCK(self%lock)
|
||||
sp = part%species%n
|
||||
CALL self%listPart_in(sp)%add(part)
|
||||
self%totalWeight(sp) = self%totalWeight(sp) + part%weight
|
||||
CALL OMP_UNSET_LOCK(self%lock)
|
||||
IF (doMCC) THEN
|
||||
CALL OMP_SET_LOCK(self%lock)
|
||||
sp = part%species%n
|
||||
CALL self%listPart_in(sp)%add(part)
|
||||
self%totalWeight(sp) = self%totalWeight(sp) + part%weight
|
||||
CALL OMP_UNSET_LOCK(self%lock)
|
||||
|
||||
END IF
|
||||
|
||||
ELSE
|
||||
!If not, searches for a neighbour and repeats the process.
|
||||
|
|
@ -688,14 +693,14 @@ MODULE moduleMesh
|
|||
|
||||
END SUBROUTINE findCell
|
||||
|
||||
!If Coll and Particle are the same, simply copy the part%vol into part%volColl
|
||||
!If Coll and Particle are the same, simply copy the part%cell into part%cellColl
|
||||
SUBROUTINE findCellSameMesh(part)
|
||||
USE moduleSpecies
|
||||
IMPLICIT NONE
|
||||
|
||||
TYPE(particle), INTENT(inout):: part
|
||||
|
||||
part%volColl = part%vol
|
||||
part%cellColl = part%cell
|
||||
|
||||
END SUBROUTINE findCellSameMesh
|
||||
|
||||
|
|
@ -715,16 +720,19 @@ MODULE moduleMesh
|
|||
|
||||
found = .FALSE.
|
||||
|
||||
cell => meshColl%cells(part%volColl)%obj
|
||||
cell => meshColl%cells(part%cellColl)%obj
|
||||
DO WHILE(.NOT. found)
|
||||
Xi = cell%phy2log(part%r)
|
||||
IF (cell%inside(Xi)) THEN
|
||||
part%volColl = cell%n
|
||||
CALL OMP_SET_LOCK(cell%lock)
|
||||
sp = part%species%n
|
||||
CALL cell%listPart_in(sp)%add(part)
|
||||
cell%totalWeight(sp) = cell%totalWeight(sp) + part%weight
|
||||
CALL OMP_UNSET_LOCK(cell%lock)
|
||||
part%cellColl = cell%n
|
||||
IF (doMCC) THEN
|
||||
CALL OMP_SET_LOCK(cell%lock)
|
||||
sp = part%species%n
|
||||
CALL cell%listPart_in(sp)%add(part)
|
||||
cell%totalWeight(sp) = cell%totalWeight(sp) + part%weight
|
||||
CALL OMP_UNSET_LOCK(cell%lock)
|
||||
|
||||
END IF
|
||||
found = .TRUE.
|
||||
|
||||
ELSE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue