Restructuring the geometry and pushers

The geometry and push structure has been reworked to allow eassy adding
new pushers.

Documentation not updated yet.

Baseline for merging Cartesian pushers into one.
This commit is contained in:
Jorge Gonzalez 2022-04-08 19:06:12 +02:00
commit 5b5dadce39
18 changed files with 429 additions and 1052 deletions

View file

@ -60,53 +60,90 @@ MODULE moduleSolver
!Init Pusher
SUBROUTINE initPusher(self, pusherType, tau, tauSp)
USE moduleErrors
USE moduleMesh, ONLY: mesh
IMPLICIT NONE
CLASS(pusherGeneric), INTENT(out):: self
CHARACTER(:), ALLOCATABLE:: pusherType
REAL(8):: tau, tauSp
SELECT CASE(pusherType)
!3D Cartesian
CASE('3DCartNeutral')
self%pushParticle => push3DCartNeutral
CASE('3DCartCharged')
self%pushParticle => push3DCartCharged
!2D Cylindrical
CASE('2DCylNeutral')
self%pushParticle => push2DCylNeutral
CASE('2DCylCharged')
self%pushParticle => push2DCylCharged
!2D Cartesian
CASE('2DCartNeutral')
self%pushParticle => push2DCartNeutral
CASE('2DCartCharged')
self%pushParticle => push2DCartCharged
!1D Cartesian
CASE('1DCartNeutral')
self%pushParticle => push1DCartNeutral
CASE('1DCartCharged')
self%pushParticle => push1DCartCharged
!1D Radial
CASE('1DRadNeutral')
self%pushParticle => push1DRadNeutral
CASE('1DRadCharged')
self%pushParticle => push1DRadCharged
CASE('0D')
!TODO: Reorganize if Cart pushers are combined
SELECT CASE(mesh%dimen)
CASE(0)
self%pushParticle => push0D
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found','initPusher')
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)
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
CASE('Electrostatic')
self%pushParticle => push2DCartCharged
CASE DEFAULT
CALL criticalError('Pusher ' // pusherType // ' not found for 2D Cart','initPusher')
END SELECT
END SELECT
CASE(1)
SELECT CASE(mesh%geometry)
CASE('Rad')
SELECT CASE(pusherType)
CASE('Neutral')
self%pushParticle => push1DRadNeutral
CASE('Electrostatic')
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')
END SELECT
END SELECT
END SELECT
@ -172,7 +209,7 @@ MODULE moduleSolver
END SUBROUTINE doPushes
!Push neutral particles in 3D cartesian coordinates
!Push neutral particles in cartesian coordinates
PURE SUBROUTINE push3DCartNeutral(part, tauIn)
USE moduleSPecies
IMPLICIT NONE
@ -195,8 +232,6 @@ MODULE moduleSolver
part_temp%v(3) = part%v(3)
part_temp%r(3) = part%r(3) + part_temp%v(3)*tauIn
part_temp%n_in = .FALSE.
part = part_temp
END SUBROUTINE push3DCartNeutral
@ -228,8 +263,6 @@ MODULE moduleSolver
part_temp%v(3) = part%v(3) + qmEFt(3)
part_temp%r(3) = part%r(3) + part_temp%v(3)*tauIn
part_temp%n_in = .FALSE.
part = part_temp
END SUBROUTINE push3DCartCharged
@ -265,7 +298,7 @@ MODULE moduleSolver
END IF
part_temp%v(2) = cos_alpha*v_p_oh_star(2)+sin_alpha*v_p_oh_star(3)
part_temp%v(3) = -sin_alpha*v_p_oh_star(2)+cos_alpha*v_p_oh_star(3)
part_temp%n_in = .FALSE. !Assume particle is outside until cell is found
!Copy temporal particle to particle
part=part_temp
@ -306,7 +339,7 @@ MODULE moduleSolver
END IF
part_temp%v(2) = cos_alpha*v_p_oh_star(2)+sin_alpha*v_p_oh_star(3)
part_temp%v(3) = -sin_alpha*v_p_oh_star(2)+cos_alpha*v_p_oh_star(3)
part_temp%n_in = .FALSE. !Assume particle is outside until cell is found
!Copy temporal particle to particle
part=part_temp
@ -331,8 +364,6 @@ MODULE moduleSolver
part_temp%v(2) = part%v(2)
part_temp%r(2) = part%r(2) + part_temp%v(2)*tauIn
part_temp%n_in = .FALSE.
part = part_temp
END SUBROUTINE push2DCartNeutral
@ -360,8 +391,6 @@ MODULE moduleSolver
part_temp%v(2) = part%v(2) + qmEFt(2)
part_temp%r(2) = part%r(2) + part_temp%v(2)*tauIn
part_temp%n_in = .FALSE.
part = part_temp
END SUBROUTINE push2DCartCharged
@ -382,8 +411,6 @@ MODULE moduleSolver
part_temp%v(1) = part%v(1)
part_temp%r(1) = part%r(1) + part_temp%v(1)*tauIn
part_temp%n_in = .FALSE.
part = part_temp
END SUBROUTINE push1DCartNeutral
@ -407,8 +434,6 @@ MODULE moduleSolver
part_temp%v(1) = part%v(1) + qmEFt(1)
part_temp%r(1) = part%r(1) + part_temp%v(1)*tauIn
part_temp%n_in = .FALSE.
part = part_temp
END SUBROUTINE push1DCartCharged
@ -442,7 +467,7 @@ MODULE moduleSolver
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
@ -480,7 +505,7 @@ MODULE moduleSolver
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
@ -800,6 +825,9 @@ MODULE moduleSolver
TYPE(particle), INTENT(inout):: part
CLASS(meshVol), POINTER:: volOld, volNew
!Assume that particle is outside the domain
part%n_in = .FALSE.
volOld => mesh%vols(part%vol)%obj
CALL volOld%findCell(part)
CALL findCellColl(part)