Some progress

Fixed an issue with random integer numbers.
Cylindrical coordinates are not perfect yet:
  - Box (cylinder) with initial constant density loses particles at r =
    0
  - Injection density still low in r = 0
This commit is contained in:
Jorge Gonzalez 2024-07-06 19:14:44 +02:00
commit 626e970d82
5 changed files with 31 additions and 8 deletions

View file

@ -313,12 +313,12 @@ MODULE moduleInject
!$OMP DO
DO n = nMin, nMax
randomX = random(1, self%nEdges)
randomX = randomWeighted(self%cumWeight, self%sumWeight)
randomEdge => mesh%edges(self%edges(randomX))%obj
!Random position in edge
partInj(n)%r = randomEdge%randPos()
!Assign weight to particle.
partInj(n)%weight = self%species%weight * sqrt(partInj(n)%r(2) / (0.1D0/L_ref))
partInj(n)%weight = self%species%weight
!Volume associated to the edge:
IF (ASSOCIATED(randomEdge%e1)) THEN
partInj(n)%cell = randomEdge%e1%n