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

@ -190,9 +190,9 @@ MODULE moduleMesh2DCart
self%x = (/r1(1), r2(1)/)
self%y = (/r1(2), r2(2)/)
!Normal vector
self%normal = (/ self%y(2)-self%y(1), &
self%x(2)-self%x(1), &
0.D0 /)
self%normal = (/ -(self%y(2)-self%y(1)), &
self%x(2)-self%x(1) , &
0.D0 /)
self%normal = self%normal/NORM2(self%normal)
!Boundary index
@ -243,20 +243,21 @@ MODULE moduleMesh2DCart
END FUNCTION getNodes2DCart
PURE FUNCTION intersection2DCartEdge(self, r0, v0) RESULT(r)
PURE FUNCTION intersection2DCartEdge(self, r0) RESULT(r)
IMPLICIT NONE
CLASS(meshEdge2DCart), 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%x(1), self%y(1), 0.D0 /)
edge0 = (/self%x(1), self%y(1), 0.D0 /)
edgeV = (/self%x(2), self%y(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 intersection2DCartEdge
@ -496,7 +497,7 @@ MODULE moduleMesh2DCart
!Scatter properties of particle into element nodes
SUBROUTINE scatterQuad(self, part)
USE moduleOutput
USE moduleMath
USE moduleSpecies
IMPLICIT NONE
@ -855,7 +856,7 @@ MODULE moduleMesh2DCart
!Scatter properties of particles into element
SUBROUTINE scatterTria(self, part)
USE moduleOutput
USE moduleMath
USE moduleSpecies
IMPLICIT NONE