The integer part%sp that referenced the species index has been

substituted for a pointer to the species.
This commit is contained in:
Jorge Gonzalez 2021-03-28 15:55:26 +02:00
commit ec128902ad
13 changed files with 94 additions and 87 deletions

View file

@ -1,5 +1,6 @@
!injection of particles
MODULE moduleInject
USE moduleSpecies
!Generic type for velocity distribution function
TYPE, ABSTRACT:: velDistGeneric
@ -51,7 +52,7 @@ MODULE moduleInject
REAL(8):: T(1:3) !Temperature
REAL(8):: n(1:3) !Direction of injection
INTEGER:: nParticles !Number of particles to introduce each time step
INTEGER:: sp !Species of injection
CLASS(speciesGeneric), POINTER:: species !Species of injection
INTEGER:: nEdges
INTEGER, ALLOCATABLE:: edges(:) !Array with edges
REAL(8), ALLOCATABLE:: cumWeight(:) !Array of cummulative probability
@ -86,11 +87,11 @@ MODULE moduleInject
INTEGER:: e, et
INTEGER:: phSurface(1:mesh%numEdges)
self%id = i
self%vMod = v/v_ref
self%n = n
self%T = T/T_ref
self%sp = sp
self%id = i
self%vMod = v/v_ref
self%n = n
self%T = T/T_ref
self%species => species(sp)%obj
SELECT CASE(units)
CASE ("sccm")
!Standard cubic centimeter per minute
@ -224,14 +225,12 @@ MODULE moduleInject
!$OMP SINGLE
nMin = SUM(inject(1:(self%id-1))%nParticles) + 1
nMax = nMin + self%nParticles - 1
!Assign particle type
partInj(nMin:nMax)%sp = self%sp
!Assign weight to particle.
partInj(nMin:nMax)%weight = species(self%sp)%obj%weight
partInj(nMin:nMax)%weight = self%species%weight
!Particle is considered to be outside the domain
partInj(nMin:nMax)%n_in = .FALSE.
!Assign charge/mass to charged particle.
SELECT TYPE(sp => species(self%sp)%obj)
SELECT TYPE(sp => self%species)
TYPE IS(speciesCharged)
partInj(nMin:nMax)%qm = sp%qm
@ -257,6 +256,9 @@ MODULE moduleInject
END IF
!Assign particle type
partInj(n)%species => self%species
partInj(n)%v = (/ self%v(1)%obj%randomVel(), &
self%v(2)%obj%randomVel(), &
self%v(3)%obj%randomVel() /)
@ -264,7 +266,7 @@ MODULE moduleInject
!Obtain natural coordinates of particle in cell
partInj(n)%xi = mesh%vols(partInj(n)%vol)%obj%phy2log(partInj(n)%r)
!Push new particle with the minimum time step
CALL solver%pusher(self%sp)%pushParticle(partInj(n), tauMin)
CALL solver%pusher(self%species%n)%pushParticle(partInj(n), tauMin)
!Assign cell to new particle
CALL solver%updateParticleCell(partInj(n))