def test_mapper(self): # Switch to MC2v2 setting to make sure the isotopic/elemental expansions are compatible # with actually doing some math using the ISOAA test microscopic library _o, r = test_reactors.loadTestReactor(customSettings={"xsKernel": "MC2v2"}) applyDummyFlux(r) r.core.lib = isotxs.readBinary(ISOAA_PATH) mapper = globalFluxInterface.GlobalFluxResultMapper() mapper.r = r mapper._renormalizeNeutronFluxByBlock(100) self.assertAlmostEqual(r.core.calcTotalParam("power", generationNum=2), 100) mapper._updateDerivedParams() self.assertGreater(r.core.p.maxPD, 0.0) self.assertGreater(r.core.p.maxFlux, 0.0) mapper.updateDpaRate() block = r.core.getFirstBlock() self.assertGreater(block.p.detailedDpaRate, 0) self.assertEqual(block.p.detailedDpa, 0) # Test DoseResultsMapper. Pass in full list of blocks to apply() in order # to exercise blockList option (does not change behavior, since this is what # apply() does anyway) opts = globalFluxInterface.GlobalFluxOptions("test") dosemapper = globalFluxInterface.DoseResultsMapper(1000, opts) dosemapper.apply(r, blockList=r.core.getBlocks()) self.assertGreater(block.p.detailedDpa, 0) mapper.clearFlux() self.assertEqual(len(block.p.mgFlux), 0)
def test_readFromReactors(self): reactor = MockReactor() opts = globalFluxInterface.GlobalFluxOptions("neutronics-run") opts.fromReactor(reactor) self.assertEqual(opts.geomType, geometry.GeomType.CARTESIAN)
def test_readFromSettings(self): cs = settings.Settings() opts = globalFluxInterface.GlobalFluxOptions("neutronics-run") opts.fromUserSettings(cs) self.assertFalse(opts.adjoint)