New functionality:
- DSMC module:
- 2D cyl geometry
- GMSH file format
- Elastic cross-section for Argon-Argon collisions.
- Basic boundary conditions: reflection, absorption and axis
symmetry.
Bugs fixed:
Other comments:
- Still searching for name.
110 lines
2.6 KiB
Fortran
110 lines
2.6 KiB
Fortran
! 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 moduleOutput
|
|
USE moduleCaseParam
|
|
IMPLICIT NONE
|
|
|
|
! t = time step; n = number of particle; e = number of element; i = number of inject
|
|
INTEGER:: t, n, e, i
|
|
CHARACTER(200):: arg1
|
|
CHARACTER(:), ALLOCATABLE:: inputFile
|
|
REAL(8), EXTERNAL::omp_get_wtime, omp_get_wtick
|
|
|
|
!Starts threads for OpenMP parallelization
|
|
!TODO: make this an input parameter
|
|
CALL OMP_SET_NUM_THREADS(8)
|
|
|
|
!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", "DSMC_Neutrals")
|
|
|
|
!Reads the json configuration file
|
|
CALL readConfig(inputFile)
|
|
|
|
t = 0
|
|
!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
|
|
|
|
!$OMP PARALLEL PRIVATE(t) DEFAULT(SHARED)
|
|
DO t = 1, tmax
|
|
tStep = omp_get_wtime()
|
|
!Insert new particles
|
|
!$OMP SINGLE
|
|
tPush = omp_get_wtime()
|
|
DO i=1, nInject
|
|
CALL inject(i)%addParticles()
|
|
END DO
|
|
!$OMP END SINGLE NOWAIT
|
|
|
|
!$OMP DO
|
|
DO n=1, n_part_old
|
|
CALL push(part_old(n))
|
|
|
|
END DO
|
|
!$OMP END DO
|
|
|
|
!$OMP SINGLE
|
|
tPush = omp_get_wtime() - tPush
|
|
tReset = omp_get_wtime()
|
|
|
|
!Reset particles
|
|
CALL resetParticles()
|
|
|
|
tReset = omp_get_wtime() - tReset
|
|
tColl = omp_get_wtime()
|
|
!$OMP END SINGLE
|
|
|
|
!Collisions
|
|
!$OMP DO
|
|
DO e=1, mesh%numVols
|
|
mesh%vols(e)%obj%nColl = 0 !Reset number of collisions
|
|
CALL mesh%vols(e)%obj%collision()
|
|
END DO
|
|
!$OMP END DO
|
|
|
|
!$OMP SINGLE
|
|
tColl = omp_get_wtime() - tColl
|
|
|
|
!Weight
|
|
tWeight = omp_get_wtime()
|
|
!$OMP END SINGLE
|
|
|
|
CALL scatterGrid()
|
|
|
|
!$OMP SINGLE
|
|
tWeight = omp_get_wtime() - tWeight
|
|
tStep = omp_get_wtime() - tStep
|
|
!Output data
|
|
counterOutput=counterOutput+1
|
|
IF (counterOutput>=triggerOutput .OR. t == tmax) THEN
|
|
counterOutput=0
|
|
CALL mesh%printOutput(t)
|
|
CALL printTime(t)
|
|
CALL mesh%printColl(t)
|
|
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
|
|
!$OMP END SINGLE
|
|
|
|
END DO
|
|
!$OMP END PARALLEL
|
|
|
|
END PROGRAM DSMC_Neutrals
|
|
|