Merge branch 'feature/collisionPairs' into feature/electromagnetic

Merging branches and fixing a number of important issues:

- Initial particles were not being assigned to the list of particles.

- List of particles was being erased every iteration, even if species
  was not pushed.

These caused issues with the calculation of collisions when a species
was frozen.

Now, things should work properly. All particles are properly added to
the volume list and the list is erased ONLY if the species has been
updated.

I hope that collisions are now properly accounted for per species pair.
This commit is contained in:
Jorge Gonzalez 2022-04-23 20:48:34 +02:00
commit cbb5fe0bf2
12 changed files with 179 additions and 81 deletions

View file

@ -333,6 +333,7 @@ MODULE moduleInput
!Mean velocity and temperature at particle position
REAL(8):: velocityXi(1:3), temperatureXi
INTEGER:: nNewPart = 0.D0
CLASS(meshVol), POINTER:: vol
TYPE(particle), POINTER:: partNew
REAL(8):: vTh
TYPE(lNode), POINTER:: partCurr, partNext
@ -356,7 +357,6 @@ MODULE moduleInput
!Density at centroid of cell
nodes = mesh%vols(e)%obj%getNodes()
nNodes = SIZE(nodes)
!TODO: Procedure to obtain centroid from element (also for printing Electric Field)
fPsi = mesh%vols(e)%obj%fPsi((/0.D0, 0.D0, 0.D0/))
ALLOCATE(source(1:nNodes))
DO j = 1, nNodes
@ -430,6 +430,13 @@ MODULE moduleInput
!Assign particle to temporal list of particles
CALL partInitial%add(partNew)
!Assign particle to list in volume
vol => meshforMCC%vols(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)
END DO
DEALLOCATE(source)
@ -685,7 +692,7 @@ MODULE moduleInput
CALL config%info(object // '.cTypes', found, n_children = nCollisions)
ij = interactionIndex(pt_i,pt_j)
!Allocates the required number of collisions per each pair of species ij
CALL interactionMatrix(ij)%init(nCollisions, species(pt_i)%obj%m, species(pt_j)%obj%m)
CALL interactionMatrix(ij)%init(nCollisions, pt_i, pt_j)
DO k = 1, nCollisions
WRITE (kString, '(I2)') k