Adjust flux when no particlesPerEdge is used

This does not affects the cases of the IEPC, but I am also doing other
stuff.
This commit is contained in:
Jorge Gonzalez 2025-07-27 18:17:01 +02:00
commit d1e73297eb

View file

@ -199,18 +199,22 @@ MODULE moduleInject
END DO END DO
self%nParticles = SUM(self%particlesPerEdge)
ELSE ELSE
! No particles assigned per edge, use the species weight ! No particles assigned per edge, use the species weight
self%weightPerEdge = self%species%weight self%weightPerEdge = self%species%weight
DO et = 1, self%nEdges DO et = 1, self%nEdges
self%particlesPerEdge(et) = FLOOR(fluxPerStep*mesh%edges(self%edges(et))%obj%surface /self%species%weight) self%particlesPerEdge(et) = max(1,FLOOR(fluxPerStep*mesh%edges(self%edges(et))%obj%surface / self%species%weight))
END DO END DO
END IF
self%nParticles = SUM(self%particlesPerEdge) self%nParticles = SUM(self%particlesPerEdge)
!Rescale weight to match flux
self%weightPerEdge = fluxPerStep * self%surface / (real(self%nParticles))
END IF
!Scale particles for different species steps !Scale particles for different species steps
IF (self%nParticles == 0) CALL criticalError("The number of particles for inject is 0.", 'initInject') IF (self%nParticles == 0) CALL criticalError("The number of particles for inject is 0.", 'initInject')