From 771e336f872d5c8a2a08d6f8fb19bf77aa85caf3 Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Fri, 8 Apr 2022 19:16:41 +0200 Subject: [PATCH] Cart pusher combined Now, all Cart pushers push particles in 3D, regardless the geometry. --- .gitignore | 1 + src/modules/moduleSolver.f90 | 168 ++++++----------------------------- 2 files changed, 26 insertions(+), 143 deletions(-) diff --git a/.gitignore b/.gitignore index f614574..b27c91c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ obj/ doc/user_manual/ doc/coding_style/ json-fortran-8.2.0/ +json-fortran/ runs/ diff --git a/src/modules/moduleSolver.f90 b/src/modules/moduleSolver.f90 index ba39d4d..69132d2 100644 --- a/src/modules/moduleSolver.f90 +++ b/src/modules/moduleSolver.f90 @@ -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