First attempt at Coulomb collisions #46

Merged
JorgeGonz merged 21 commits from feature/CoulombLinear into development 2023-07-16 14:47:59 +02:00
2 changed files with 6 additions and 4 deletions
Showing only changes of commit ed6c2c46e4 - Show all commits

I'm a fucking idiot

The limit I set to avoid divisions by zero was wront and collisions were
being skipped. It is corrected now.
Jorge Gonzalez 2023-03-29 10:08:11 +02:00

View file

@ -155,7 +155,7 @@ MODULE moduleInput
sigmaVrel_ref = PI*(r_ref+r_ref)**2*v_ref !reference cross section times velocity
ELSE
sigmaVrel_ref = 0.D0 !Assume no collisions
sigmaVrel_ref = L_ref**2 * v_ref
END IF

View file

@ -1016,7 +1016,7 @@ MODULE moduleMesh
W = partTemp%part%v - velocity
normW = NORM2(W)
IF (normW > 1.D-10) THEN
IF (normW < 1.D-12) THEN
!If relative velocity is too low, skip collision and move to next particle
partTemp => partTemp%next
@ -1055,6 +1055,7 @@ MODULE moduleMesh
deltaV = dW(1)*e1 + dW(2)*(COS(rnd)*e2 + SIN(rnd)*e3)
totalDeltaV_ij = totalDeltaV_ij + NORM2(deltaV)
!Change particle velocity
partTemp%part%v = partTemp%part%v + deltaV
@ -1078,6 +1079,7 @@ MODULE moduleMesh
normDeltaV = totalDeltaV_ij / REAL(cell%listPart_in(j)%amount) * &
(coulombMatrix(k)%sp_i%weight*coulombMatrix(k)%sp_i%m) / &
(coulombMatrix(k)%sp_j%weight*coulombMatrix(k)%sp_j%m)
!Loop over particles of species_j
partTemp => cell%listPart_in(j)%head
DO WHILE(ASSOCIATED(partTemp))
@ -1090,7 +1092,7 @@ MODULE moduleMesh
W = partTemp%part%v - velocity
normW = NORM2(W)
IF (normW > 1.D-10) THEN
IF (normW < 1.D-12) THEN
!If relative velocity is too low, skip collision and move to next particle
partTemp => partTemp%next
@ -1111,7 +1113,7 @@ MODULE moduleMesh
dW(2) = ABS(randomMaxwellian()*SQRT(delta_per_square*tauMin))
!Normalize with average exchange per particle
!TODO: This is a dirty trick, it should not be neccessary but I don't lnow why it is.
!TODO: This is a dirty trick to ensure conservation between species
dW = normDeltaV*dW/NORM2(dW)
!System of reference for the velocity change