Locks for particle lists are now inside the type.
The lock of a particle list is no longer an external variable, it is now part of the type. New procedures have been added to set and unset the lock.
This commit is contained in:
parent
0677684f85
commit
8199a228c8
5 changed files with 39 additions and 16 deletions
|
|
@ -612,7 +612,7 @@ MODULE moduleInput
|
||||||
nPartOld = 0
|
nPartOld = 0
|
||||||
|
|
||||||
!Initialize the lock for the non-analogue (NA) list of particles
|
!Initialize the lock for the non-analogue (NA) list of particles
|
||||||
CALL OMP_INIT_LOCK(lockWScheme)
|
CALL OMP_INIT_LOCK(partWScheme%lock)
|
||||||
|
|
||||||
END SUBROUTINE readSpecies
|
END SUBROUTINE readSpecies
|
||||||
|
|
||||||
|
|
@ -676,7 +676,7 @@ MODULE moduleInput
|
||||||
CALL config%get('interactions.folderCollisions', pathCollisions, found)
|
CALL config%get('interactions.folderCollisions', pathCollisions, found)
|
||||||
|
|
||||||
!Inits lock for list of particles
|
!Inits lock for list of particles
|
||||||
CALL OMP_INIT_LOCK(lockCollisions)
|
CALL OMP_INIT_LOCK(partCollisions%lock)
|
||||||
|
|
||||||
CALL config%info('interactions.collisions', found, n_children = nPairs)
|
CALL config%info('interactions.collisions', found, n_children = nPairs)
|
||||||
DO i = 1, nPairs
|
DO i = 1, nPairs
|
||||||
|
|
@ -770,6 +770,7 @@ MODULE moduleInput
|
||||||
USE moduleErrors
|
USE moduleErrors
|
||||||
USE moduleSpecies
|
USE moduleSpecies
|
||||||
USE moduleRefParam
|
USE moduleRefParam
|
||||||
|
USE moduleList, ONLY: partSurfaces
|
||||||
USE json_module
|
USE json_module
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
||||||
|
|
@ -862,6 +863,9 @@ MODULE moduleInput
|
||||||
|
|
||||||
END DO
|
END DO
|
||||||
|
|
||||||
|
!Init the list of particles from surfaces
|
||||||
|
CALL OMP_INIT_LOCK(partSurfaces%lock)
|
||||||
|
|
||||||
END SUBROUTINE readBoundary
|
END SUBROUTINE readBoundary
|
||||||
|
|
||||||
!Read the geometry (mesh) for the case
|
!Read the geometry (mesh) for the case
|
||||||
|
|
|
||||||
|
|
@ -169,10 +169,10 @@ MODULE moduleMeshBoundary
|
||||||
newIon%n_in = .TRUE.
|
newIon%n_in = .TRUE.
|
||||||
|
|
||||||
!Add particles to list
|
!Add particles to list
|
||||||
CALL OMP_SET_LOCK(lockSurfaces)
|
CALL partSurfaces%setLock()
|
||||||
CALL partSurfaces%add(newElectron)
|
CALL partSurfaces%add(newElectron)
|
||||||
CALL partSurfaces%add(newIon)
|
CALL partSurfaces%add(newIon)
|
||||||
CALL OMP_UNSET_LOCK(lockSurfaces)
|
CALL partSurfaces%unsetLock()
|
||||||
|
|
||||||
!Electron loses energy due to ionization
|
!Electron loses energy due to ionization
|
||||||
eRel = eRel - bound%eThreshold
|
eRel = eRel - bound%eThreshold
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,6 @@ MODULE moduleCollisions
|
||||||
ELSEIF (electron%weight < neutral%weight) THEN
|
ELSEIF (electron%weight < neutral%weight) THEN
|
||||||
!If primary electron is ligther than neutral, change weight of neutral and create new neutral
|
!If primary electron is ligther than neutral, change weight of neutral and create new neutral
|
||||||
ALLOCATE(remainingNeutral)
|
ALLOCATE(remainingNeutral)
|
||||||
PRINT *, "ionize"
|
|
||||||
|
|
||||||
remainingNeutral = neutral
|
remainingNeutral = neutral
|
||||||
|
|
||||||
|
|
@ -369,13 +368,13 @@ MODULE moduleCollisions
|
||||||
END SELECT
|
END SELECT
|
||||||
|
|
||||||
!Adds new particles to the list
|
!Adds new particles to the list
|
||||||
CALL OMP_SET_LOCK(lockCollisions)
|
CALL partCollisions%setLock()
|
||||||
CALL partCollisions%add(newElectron)
|
CALL partCollisions%add(newElectron)
|
||||||
IF (ASSOCIATED(remainingNeutral)) THEN
|
IF (ASSOCIATED(remainingNeutral)) THEN
|
||||||
CALL partCollisions%add(remainingNeutral)
|
CALL partCollisions%add(remainingNeutral)
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
CALL OMP_UNSET_LOCK(lockCollisions)
|
CALL partCollisions%unsetLock()
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
|
@ -495,9 +494,9 @@ MODULE moduleCollisions
|
||||||
|
|
||||||
!Adds new particles to the list
|
!Adds new particles to the list
|
||||||
IF (ASSOCIATED(remainingIon)) THEN
|
IF (ASSOCIATED(remainingIon)) THEN
|
||||||
CALL OMP_SET_LOCK(lockCollisions)
|
CALL partCollisions%setLock()
|
||||||
CALL partCollisions%add(remainingIon)
|
CALL partCollisions%add(remainingIon)
|
||||||
CALL OMP_UNSET_LOCK(lockCollisions)
|
CALL partCollisions%unsetLock()
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
END SUBROUTINE collideBinaryRecombination
|
END SUBROUTINE collideBinaryRecombination
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,19 @@ MODULE moduleList
|
||||||
INTEGER:: amount = 0
|
INTEGER:: amount = 0
|
||||||
TYPE(lNode),POINTER:: head => NULL()
|
TYPE(lNode),POINTER:: head => NULL()
|
||||||
TYPE(lNode),POINTER:: tail => NULL()
|
TYPE(lNode),POINTER:: tail => NULL()
|
||||||
|
INTEGER(KIND=OMP_LOCK_KIND):: lock
|
||||||
CONTAINS
|
CONTAINS
|
||||||
PROCEDURE,PASS:: add => addToList
|
PROCEDURE,PASS:: add => addToList
|
||||||
PROCEDURE,PASS:: convert2Array
|
PROCEDURE,PASS:: convert2Array
|
||||||
PROCEDURE,PASS:: erase => eraseList
|
PROCEDURE,PASS:: erase => eraseList
|
||||||
|
PROCEDURE,PASS:: setLock
|
||||||
|
PROCEDURE,PASS:: unsetLock
|
||||||
|
|
||||||
END TYPE listNode
|
END TYPE listNode
|
||||||
|
|
||||||
TYPE(listNode):: partWScheme !Particles comming from the nonAnalogue scheme
|
TYPE(listNode):: partWScheme !Particles comming from the nonAnalogue scheme
|
||||||
INTEGER(KIND=OMP_LOCK_KIND):: lockWScheme !Lock for the NA list of particles
|
|
||||||
TYPE(listNode):: partCollisions !Particles created in collisional process
|
TYPE(listNode):: partCollisions !Particles created in collisional process
|
||||||
INTEGER(KIND=OMP_LOCK_KIND):: lockCollisions !Lock for the NA list of particles
|
|
||||||
TYPE(listNode):: partSurfaces !Particles created in surface interactions
|
TYPE(listNode):: partSurfaces !Particles created in surface interactions
|
||||||
INTEGER(KIND=OMP_LOCK_KIND):: lockSurfaces !Lock for the NA list of particles
|
|
||||||
TYPE(listNode):: partInitial !Initial distribution of particles
|
TYPE(listNode):: partInitial !Initial distribution of particles
|
||||||
|
|
||||||
TYPE pointerArray
|
TYPE pointerArray
|
||||||
|
|
@ -80,8 +80,10 @@ MODULE moduleList
|
||||||
END FUNCTION convert2Array
|
END FUNCTION convert2Array
|
||||||
|
|
||||||
!Erase list
|
!Erase list
|
||||||
SUBROUTINE eraseList(self)
|
PURE SUBROUTINE eraseList(self)
|
||||||
CLASS(listNode):: self
|
IMPLICIT NONE
|
||||||
|
|
||||||
|
CLASS(listNode), INTENT(inout):: self
|
||||||
TYPE(lNode),POINTER:: current, next
|
TYPE(lNode),POINTER:: current, next
|
||||||
|
|
||||||
current => self%head
|
current => self%head
|
||||||
|
|
@ -95,4 +97,22 @@ MODULE moduleList
|
||||||
self%amount = 0
|
self%amount = 0
|
||||||
END SUBROUTINE eraseList
|
END SUBROUTINE eraseList
|
||||||
|
|
||||||
|
SUBROUTINE setLock(self)
|
||||||
|
USE OMP_LIB
|
||||||
|
IMPLICIT NONE
|
||||||
|
|
||||||
|
CLASS(listNode):: self
|
||||||
|
CALL OMP_SET_LOCK(self%lock)
|
||||||
|
|
||||||
|
END SUBROUTINE setLock
|
||||||
|
|
||||||
|
SUBROUTINE unsetLock(self)
|
||||||
|
USE OMP_LIB
|
||||||
|
IMPLICIT NONE
|
||||||
|
|
||||||
|
CLASS(listNode):: self
|
||||||
|
CALL OMP_UNSET_LOCK(self%lock)
|
||||||
|
|
||||||
|
END SUBROUTINE unsetLock
|
||||||
|
|
||||||
END MODULE moduleList
|
END MODULE moduleList
|
||||||
|
|
|
||||||
|
|
@ -434,9 +434,9 @@ MODULE moduleSolver
|
||||||
!Copy data from original particle
|
!Copy data from original particle
|
||||||
newPart = part
|
newPart = part
|
||||||
!Add particle to list of new particles from weighting scheme
|
!Add particle to list of new particles from weighting scheme
|
||||||
CALL OMP_SET_LOCK(lockWScheme)
|
CALL partWScheme%setLock()
|
||||||
CALL partWScheme%add(newPart)
|
CALL partWScheme%add(newPart)
|
||||||
CALL OMP_UNSET_LOCK(lockWScheme)
|
CALL partWScheme%unsetLock()
|
||||||
!Add particle to cell list
|
!Add particle to cell list
|
||||||
CALL OMP_SET_lock(vol%lock)
|
CALL OMP_SET_lock(vol%lock)
|
||||||
sp = part%species%n
|
sp = part%species%n
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue