1 -- 2 -- Patricia Fasel 3 -- Los Alamos National Laboratory 4 -- 1990 August 5 -- 6 module RoulSplit (roulet, split) where 7 8 import GamtebType 9 import Consts 10 import Utils 11 12 -- russian roulette on existence of the particle 13 -- set new cell to 1 so next pass through tport is split, not roulet 14 15 roulet :: Particle -> (Particle, [Stat], Bool) 16 roulet (Part pos dir w e eIndx cell seed) = 17 if (r1 < 0.5) 18 then -- not killed in russian roulette 19 (Part pos dir (2*w) e eIndx 1 seed', 20 [(nr,1), (wrg,w)], False) 21 else -- killed in russian roulette 22 (Part pos dir 0 e eIndx 1 seed', 23 [(nr,1), (nrk,1), (wrl,w)], True) 24 where 25 (r1, r2) = genRand seed 26 (seed', r3) = genRand r2 27 28 29 -- split a particle into two 30 -- set new cells to 2 so next pass through tport is roulet, not split 31 32 split :: Particle -> (Particle, Particle) 33 split (Part pos dir w e eIndx cell seed) = 34 (Part pos dir (0.5*w) e eIndx 2 seed1, 35 Part pos dir (0.5*w) e eIndx 2 seed2) 36 where 37 (seed1, seed2) = genRand seed