Ionization boundary condition fully tested.

Documentation updated properly.

3D Cartesian geometry also tested.
Documentation updated properly.

Added weighting probability in the injection of particles.
This commit is contained in:
Jorge Gonzalez 2021-03-27 11:38:18 +01:00
commit 2a843547b8
8 changed files with 128 additions and 24 deletions

View file

@ -54,6 +54,8 @@ MODULE moduleInject
INTEGER:: sp !Species of injection
INTEGER:: nEdges
INTEGER, ALLOCATABLE:: edges(:) !Array with edges
REAL(8), ALLOCATABLE:: cumWeight(:) !Array of cummulative probability
REAL(8):: sumWeight
TYPE(velDistCont):: v(1:3) !Velocity distribution function in each direction
CONTAINS
PROCEDURE, PASS:: init => initInject
@ -121,12 +123,21 @@ MODULE moduleInject
DO e=1, mesh%numEdges
IF (mesh%edges(e)%obj%physicalSurface == physicalSurface) THEN
et = et + 1
self%edges(et) = mesh%edges(e)%obj%n
self%edges(et) = mesh%edges(e)%obj%n
END IF
END DO
!Calculates cumulative probability
ALLOCATE(self%cumWeight(1:self%nEdges))
self%cumWeight(1) = mesh%edges(self%edges(et))%obj%weight
DO et = 2, self%nEdges
self%cumWeight(et) = mesh%edges(self%edges(et))%obj%weight + self%cumWeight(et-1)
END DO
self%sumWeight = self%cumWeight(self%nEdges)
nPartInj = nPartInj + self%nParticles
END SUBROUTINE initInject
@ -229,7 +240,7 @@ 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