First implementation of 1D radial case. Only charged particles taked

into account (as in 1D Cartesian case).

The 1D Cathode example case has been modified, having now 2 input files:
  - inputCart.json: Used for Cartesian coordinates
  - inputRad.json:  Used for Radial coordinates

Pusher is a Boris pusher but without z direction.
This commit is contained in:
Jorge Gonzalez 2020-12-13 22:14:37 +01:00
commit d3d070a367
15 changed files with 1024 additions and 109 deletions

View file

@ -73,10 +73,13 @@ MODULE moduleSolver
self%pushParticle => pushCylCharged
CASE('1DCartCharged')
self%pushParticle => push1DCharged
self%pushParticle => push1DCartCharged
CASE('1DRadCharged')
self%pushParticle => push1DRadCharged
CASE DEFAULT
CALL criticalError('Solver ' // pusherType // ' not found','readCase')
CALL criticalError('Pusher ' // pusherType // ' not found','initPusher')
END SELECT
@ -225,7 +228,7 @@ MODULE moduleSolver
END SUBROUTINE pushCylCharged
!Push charged particles in 1D cartesian coordinates
PURE SUBROUTINE push1DCharged(part)
PURE SUBROUTINE push1DCartCharged(part)
USE moduleSPecies
USE moduleEM
IMPLICIT NONE
@ -249,7 +252,47 @@ MODULE moduleSolver
part = part_temp
END SUBROUTINE push1DCharged
END SUBROUTINE push1DCartCharged
!Push one particle. Boris pusher for 1D Radial Charged particle
PURE SUBROUTINE push1DRadCharged(part)
USE moduleSpecies
USE moduleEM
IMPLICIT NONE
TYPE(particle), INTENT(inout):: part
REAL(8):: v_p_oh_star(1:2)
TYPE(particle):: part_temp
REAL(8):: x_new, y_new, r, sin_alpha, cos_alpha
REAL(8):: tauSp
REAL(8):: qmEFt(1:3)!charge*tauSp*EF/mass
part_temp = part
!Time step for the species
tauSp = tau(part_temp%sp)
!Get electric field at particle position
qmEFt = part_temp%qm*gatherElecField(part_temp)*tauSp
!r,theta
v_p_oh_star(1) = part%v(1) + qmEFt(1)
x_new = part%r(1) + v_p_oh_star(1)*tauSp
v_p_oh_star(2) = part%v(2) + qmEFt(2)
y_new = v_p_oh_star(2)*tauSp
r = DSQRT(x_new**2+y_new**2)
part_temp%r(1) = r
IF (r > 0.D0) THEN
sin_alpha = y_new/r
cos_alpha = x_new/r
ELSE
sin_alpha = 0.D0
cos_alpha = 1.D0
END IF
part_temp%v(1) = cos_alpha*v_p_oh_star(1)+sin_alpha*v_p_oh_star(2)
part_temp%v(2) = -sin_alpha*v_p_oh_star(1)+cos_alpha*v_p_oh_star(2)
part_temp%n_in = .FALSE. !Assume particle is outside until cell is found
!Copy temporal particle to particle
part=part_temp
END SUBROUTINE push1DRadCharged
!Do the collisions in all the cells
SUBROUTINE doCollisions()