First version with possibility for charged particles to be included.
Now, the solver needs to be an input parameter of the case, to select if it is for charged or neutral particles. Resolution of Poisson equation with Dirichlet boundary conditions is possible. The source vector is the charge density. This resolution is done in two steps to save computational time: 1. When reading the mesh, the PLU factorization of the K matrix is computed. 2. In each iteration, the system K*u = f is solved, in which f is the source vector (charge density) and u is the solution (potential) in each node. No case has been added to the repository. This will be done in next commit. The 'non-analog' scheme has been commented. It still needs to split the particle to avoid 'overweight' particles.
This commit is contained in:
parent
73fc9f69c1
commit
c82279f5c5
20 changed files with 859 additions and 227 deletions
94
src/PPartiC.f95
Normal file
94
src/PPartiC.f95
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
! PPartiC neutral PIC main program.
|
||||
PROGRAM PPartiC
|
||||
USE moduleInput
|
||||
USE moduleErrors
|
||||
USE OMP_LIB
|
||||
USE moduleInject
|
||||
USE moduleSolver
|
||||
USE moduleOutput
|
||||
USE moduleCompTime
|
||||
USE moduleMesh
|
||||
IMPLICIT NONE
|
||||
|
||||
! t = time step
|
||||
INTEGER:: t = 0
|
||||
! arg1 = Input argument 1 (input file)
|
||||
CHARACTER(200):: arg1
|
||||
! inputFile = path+name of input file
|
||||
CHARACTER(:), ALLOCATABLE:: inputFile
|
||||
|
||||
tStep = omp_get_wtime()
|
||||
!Gets the input file
|
||||
CALL getarg(1, arg1)
|
||||
inputFile = TRIM(arg1)
|
||||
!If no input file is declared, a critical error is called
|
||||
IF (inputFile == "") CALL criticalError("No input file provided", "PPartiC")
|
||||
|
||||
!Reads the json configuration file
|
||||
CALL readConfig(inputFile)
|
||||
|
||||
CALL verboseError("Calculating initial EM field...")
|
||||
CALL doEMField()
|
||||
|
||||
tStep = omp_get_wtime() - tStep
|
||||
|
||||
!Output initial state
|
||||
CALL doOutput(t)
|
||||
CALL verboseError('Starting main loop...')
|
||||
!$OMP PARALLEL DEFAULT(SHARED)
|
||||
DO t = 1, tmax
|
||||
!Insert new particles and push them
|
||||
!$OMP SINGLE
|
||||
tStep = omp_get_wtime()
|
||||
tPush = omp_get_wtime()
|
||||
!$OMP END SINGLE
|
||||
|
||||
CALL doInjects()
|
||||
|
||||
!Push old particles
|
||||
CALL doPushes()
|
||||
|
||||
!$OMP SINGLE
|
||||
tPush = omp_get_wtime() - tPush
|
||||
!Collisions
|
||||
tColl = omp_get_wtime()
|
||||
!$OMP END SINGLE
|
||||
|
||||
CALL doCollisions()
|
||||
|
||||
!$OMP SINGLE
|
||||
tColl = omp_get_wtime() - tColl
|
||||
!Reset particles
|
||||
tReset = omp_get_wtime()
|
||||
!$OMP END SINGLE
|
||||
|
||||
CALL doReset()
|
||||
|
||||
!$OMP SINGLE
|
||||
tReset = omp_get_wtime() - tReset
|
||||
|
||||
!Weight
|
||||
tWeight = omp_get_wtime()
|
||||
!$OMP END SINGLE
|
||||
|
||||
CALL doScatter()
|
||||
|
||||
!$OMP SINGLE
|
||||
tWeight = omp_get_wtime() - tWeight
|
||||
tEMField = omp_get_wtime()
|
||||
!$OMP END SINGLE
|
||||
|
||||
CALL doEMField()
|
||||
|
||||
!$OMP SINGLE
|
||||
tEMField = omp_get_wtime() - tEMField
|
||||
tStep = omp_get_wtime() - tStep
|
||||
!Output data
|
||||
CALL doOutput(t)
|
||||
!$OMP END SINGLE
|
||||
|
||||
END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
END PROGRAM PPartiC
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue