Implementation of ionization process.

Now collisions can have a different time step.

Added species name to output names as it was starting to get confusing
in Gmsh for multiple species.

Output filenames adapted to match any number of iterations.
This commit is contained in:
Jorge Gonzalez 2020-12-25 23:08:59 +01:00
commit e50cc3325b
13 changed files with 569 additions and 375 deletions

View file

@ -67,7 +67,7 @@ MODULE moduleInput
IMPLICIT NONE
TYPE(json_file), INTENT(inout):: config
LOGICAL:: found, found_r
LOGICAL:: found
CHARACTER(:), ALLOCATABLE:: object
object = 'reference'
@ -81,24 +81,29 @@ MODULE moduleInput
CALL config%get(object // '.temperature', T_ref, found)
IF (.NOT. found) CALL criticalError('Reference temperature not found','readReference')
CALL config%get(object // '.radius', r_ref, found_r)
!Derived parameters
v_ref = DSQRT(kb*T_ref/m_ref) !reference velocity
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
!If a reference cross section is given, it is used
CALL config%get(object // '.crossSection', sigma_ref, found)
ELSE
L_ref = DSQRT(kb*T_ref*eps_0/n_ref)/qe !Debye length
!TODO: Obtain right sigma_ref for PIC case
sigma_ref = PI*(4.D-10)**2 !reference cross section
!If not, the reference radius is searched
IF (.NOT. found) THEN
CALL config%get(object // '.radius', r_ref, found)
IF (found) THEN
sigma_ref = PI*(r_ref+r_ref)**2 !reference cross section
ELSE
sigma_ref = 0.D0 !Assume no collisions
END IF
END IF
ti_ref = L_ref/v_ref !reference time
Vol_ref = L_ref**3 !reference volume
EF_ref = qe*n_ref*L_ref/eps_0 !reference electric field
Volt_ref = EF_ref*L_ref !reference voltage
!Derived parameters
L_ref = DSQRT(kb*T_ref*eps_0/n_ref)/qe !reference length
v_ref = DSQRT(kb*T_ref/m_ref) !reference velocity
ti_ref = L_ref/v_ref !reference time
Vol_ref = L_ref**3 !reference volume
EF_ref = qe*n_ref*L_ref/eps_0 !reference electric field
Volt_ref = EF_ref*L_ref !reference voltage
END SUBROUTINE readReference
@ -109,6 +114,8 @@ MODULE moduleInput
USE moduleCaseParam
USE moduleSolver
USE moduleSpecies
USE moduleCollisions
USE moduleOutput
USE json_module
IMPLICIT NONE
@ -120,6 +127,7 @@ MODULE moduleInput
INTEGER:: nTau, nSolver
INTEGER:: i
CHARACTER(2):: iString
CHARACTER(1):: tString
object = 'case'
@ -139,6 +147,17 @@ MODULE moduleInput
END IF
tauMin = MINVAL(tau)
!Calculates iterations between collisions
IF (tauCollisions /= 0.D0) THEN
everyCollisions = INT(tauCollisions/tauMin)
ELSE
CALL warningError('Using minimum time step for collisions')
tauCollisions = tauMin
everyCollisions = 1
END IF
!Gets the simulation time
CALL config%get(object // '.time', time, found)
IF (.NOT. found) CALL criticalError('Required parameter time not found','readCase')
@ -174,9 +193,15 @@ MODULE moduleInput
CALL solver%initWS(WSType)
!Makes tau non-dimensional
!Makes tau(s) non-dimensional
tau = tau / ti_ref
tauMin = tauMin / ti_ref
tauCollisions = tauCollisions / ti_ref
!Sets the format of output files accordint to iteration number
iterationDigits = INT(LOG10(REAL(tmax))) + 1
WRITE(tString, '(I1)') iterationDigits
iterationFormat = "(I" // tString // "." // tString // ")"
END SUBROUTINE readCase
@ -227,6 +252,7 @@ MODULE moduleInput
USE moduleSpecies
USE moduleErrors
USE moduleRefParam
USE moduleList
USE json_module
IMPLICIT NONE
@ -262,6 +288,7 @@ MODULE moduleInput
CASE ("charged")
CALL config%get(object // '.charge', charge, found)
IF (.NOT. found) CALL criticalError("Required parameter charge not found for species " // object, 'readSpecies')
ALLOCATE(species(i)%obj, source=speciesCharged(q = charge, &
qm = charge/mass))
@ -293,7 +320,7 @@ MODULE moduleInput
TYPE IS (speciesCharged)
!Gets species linked neutral
CALL config%get(object // '.neutral', linkName)
CALL config%get(object // '.neutral', linkName, found)
IF (found) THEN
linkID = speciesName2Index(linkName)
sp%neutral => species(linkID)%obj
@ -324,8 +351,10 @@ MODULE moduleInput
!Reads information about interactions between species
SUBROUTINE readInteractions(config)
USE moduleSpecies
USE moduleList
USE moduleCollisions
USE moduleErrors
USE OMP_LIB
USE json_module
IMPLICIT NONE
@ -341,10 +370,17 @@ MODULE moduleInput
INTEGER:: i, k, ij
INTEGER:: pt_i, pt_j
REAL(8):: energyThreshold
CHARACTER(:), ALLOCATABLE:: electron
CALL initInteractionMatrix(interactionMatrix)
!Path for collision cross-section data files
CALL config%get('interactions.folderCollisions', pathCollisions, found)
!Collisional time step
CALL config%get('interactions.tauCollisions', tauCollisions, found)
!Inits lock for list of particles
CALL OMP_INIT_LOCK(lockCollisions)
CALL config%info('interactions.collisions', found, n_children = nInteractions)
DO i = 1, nInteractions
@ -382,10 +418,12 @@ MODULE moduleInput
CASE ('ionization')
!Electorn impact ionization
CALL config%get(object // '.energyThreshold', found)
CALL config%get(object // '.energyThreshold', energyThreshold, found)
IF (.NOT. found) CALL criticalError('energyThreshold not found for collision' // object, 'readInteractions')
CALL config%get(object // '.electron', electron, found)
IF (.NOT. found) CALL criticalError('electron 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)
crossSecFilePath, energyThreshold, species(pt_i)%obj%m, species(pt_j)%obj%m, electron)
CASE DEFAULT
CALL criticalError('Collision type' // cType // 'not defined yet', 'readInteractions')