Issue with random position in volumes

Fixed an issue in which  the position in triangular an thetrahedron
elements were not correctly being computed.

Other minor issues fixed:
  - Units in input file now do not use '/'.
  - Collisions accuratly conserve momentum.
  - Minor improvements in mass calculation in collisions.
This commit is contained in:
Jorge Gonzalez 2021-05-24 12:37:16 +02:00
commit 9af3429395
7 changed files with 95 additions and 35 deletions

View file

@ -622,7 +622,7 @@ MODULE moduleMesh2DCart
REAL(8), ALLOCATABLE:: fPsi(:)
xii(1) = random( 0.D0, 1.D0)
xii(2) = random( 0.D0, 1.D0)
xii(2) = random( 0.D0, 1.D0 - xii(1))
xii(3) = 0.D0
fPsi = self%fPsi(xii)

View file

@ -643,10 +643,9 @@ MODULE moduleMesh2DCyl
REAL(8), ALLOCATABLE:: fPsi(:)
xii(1) = random( 0.D0, 1.D0)
xii(2) = random( 0.D0, 1.D0)
xii(2) = random( 0.D0, 1.D0 - xii(1))
xii(3) = 0.D0
ALLOCATE(fPsi(1:3))
fPsi = self%fPsi(xii)
r(1) = DOT_PRODUCT(fPsi, self%z)

View file

@ -215,7 +215,9 @@ MODULE moduleMesh3DCart
REAL(8):: xii(1:3)
REAL(8):: fPsi(1:3)
xii = (/random(), random(), 0.D0 /)
xii(1) = random( 0.D0, 1.D0)
xii(2) = random( 0.D0, 1.D0 - xii(1))
xii(3) = 0.D0
fPsi = self%fPsi(xii)
r = (/DOT_PRODUCT(fPsi, self%x), &
@ -294,9 +296,9 @@ MODULE moduleMesh3DCart
REAL(8):: xii(1:3)
REAL(8), ALLOCATABLE:: fPsi(:)
xii(1) = random(0.D0, 1.D0)
xii(2) = random(0.D0, 1.D0)
xii(3) = random(0.D0, 1.D0)
xii(1) = random( 0.D0, 1.D0)
xii(2) = random( 0.D0, 1.D0 - xii(1))
xii(3) = random( 0.D0, 1.D0 - xii(1) - xii(2))
ALLOCATE(fPsi(1:4))
fPsi = self%fPsi(xii)

View file

@ -43,7 +43,7 @@ MODULE moduleMeshOutputGmsh2
WRITE(60, "(A)") '$EndNodeData'
WRITE(60, "(A)") '$NodeData'
WRITE(60, "(A)") '1'
WRITE(60, "(A)") '"' // species(i)%obj%name // ' velocity (m/s)"'
WRITE(60, "(A)") '"' // species(i)%obj%name // ' velocity (m s^-1)"'
WRITE(60, *) 1
WRITE(60, *) time
WRITE(60, *) 3
@ -189,7 +189,7 @@ MODULE moduleMeshOutputGmsh2
WRITE(20, "(A)") '$ElementData'
WRITE(20, "(A)") '1'
WRITE(20, "(A)") '"Electric Field (V/m)"'
WRITE(20, "(A)") '"Electric Field (V m^-1)"'
WRITE(20, *) 1
WRITE(20, *) time
WRITE(20, *) 3

View file

@ -186,15 +186,6 @@ MODULE moduleMesh
END SUBROUTINE initVol_interface
SUBROUTINE scatter_interface(self, part)
USE moduleSpecies
IMPORT:: meshVol
CLASS(meshVol), INTENT(in):: self
CLASS(particle), INTENT(in):: part
END SUBROUTINE scatter_interface
PURE FUNCTION gatherEF_interface(self, xi) RESULT(EF)
IMPORT:: meshVol
CLASS(meshVol), INTENT(in):: self
@ -574,6 +565,7 @@ MODULE moduleMesh
!TODO: try to combine this with the findCell for a regular mesh
!Find the volume in which particle reside in the mesh for collisions
!No boundary interaction taken into account
SUBROUTINE findCellCollMesh(part)
USE moduleSpecies
IMPLICIT NONE
@ -669,7 +661,7 @@ MODULE moduleMesh
DO e=1, self%numVols
vol => self%vols(e)%obj
nPart = vol%listPart_in%amount
!Computes iterations if there is more than one particle in the cell
!Calculates number of collisions if there is more than one particle in the cell
IF (nPart > 1) THEN
!Probability of collision
pMax = vol%totalWeight*vol%sigmaVrelMax*tauMin/vol%volume