Skip to content

Commit

Permalink
Merge branch 'fix.small.issues' into 'master.dev'
Browse files Browse the repository at this point in the history
[fix.small.issues] Fixed various smaller issues

See merge request piclas/piclas!676
  • Loading branch information
scopplestone committed Aug 3, 2022
2 parents 665a416 + f6740dc commit 337bbcd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
9 changes: 7 additions & 2 deletions src/io_hdf5/io_hdf5.f90
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,13 @@ SUBROUTINE InitIOHDF5()
!===================================================================================================================================
SWRITE(UNIT_StdOut,'(132("-"))')
SWRITE(UNIT_stdOut,'(A)')' INIT IOHDF5 ...'
gatheredWrite=.FALSE.
IF(nLeaderProcs.LT.nProcessors) gatheredWrite=GETLOGICAL('gatheredWrite','.FALSE.')

gatheredWrite = .FALSE.
UseCollectiveIO = .FALSE.
IF(nLeaderProcs.LT.nProcessors)THEN
gatheredWrite = GETLOGICAL('gatheredWrite')
UseCollectiveIO = GETLOGICAL('UseCollectiveIO')
END IF

CALL InitMPIInfo()
SWRITE(UNIT_stdOut,'(A)')' INIT DONE!'
Expand Down
3 changes: 2 additions & 1 deletion src/particles/emission/particle_position_and_velocity.f90
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ SUBROUTINE SetParticleVelocity(FractNbr,iInit,NbrOfParticle)
!===================================================================================================================================

IF(NbrOfParticle.LT.1) RETURN
IF(NbrOfParticle.GT.PDM%maxParticleNumber) CALL abort(__STAMP__,'NbrOfParticle > PDM%maxParticleNumber!')
IF(NbrOfParticle.GT.PDM%maxParticleNumber) CALL abort(__STAMP__,'NbrOfParticle > PDM%maxParticleNumber! '//&
'Increase Part-maxParticleNumber or use more processors.')

velocityDistribution=Species(FractNbr)%Init(iInit)%velocityDistribution
VeloIC=Species(FractNbr)%Init(iInit)%VeloIC
Expand Down
2 changes: 1 addition & 1 deletion src/particles/particle_mpi/particle_mpi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ SUBROUTINE MPIParticleRecv(DoMPIUpdateNextFreePos)
PDM%CurrentNextFreePosition = PDM%CurrentNextFreePosition + PartMPIExchange%nMPIParticles
PartMPIExchange%nMPIParticles = 0
IF(PDM%ParticleVecLength.GT.PDM%MaxParticleNumber) CALL ABORT(__STAMP__&
,' ParticleVecLegnth>MaxParticleNumber due to MPI-communication!')
,' ParticleVecLegnth>MaxParticleNumber due to MPI-communication! Increase Part-maxParticleNumber or use more processors.')

IF(RadialWeighting%PerformCloning) THEN
! Checking whether received particles have to be cloned or deleted
Expand Down
3 changes: 2 additions & 1 deletion src/particles/particle_operations.f90
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ SUBROUTINE CreateParticle(SpecID,Pos,GlobElemID,Velocity,RotEnergy,VibEnergy,Ele
PDM%ParticleVecLength = PDM%ParticleVecLength + 1 ! Increase particle vector length
newParticleID = PDM%ParticleVecLength
IF(newParticleID.GT.PDM%MaxParticleNumber)THEN
CALL abort(__STAMP__,'CreateParticle: newParticleID.GT.PDM%MaxParticleNumber. newParticleID=',IntInfoOpt=newParticleID)
CALL abort(__STAMP__,'CreateParticle: newParticleID.GT.PDM%MaxParticleNumber. '//&
'Increase Part-maxParticleNumber or use more processors. newParticleID=',IntInfoOpt=newParticleID)
END IF

PartSpecies(newParticleID) = SpecID
Expand Down
18 changes: 9 additions & 9 deletions src/particles/particle_tools.f90
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ SUBROUTINE UpdateNextFreePosition(WithOutMPIParts)
! OUTPUT VARIABLES
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
INTEGER :: counter,i,n
INTEGER :: counter,i
INTEGER :: ElemID
#if USE_LOADBALANCE
REAL :: tLBStart
Expand All @@ -107,24 +107,24 @@ SUBROUTINE UpdateNextFreePosition(WithOutMPIParts)
END IF

PDM%ParticleVecLengthOld = PDM%ParticleVecLength
n = PDM%ParticleVecLength
counter = 0
PDM%ParticleVecLength = 0

! Check size of PDM%ParticleInside array vs. PDM%ParticleVecLength. During particle splitting, the max particle number might be
! exceeded, which may lead to an out-of-bounds here
IF(usevMPF)THEN
IF(n.GT.SIZE(PDM%ParticleInside))THEN
IPWRITE(UNIT_StdOut,*) "PDM%ParticleVecLength :", PDM%ParticleVecLength
IF(PDM%ParticleVecLengthOld.GT.SIZE(PDM%ParticleInside))THEN
IPWRITE(UNIT_StdOut,*) "PDM%ParticleVecLength :", PDM%ParticleVecLengthOld
IPWRITE(UNIT_StdOut,*) "SIZE(PDM%ParticleInside) :", SIZE(PDM%ParticleInside)
CALL abort(__STAMP__,'PDM%ParticleVecLength exceeds allocated arrays. Possible vMPF overflow.')
END IF ! n.GT.SIZE(PDM%ParticleInside)
CALL abort(__STAMP__,'PDM%ParticleVecLength exceeds allocated arrays. Possible vMPF overflow during particle split or '//&
'restart file with too many particles. Increase Part-maxParticleNumber or use more processors')
END IF ! PDM%ParticleVecLengthOld.GT.SIZE(PDM%ParticleInside)
END IF ! usevMPF

IF (doParticleMerge) vMPF_SpecNumElem = 0

IF (useDSMC.OR.doParticleMerge.OR.usevMPF) THEN
DO i = 1,n
DO i = 1,PDM%ParticleVecLengthOld
IF (.NOT.PDM%ParticleInside(i)) THEN
IF (CollInf%ProhibitDoubleColl) CollInf%OldCollPartner(i) = 0
counter = counter + 1
Expand Down Expand Up @@ -179,7 +179,7 @@ SUBROUTINE UpdateNextFreePosition(WithOutMPIParts)
END DO
! no DSMC
ELSE
DO i = 1,n
DO i = 1,PDM%ParticleVecLengthOld
IF (.NOT.PDM%ParticleInside(i)) THEN
counter = counter + 1
PDM%nextFreePosition(counter) = i
Expand All @@ -203,7 +203,7 @@ SUBROUTINE UpdateNextFreePosition(WithOutMPIParts)
PDM%CurrentNextFreePosition = 0

! Positions after ParticleVecLength in freePosition
DO i = n+1,PDM%maxParticleNumber
DO i = PDM%ParticleVecLengthOld+1,PDM%maxParticleNumber
IF (CollInf%ProhibitDoubleColl) CollInf%OldCollPartner(i) = 0
counter = counter + 1
PDM%nextFreePosition(counter) = i
Expand Down

0 comments on commit 337bbcd

Please sign in to comment.