Implementation of charge exchange and structure for ionization

processes.
This commit is contained in:
Jorge Gonzalez 2020-12-22 10:41:30 +01:00
commit 35936ea918
9 changed files with 1604 additions and 29 deletions

View file

@ -85,7 +85,6 @@ MODULE moduleInput
!Derived parameters
v_ref = DSQRT(kb*T_ref/m_ref) !reference velocity
!TODO: Make this solver dependent
IF (found_r) THEN
sigma_ref = PI*(r_ref+r_ref)**2 !reference cross section
L_ref = 1.D0/(sigma_ref*n_ref) !mean free path
@ -238,6 +237,8 @@ MODULE moduleInput
REAL(8):: mass, charge
LOGICAL:: found
INTEGER:: i
CHARACTER(:), ALLOCATABLE:: linkName
INTEGER:: linkID
!Gets the number of species
CALL config%info('species', found, n_children = nSpecies)
@ -276,6 +277,39 @@ MODULE moduleInput
END DO
!Reads relations between species
DO i = 1, nSpecies
SELECT TYPE(sp => species(i)%obj)
TYPE IS (speciesNeutral)
!Gets species linked ion
CALL config%get(object // '.ion', linkName, found)
IF (found) THEN
linkID = speciesName2Index(linkName)
sp%ion => species(linkID)%obj
END IF
TYPE IS (speciesCharged)
!Gets species linked neutral
CALL config%get(object // '.neutral', linkName)
IF (found) THEN
linkID = speciesName2Index(linkName)
sp%neutral => species(linkID)%obj
END IF
!Gets species linked ion
CALL config%get(object // '.ion', linkName, found)
IF (found) THEN
linkID = speciesName2Index(linkName)
sp%ion => species(linkID)%obj
END IF
END SELECT
END DO
!Set number of particles to 0 for init state
!TODO: In a future, this should include the particles from init states
nPartOld = 0
@ -289,6 +323,7 @@ MODULE moduleInput
SUBROUTINE readInteractions(config)
USE moduleSpecies
USE moduleCollisions
USE moduleErrors
USE json_module
IMPLICIT NONE
@ -298,10 +333,12 @@ MODULE moduleInput
CHARACTER(:), ALLOCATABLE:: species_i, species_j
CHARACTER(:), ALLOCATABLE:: crossSecFile
CHARACTER(:), ALLOCATABLE:: crossSecFilePath
CHARACTER(:), ALLOCATABLE:: cType
LOGICAL:: found
INTEGER:: nInteractions, nCollisions
INTEGER:: i, k, ij
INTEGER:: pt_i, pt_j
REAL(8):: energyThreshold
CALL initInteractionMatrix(interactionMatrix)
@ -315,15 +352,43 @@ MODULE moduleInput
pt_i = speciesName2Index(species_i)
CALL config%get(object // '.species_j', species_j, found)
pt_j = speciesName2Index(species_j)
CALL config%info(object // '.crossSections', found, n_children = nCollisions)
CALL config%info(object // '.cTypes', found, n_children = nCollisions)
ij = interactionIndex(pt_i,pt_j)
!Allocates the required number of collisions per each pair of species ij
CALL interactionMatrix(ij)%init(nCollisions)
DO k = 1, nCollisions
WRITE (kString, '(I2)') k
CALL config%get(object // '.crossSections(' // TRIM(kString)// ')', crossSecFile, found)
object = 'interactions.collisions(' // TRIM(iString) // ').cTypes(' // TRIM(kString) // ')'
!Reads the cross section file
CALL config%get(object // '.crossSection', crossSecFile, found)
crossSecFilePath = pathCollisions // crossSecFile
CALL interactionMatrix(ij)%collisions(k)%obj%init(crossSecFilePath, species(pt_i)%obj%m, species(pt_j)%obj%m)
IF (.NOT. found) CALL criticalError('crossSection not found for ' // object, 'readInteractions')
!Reads the type of collision
CALL config%get(object // '.type', cType, found)
!Initialize collision type and reads required additional data
SELECT CASE(cType)
CASE ('elastic')
!Elastic collision
CALL initBinaryElastic(interactionMatrix(ij)%collisions(k)%obj, &
crossSecFilePath, species(pt_i)%obj%m, species(pt_j)%obj%m)
CASE ('chargeExchange')
!Resonant charge exchange
CALL initBinaryChargeExchange(interactionMatrix(ij)%collisions(k)%obj, &
crossSecFilePath, species(pt_i)%obj%m, species(pt_j)%obj%m)
CASE ('ionization')
!Electorn impact ionization
CALL config%get(object // '.energyThreshold', found)
IF (.NOT. found) CALL criticalError('energyThreshold not found for collision' // object, 'readInteractions')
CALL initBinaryIonization(interactionMatrix(ij)%collisions(k)%obj, &
crossSecFilePath, energyThreshold, species(pt_i)%obj%m, species(pt_j)%obj%m)
CASE DEFAULT
CALL criticalError('Collision type' // cType // 'not defined yet', 'readInteractions')
END SELECT
END DO