Ionization boundary ready to testing.

Fixed an issue in which some particles in the corner were interacting
with the axis boundary. Now the axis acts as a reflective boundary in
case a particle is wrongly assigned to it.
This commit is contained in:
Jorge Gonzalez 2021-03-23 16:43:11 +01:00
commit 12e61731df
3 changed files with 36 additions and 17 deletions

View file

@ -111,6 +111,7 @@ MODULE moduleMeshBoundary
USE moduleSpecies
USE moduleMesh
USE moduleRefParam
USE moduleRandom
IMPLICIT NONE
CLASS(meshEdge), INTENT(inout):: edge
@ -118,6 +119,7 @@ MODULE moduleMeshBoundary
REAL(8):: vRel, eRel, mRel !relative velocity, energy and mass
REAL(8):: ionizationRate
INTEGER:: ionizationPair, p
REAL(8):: v0(1:3) !random velocity of neutral
TYPE(particle), POINTER:: newElectron
TYPE(particle), POINTER:: newIon
@ -128,21 +130,26 @@ MODULE moduleMeshBoundary
eRel = mRel*vRel**2*5.D-1
IF (eRel > bound%eThreshold) THEN
!TODO: Check units
ionizationRate = bound%n0*bound%crossSection%get(eRel)
ionizationRate = part%weight*bound%n0*bound%crossSection%get(eRel)*vRel
ionizationPair = INT(ionizationRate*tauMin*ti_ref/species(bound%sp)%obj%weight)
!Rounds the number of particles up
ionizationPair = NINT(ionizationRate*bound%effectiveTime/species(bound%sp)%obj%weight)
!Create the new pair of particles
DO p = 1, ionizationPair
ALLOCATE(newElectron)
ALLOCATE(newIon)
!Assign random velocity to the neutral
v0(1) = bound%v0(1) + bound%vTh*randomMaxwellian()
v0(2) = bound%v0(2) + bound%vTh*randomMaxwellian()
v0(3) = bound%v0(3) + bound%vTh*randomMaxwellian()
newElectron%sp = part%sp
newIon%sp = bound%sp
newElectron%v = 10.D0*bound%v0 + (1.D0 + bound%deltaV/NORM2(bound%v0))
newIon%v = bound%v0
newElectron%v = v0 + (1.D0 + bound%deltaV*v0/NORM2(v0))
newIon%v = v0
newElectron%r = edge%randPos()
newIon%r = newElectron%r
@ -174,16 +181,18 @@ MODULE moduleMeshBoundary
END DO
!Removes ionizing electron
part%n_in = .FALSE.
END IF
END SELECT
!Removes ionizing electron regardless the number of pair created
part%n_in = .FALSE.
END SUBROUTINE ionization
!Symmetry axis. Dummy function
!Symmetry axis. Reflects particles.
!Although this function should never be called, it is set as a reflective boundary
!to properly deal with possible particles reaching a corner and selecting this boundary.
SUBROUTINE symmetryAxis(edge, part)
USE moduleSpecies
IMPLICIT NONE
@ -191,6 +200,8 @@ MODULE moduleMeshBoundary
CLASS(meshEdge), INTENT(inout):: edge
CLASS(particle), INTENT(inout):: part
CALL reflection(edge, part)
END SUBROUTINE symmetryAxis
!Points the boundary function to specific type