Not fully conservative but works

The code is still not fully conservative in intra-species collisions
(small error) but at least now is working.

I have to test species with different weight.

I have to implement a fully conservation for intra-species.
This commit is contained in:
Jorge Gonzalez 2023-07-11 18:55:20 +02:00
commit f63e34e266
2 changed files with 7 additions and 3 deletions

View file

@ -1055,7 +1055,7 @@ MODULE moduleMesh
rotation(1, 1:3) = (/ cosThe*cosPhi, -sinPhi, sinThe*cosPhi /)
rotation(2, 1:3) = (/ cosThe*sinPhi, cosPhi, sinThe*sinPhi /)
rotation(3, 1:3) = (/-sinThe, 0.D0, cosThe /)
rotation(3, 1:3) = (/-sinThe, 0.D0, cosThe /)
!W at start is = (0, 0, normC), so normW = normC
lW = l * normC
@ -1069,6 +1069,7 @@ MODULE moduleMesh
deltaW_par_square = SQRT(AW * GlW * tauMin)*randomMaxwellian()
deltaW_per_square = SQRT(AW * HlW * tauMin)*randomMaxwellian()
!Random angle to distribute perpendicular change in velocity
theta_per = PI2*random()
!Change W
@ -1076,9 +1077,10 @@ MODULE moduleMesh
W(2) = deltaW_per_square * SIN(theta_per)
W(3) = normC + deltaW_par + deltaW_par_square
!Change particle velocity
!Update particle velocity and return to laboratory frame
partTemp%part%v = velocity + MATMUL(rotation, W)
!Move to the next particle in the list
partTemp => partTemp%next
END DO