Cart pusher combined

Now, all Cart pushers push particles in 3D, regardless the geometry.
This commit is contained in:
Jorge Gonzalez 2022-04-08 19:16:41 +02:00
commit 771e336f87
2 changed files with 26 additions and 143 deletions

1
.gitignore vendored
View file

@ -4,4 +4,5 @@ obj/
doc/user_manual/
doc/coding_style/
json-fortran-8.2.0/
json-fortran/
runs/

View file

@ -72,51 +72,39 @@ MODULE moduleSolver
CASE(0)
self%pushParticle => push0D
CASE(3)
SELECT CASE(pusherType)
CASE('Neutral')
self%pushParticle => push3DCartNeutral
CASE('Electrostatic')
self%pushParticle => push3DCartCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 3D','initPusher')
END SELECT
CASE(2)
CASE(1:3)
SELECT CASE(mesh%geometry)
CASE('Cyl')
SELECT CASE(pusherType)
CASE('Neutral')
self%pushParticle => push2DCylNeutral
CASE('Electrostatic')
self%pushParticle => push2DCylCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 2D Cyl','initPusher')
END SELECT
CASE ('Cart')
SELECT CASE(pusherType)
CASE('Neutral')
self%pushParticle => push2DCartNeutral
self%pushParticle => pushCartNeutral
CASE('Electrostatic')
self%pushParticle => push2DCartCharged
self%pushParticle => pushCartCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 2D Cart','initPusher')
CALL criticalError('Pusher ' // pusherType // ' not found for Cart','initPusher')
END SELECT
CASE('Cyl')
IF (self%dimen == 2) THEN
SELECT CASE(pusherType)
CASE('Neutral')
self%pushParticle => push2DCylNeutral
CASE('Electrostatic')
self%pushParticle => push2DCylCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for Cyl','initPusher')
END SELECT
END IF
END SELECT
CASE(1)
SELECT CASE(mesh%geometry)
CASE('Rad')
SELECT CASE(pusherType)
CASE('Neutral')
@ -126,20 +114,7 @@ MODULE moduleSolver
self%pushParticle => push1DRadCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 1D Rad','initPusher')
END SELECT
CASE('Cart')
SELECT CASE(pusherType)
CASE('Neutral')
self%pushParticle => push1DCartNeutral
CASE('Electrostatic')
self%pushParticle => push1DCartCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 1D Cart','initPusher')
CALL criticalError('Pusher ' // pusherType // ' not found for Rad','initPusher')
END SELECT
@ -210,7 +185,7 @@ MODULE moduleSolver
END SUBROUTINE doPushes
!Push neutral particles in cartesian coordinates
PURE SUBROUTINE push3DCartNeutral(part, tauIn)
PURE SUBROUTINE pushCartNeutral(part, tauIn)
USE moduleSPecies
IMPLICIT NONE
@ -234,10 +209,10 @@ MODULE moduleSolver
part = part_temp
END SUBROUTINE push3DCartNeutral
END SUBROUTINE pushCartNeutral
!Push charged particles in 3D cartesian coordinates
PURE SUBROUTINE push3DCartCharged(part, tauIn)
PURE SUBROUTINE pushCartCharged(part, tauIn)
USE moduleSPecies
USE moduleEM
IMPLICIT NONE
@ -265,7 +240,7 @@ MODULE moduleSolver
part = part_temp
END SUBROUTINE push3DCartCharged
END SUBROUTINE pushCartCharged
!Push one particle. Boris pusher for 2D Cyl Neutral particle
PURE SUBROUTINE push2DCylNeutral(part, tauIn)
@ -345,99 +320,6 @@ MODULE moduleSolver
END SUBROUTINE push2DCylCharged
!Push neutral particles in 2D cartesian coordinates
PURE SUBROUTINE push2DCartNeutral(part, tauIn)
USE moduleSPecies
IMPLICIT NONE
TYPE(particle), INTENT(inout):: part
REAL(8), INTENT(in):: tauIn
TYPE(particle):: part_temp
part_temp = part
!x
part_temp%v(1) = part%v(1)
part_temp%r(1) = part%r(1) + part_temp%v(1)*tauIn
!y
part_temp%v(2) = part%v(2)
part_temp%r(2) = part%r(2) + part_temp%v(2)*tauIn
part = part_temp
END SUBROUTINE push2DCartNeutral
!Push charged particles in 2D cartesian coordinates
PURE SUBROUTINE push2DCartCharged(part, tauIn)
USE moduleSPecies
USE moduleEM
IMPLICIT NONE
TYPE(particle), INTENT(inout):: part
REAL(8), INTENT(in):: tauIn
TYPE(particle):: part_temp
REAL(8):: qmEFt(1:3)
part_temp = part
!Get the electric field at particle position
qmEFt = part_temp%qm*gatherElecField(part_temp)*tauIn
!x
part_temp%v(1) = part%v(1) + qmEFt(1)
part_temp%r(1) = part%r(1) + part_temp%v(1)*tauIn
!y
part_temp%v(2) = part%v(2) + qmEFt(2)
part_temp%r(2) = part%r(2) + part_temp%v(2)*tauIn
part = part_temp
END SUBROUTINE push2DCartCharged
!Push neutral particles in 1D cartesian coordinates
PURE SUBROUTINE push1DCartNeutral(part, tauIn)
USE moduleSPecies
USE moduleEM
IMPLICIT NONE
TYPE(particle), INTENT(inout):: part
REAL(8), INTENT(in):: tauIn
TYPE(particle):: part_temp
part_temp = part
!x
part_temp%v(1) = part%v(1)
part_temp%r(1) = part%r(1) + part_temp%v(1)*tauIn
part = part_temp
END SUBROUTINE push1DCartNeutral
!Push charged particles in 1D cartesian coordinates
PURE SUBROUTINE push1DCartCharged(part, tauIn)
USE moduleSPecies
USE moduleEM
IMPLICIT NONE
TYPE(particle), INTENT(inout):: part
REAL(8), INTENT(in):: tauIn
TYPE(particle):: part_temp
REAL(8):: qmEFt(1:3)
part_temp = part
!Get the electric field at particle position
qmEFt = part_temp%qm*gatherElecField(part_temp)*tauIn
!x
part_temp%v(1) = part%v(1) + qmEFt(1)
part_temp%r(1) = part%r(1) + part_temp%v(1)*tauIn
part = part_temp
END SUBROUTINE push1DCartCharged
!Push one particle. Boris pusher for 1D Radial Neutral particle
PURE SUBROUTINE push1DRadNeutral(part, tauIn)
USE moduleSpecies