Package: neutronics-material-maker
Neutronics Material MakerThe aim of this project is to facilitate the creation of materials for use in
neutronics codes such as OpenMC, Serpent, MCNP and Fispact.The hope is that by having this collection of materials it is easier to reuse
materials across projects, use a common source with less room for user error.One nice aspect of this material maker is the ability to change the density of
a material based on isotope enrichment (e.g. inbuild lithium ceramics),
temperature and pressure.:point_right:Documentation:point_right:Video presentationInstallationCondaTo use the code you will need to have OpenMC installedOpenMC.The recommended method is to install fromConda Forgewhich also installs all the dependencies
including OpenMC.condacreate--namenew_envpython=3.8
condaactivatenew_env
condainstallneutronics_material_maker-cconda-forgePipAlternatively the code can be easily installed using pip. This method doesn't
currently include OpenMC so that will have to be installed separately using
Conda or compiled.pipinstallneutronics_material_makerTo include the optional capability of calculating the density of coolants
additional packages are needed (CoolProp). A slightly modified pip install
is required in this case.pipinstall"neutronics_material_maker[density]"FeaturesMaterials for using in neutronics codes have two main aspects; a list of
isotopes along with their abundance and the material density.This code contains an internal collection of materials with their isotope
abundances and densities (sometimes temperature, pressure and enrichment
dependant), but you may also import your own materials collection.Usage - Finding Available MaterialsEach of the materials available is stored in an internal dictionary that can be
accessed using theAvailableMaterials()command.importneutronics_material_makerasnmmall_materials=nmm.AvailableMaterials()print(all_materials.keys())Usage - Material()importneutronics_material_makerasnmmmy_mat=nmm.Material(name='my_custom_material',isotopes={'Li6':0.5,'Li7':0.5},density=2.01,percent_type='ao',density_unit='g/cm3')my_mat.openmc_materialUsage - Material from libraryHere is an example that accesses a material from the internal collection called
eurofer which has about 60 isotopes of a density of 7.78g/cm3.importneutronics_material_makerasnmmmy_mat=nmm.Material.from_library('eurofer')my_mat.openmc_materialUsage - Hot Pressurised MaterialFor several materials within the collection the temperature and the pressure impacts the density of the material. The neutronics_material_maker adjusts the density to take temperature and the pressure into account when appropriate. Densities are calculated either by a material specific formula (for exampleFLiBe) or usingCoolProps(for examplecoolants)importneutronics_material_makerasnmmmy_mat1=nmm.Material.from_library(name='H2O',temperature=600,pressure=15e6)my_mat1.openmc_materialFor several materials within the collection the density is adjusted when the
material is enriched. For breeder blankets in fusion it is common to enrich the
lithium 6 content.Usage - Enriched MaterialLithium ceramics used in fusion breeder blankets often contain enriched
lithium-6 content. This slight change in density is accounted for by the
neutronics_material_maker.importneutronics_material_makerasnmmmy_mat2=nmm.Material.from_library(name='Li4SiO4',enrichment=60)my_mat2.openmc_materialUsage - Material.from_mixtureMaterials can also be mixed together using the from_mixture method. This
accepts a list ofneutronics_material_maker.Materialsoropenmc.Materialobjects along with the material fractions (fracs).importneutronics_material_makerasnmmmy_mat1=nmm.Material.from_library(name='Li4SiO4',packing_fraction=0.64)my_mat2=nmm.Material.from_library(name='Be12Ti')my_mat3=nmm.Material.from_mixture(materials=[my_mat1,my_mat2],fracs=[0.4,0.6],percent_type='vo')my_mat3.openmc_materialUsage - Importing Your Own Material LibraryAssuming you have a JSON file saved asmat_lib.jsoncontaining materials
defined in the same format as theexisiting materialsthen you can import this file into the package usingAddMaterialFromFile(). Another option is to useAddMaterialFromDir()to import a directory of json files.importneutronics_material_makerasnmmnmm.AddMaterialFromFile('mat_lib.json')nmm.AvailableMaterials()# this will print the new larger list of materialsUsage - Exporting To Different Neutronics CodesYou can export to OpenMC, Serpent, MCNP and Fispact with the appropiate
arguments.importneutronics_material_makerasnmmmy_mat=nmm.Materialfrom_library('tungsten')# openmcmy_mat.openmc_material# mcnp - required a material_id to be setmy_mat.material_id=1my_mat.mcnp_material# serpentmy_mat.serpent_material# fispact - requires volume to be specifiedmy_mat.volume_in_cm3=1/my_mat.densitymy_mat.fispact_materialFurther ExamplesFurther examples can be found in theneutronics workshop task 11and in theDocumentationAcknowledgementInspired by software projectsPyneand making use ofOpenMCfunctionality and theJSONfile format andPNNLfor many definitions.