diff --git a/src/modules/init/moduleInput.f90 b/src/modules/init/moduleInput.f90 index 9891806..c867e23 100644 --- a/src/modules/init/moduleInput.f90 +++ b/src/modules/init/moduleInput.f90 @@ -806,7 +806,7 @@ MODULE moduleInput REAL(8):: effTime REAL(8):: eThreshold !Energy threshold INTEGER:: speciesID - CHARACTER(:), ALLOCATABLE:: speciesName, crossSection + CHARACTER(:), ALLOCATABLE:: speciesName, crossSection, yield LOGICAL:: found INTEGER:: nTypes @@ -872,6 +872,15 @@ MODULE moduleInput CALL initWallTemperature(boundary(i)%bTypes(s)%obj, Tw, cw) + CASE('secondaryEmission') + CALL config%get(object // '.yield', yield, found) + IF (.NOT. found) CALL criticalError("missing parameter 'yield' for secondary emission", 'readBoundary') + CALL config%get(object // '.electron', speciesName, found) + IF (.NOT. found) CALL criticalError("missing parameter 'electron' for secondary emission", 'readBoundary') + speciesID = speciesName2Index(speciesName) + + CALL initSEE(boundary(i)%bTypes(s)%obj, yield, speciesID) + CASE('axis') ALLOCATE(boundaryAxis:: boundary(i)%bTypes(s)%obj) diff --git a/src/modules/mesh/moduleMeshBoundary.f90 b/src/modules/mesh/moduleMeshBoundary.f90 index ffd1af9..90420c6 100644 --- a/src/modules/mesh/moduleMeshBoundary.f90 +++ b/src/modules/mesh/moduleMeshBoundary.f90 @@ -220,7 +220,9 @@ MODULE moduleMeshBoundary CLASS(meshEdge), INTENT(inout):: edge CLASS(particle), INTENT(inout):: part REAL(8):: vRel, eRel - INTEGER:: yield + REAL(8):: yield + INTEGER:: nNewElectrons + REAL(8), ALLOCATABLE:: weight(:) INTEGER:: p REAL(8), DIMENSION(1:3):: rElectron, XiElectron!Position of new electrons INTEGER:: cell @@ -234,9 +236,20 @@ MODULE moduleMeshBoundary eRel = part%species%m*vRel**2*5.D-1 !Get number of secondary electrons macro-particles - yield = INT(part%weight*bound%yield%get(eRel) / bound%electron%weight) + yield = part%weight*bound%yield%get(eRel) + nNewElectrons = FLOOR(yield / bound%electron%weight) + IF (REAL(nNewElectrons) * bound%electron%weight < yield) THEN + nNewElectrons = nNewElectrons + 1 + ALLOCATE(weight(1:nNewElectrons)) + weight(1:nNewElectrons-1) = bound%electron%weight + weight(nNewElectrons) = yield - SUM(weight(1:nNewElectrons-1)) + ELSE + ALLOCATE(weight(1:nNewElectrons)) + weight(1:nNewElectrons) = bound%electron%weight + END IF + !position of impacting ion rElectron = edge%intersection(part%r) XiElectron = mesh%cells(part%cell)%obj%phy2log(rElectron) @@ -250,7 +263,7 @@ MODULE moduleMeshBoundary END IF - DO p = 1, yield + DO p = 1, nNewElectrons !Create new macro-particle ALLOCATE(secondaryElectron) @@ -265,7 +278,7 @@ MODULE moduleMeshBoundary secondaryElectron%cell = cell !Assign weight - secondaryElectron%weight = bound%electron%weight + secondaryElectron%weight = weight(p) !Assume particle is inside the numerical domain secondaryElectron%n_in = .TRUE.