Change in injection to achieve uniform density of particles. #50

Merged
JorgeGonz merged 6 commits from issue/injection into development 2024-06-30 10:50:25 +02:00
2 changed files with 6 additions and 23 deletions
Showing only changes of commit 4cadfe5367 - Show all commits

Seems are a bit better

There is still less density in the axis. I don't find a reason why.
There must be a modification to the weight...
Jorge Gonzalez 2024-06-29 22:22:10 +02:00

View file

@ -586,32 +586,16 @@ MODULE moduleMesh2DCyl
!Computes volume per node !Computes volume per node
Xi = (/-5.D-1, -5.D-1, 0.D0/) Xi = (/-5.D-1, -5.D-1, 0.D0/)
r = self%gatherF(Xi, 4, self%r) r = self%gatherF(Xi, 4, self%r)
self%n1%v = self%n1%v + fPsi(1)*r*detJ*PI8 self%n1%v = self%n1%v + fPsi(1)*self%volume
IF (self%r(1) == 0.D0) THEN
self%n1%v = self%n1%v * PI / 2.D0
END IF
Xi = (/ 5.D-1, -5.D-1, 0.D0/) Xi = (/ 5.D-1, -5.D-1, 0.D0/)
r = self%gatherF(Xi, 4, self%r) r = self%gatherF(Xi, 4, self%r)
self%n2%v = self%n2%v + fPsi(2)*r*detJ*PI8 self%n2%v = self%n2%v + fPsi(2)*self%volume
IF (self%r(2) == 0.D0) THEN
self%n2%v = self%n2%v * PI / 2.D0
END IF
Xi = (/ 5.D-1, 5.D-1, 0.D0/) Xi = (/ 5.D-1, 5.D-1, 0.D0/)
r = self%gatherF(Xi, 4, self%r) r = self%gatherF(Xi, 4, self%r)
self%n3%v = self%n3%v + fPsi(3)*r*detJ*PI8 self%n3%v = self%n3%v + fPsi(3)*self%volume
IF (self%r(3) == 0.D0) THEN
self%n3%v = self%n3%v * PI / 2.D0
END IF
Xi = (/-5.D-1, 5.D-1, 0.D0/) Xi = (/-5.D-1, 5.D-1, 0.D0/)
r = self%gatherF(Xi, 4, self%r) r = self%gatherF(Xi, 4, self%r)
self%n4%v = self%n4%v + fPsi(4)*r*detJ*PI8 self%n4%v = self%n4%v + fPsi(4)*self%volume
IF (self%r(4) == 0.D0) THEN
self%n4%v = self%n4%v * PI / 2.D0
END IF
END SUBROUTINE volumeQuad END SUBROUTINE volumeQuad

View file

@ -306,8 +306,6 @@ MODULE moduleInject
nMin = nMin + 1 nMin = nMin + 1
nMax = nMin + self%nParticles - 1 nMax = nMin + self%nParticles - 1
!Assign weight to particle.
partInj(nMin:nMax)%weight = self%species%weight
!Particle is considered to be outside the domain !Particle is considered to be outside the domain
partInj(nMin:nMax)%n_in = .FALSE. partInj(nMin:nMax)%n_in = .FALSE.
!$OMP END SINGLE !$OMP END SINGLE
@ -315,10 +313,11 @@ MODULE moduleInject
!$OMP DO !$OMP DO
DO n = nMin, nMax DO n = nMin, nMax
randomX = randomWeighted(self%cumWeight, self%sumWeight) randomX = randomWeighted(self%cumWeight, self%sumWeight)
randomEdge => mesh%edges(self%edges(randomX))%obj randomEdge => mesh%edges(self%edges(randomX))%obj
!Random position in edge !Random position in edge
partInj(n)%r = randomEdge%randPos() partInj(n)%r = randomEdge%randPos()
!Assign weight to particle.
partInj(n)%weight = self%species%weight
!Volume associated to the edge: !Volume associated to the edge:
IF (ASSOCIATED(randomEdge%e1)) THEN IF (ASSOCIATED(randomEdge%e1)) THEN
partInj(n)%cell = randomEdge%e1%n partInj(n)%cell = randomEdge%e1%n