From e369bccf78ff5343c8df51a342daf8fe6f7ee92b Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Mon, 17 Jul 2023 13:58:57 +0200 Subject: [PATCH] Function to create electrons Still required to assign velocity: - In the direction normal to the surface - Which energy? --- src/modules/mesh/moduleMeshBoundary.f90 | 75 +++++++++++++++++++++++++ src/modules/moduleBoundary.f90 | 14 ++++- 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/src/modules/mesh/moduleMeshBoundary.f90 b/src/modules/mesh/moduleMeshBoundary.f90 index 4f72e10..34dc8a7 100644 --- a/src/modules/mesh/moduleMeshBoundary.f90 +++ b/src/modules/mesh/moduleMeshBoundary.f90 @@ -212,6 +212,79 @@ MODULE moduleMeshBoundary END SUBROUTINE symmetryAxis + SUBROUTINE secondaryEmission(edge, part) + USE moduleSpecies + IMPLICIT NONE + + CLASS(meshEdge), INTENT(inout):: edge + CLASS(particle), INTENT(inout):: part + REAL(8):: vRel, eRel + INTEGER:: yield + INTEGER:: p + REAL(8), DIMENSION(1:3):: rElectron, XiElectron!Position of new electrons + INTEGER:: cell + TYPE(particle), POINTER:: secondaryElectron + + SELECT TYPE(bound => edge%boundary%bTypes(part%species%n)%obj) + TYPE IS(boundarySEE) + !Get relative velocity + vRel = NORM2(part%v) + !Convert to relative energy + 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) + + + !position of impacting ion + rElectron = edge%intersection(part%r) + XiElectron = mesh%cells(part%cell)%obj%phy2log(rElectron) + + !New cell of origin + IF (ASSOCIATED(edge%e1)) THEN + cell = edge%e1%n + + ELSEIF (ASSOCIATED(edge%e2)) THEN + cell = edge%e2%n + + END IF + + DO p = 1, yield + !Create new macro-particle + ALLOCATE(secondaryElectron) + + !Assign species to electron + secondaryElectron%species => bound%electron + + !Assign position to particle + secondaryElectron%r = rElectron + secondaryElectron%Xi = XiElectron + + !Assign cell to electron + secondaryElectron%cell = cell + + !Assign weight + secondaryElectron%weight = bound%electron%weight + + !Assume particle is inside the numerical domain + secondaryElectron%n_in = .TRUE. + + !Assign velocity + + !Add particle to list + CALL partSurfaces%setLock() + CALL partSurfaces%add(secondaryElectron) + CALL partSurfaces%unsetLock() + + END DO + + !Absorb impacting particle + CALL absorption(edge, part) + + END SELECT + + END SUBROUTINE secondaryEmission + !Points the boundary function to specific type SUBROUTINE pointBoundaryFunction(edge, s) USE moduleErrors @@ -239,6 +312,8 @@ MODULE moduleMeshBoundary TYPE IS(boundaryAxis) edge%fBoundary(s)%apply => symmetryAxis + TYPE IS(boundarySEE) + edge%fBoundary(s)%apply => secondaryEmission CLASS DEFAULT CALL criticalError("Boundary type not defined in this geometry", 'pointBoundaryFunction') diff --git a/src/modules/moduleBoundary.f90 b/src/modules/moduleBoundary.f90 index 9fb212f..bfdbd70 100644 --- a/src/modules/moduleBoundary.f90 +++ b/src/modules/moduleBoundary.f90 @@ -50,6 +50,7 @@ MODULE moduleBoundary TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundarySEE !Yield as a function of ion energy TYPE(table1D):: yield + CLASS(speciesGeneric), POINTER:: electron !Electron species for secondary emission CONTAINS END TYPE boundarySEE @@ -145,13 +146,24 @@ MODULE moduleBoundary END SUBROUTINE initIonization - SUBROUTINE initSEE(boundary, tableFile) + SUBROUTINE initSEE(boundary, tableFile, speciesID) + USE moduleRefParam + USE moduleConstParam + USE moduleSpecies IMPLICIT NONE CLASS(boundaryGeneric), ALLOCATABLE, INTENT(out):: boundary CHARACTER(:), ALLOCATABLE, INTENT(in):: tableFile + INTEGER:: speciesID ALLOCATE(boundarySEE:: boundary) + SELECT TYPE(boundary) + TYPE IS(boundarySEE) + CALL boundary%yield%init(tableFile) + CALL boundary%yield%convert(eV2J/(m_ref*v_ref**2), 1.D0) + boundary%electron => species(speciesID)%obj + + END SELECT END SUBROUTINE initSEE