Fixed an issue with reflection of particles in all geometries and also

assigning the normal vector in 2D and 3D.

3D Cartesian geometry is working properly, although it needs testing.

Still issue with ionization boundary.
This commit is contained in:
Jorge Gonzalez 2021-03-22 12:39:34 +01:00
commit db6b0a2c03
15 changed files with 349 additions and 265 deletions

View file

@ -191,9 +191,9 @@ MODULE moduleMesh2DCyl
self%z = (/r1(1), r2(1)/)
self%r = (/r1(2), r2(2)/)
!Normal vector
self%normal = (/ self%r(2)-self%r(1), &
self%z(2)-self%z(1), &
0.D0 /)
self%normal = (/ -(self%r(2)-self%r(1)), &
self%z(2)-self%z(1) , &
0.D0 /)
self%normal = self%normal/NORM2(self%normal)
!Boundary index
self%boundary => boundary(bt)
@ -221,20 +221,22 @@ MODULE moduleMesh2DCyl
END FUNCTION getNodes2DCyl
PURE FUNCTION intersection2DCylEdge(self, r0, v0) RESULT(r)
PURE FUNCTION intersection2DCylEdge(self, r0) RESULT(r)
USE moduleMath
IMPLICIT NONE
CLASS(meshEdge2DCyl), INTENT(in):: self
REAL(8), DIMENSION(1:3), INTENT(in):: r0, v0
REAL(8), DIMENSION(1:3), INTENT(in):: r0
REAL(8), DIMENSION(1:3):: r
REAL(8), DIMENSION(1:3):: rS !base point of surface
REAL(8):: d
REAL(8), DIMENSION(1:3):: edge0, edgeV
REAL(8):: tI
rS = (/ self%z(1), self%r(1), 0.D0 /)
edge0 = (/self%z(1), self%r(1), 0.D0 /)
edgeV = (/self%z(2), self%r(2), 0.D0 /) - edge0
d = DOT_PRODUCT((rS - r0), self%normal)/DOT_PRODUCT(v0, self%normal)
tI = DOT_PRODUCT(r0 - edge0, edgeV)/DOT_PRODUCT(edgeV, edgeV)
r = r0 + v0*d
r = edge0 + tI*edgeV
END FUNCTION intersection2DCylEdge
@ -507,7 +509,7 @@ MODULE moduleMesh2DCyl
!Scatter properties of particle into element nodes
SUBROUTINE scatterQuad(self, part)
USE moduleOutput
USE moduleMath
USE moduleSpecies
IMPLICIT NONE
@ -874,7 +876,7 @@ MODULE moduleMesh2DCyl
!Scatter properties of particles into element
SUBROUTINE scatterTria(self, part)
USE moduleOutput
USE moduleMath
USE moduleSpecies
IMPLICIT NONE