diff --git a/src/modules/moduleSolver.f90 b/src/modules/moduleSolver.f90 index be78420..d0b2d01 100644 --- a/src/modules/moduleSolver.f90 +++ b/src/modules/moduleSolver.f90 @@ -660,24 +660,18 @@ MODULE moduleSolver TYPE(particle), INTENT(inout):: part CLASS(meshVol), POINTER, INTENT(in):: volOld CLASS(meshVol), POINTER, INTENT(inout):: volNew - REAL(8):: fractionVolume, fractionWeight - INTEGER:: nSplit + REAL(8):: fractionVolume, pSplit - !If particle has change cell, call Weighting scheme - IF (volOld%n /= volNew%n) THEN + !If particle changes volume to smaller cell + IF (volOld%volume > volNew%volume) THEN fractionVolume = volOld%volume/volNew%volume - part%weight = part%weight * fractionVolume + !Calculate probability of splitting particle + pSplit = 1.D0 - DEXP(-fractionVolume) - fractionWeight = part%weight / part%species%weight - - IF (fractionWeight >= 2.D0) THEN - nSplit = FLOOR(fractionWeight) - CALL splitParticle(part, nSplit, volNew) - - ELSEIF (part%weight < 1.D0) THEN - !Particle has lost statistical meaning and will be terminated - part%n_in = .FALSE. + IF (random() < pSplit THEN + !Split particle in two + CALL splitParticle(part, 2, volNew) END IF