Fixing a bug in injection of particles that was creating ghost particles
assumed to be inside the domain but without cell assigned. Now, particles are assumed to be outside the domain (n_in = .FALSE.) until findCell assign them a cell.
This commit is contained in:
parent
88b7dae9e5
commit
5368ff2bf3
3 changed files with 12 additions and 10 deletions
|
|
@ -4,8 +4,10 @@ MODULE moduleInject
|
||||||
TYPE:: injectGeneric
|
TYPE:: injectGeneric
|
||||||
INTEGER:: id
|
INTEGER:: id
|
||||||
CHARACTER(:), ALLOCATABLE:: name
|
CHARACTER(:), ALLOCATABLE:: name
|
||||||
REAL(8):: v !Velocity (module)
|
REAL(8):: vMod !Velocity (module)
|
||||||
REAL(8):: T(1:3) !Temperature
|
REAL(8):: T(1:3) !Temperature
|
||||||
|
REAL(8):: v(1:3) !Velocity(vector)
|
||||||
|
REAL(8):: vTh(1:3) !Thermal Velocity
|
||||||
REAL(8):: n(1:3) !Direction of injection
|
REAL(8):: n(1:3) !Direction of injection
|
||||||
INTEGER:: nParticles !Number of particles to introduce each time step
|
INTEGER:: nParticles !Number of particles to introduce each time step
|
||||||
INTEGER:: pt !Species of injection
|
INTEGER:: pt !Species of injection
|
||||||
|
|
@ -52,12 +54,15 @@ MODULE moduleInject
|
||||||
INTEGER:: phSurface(1:mesh%numEdges)
|
INTEGER:: phSurface(1:mesh%numEdges)
|
||||||
|
|
||||||
self%id = i
|
self%id = i
|
||||||
self%v = v/v_ref
|
self%vMod = v/v_ref
|
||||||
self%n = n
|
self%n = n
|
||||||
self%T = T/T_ref
|
self%T = T/T_ref
|
||||||
self%nParticles = INT(flow*sccm2atomPerS*tau*ti_ref/species(pt)%obj%weight)
|
self%nParticles = INT(flow*sccm2atomPerS*tau*ti_ref/species(pt)%obj%weight)
|
||||||
self%pt = pt
|
self%pt = pt
|
||||||
|
|
||||||
|
self%v = self%v * self%n
|
||||||
|
self%vTh = DSQRT(self%T/species(self%pt)%obj%m)
|
||||||
|
|
||||||
!Gets the edge elements from which particles are injected
|
!Gets the edge elements from which particles are injected
|
||||||
!TODO: Improve this A LOT
|
!TODO: Improve this A LOT
|
||||||
DO e = 1, mesh%numEdges
|
DO e = 1, mesh%numEdges
|
||||||
|
|
@ -116,7 +121,6 @@ MODULE moduleInject
|
||||||
INTEGER:: j
|
INTEGER:: j
|
||||||
INTEGER:: randomEdge
|
INTEGER:: randomEdge
|
||||||
REAL(8):: randomPos
|
REAL(8):: randomPos
|
||||||
REAL(8):: vVec(1:3), vTh(1:3)
|
|
||||||
!Edge nodes
|
!Edge nodes
|
||||||
INTEGER:: n1 = 0, n2 = 0
|
INTEGER:: n1 = 0, n2 = 0
|
||||||
!Edge nodes coordinates
|
!Edge nodes coordinates
|
||||||
|
|
@ -124,9 +128,6 @@ MODULE moduleInject
|
||||||
INTEGER:: nMin, nMax !Min and Max index in partInj array
|
INTEGER:: nMin, nMax !Min and Max index in partInj array
|
||||||
INTEGER:: n
|
INTEGER:: n
|
||||||
|
|
||||||
vVec = self%v * self%n
|
|
||||||
vTh = DSQRT(self%T/species(self%pt)%obj%m)
|
|
||||||
|
|
||||||
!Insert particles
|
!Insert particles
|
||||||
!TODO: Adjust for multiple injections
|
!TODO: Adjust for multiple injections
|
||||||
nMin = 1
|
nMin = 1
|
||||||
|
|
@ -135,7 +136,6 @@ MODULE moduleInject
|
||||||
partInj(nMin:nMax)%pt = self%pt
|
partInj(nMin:nMax)%pt = self%pt
|
||||||
!Assign weight to particle.
|
!Assign weight to particle.
|
||||||
partInj(nMin:nMax)%weight = species(self%pt)%obj%weight
|
partInj(nMin:nMax)%weight = species(self%pt)%obj%weight
|
||||||
partInj(nMin:nMax)%n_in = .TRUE.
|
|
||||||
DO n = nMin, nMax
|
DO n = nMin, nMax
|
||||||
!Select edge randomly from which inject particle
|
!Select edge randomly from which inject particle
|
||||||
randomX = RAND()*self%sumWeight
|
randomX = RAND()*self%sumWeight
|
||||||
|
|
@ -176,9 +176,9 @@ MODULE moduleInject
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
partInj(n)%v = (/ vBC(vVec(1), vTh(1)), &
|
partInj(n)%v = (/ vBC(self%v(1), self%vTh(1)), &
|
||||||
vBC(vVec(2), vTh(2)), &
|
vBC(self%v(2), self%vTh(2)), &
|
||||||
vBC(vVec(3), vTh(3)) /)
|
vBC(self%v(3), self%vTh(3)) /)
|
||||||
|
|
||||||
!Random position in edge
|
!Random position in edge
|
||||||
!TODO: Use edge coordinates and transformations for this process
|
!TODO: Use edge coordinates and transformations for this process
|
||||||
|
|
|
||||||
|
|
@ -451,6 +451,7 @@ MODULE moduleMeshCyl
|
||||||
END IF
|
END IF
|
||||||
part%e_p = self%n
|
part%e_p = self%n
|
||||||
part%xLog = xLog
|
part%xLog = xLog
|
||||||
|
part%n_in = .TRUE.
|
||||||
!Assign particle to listPart_in
|
!Assign particle to listPart_in
|
||||||
CALL OMP_SET_LOCK(self%lock)
|
CALL OMP_SET_LOCK(self%lock)
|
||||||
CALL self%listPart_in%add(part)
|
CALL self%listPart_in%add(part)
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ MODULE moduleSolver
|
||||||
part_temp%v(3) = -sin_alpha*v_p_oh_star(2)+cos_alpha*v_p_oh_star(3)
|
part_temp%v(3) = -sin_alpha*v_p_oh_star(2)+cos_alpha*v_p_oh_star(3)
|
||||||
part_temp%pt = part%pt
|
part_temp%pt = part%pt
|
||||||
part_temp%e_p = part%e_p
|
part_temp%e_p = part%e_p
|
||||||
|
part_temp%n_in = .FALSE. !Assume particle is outside until cell is found
|
||||||
!Copy temporal particle to particle
|
!Copy temporal particle to particle
|
||||||
part=part_temp
|
part=part_temp
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue