Final implementation of ionization process by electron impact.

Possibility to input initial species distributions (density, velocity
    and temperature) via an input file for each species.

New moduleRandom includes function to generate random numbers in
different ways (still uses) the implicit RANDOM_NUMBER().
This commit is contained in:
Jorge Gonzalez 2020-12-26 22:45:55 +01:00
commit 9e0d1a7cc7
16 changed files with 363 additions and 86 deletions

View file

@ -148,6 +148,7 @@ MODULE moduleCollisions
part_i, part_j)
USE moduleSpecies
USE moduleConstParam
USE moduleRandom
IMPLICIT NONE
CLASS(collisionBinaryElastic), INTENT(in):: self
@ -160,27 +161,23 @@ MODULE moduleCollisions
REAL(8):: vp_i, vp_j, v_i, v_j !post and pre-collision velocities
REAL(8):: v_ij !sum of velocities modules
REAL(8):: alpha !random angle of scattering
REAL(8):: rnd
!eRel (in units of [m][L]^2[t]^-2
vRel = SUM(DABS(part_i%v-part_j%v)) !TODO make function of norm1
eRel = self%rMass*vRel**2
sigmaVrel = self%crossSec%get(eRel)*vRel
sigmaVrelMaxNew = sigmaVrelMaxNew + sigmaVrel
CALL RANDOM_NUMBER(rnd)
IF (sigmaVrelMaxNew/sigmaVrelMax > rnd) THEN
IF (sigmaVrelMaxNew/sigmaVrelMax > random()) THEN
!Applies the collision
v_i = NORM2(part_i%v)
v_j = NORM2(part_j%v)
v_ij = v_i+v_j
vp_j = v_ij*self%w_i
vp_i = v_ij*self%w_j
CALL RANDOM_NUMBER(rnd)
alpha = PI*rnd
alpha = PI*random()
part_i%v(1) = vp_i*DCOS(alpha)
part_i%v(2) = vp_i*DSIN(alpha)
CALL RANDOM_NUMBER(rnd)
alpha = PI*rnd
alpha = PI*random()
part_j%v(1) = vp_j*DCOS(alpha)
part_j%v(2) = vp_j*DSIN(alpha)
@ -243,8 +240,7 @@ MODULE moduleCollisions
USE moduleSpecies
USE moduleErrors
USE moduleList
USE moduleRefParam !TODO: DELETE
USE moduleConstParam !TODO: DELETE
USE moduleRandom
USE OMP_LIB
IMPLICIT NONE
@ -256,7 +252,6 @@ MODULE moduleCollisions
TYPE(particle), POINTER:: newElectron
REAL(8):: vRel, eRel
REAL(8):: sigmaVrel
REAL(8):: rnd
REAL(8), DIMENSION(1:3):: vp_e, vp_n
!eRel (in units of [m][L]^2[t]^-2
@ -266,8 +261,7 @@ MODULE moduleCollisions
IF (eRel > self%eThreshold) THEN
sigmaVrel = self%crossSec%get(eRel)*vRel
sigmaVrelMaxNew = sigmaVrelMaxNew + sigmaVrel
CALL RANDOM_NUMBER(rnd)
IF (sigmaVrelMaxNew/sigmaVrelMax > rnd) THEN
IF (sigmaVrelMaxNew/sigmaVrelMax > random()) THEN
!Find which particle is the ionizing electron
IF (part_i%sp == self%electron%sp) THEN
electron => part_i
@ -350,6 +344,7 @@ MODULE moduleCollisions
SUBROUTINE collideBinaryChargeExchange(self, sigmaVrelMax, sigmaVrelMaxNew, &
part_i, part_j)
USE moduleSpecies
USE moduleRandom
IMPLICIT NONE
CLASS(collisionBinaryChargeExchange), INTENT(in):: self
@ -359,15 +354,13 @@ MODULE moduleCollisions
REAL(8):: sigmaVrel
REAL(8):: vRel !relative velocity
REAL(8):: eRel !relative energy
REAL(8):: rnd
!eRel (in units of [m][L]^2[t]^-2
vRel = SUM(DABS(part_i%v-part_j%v)) !TODO make function of norm1
eRel = self%rMass*vRel**2
sigmaVrel = self%crossSec%get(eRel)*vRel
sigmaVrelMaxNew = sigmaVrelMaxNew + sigmaVrel
CALL RANDOM_NUMBER(rnd)
IF (sigmaVrelMaxNew/sigmaVrelMax > rnd) THEN
IF (sigmaVrelMaxNew/sigmaVrelMax > random()) THEN
SELECT TYPE(sp => species(part_i%sp)%obj)
TYPE IS (speciesNeutral)
!Species i is neutral, ionize particle i