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/user_manual/
doc/coding_style/ doc/coding_style/
json-fortran-8.2.0/ json-fortran-8.2.0/
json-fortran/
runs/ runs/

View file

@ -72,22 +72,23 @@ MODULE moduleSolver
CASE(0) CASE(0)
self%pushParticle => push0D self%pushParticle => push0D
CASE(3) CASE(1:3)
SELECT CASE(mesh%geometry)
CASE ('Cart')
SELECT CASE(pusherType) SELECT CASE(pusherType)
CASE('Neutral') CASE('Neutral')
self%pushParticle => push3DCartNeutral self%pushParticle => pushCartNeutral
CASE('Electrostatic') CASE('Electrostatic')
self%pushParticle => push3DCartCharged self%pushParticle => pushCartCharged
CASE DEFAULT CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 3D','initPusher') CALL criticalError('Pusher ' // pusherType // ' not found for Cart','initPusher')
END SELECT END SELECT
CASE(2)
SELECT CASE(mesh%geometry)
CASE('Cyl') CASE('Cyl')
IF (self%dimen == 2) THEN
SELECT CASE(pusherType) SELECT CASE(pusherType)
CASE('Neutral') CASE('Neutral')
self%pushParticle => push2DCylNeutral self%pushParticle => push2DCylNeutral
@ -96,27 +97,14 @@ MODULE moduleSolver
self%pushParticle => push2DCylCharged self%pushParticle => push2DCylCharged
CASE DEFAULT CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 2D Cyl','initPusher') CALL criticalError('Pusher ' // pusherType // ' not found for Cyl','initPusher')
END SELECT END SELECT
CASE ('Cart') END IF
SELECT CASE(pusherType)
CASE('Neutral')
self%pushParticle => push2DCartNeutral
CASE('Electrostatic')
self%pushParticle => push2DCartCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 2D Cart','initPusher')
END SELECT END SELECT
END SELECT
CASE(1)
SELECT CASE(mesh%geometry)
CASE('Rad') CASE('Rad')
SELECT CASE(pusherType) SELECT CASE(pusherType)
CASE('Neutral') CASE('Neutral')
@ -126,20 +114,7 @@ MODULE moduleSolver
self%pushParticle => push1DRadCharged self%pushParticle => push1DRadCharged
CASE DEFAULT CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 1D Rad','initPusher') CALL criticalError('Pusher ' // pusherType // ' not found for 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')
END SELECT END SELECT
@ -210,7 +185,7 @@ MODULE moduleSolver
END SUBROUTINE doPushes END SUBROUTINE doPushes
!Push neutral particles in cartesian coordinates !Push neutral particles in cartesian coordinates
PURE SUBROUTINE push3DCartNeutral(part, tauIn) PURE SUBROUTINE pushCartNeutral(part, tauIn)
USE moduleSPecies USE moduleSPecies
IMPLICIT NONE IMPLICIT NONE
@ -234,10 +209,10 @@ MODULE moduleSolver
part = part_temp part = part_temp
END SUBROUTINE push3DCartNeutral END SUBROUTINE pushCartNeutral
!Push charged particles in 3D cartesian coordinates !Push charged particles in 3D cartesian coordinates
PURE SUBROUTINE push3DCartCharged(part, tauIn) PURE SUBROUTINE pushCartCharged(part, tauIn)
USE moduleSPecies USE moduleSPecies
USE moduleEM USE moduleEM
IMPLICIT NONE IMPLICIT NONE
@ -265,7 +240,7 @@ MODULE moduleSolver
part = part_temp part = part_temp
END SUBROUTINE push3DCartCharged END SUBROUTINE pushCartCharged
!Push one particle. Boris pusher for 2D Cyl Neutral particle !Push one particle. Boris pusher for 2D Cyl Neutral particle
PURE SUBROUTINE push2DCylNeutral(part, tauIn) PURE SUBROUTINE push2DCylNeutral(part, tauIn)
@ -345,99 +320,6 @@ MODULE moduleSolver
END SUBROUTINE push2DCylCharged 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 !Push one particle. Boris pusher for 1D Radial Neutral particle
PURE SUBROUTINE push1DRadNeutral(part, tauIn) PURE SUBROUTINE push1DRadNeutral(part, tauIn)
USE moduleSpecies USE moduleSpecies