WARNING: This current denstiy will be multiplied by the reference length, no the surface area that is being used for injection! New units in the injection of particles 'Am2' to inject a density current. Manual has been modified accordingly. Reference parameters are now also printed in the case folder.
139 lines
2.7 KiB
Fortran
139 lines
2.7 KiB
Fortran
! FPAKC main program
|
|
PROGRAM fpakc
|
|
USE moduleCompTime
|
|
USE moduleCaseParam
|
|
USE moduleInput
|
|
USE moduleInject
|
|
USE moduleSolver
|
|
USE moduleMesh
|
|
USE moduleProbe
|
|
USE moduleErrors
|
|
USE OMP_LIB
|
|
IMPLICIT NONE
|
|
|
|
! t = time step
|
|
INTEGER:: t
|
|
! 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", "fpakc")
|
|
|
|
!Reads the json configuration file
|
|
CALL readConfig(inputFile)
|
|
|
|
!Create output folder and initial files
|
|
CALL initOutput(inputFile)
|
|
|
|
!Do '0' iteration
|
|
t = tInitial
|
|
|
|
!$OMP PARALLEL DEFAULT(SHARED)
|
|
!$OMP SINGLE
|
|
CALL verboseError("Initial scatter of particles...")
|
|
!$OMP END SINGLE
|
|
CALL doScatter()
|
|
|
|
!$OMP SINGLE
|
|
CALL verboseError("Calculating initial EM field...")
|
|
!$OMP END SINGLE
|
|
CALL doEMField()
|
|
!$OMP END PARALLEL
|
|
|
|
tStep = omp_get_wtime() - tStep
|
|
|
|
!Output initial state
|
|
CALL doOutput(t)
|
|
CALL verboseError('Starting main loop...')
|
|
!$OMP PARALLEL DEFAULT(SHARED)
|
|
DO t = tInitial + 1, tFinal
|
|
!Insert new particles and push them
|
|
!$OMP SINGLE
|
|
tStep = omp_get_wtime()
|
|
|
|
!Checks if a species needs to me moved in this iteration
|
|
CALL solver%updatePushSpecies(t)
|
|
|
|
!Checks if probes need to be calculated this iteration
|
|
CALL resetProbes(t)
|
|
tPush = omp_get_wtime()
|
|
!$OMP END SINGLE
|
|
|
|
!Injects new particles
|
|
CALL doInjects()
|
|
|
|
!Push old particles
|
|
CALL doPushes()
|
|
|
|
!$OMP SINGLE
|
|
tPush = omp_get_wtime() - tPush
|
|
|
|
!Collisions
|
|
tColl = omp_get_wtime()
|
|
!$OMP END SINGLE
|
|
|
|
IF (doMCCollisions) THEN
|
|
CALL meshForMCC%doCollisions(t)
|
|
|
|
END IF
|
|
|
|
!$OMP SINGLE
|
|
tColl = omp_get_wtime() - tColl
|
|
|
|
!Coulomb scattering
|
|
tCoul = omp_get_wTime()
|
|
!$OMP END SINGLE
|
|
|
|
IF (doCoulombScattering) THEN
|
|
CALL mesh%doCoulomb()
|
|
|
|
END IF
|
|
|
|
!$OMP SINGLE
|
|
tCoul = omp_get_wTime() - tCoul
|
|
|
|
!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
|
|
|
|
CALL doAverage(t)
|
|
|
|
tStep = omp_get_wtime() - tStep
|
|
|
|
!Output data
|
|
CALL doOutput(t)
|
|
!$OMP END SINGLE
|
|
|
|
END DO
|
|
!$OMP END PARALLEL
|
|
|
|
END PROGRAM fpakc
|
|
|