Identifying issues

I need a way to compute the energy (velocity) for the emitted particles.

I think I also need a better way to calculate the velocity distribution
of particles being injected or emitted from a surface.
This commit is contained in:
Jorge Gonzalez 2024-07-13 23:34:43 +02:00
commit db804bebc1
2 changed files with 9 additions and 10 deletions

View file

@ -261,12 +261,12 @@ MODULE moduleMeshBoundary
energy = (eRel - bound%energyThreshold) * PI2 / (PI2 + theta**2) + bound%energyThreshold
!Get number of secondary electrons particles
yield = part%weight*bound%yield%get(eRel) * (1.D0 * theta**2 / PI2) !Check equation!
yield = part%weight*bound%yield%get(eRel) * (1.D0 * theta**2 / PI2)
!Convert the number to macro-particles
nNewElectrons = FLOOR(yield / bound%electron%weight)
!If the weight of new macro-particles is below the yield, correct adding a particle
!If the weight of new macro-particles is below the yield, add an additional particle with less weight
IF (REAL(nNewElectrons) * bound%electron%weight < yield) THEN
nNewElectrons = nNewElectrons + 1
ALLOCATE(weight(1:nNewElectrons))
@ -310,7 +310,9 @@ MODULE moduleMeshBoundary
secondaryElectron%n_in = .TRUE.
!Assign velocity
secondaryElectron%v = 2.D0 * edge%normal + 1.D-1 * (/ randomMaxwellian(), randomMaxwellian(), randomMaxwellian() /)
!TODO: Calculate energy and velocity
!TODO: Better way to inject particles from surface. For this and for general injection
secondaryElectron%v = 1.D0 * edge%normal + 1.D-1 * (/ randomMaxwellian(), randomMaxwellian(), randomMaxwellian() /)
!Add particle to list
CALL partSurfaces%setLock()

View file

@ -367,14 +367,11 @@ MODULE moduleInject
self%v(2)%obj%randomVel(), &
self%v(3)%obj%randomVel() /)
!For each direction, velocities have to agree with the direction of injection
DO j = 1, 3
DO WHILE (partInj(n)%v(i)*direction(i) < 0)
partInj(n)%v(i) = self%vMod*direction(i) + self%v(i)%obj%randomVel()
!If velocity is not in the right direction, invert it
IF (DOT_PRODUCT(direction, partInj(n)%v) < 0.D0) THEN
partInj(n)%v = - partInj(n)%v
END DO
END DO
END IF
!Obtain natural coordinates of particle in cell
partInj(n)%Xi = mesh%cells(partInj(n)%cell)%obj%phy2log(partInj(n)%r)