Final adjustments, format of verbose corrected and minor modifications

to the input case cylFlow.
This commit is contained in:
Jorge Gonzalez 2020-10-18 00:21:13 +02:00
commit bf6caad56a
11 changed files with 189 additions and 117 deletions

View file

@ -1,24 +1,22 @@
! PPartiC neutral DSMC main program.
PROGRAM DSMC_Neutrals
USE moduleMesh
USE moduleCompTime
USE moduleSolver
USE moduleSpecies
USE moduleInject
USE moduleInput
USE moduleErrors
USE moduleList
USE OMP_LIB
USE moduleInject
USE moduleSolver
USE moduleOutput
USE moduleCaseParam
USE moduleParallel
USE moduleCompTime
USE moduleMesh
IMPLICIT NONE
! t = time step; n = number of particle; e = number of element; i = number of inject
INTEGER:: t, n, e, i
INTEGER:: t = 0
CHARACTER(200):: arg1
CHARACTER(:), ALLOCATABLE:: inputFile
tStep = omp_get_wtime()
!Gets the input file
CALL getarg(1, arg1)
inputFile = TRIM(arg1)
@ -28,37 +26,24 @@ PROGRAM DSMC_Neutrals
!Reads the json configuration file
CALL readConfig(inputFile)
t = 0
tStep = omp_get_wtime() - tStep
!Output initial state
CALL mesh%printOutput(t)
CALL printTime(t, .TRUE.)
CALL mesh%printColl(t)
PRINT *, "t/tmax: ", t, "/", tmax
PRINT *, "Particles: ", n_part_old
!Starts threads for OpenMP parallelization
!TODO: make this an input parameter
CALL OMP_SET_NUM_THREADS(openMP%nThreads)
CALL doOutput(t)
CALL verboseError('Starting main loop...')
!$OMP PARALLEL PRIVATE(t) DEFAULT(SHARED)
DO t = 1, tmax
!Insert new particles
!Insert new particles and push them
!$OMP SINGLE
n_part_new = 0
tStep = omp_get_wtime()
tPush = omp_get_wtime()
DO i=1, nInject
CALL inject(i)%addParticles()
END DO
CALL doInjects()
!$OMP END SINGLE NOWAIT
!$OMP DO
DO n=1, n_part_old
CALL push(part_old(n))
CALL mesh%vols(part_old(n)%e_p)%obj%findCell(part_old(n))
END DO
!$OMP END DO
!Push old particles
CALL doPushes()
!$OMP SINGLE
tPush = omp_get_wtime() - tPush
@ -66,11 +51,7 @@ PROGRAM DSMC_Neutrals
!$OMP END SINGLE
!Collisions
!$OMP DO
DO e=1, mesh%numVols
CALL mesh%vols(e)%obj%collision()
END DO
!$OMP END DO
CALL doCollisions()
!$OMP SINGLE
tColl = omp_get_wtime() - tColl
@ -78,7 +59,7 @@ PROGRAM DSMC_Neutrals
!$OMP END SINGLE
!Reset particles
CALL resetParticles(part_inj, part_old)
CALL doReset()
!$OMP SINGLE
tReset = omp_get_wtime() - tReset
@ -87,26 +68,13 @@ PROGRAM DSMC_Neutrals
tWeight = omp_get_wtime()
!$OMP END SINGLE
CALL scatterGrid(mesh, part_old)
CALL doScatter()
!$OMP SINGLE
tWeight = omp_get_wtime() - tWeight
tStep = omp_get_wtime() - tStep
!Output data
!TODO: Move to subroutine
counterOutput=counterOutput+1
IF (counterOutput>=triggerOutput .OR. t == tmax) THEN
counterOutput=0
CALL mesh%printOutput(t)
CALL printTime(t)
CALL mesh%printColl(t)
!TODO: Move to subroutine
PRINT *, "t/tmax: ", t, "/", tmax
PRINT *, "Particles: ", n_part_old
WRITE (*, "(2(5X,A26))") "total time (ms)", "avg t/particle (ns)"
WRITE (*, "(2(F31.3))") 1.D3*tStep, 1.D9*(tPush+tReset+tColl+tWeight)/DBLE(n_part_old)
END IF
CALL doOutput(t)
!$OMP END SINGLE
END DO