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
|
|
@ -338,7 +338,7 @@ MODULE moduleInput
|
|||
!Mean velocity and temperature at particle position
|
||||
REAL(8):: velocityXi(1:3), temperatureXi
|
||||
INTEGER:: nNewPart = 0.D0
|
||||
CLASS(meshCell), POINTER:: vol
|
||||
CLASS(meshCell), POINTER:: cell
|
||||
TYPE(particle), POINTER:: partNew
|
||||
REAL(8):: vTh
|
||||
TYPE(lNode), POINTER:: partCurr, partNext
|
||||
|
|
@ -394,12 +394,12 @@ MODULE moduleInput
|
|||
partNew%v(2) = velocityXi(2) + vTh*randomMaxwellian()
|
||||
partNew%v(3) = velocityXi(3) + vTh*randomMaxwellian()
|
||||
|
||||
partNew%vol = e
|
||||
partNew%cell = e
|
||||
IF (doubleMesh) THEN
|
||||
partNew%volColl = findCellBrute(meshColl, partNew%r)
|
||||
partNew%cellColl = findCellBrute(meshColl, partNew%r)
|
||||
|
||||
ELSE
|
||||
partNew%volColl = partNew%vol
|
||||
partNew%cellColl = partNew%cell
|
||||
|
||||
END IF
|
||||
|
||||
|
|
@ -411,11 +411,14 @@ MODULE moduleInput
|
|||
CALL partInitial%add(partNew)
|
||||
|
||||
!Assign particle to list in volume
|
||||
vol => meshforMCC%cells(partNew%volColl)%obj
|
||||
CALL OMP_SET_LOCK(vol%lock)
|
||||
CALL vol%listPart_in(sp)%add(partNew)
|
||||
vol%totalWeight(sp) = vol%totalWeight(sp) + partNew%weight
|
||||
CALL OMP_UNSET_LOCK(vol%lock)
|
||||
IF (doMCC) THEN
|
||||
cell => meshforMCC%cells(partNew%cellColl)%obj
|
||||
CALL OMP_SET_LOCK(cell%lock)
|
||||
CALL cell%listPart_in(sp)%add(partNew)
|
||||
cell%totalWeight(sp) = cell%totalWeight(sp) + partNew%weight
|
||||
CALL OMP_UNSET_LOCK(cell%lock)
|
||||
|
||||
END IF
|
||||
|
||||
END DO
|
||||
|
||||
|
|
@ -628,7 +631,7 @@ MODULE moduleInput
|
|||
REAL(8):: energyThreshold, energyBinding
|
||||
CHARACTER(:), ALLOCATABLE:: electron
|
||||
INTEGER:: e
|
||||
CLASS(meshCell), POINTER:: vol
|
||||
CLASS(meshCell), POINTER:: cell
|
||||
|
||||
!Firstly, check if the object 'interactions' exists
|
||||
CALL config%info('interactions', found)
|
||||
|
|
@ -725,17 +728,17 @@ MODULE moduleInput
|
|||
|
||||
!Init the required arrays in each volume to account for MCC.
|
||||
DO e = 1, meshForMCC%numCells
|
||||
vol => meshForMCC%cells(e)%obj
|
||||
cell => meshForMCC%cells(e)%obj
|
||||
|
||||
!Allocate Maximum cross section per collision pair and assign the initial collision rate
|
||||
ALLOCATE(vol%sigmaVrelMax(1:nCollPairs))
|
||||
vol%sigmaVrelMax = sigmaVrel_ref/(L_ref**2 * v_ref)
|
||||
ALLOCATE(cell%sigmaVrelMax(1:nCollPairs))
|
||||
cell%sigmaVrelMax = sigmaVrel_ref/(L_ref**2 * v_ref)
|
||||
|
||||
IF (collOutput) THEN
|
||||
ALLOCATE(vol%tallyColl(1:nCollPairs))
|
||||
ALLOCATE(cell%tallyColl(1:nCollPairs))
|
||||
DO k = 1, nCollPairs
|
||||
ALLOCATE(vol%tallyColl(k)%tally(1:interactionmatrix(k)%amount))
|
||||
vol%tallyColl(k)%tally = 0
|
||||
ALLOCATE(cell%tallyColl(k)%tally(1:interactionmatrix(k)%amount))
|
||||
cell%tallyColl(k)%tally = 0
|
||||
|
||||
END DO
|
||||
|
||||
|
|
@ -892,6 +895,8 @@ MODULE moduleInput
|
|||
|
||||
END IF
|
||||
|
||||
doMCC = ASSOCIATED(meshForMCC)
|
||||
|
||||
!Get the dimension of the geometry
|
||||
CALL config%get(object // '.dimension', mesh%dimen, found)
|
||||
IF (.NOT. found) THEN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue