scheme to use is chosen in the input file. Additional schemes could be added easily.
71 lines
2 KiB
Fortran
71 lines
2 KiB
Fortran
!Contains the information about species (particles)
|
|
MODULE moduleSpecies
|
|
USE moduleCaseParam
|
|
USE OMP_LIB
|
|
IMPLICIT NONE
|
|
|
|
TYPE, ABSTRACT:: speciesGeneric
|
|
CHARACTER(:), ALLOCATABLE:: name
|
|
REAL(8):: m=0.D0, weight=0.D0
|
|
INTEGER:: sp=0
|
|
END TYPE speciesGeneric
|
|
|
|
TYPE, EXTENDS(speciesGeneric):: speciesNeutral
|
|
|
|
END TYPE speciesNeutral
|
|
|
|
TYPE, EXTENDS(speciesGeneric):: speciesCharged
|
|
REAL(8):: q=0.D0, qm=0.D0
|
|
|
|
END TYPE speciesCharged
|
|
|
|
TYPE:: speciesCont
|
|
CLASS(speciesGeneric), ALLOCATABLE:: obj
|
|
|
|
END TYPE
|
|
|
|
INTEGER:: nSpecies
|
|
TYPE(speciesCont), ALLOCATABLE:: species(:)
|
|
|
|
TYPE particle
|
|
REAL(8):: r(1:3) !Position
|
|
REAL(8):: v(1:3) !Velocity
|
|
INTEGER:: sp !Particle species id
|
|
INTEGER:: vol !Index of element in which the particle is located
|
|
REAL(8):: xi(1:3) !Logical coordinates of particle in element e_p.
|
|
LOGICAL:: n_in !Flag that indicates if a particle is in the domain
|
|
REAL(8):: weight=0.D0 !weight of particle
|
|
REAL(8):: qm = 0.D0 !charge over mass
|
|
|
|
END TYPE particle
|
|
|
|
!Number of old particles
|
|
INTEGER:: nPartOld
|
|
INTEGER:: nPartInj
|
|
!Arrays that contain the particles
|
|
TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partOld !array of particles from previous iteration
|
|
TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partInj !array of inject particles
|
|
INTEGER(KIND=OMP_LOCK_KIND):: lockNAScheme !Lock for the NA list of particles
|
|
|
|
CONTAINS
|
|
FUNCTION speciesName2Index(speciesName) RESULT(sp)
|
|
USE moduleErrors
|
|
IMPLICIT NONE
|
|
|
|
CHARACTER(:), ALLOCATABLE:: speciesName
|
|
INTEGER:: sp
|
|
INTEGER:: n
|
|
|
|
sp = 0
|
|
DO n = 1, nSpecies
|
|
IF (speciesName == species(n)%obj%name) THEN
|
|
sp = species(n)%obj%sp
|
|
EXIT
|
|
END IF
|
|
END DO
|
|
!If no species is found, call a critical error
|
|
IF (sp == 0) CALL criticalError('Species ' // speciesName // ' not found.', 'speciesName2Index')
|
|
|
|
END FUNCTION speciesName2Index
|
|
|
|
END MODULE moduleSpecies
|