Intermediate push
I still have to figure out how to do this properly, but I am tired of working on my laptop.
This commit is contained in:
parent
b73c8531e8
commit
286e858d66
10 changed files with 166 additions and 139 deletions
|
|
@ -4,12 +4,56 @@ MODULE moduleSpecies
|
|||
USE OMP_LIB
|
||||
IMPLICIT NONE
|
||||
|
||||
!Basic type that defines a macro-particle
|
||||
TYPE:: particle
|
||||
REAL(8):: r(1:3) !Position
|
||||
REAL(8):: v(1:3) !Velocity
|
||||
CLASS(speciesGeneric), POINTER:: species !Pointer to species associated with this particle
|
||||
INTEGER:: cell !Index of element in which the particle is located. TODO: Make these pointers
|
||||
INTEGER:: cellColl !Index of element in which the particle is located in the Collision Mesh
|
||||
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
|
||||
|
||||
END TYPE particle
|
||||
|
||||
!Wrapper to store the particles per species
|
||||
TYPE:: particleArray
|
||||
TYPE(particle), ALLOCATABLE, DIMENSION(:):: p
|
||||
|
||||
END TYPE particleArray
|
||||
|
||||
!Array of pointers for the species to be pushed
|
||||
TYPE:: particleArray_pointer
|
||||
TYPE(particle), POINTER, DIMENSION(:):: p
|
||||
|
||||
END TYPE particleArray_pointer
|
||||
|
||||
!Number of old particles
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:):: nPartOld
|
||||
INTEGER:: nPartOldTotal
|
||||
!Number of injected particles
|
||||
INTEGER:: nPartInj
|
||||
!Arrays that contain the particles
|
||||
TYPE(particle), ALLOCATABLE, TARGET, DIMENSION(:):: partInj !array of inject particles
|
||||
TYPE(particleArray), ALLOCATABLE, TARGET, DIMENSION(:):: partOld !array of particles from previous iteration
|
||||
TYPE(particleArray_pointer), ALLOCATABLE, DIMENSION(:):: particlesToPush !particles pushed in each iteration
|
||||
|
||||
INTEGER:: nSpeciesToPush
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:):: nPartOldToPush
|
||||
|
||||
!Generic species type
|
||||
TYPE, ABSTRACT:: speciesGeneric
|
||||
CHARACTER(:), ALLOCATABLE:: name
|
||||
REAL(8):: m=0.D0, weight=0.D0, qm=0.D0
|
||||
INTEGER:: n=0
|
||||
INTEGER:: n=0 !Index of species
|
||||
CHARACTER(:), ALLOCATABLE:: name !Name of species
|
||||
!Mass, default weight of species and charge over mass
|
||||
REAL(8):: mass=0.D0, weight=0.D0, qm=0.D0
|
||||
INTEGER:: every !How many interations between advancing the species
|
||||
LOGICAL:: pushSpecies !Boolean to indicate if the species is moved in the iteration
|
||||
|
||||
END TYPE speciesGeneric
|
||||
|
||||
!Neutral species
|
||||
TYPE, EXTENDS(speciesGeneric):: speciesNeutral
|
||||
CLASS(speciesGeneric), POINTER:: ion => NULL()
|
||||
CONTAINS
|
||||
|
|
@ -17,6 +61,7 @@ MODULE moduleSpecies
|
|||
|
||||
END TYPE speciesNeutral
|
||||
|
||||
!Charged species
|
||||
TYPE, EXTENDS(speciesGeneric):: speciesCharged
|
||||
REAL(8):: q=0.D0
|
||||
CLASS(speciesGeneric), POINTER:: ion => NULL(), neutral => NULL()
|
||||
|
|
@ -26,34 +71,17 @@ MODULE moduleSpecies
|
|||
|
||||
END TYPE speciesCharged
|
||||
|
||||
!Wrapper for species
|
||||
TYPE:: speciesCont
|
||||
CLASS(speciesGeneric), ALLOCATABLE:: obj
|
||||
|
||||
END TYPE
|
||||
|
||||
!Number of species
|
||||
INTEGER:: nSpecies
|
||||
!Array for species
|
||||
TYPE(speciesCont), ALLOCATABLE, TARGET:: species(:)
|
||||
|
||||
TYPE particle
|
||||
REAL(8):: r(1:3) !Position
|
||||
REAL(8):: v(1:3) !Velocity
|
||||
CLASS(speciesGeneric), POINTER:: species !Pointer to species associated with this particle
|
||||
INTEGER:: cell !Index of element in which the particle is located
|
||||
INTEGER:: cellColl !Index of element in which the particle is located in the Collision Mesh
|
||||
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
|
||||
|
||||
END TYPE particle
|
||||
|
||||
!Number of old particles
|
||||
INTEGER:: nPartOld
|
||||
!Number of injected particles
|
||||
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
|
||||
|
||||
CONTAINS
|
||||
FUNCTION speciesName2Index(speciesName) RESULT(sp)
|
||||
USE moduleErrors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue