Rework of injection of particles with a special focus in 2DCyl to ensure an homogeneous distribution. #51

Merged
JorgeGonz merged 22 commits from issue/injection2DCyl into development 2024-07-11 18:51:43 +02:00
8 changed files with 23 additions and 22 deletions
Showing only changes of commit bc8f205287 - Show all commits

Clean-up!

Trying to reduce warnings and unused variables in the code. This should
not be in this branch.
Jorge Gonzalez 2024-07-11 15:55:02 +02:00

View file

@ -308,7 +308,7 @@ MODULE moduleInput
LOGICAL:: found LOGICAL:: found
CHARACTER(:), ALLOCATABLE:: object CHARACTER(:), ALLOCATABLE:: object
INTEGER:: nInitial INTEGER:: nInitial
INTEGER:: i, j, p, e INTEGER:: i, p, e
CHARACTER(LEN=2):: iString CHARACTER(LEN=2):: iString
CHARACTER(:), ALLOCATABLE:: spName CHARACTER(:), ALLOCATABLE:: spName
INTEGER:: sp INTEGER:: sp
@ -923,7 +923,6 @@ MODULE moduleInput
LOGICAL:: found LOGICAL:: found
CHARACTER(:), ALLOCATABLE:: meshFormat, meshFile CHARACTER(:), ALLOCATABLE:: meshFormat, meshFile
REAL(8):: volume REAL(8):: volume
CHARACTER(:), ALLOCATABLE:: meshFileVTU !Temporary to test VTU OUTPUT
object = 'geometry' object = 'geometry'

View file

@ -582,8 +582,6 @@ MODULE moduleMesh2DCyl
REAL(8):: detJ REAL(8):: detJ
REAL(8):: fPsi(1:4) REAL(8):: fPsi(1:4)
REAL(8):: dPsi(1:3, 1:4), pDer(1:3, 1:3) REAL(8):: dPsi(1:3, 1:4), pDer(1:3, 1:3)
REAL(8):: corrUp, corrDown
REAL(8):: dZ, r2, r1
self%volume = 0.D0 self%volume = 0.D0

View file

@ -108,6 +108,7 @@ MODULE moduleMeshInputGmsh2
READ(10, *) totalNumElem READ(10, *) totalNumElem
!Count edges and volume elements !Count edges and volume elements
numEdges = 0
SELECT TYPE(self) SELECT TYPE(self)
TYPE IS(meshParticles) TYPE IS(meshParticles)
self%numEdges = 0 self%numEdges = 0
@ -342,7 +343,7 @@ MODULE moduleMeshInputGmsh2
DO i = 1, numNodes DO i = 1, numNodes
!Reads the density !Reads the density
READ(10, *), e, density(i) READ(10, *) e, density(i)
END DO END DO
@ -353,7 +354,7 @@ MODULE moduleMeshInputGmsh2
DO i = 1, numNodes DO i = 1, numNodes
!Reads the velocity !Reads the velocity
READ(10, *), e, velocity(i, 1:3) READ(10, *) e, velocity(i, 1:3)
END DO END DO

View file

@ -275,6 +275,7 @@ MODULE moduleMeshInputVTU
END DO END DO
!Count the number of edges !Count the number of edges
numEdges = 0
SELECT CASE(self%dimen) SELECT CASE(self%dimen)
CASE(3) CASE(3)
!Edges are triangles, type 5 in VTK !Edges are triangles, type 5 in VTK

View file

@ -315,9 +315,8 @@ MODULE moduleMeshOutputVTU
CLASS(meshParticles), INTENT(in):: self CLASS(meshParticles), INTENT(in):: self
INTEGER, INTENT(in):: t INTEGER, INTENT(in):: t
INTEGER:: n, i, fileID INTEGER:: i, fileID
CHARACTER(:), ALLOCATABLE:: fileName, fileNameCollection CHARACTER(:), ALLOCATABLE:: fileName, fileNameCollection
TYPE(outputFormat):: output(1:self%numNodes)
fileID = 60 fileID = 60
@ -352,10 +351,9 @@ MODULE moduleMeshOutputVTU
CLASS(meshGeneric), INTENT(in):: self CLASS(meshGeneric), INTENT(in):: self
INTEGER, INTENT(in):: t INTEGER, INTENT(in):: t
INTEGER:: n, i, fileID INTEGER:: fileID
CHARACTER(:), ALLOCATABLE:: fileName, fileNameCollection CHARACTER(:), ALLOCATABLE:: fileName, fileNameCollection
CHARACTER (LEN=iterationDigits):: tstring CHARACTER (LEN=iterationDigits):: tstring
TYPE(outputFormat):: output(1:self%numNodes)
fileID = 62 fileID = 62
@ -424,9 +422,8 @@ MODULE moduleMeshOutputVTU
IMPLICIT NONE IMPLICIT NONE
CLASS(meshParticles), INTENT(in):: self CLASS(meshParticles), INTENT(in):: self
INTEGER:: n, i, fileIDMean, fileIDDeviation INTEGER:: i, fileIDMean, fileIDDeviation
CHARACTER(:), ALLOCATABLE:: fileNameMean, fileNameDeviation CHARACTER(:), ALLOCATABLE:: fileNameMean, fileNameDeviation
TYPE(outputFormat):: output(1:self%numNodes)
fileIDMean = 66 fileIDMean = 66
fileIDDeviation = 67 fileIDDeviation = 67

View file

@ -1025,6 +1025,9 @@ MODULE moduleMesh
ALLOCATE(deltaV_ij(1:cell%listPart_in(i)%amount, 1:3)) ALLOCATE(deltaV_ij(1:cell%listPart_in(i)%amount, 1:3))
ALLOCATE(p_ij(1:cell%listPart_in(i)%amount, 1:3)) ALLOCATE(p_ij(1:cell%listPart_in(i)%amount, 1:3))
ALLOCATE(mass_ij(1:cell%listPart_in(i)%amount)) ALLOCATE(mass_ij(1:cell%listPart_in(i)%amount))
deltaV_ij = 0.D0
p_ij = 0.D0
mass_ij = 0.D0
!Loop over particles of species_i !Loop over particles of species_i
partTemp => cell%listPart_in(i)%head partTemp => cell%listPart_in(i)%head
p = 1 p = 1
@ -1109,6 +1112,9 @@ MODULE moduleMesh
ALLOCATE(deltaV_ji(1:cell%listPart_in(j)%amount, 1:3)) ALLOCATE(deltaV_ji(1:cell%listPart_in(j)%amount, 1:3))
ALLOCATE(p_ji(1:cell%listPart_in(j)%amount, 1:3)) ALLOCATE(p_ji(1:cell%listPart_in(j)%amount, 1:3))
ALLOCATE(mass_ji(1:cell%listPart_in(j)%amount)) ALLOCATE(mass_ji(1:cell%listPart_in(j)%amount))
deltaV_ji = 0.D0
p_ji = 0.D0
mass_ji = 0.D0
!Loop over particles of species_j !Loop over particles of species_j
partTemp => cell%listPart_in(j)%head partTemp => cell%listPart_in(j)%head
p = 1 p = 1

View file

@ -151,28 +151,29 @@ MODULE moduleInject
! Information about species and flux ! Information about species and flux
self%species => species(sp)%obj self%species => species(sp)%obj
tauInject = tau(self%species%n) tauInject = tau(self%species%n)
! Convert units
SELECT CASE(units) SELECT CASE(units)
CASE ("sccm") CASE ("sccm")
!Standard cubic centimeter per minute !Standard cubic centimeter per minute
fluxPerStep = flow*sccm2atomPerS*tauInject*ti_ref fluxPerStep = flow*sccm2atomPerS
CASE ("A") CASE ("A")
!Current in Ampers !Current in Ampers
fluxPerStep = flow*tauInject*ti_ref/qe fluxPerStep = flow/qe
CASE ("Am2") CASE ("Am2")
!Input current in Ampers per square meter !Input current in Ampers per square meter
fluxPerStep = flow*tauInject*ti_ref*self%surface*L_ref**2/qe fluxPerStep = flow*self%surface*L_ref**2/qe
CASE ("part/s") CASE ("part/s")
!Input current in Ampers !Input current in Ampers
fluxPerStep = flow*tauInject*ti_ref fluxPerStep = flow
CASE DEFAULT CASE DEFAULT
CALL criticalError("No support for units: " // units, 'initInject') CALL criticalError("No support for units: " // units, 'initInject')
END SELECT END SELECT
fluxPerStep = fluxPerStep / self%surface fluxPerStep = fluxPerStep * tauInject * ti_ref / self%surface
!Assign particles per edge !Assign particles per edge
IF (particlesPerEdge > 0) THEN IF (particlesPerEdge > 0) THEN
@ -307,16 +308,13 @@ MODULE moduleInject
USE moduleMesh USE moduleMesh
USE moduleRandom USE moduleRandom
USE moduleErrors USE moduleErrors
USE moduleRefParam, ONLY: L_ref
IMPLICIT NONE IMPLICIT NONE
CLASS(injectGeneric), INTENT(in):: self CLASS(injectGeneric), INTENT(in):: self
INTEGER:: randomX INTEGER, SAVE:: nMin
INTEGER, SAVE:: nMin, nMax !Min and Max index in partInj array
INTEGER:: i, e INTEGER:: i, e
INTEGER:: n, sp INTEGER:: n, sp
CLASS(meshEdge), POINTER:: randomEdge CLASS(meshEdge), POINTER:: randomEdge
INTEGER:: particlesPerEdge
REAL(8):: direction(1:3) REAL(8):: direction(1:3)
!Insert particles !Insert particles

View file

@ -30,6 +30,7 @@ MODULE moduleEM
INTEGER, ALLOCATABLE:: nodes(:) INTEGER, ALLOCATABLE:: nodes(:)
INTEGER:: n INTEGER:: n
nNodes = 1
nNodes = edge%nNodes nNodes = edge%nNodes
nodes = edge%getNodes(nNodes) nodes = edge%getNodes(nNodes)