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,4 +1,4 @@
## Total time per iteration
set terminal qt enhanced 1 persist size 1600, 1000 font "Times ,10" set terminal qt enhanced 1 persist size 1600, 1000 font "Times ,10"
set style line 1 pt 4 lc rgb "#B50427" #Squares red set style line 1 pt 4 lc rgb "#B50427" #Squares red
@ -8,14 +8,18 @@ set style line 4 pt 2 lc rgb "#FE7F0E" #Exes orange
set style line 5 pt 8 lc rgb "#D6696B" #Triangles light red set style line 5 pt 8 lc rgb "#D6696B" #Triangles light red
set style line 10 lt 1 lw 2.0 lc rgb "black" #Black solid line set style line 10 lt 1 lw 2.0 lc rgb "black" #Black solid line
name1 = "Base Case" #Name and folder 1 for comparison (include / at the end of the folder)
folder1 = "base_case/" name1 = ""
name2 = "OMP LOCK 1" folder1 = ""
folder2 = "OMP_LOCK_1/" #Name and folder 2 for comparison (include / at the end of the folder)
name3 = "OMP LOCK 2" name2 = ""
folder3 = "2020-10-17_18.33.45/" folder2 = ""
name4 = "Reset with List Parallel" #Name and folder 3 for comparison (include / at the end of the folder)
folder4 = "2020-10-11_15.20.09/" name3 = ""
folder3 = ""
#Name and folder 4 for comparison (include / at the end of the folder)
name4 = ""
folder4 = ""
set key box opaque set key box opaque
set pointsize 1.5 set pointsize 1.5
@ -50,7 +54,7 @@ plot folder1."cpuTime.dat" u 1:(1e3*$6) t name1 ls 1, \
folder3."cpuTime.dat" u 1:(1e3*$6) t name3 ls 3, \ folder3."cpuTime.dat" u 1:(1e3*$6) t name3 ls 3, \
folder4."cpuTime.dat" u 1:(1e3*$6) t name4 ls 4 folder4."cpuTime.dat" u 1:(1e3*$6) t name4 ls 4
set title "Weighting" set title "Scattering"
plot folder1."cpuTime.dat" u 1:(1e3*$7) t name1 ls 1, \ plot folder1."cpuTime.dat" u 1:(1e3*$7) t name1 ls 1, \
folder2."cpuTime.dat" u 1:(1e3*$7) t name2 ls 2, \ folder2."cpuTime.dat" u 1:(1e3*$7) t name2 ls 2, \
folder3."cpuTime.dat" u 1:(1e3*$7) t name3 ls 3, \ folder3."cpuTime.dat" u 1:(1e3*$7) t name3 ls 3, \
@ -64,7 +68,7 @@ plot folder1."cpuTime.dat" u 1:($2) t name1 ls 1, \
unset multiplot unset multiplot
## Time per particle
# set terminal qt enhanced 2 persist size 1600, 1000 font "Times ,10" # set terminal qt enhanced 2 persist size 1600, 1000 font "Times ,10"
# #
# set style line 1 pt 4 lc rgb "#B50427" #Squares red # set style line 1 pt 4 lc rgb "#B50427" #Squares red
@ -107,7 +111,7 @@ unset multiplot
# folder3."cpuTime.dat" u 1:(1e6*$6/$2) t name3 ls 3, \ # folder3."cpuTime.dat" u 1:(1e6*$6/$2) t name3 ls 3, \
# folder4."cpuTime.dat" u 1:(1e6*$6/$2) t name4 ls 4 # folder4."cpuTime.dat" u 1:(1e6*$6/$2) t name4 ls 4
# #
# set title "Weighting" # set title "Scattering"
# plot folder1."cpuTime.dat" u 1:(1e6*$7/$2) t name1 ls 1, \ # plot folder1."cpuTime.dat" u 1:(1e6*$7/$2) t name1 ls 1, \
# folder2."cpuTime.dat" u 1:(1e6*$7/$2) t name2 ls 2, \ # folder2."cpuTime.dat" u 1:(1e6*$7/$2) t name2 ls 2, \
# folder3."cpuTime.dat" u 1:(1e6*$7/$2) t name3 ls 3, \ # folder3."cpuTime.dat" u 1:(1e6*$7/$2) t name3 ls 3, \

View file

@ -3,7 +3,7 @@
"path": "./runs/cylFlow/", "path": "./runs/cylFlow/",
"trigger": 10, "trigger": 10,
"cpuTime": true, "cpuTime": true,
"numColl": false "numColl": true
}, },
"geometry": { "geometry": {
"type": "2DCyl", "type": "2DCyl",

View file

@ -1,24 +1,22 @@
! PPartiC neutral DSMC main program. ! PPartiC neutral DSMC main program.
PROGRAM DSMC_Neutrals PROGRAM DSMC_Neutrals
USE moduleMesh
USE moduleCompTime
USE moduleSolver
USE moduleSpecies
USE moduleInject
USE moduleInput USE moduleInput
USE moduleErrors USE moduleErrors
USE moduleList USE OMP_LIB
USE moduleInject
USE moduleSolver
USE moduleOutput USE moduleOutput
USE moduleCaseParam USE moduleCompTime
USE moduleParallel USE moduleMesh
IMPLICIT NONE IMPLICIT NONE
! t = time step; n = number of particle; e = number of element; i = number of inject ! 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(200):: arg1
CHARACTER(:), ALLOCATABLE:: inputFile CHARACTER(:), ALLOCATABLE:: inputFile
tStep = omp_get_wtime()
!Gets the input file !Gets the input file
CALL getarg(1, arg1) CALL getarg(1, arg1)
inputFile = TRIM(arg1) inputFile = TRIM(arg1)
@ -28,37 +26,24 @@ PROGRAM DSMC_Neutrals
!Reads the json configuration file !Reads the json configuration file
CALL readConfig(inputFile) CALL readConfig(inputFile)
t = 0 tStep = omp_get_wtime() - tStep
!Output initial state !Output initial state
CALL mesh%printOutput(t) CALL doOutput(t)
CALL printTime(t, .TRUE.) CALL verboseError('Starting main loop...')
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)
!$OMP PARALLEL PRIVATE(t) DEFAULT(SHARED) !$OMP PARALLEL PRIVATE(t) DEFAULT(SHARED)
DO t = 1, tmax DO t = 1, tmax
!Insert new particles !Insert new particles and push them
!$OMP SINGLE !$OMP SINGLE
n_part_new = 0
tStep = omp_get_wtime() tStep = omp_get_wtime()
tPush = omp_get_wtime() tPush = omp_get_wtime()
DO i=1, nInject
CALL inject(i)%addParticles() CALL doInjects()
END DO
!$OMP END SINGLE NOWAIT !$OMP END SINGLE NOWAIT
!$OMP DO !Push old particles
DO n=1, n_part_old CALL doPushes()
CALL push(part_old(n))
CALL mesh%vols(part_old(n)%e_p)%obj%findCell(part_old(n))
END DO
!$OMP END DO
!$OMP SINGLE !$OMP SINGLE
tPush = omp_get_wtime() - tPush tPush = omp_get_wtime() - tPush
@ -66,11 +51,7 @@ PROGRAM DSMC_Neutrals
!$OMP END SINGLE !$OMP END SINGLE
!Collisions !Collisions
!$OMP DO CALL doCollisions()
DO e=1, mesh%numVols
CALL mesh%vols(e)%obj%collision()
END DO
!$OMP END DO
!$OMP SINGLE !$OMP SINGLE
tColl = omp_get_wtime() - tColl tColl = omp_get_wtime() - tColl
@ -78,7 +59,7 @@ PROGRAM DSMC_Neutrals
!$OMP END SINGLE !$OMP END SINGLE
!Reset particles !Reset particles
CALL resetParticles(part_inj, part_old) CALL doReset()
!$OMP SINGLE !$OMP SINGLE
tReset = omp_get_wtime() - tReset tReset = omp_get_wtime() - tReset
@ -87,26 +68,13 @@ PROGRAM DSMC_Neutrals
tWeight = omp_get_wtime() tWeight = omp_get_wtime()
!$OMP END SINGLE !$OMP END SINGLE
CALL scatterGrid(mesh, part_old) CALL doScatter()
!$OMP SINGLE !$OMP SINGLE
tWeight = omp_get_wtime() - tWeight tWeight = omp_get_wtime() - tWeight
tStep = omp_get_wtime() - tStep tStep = omp_get_wtime() - tStep
!Output data !Output data
!TODO: Move to subroutine CALL doOutput(t)
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
!$OMP END SINGLE !$OMP END SINGLE
END DO END DO

View file

@ -37,6 +37,7 @@ MODULE moduleErrors
errorMsg = msg errorMsg = msg
WRITE (*, '(A)') errorMsg WRITE (*, '(A)') errorMsg
WRITE (*, *)
END SUBROUTINE verboseError END SUBROUTINE verboseError

View file

@ -23,6 +23,18 @@ MODULE moduleInject
TYPE(injectGeneric), ALLOCATABLE:: inject(:) TYPE(injectGeneric), ALLOCATABLE:: inject(:)
CONTAINS CONTAINS
!Injection of particles
SUBROUTINE doInjects()
IMPLICIT NONE
INTEGER:: i
DO i=1, nInject
CALL inject(i)%addParticles()
END DO
END SUBROUTINE doInjects
SUBROUTINE initInject(self, i, v, n, T, flow, pt, physicalSurface) SUBROUTINE initInject(self, i, v, n, T, flow, pt, physicalSurface)
USE moduleMesh USE moduleMesh
USE moduleMeshCyl USE moduleMeshCyl
@ -109,7 +121,7 @@ MODULE moduleInject
INTEGER:: n1 = 0, n2 = 0 INTEGER:: n1 = 0, n2 = 0
!Edge nodes coordinates !Edge nodes coordinates
REAL(8):: p1(1:3) = 0.D0, p2(1:3) = 0.D0 REAL(8):: p1(1:3) = 0.D0, p2(1:3) = 0.D0
INTEGER:: nMin, nMax !Min and Max index in part_inj array INTEGER:: nMin, nMax !Min and Max index in partInj array
INTEGER:: n INTEGER:: n
vVec = self%v * self%n vVec = self%v * self%n
@ -120,10 +132,10 @@ MODULE moduleInject
nMin = 1 nMin = 1
nMax = self%nParticles nMax = self%nParticles
!Assign particle type !Assign particle type
part_inj(nMin:nMax)%pt = self%pt partInj(nMin:nMax)%pt = self%pt
!Assign weight to particle. !Assign weight to particle.
part_inj(nMin:nMax)%weight = species(self%pt)%obj%weight partInj(nMin:nMax)%weight = species(self%pt)%obj%weight
part_inj(nMin:nMax)%n_in = .TRUE. partInj(nMin:nMax)%n_in = .TRUE.
DO n = nMin, nMax DO n = nMin, nMax
!Select edge randomly from which inject particle !Select edge randomly from which inject particle
randomX = RAND()*self%sumWeight randomX = RAND()*self%sumWeight
@ -157,29 +169,29 @@ MODULE moduleInject
!Volume associated to the edge: !Volume associated to the edge:
IF (DOT_PRODUCT(self%n, mesh%edges(randomEdge)%obj%normal) >= 0.D0) THEN IF (DOT_PRODUCT(self%n, mesh%edges(randomEdge)%obj%normal) >= 0.D0) THEN
part_inj(n)%e_p = mesh%edges(randomEdge)%obj%e1%n partInj(n)%e_p = mesh%edges(randomEdge)%obj%e1%n
ELSE ELSE
part_inj(n)%e_p = mesh%edges(randomEdge)%obj%e2%n partInj(n)%e_p = mesh%edges(randomEdge)%obj%e2%n
END IF END IF
part_inj(n)%v = (/ vBC(vVec(1), vTh(1)), & partInj(n)%v = (/ vBC(vVec(1), vTh(1)), &
vBC(vVec(2), vTh(2)), & vBC(vVec(2), vTh(2)), &
vBC(vVec(3), vTh(3)) /) vBC(vVec(3), vTh(3)) /)
!Random position in edge !Random position in edge
!TODO: Use edge coordinates and transformations for this process !TODO: Use edge coordinates and transformations for this process
randomPos = RAND() randomPos = RAND()
part_inj(n)%r(1) = p1(1) + randomPos*(p2(1) - p1(1)) partInj(n)%r(1) = p1(1) + randomPos*(p2(1) - p1(1))
part_inj(n)%r(2) = p1(2) + randomPos*(p2(2) - p1(2)) partInj(n)%r(2) = p1(2) + randomPos*(p2(2) - p1(2))
part_inj(n)%r(3) = p1(3) + randomPos*(p2(3) - p1(3)) partInj(n)%r(3) = p1(3) + randomPos*(p2(3) - p1(3))
!Push new particle !Push new particle
CALL push(part_inj(n)) CALL push(partInj(n))
!Assign cell to new particle !Assign cell to new particle
CALL mesh%vols(part_inj(n)%e_p)%obj%findCell(part_inj(n)) CALL mesh%vols(partInj(n)%e_p)%obj%findCell(partInj(n))
END DO END DO

View file

@ -19,6 +19,7 @@ MODULE moduleInput
CALL config%initialize() CALL config%initialize()
!Loads the config file !Loads the config file
CALL verboseError('Loading input file...')
CALL config%load(filename = inputFile) CALL config%load(filename = inputFile)
!Reads reference parameters !Reads reference parameters
@ -40,12 +41,15 @@ MODULE moduleInput
CALL readBoundary(config) CALL readBoundary(config)
!Read Geometry !Read Geometry
CALL verboseError('Reading Geometry...')
CALL readGeometry(config) CALL readGeometry(config)
!Read injection of particles !Read injection of particles
CALL verboseError('Reading Interactions between species...')
CALL readInject(config) CALL readInject(config)
!Read parallel parameters !Read parallel parameters
CALL verboseError('Reading Parallel configuration...')
CALL readParallel(config) CALL readParallel(config)
END SUBROUTINE readConfig END SUBROUTINE readConfig
@ -196,7 +200,7 @@ MODULE moduleInput
!Set number of particles to 0 for init state !Set number of particles to 0 for init state
!TODO: In a future, this should include the particles from init states !TODO: In a future, this should include the particles from init states
n_part_old = 0 nPartOld = 0
END SUBROUTINE readSpecies END SUBROUTINE readSpecies
@ -363,7 +367,7 @@ MODULE moduleInput
!Allocate array for injected particles !Allocate array for injected particles
IF (nPartInj > 0) THEN IF (nPartInj > 0) THEN
ALLOCATE(part_inj(1:nPartInj)) ALLOCATE(partInj(1:nPartInj))
END IF END IF
@ -390,6 +394,8 @@ MODULE moduleInput
END IF END IF
CALL initParallel()
END SUBROUTINE readParallel END SUBROUTINE readParallel

View file

@ -317,7 +317,7 @@ MODULE moduleMeshCylRead
DO i = 1, nSpecies DO i = 1, nSpecies
WRITE(tstring, '(I6.6)') t WRITE(tstring, '(I6.6)') t
fileName='OUTPUT_' // tstring// '_' // species(i)%obj%name // '.msh' fileName='OUTPUT_' // tstring// '_' // species(i)%obj%name // '.msh'
PRINT *, "Creado archivo de datos:", fileName WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (60, file = path // folder // '/' // fileName) OPEN (60, file = path // folder // '/' // fileName)
WRITE(60, "(A)") '$MeshFormat' WRITE(60, "(A)") '$MeshFormat'
WRITE(60, "(A)") '2.2 0 8' WRITE(60, "(A)") '2.2 0 8'
@ -400,7 +400,7 @@ MODULE moduleMeshCylRead
WRITE(tstring, '(I6.6)') t WRITE(tstring, '(I6.6)') t
fileName='OUTPUT_' // tstring// '_Collisions.msh' fileName='OUTPUT_' // tstring// '_Collisions.msh'
PRINT *, "Creado archivo de datos:", fileName WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (60, file = path // folder // '/' // fileName) OPEN (60, file = path // folder // '/' // fileName)
WRITE(60, "(A)") '$MeshFormat' WRITE(60, "(A)") '$MeshFormat'
WRITE(60, "(A)") '2.2 0 8' WRITE(60, "(A)") '2.2 0 8'

View file

@ -20,7 +20,6 @@ MODULE moduleOutput
LOGICAL:: collOutput = .FALSE. LOGICAL:: collOutput = .FALSE.
CONTAINS CONTAINS
FUNCTION outerProduct(a,b) RESULT(s) FUNCTION outerProduct(a,b) RESULT(s)
IMPLICIT NONE IMPLICIT NONE
@ -89,33 +88,34 @@ MODULE moduleOutput
INTEGER, INTENT(in):: t INTEGER, INTENT(in):: t
LOGICAL, INTENT(in), OPTIONAL:: first LOGICAL, INTENT(in), OPTIONAL:: first
CHARACTER(:), ALLOCATABLE:: filename CHARACTER(:), ALLOCATABLE:: fileName
filename = 'cpuTime.dat' fileName = 'cpuTime.dat'
IF (timeOutput) THEN IF (timeOutput) THEN
IF (PRESENT(first)) THEN IF (PRESENT(first)) THEN
IF (first) THEN IF (first) THEN
OPEN(20, file = path // folder // '/' // filename, action = 'write') OPEN(20, file = path // folder // '/' // fileName, action = 'write')
WRITE(20, "(A1, 8X, A1, 9X, A1, 5(A20))") "#","t","n","total","push","reset","collision","weighting" WRITE(20, "(A1, 8X, A1, 9X, A1, 5(A20))") "#","t","n","total","push","reset","collision","weighting"
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
ELSE ELSE
END IF END IF
OPEN(20, file = path // folder // '/' // filename, position = 'append', action = 'write') OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
ELSE ELSE
OPEN(20, file = path // folder // '/' // filename, position = 'append', action = 'write') OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
END IF END IF
WRITE (20, "(I10, I10, 5(ES20.6E3))") t, n_part_old, tStep, tPush, tReset, tColl, tWeight WRITE (20, "(I10, I10, 5(ES20.6E3))") t, nPartOld, tStep, tPush, tReset, tColl, tWeight
CLOSE(20) CLOSE(20)
END IF END IF
END SUBROUTINE END SUBROUTINE printTime
END MODULE moduleOutput END MODULE moduleOutput

View file

@ -1,4 +1,5 @@
MODULE moduleParallel MODULE moduleParallel
IMPLICIT NONE
TYPE openMP_type TYPE openMP_type
INTEGER:: nThreads INTEGER:: nThreads
@ -7,4 +8,13 @@ MODULE moduleParallel
TYPE(openMP_type):: openMP TYPE(openMP_type):: openMP
CONTAINS
SUBROUTINE initParallel()
IMPLICIT NONE
!Starts threads for OpenMP parallelization
CALL OMP_SET_NUM_THREADS(openMP%nThreads)
END SUBROUTINE initParallel
END MODULE moduleParallel END MODULE moduleParallel

View file

@ -1,24 +1,25 @@
MODULE moduleSolver MODULE moduleSolver
CONTAINS CONTAINS
SUBROUTINE scatterGrid(meshIn, partArray) SUBROUTINE doPushes()
USE moduleSpecies USE moduleSpecies
USE moduleMesh USE moduleMesh
IMPLICIT NONE
CLASS(meshGeneric), INTENT(in):: meshIn
TYPE(particle), INTENT(in):: partArray(:)
INTEGER:: n INTEGER:: n
!Loops over the particles to scatter them
!$OMP DO !$OMP DO
DO n=1, n_part_old DO n=1, nPartOld
CALL meshIn%vols(partArray(n)%e_p)%obj%scatter(partArray(n)) CALL push(partOld(n))
CALL mesh%vols(partOld(n)%e_p)%obj%findCell(partOld(n))
END DO END DO
!$OMP END DO !$OMP END DO
END SUBROUTINE scatterGrid END SUBROUTINE doPushes
!Push one particle. Boris pusher for 2D Cyl
!TODO: make general for any pusher
PURE SUBROUTINE push(part) PURE SUBROUTINE push(part)
USE moduleSpecies USE moduleSpecies
USE moduleMesh USE moduleMesh
@ -57,28 +58,58 @@ MODULE moduleSolver
END SUBROUTINE push END SUBROUTINE push
SUBROUTINE resetParticles(partInj, partOld) !Do the collisions in all the cells
USE moduleSpecies, ONLY: particle, & SUBROUTINE doCollisions()
n_part_old, n_part_new, nPartInj USE moduleMesh
IMPLICIT NONE
INTEGER:: e
!$OMP DO
DO e=1, mesh%numVols
CALL mesh%vols(e)%obj%collision()
END DO
!$OMP END DO
END SUBROUTINE doCollisions
!Scatter particles in the grid
SUBROUTINE doScatter
USE moduleSpecies
USE moduleMesh
INTEGER:: n
!Loops over the particles to scatter them
!$OMP DO
DO n=1, nPartOld
CALL mesh%vols(partOld(n)%e_p)%obj%scatter(partOld(n))
END DO
!$OMP END DO
END SUBROUTINE doScatter
SUBROUTINE doReset()
USE moduleSpecies
IMPLICIT NONE IMPLICIT NONE
TYPE(particle), INTENT(in), ALLOCATABLE:: partInj(:)
TYPE(particle), INTENT(inout), ALLOCATABLE:: partOld(:)
INTEGER:: nn, n INTEGER:: nn, n
INTEGER, SAVE:: n_inj_in, n_old_in INTEGER:: nPartNew
INTEGER, SAVE:: nInjIn, nOldIn
TYPE(particle), ALLOCATABLE:: partTemp(:) TYPE(particle), ALLOCATABLE:: partTemp(:)
!$OMP SECTIONS !$OMP SECTIONS
!$OMP SECTION !$OMP SECTION
n_inj_in = 0 nInjIn = 0
IF (ALLOCATED(partInj)) THEN IF (ALLOCATED(partInj)) THEN
n_inj_in = COUNT(partInj%n_in) nInjIn = COUNT(partInj%n_in)
END IF END IF
!$OMP SECTION !$OMP SECTION
n_old_in = 0 nOldIn = 0
IF (ALLOCATED(partOld)) THEN IF (ALLOCATED(partOld)) THEN
n_old_in = COUNT(partOld%n_in) nOldIn = COUNT(partOld%n_in)
END IF END IF
!$OMP END SECTIONS !$OMP END SECTIONS
@ -87,8 +118,8 @@ MODULE moduleSolver
!$OMP SINGLE !$OMP SINGLE
CALL MOVE_ALLOC(partOld, partTemp) CALL MOVE_ALLOC(partOld, partTemp)
n_part_new = n_inj_in + n_old_in nPartNew = nInjIn + nOldIn
ALLOCATE(partOld(1:n_part_new)) ALLOCATE(partOld(1:nPartNew))
nn = 0 nn = 0
DO n = 1, nPartInj DO n = 1, nPartInj
@ -100,7 +131,7 @@ MODULE moduleSolver
END DO END DO
DO n = 1, n_part_old DO n = 1, nPartOld
IF (partTemp(n)%n_in) THEN IF (partTemp(n)%n_in) THEN
nn = nn + 1 nn = nn + 1
partOld(nn) = partTemp(n) partOld(nn) = partTemp(n)
@ -109,10 +140,50 @@ MODULE moduleSolver
END DO END DO
n_part_old = n_part_new nPartOld = nPartNew
!$OMP END SINGLE !$OMP END SINGLE
END SUBROUTINE resetParticles END SUBROUTINE doReset
SUBROUTINE doOutput(t)
USE moduleMesh
USE moduleOutput
USE moduleSpecies
USE moduleCompTime
IMPLICIT NONE
INTEGER, INTENT(in):: t
counterOutput=counterOutput+1
IF (counterOutput>=triggerOutput .OR. &
t == tmax .OR. t == 0) THEN
!Resets output counter
counterOutput=0
CALL mesh%printOutput(t)
CALL printTime(t, t == 0)
CALL mesh%printColl(t)
WRITE(*, "(5X,A21,I10,A1,I8)") "t/tmax: ", t, "/", tmax
WRITE(*, "(5X,A21,I10)") "Particles: ", nPartOld
IF (t == 0) THEN
WRITE(*, "(5X,A21,F8.1,A2)") " init time: ", 1.D3*tStep, "ms"
ELSE
WRITE(*, "(5X,A21,F8.1,A2)") "iteration time: ", 1.D3*tStep, "ms"
END IF
IF (nPartOld > 0) THEN
WRITE(*, "(5X,A21,F8.1,A2)") "avg t/particle: ", 1.D9*(tPush+tReset+tColl+tWeight)/DBLE(nPartOld), "ns"
END IF
WRITE(*,*)
END IF
END SUBROUTINE doOutput
END MODULE moduleSolver END MODULE moduleSolver

View file

@ -37,12 +37,12 @@ MODULE moduleSpecies
END TYPE particle END TYPE particle
INTEGER:: n_part_old, n_part_new !Number of old particles
INTEGER:: nPartOld
INTEGER:: nPartInj INTEGER:: nPartInj
!Arrays that define the particles !Arrays that contain the particles
TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: part_old TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partOld
TYPE(particle), ALLOCATABLE, DIMENSION(:):: part_new TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partInj !array of inject particles
TYPE(particle), ALLOCATABLE, DIMENSION(:):: part_inj !array of inject particles
CONTAINS CONTAINS
FUNCTION speciesName2Index(speciesName) RESULT(pt) FUNCTION speciesName2Index(speciesName) RESULT(pt)