From a0dfc55a69e0cb5292790801a5b021fb67e00c34 Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Fri, 3 Feb 2023 10:52:49 +0100 Subject: [PATCH] Fix an issue in assigning cells in ionization Boundary This assigns the correct random cell when a particle is created from the ionization boundary. Also, the number of possible ionizations is reduced by one if there is a suscesful ionization. This has no impact on the results. --- src/modules/mesh/moduleMeshBoundary.f90 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/mesh/moduleMeshBoundary.f90 b/src/modules/mesh/moduleMeshBoundary.f90 index 6120111..4f72e10 100644 --- a/src/modules/mesh/moduleMeshBoundary.f90 +++ b/src/modules/mesh/moduleMeshBoundary.f90 @@ -156,8 +156,14 @@ MODULE moduleMeshBoundary newElectron%r = edge%randPos() newIon%r = newElectron%r - newElectron%cell = part%cell - newIon%cell = part%cell + IF (ASSOCIATED(edge%e1)) THEN + newElectron%cell = edge%e1%n + + ELSEIF (ASSOCIATED(edge%e2)) THEN + newElectron%cell = edge%e2%n + + END IF + newIon%cell = newElectron%cell newElectron%Xi = mesh%cells(part%cell)%obj%phy2log(newElectron%r) newIon%Xi = newElectron%Xi @@ -178,6 +184,9 @@ MODULE moduleMeshBoundary eRel = eRel - bound%eThreshold vRel = 2.D0*DSQRT(eRel)/mRel + !Reduce number of possible ionizations + nIonizations = nIonizations - 1 + END IF END DO