def testMeanColl(self): py_printf('UNITTEST', 'Testing HW2 mean collisions') num_collisions = process.computeMeanNumCollisions(self.coll_rate, \ self.num_neutrons) self.assertGreater(.05, abs(21.0 - num_collisions) / 21.0)
def testMeanCollToOne(self): py_printf('UNITTEST', 'Testing HW2 mean collisions to 1 eV') num_collisions = process.computeMeanNumCollisions(self.coll_rate_1eV, \ self.num_neutrons) self.assertGreater(.05, abs(13.6 - num_collisions) / 13.6)
def testMeanColl(self): py_printf('UNITTEST', 'Testing HW2 mean collisions') num_collisions = process.computeMeanNumCollisions(self.coll_rate, \ self.num_neutrons) self.assertGreater(.05, abs(21.0 - num_collisions)/21.0)
def testMeanCollToOne(self): py_printf('UNITTEST', 'Testing HW2 mean collisions to 1 eV') num_collisions = process.computeMeanNumCollisions(self.coll_rate_1eV, \ self.num_neutrons) self.assertGreater(.05, abs(13.6 - num_collisions)/13.6)
reached_one_ev = False # Simulate neutron until it is absorbed in H-1 while(neutron._alive): h1_material.collideNeutron(neutron) flux.tally(neutron) times.tally(neutron) coll_rate.tally(neutron) if neutron._energy < 1.0: reached_one_ev = True if not reached_one_ev: coll_rate_1eV.tally(neutron) py_printf('INFO', 'Plotting the flux...') plotter.plotFlux(flux, title='H-1 Flux', filename='h-1-flux') num_collisions = process.computeMeanNumCollisions(coll_rate_1eV, num_neutrons) py_printf('RESULT', 'Mean # of collisions to 1 eV: %f', num_collisions) num_collisions = process.computeMeanNumCollisions(coll_rate, num_neutrons) py_printf('RESULT', 'Mean # of collisions to death: %f', num_collisions) mean_lifetime = process.computeMeanNeutronLifetime(times, num_neutrons) py_printf('RESULT', 'Avg neutron lifetime: %1.2E seconds', mean_lifetime) py_printf('TITLE', 'Finished')
neutron._energy = fissioner.emitNeutroneV() neutron._alive = True reached_one_ev = False # Simulate neutron until it is absorbed in H-1 while (neutron._alive): h1_material.collideNeutron(neutron) flux.tally(neutron) times.tally(neutron) coll_rate.tally(neutron) if neutron._energy < 1.0: reached_one_ev = True if not reached_one_ev: coll_rate_1eV.tally(neutron) py_printf('INFO', 'Plotting the flux...') plotter.plotFlux(flux, title='H-1 Flux', filename='h-1-flux') num_collisions = process.computeMeanNumCollisions(coll_rate_1eV, num_neutrons) py_printf('RESULT', 'Mean # of collisions to 1 eV: %f', num_collisions) num_collisions = process.computeMeanNumCollisions(coll_rate, num_neutrons) py_printf('RESULT', 'Mean # of collisions to death: %f', num_collisions) mean_lifetime = process.computeMeanNeutronLifetime(times, num_neutrons) py_printf('RESULT', 'Avg neutron lifetime: %1.2E seconds', mean_lifetime) py_printf('TITLE', 'Finished')