mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Move density_to_mat to example_geometry.py
This commit is contained in:
parent
2cd9aecf21
commit
4e21e398c8
2 changed files with 22 additions and 22 deletions
|
|
@ -657,24 +657,3 @@ class OpenMCOperator(Operator):
|
|||
volume = {k: v for d in volume_list for k, v in d.items()}
|
||||
|
||||
return volume, nuc_list, burn_list, self.burnable_mats
|
||||
|
||||
|
||||
def density_to_mat(dens_dict):
|
||||
"""Generates an OpenMC material from a cell ID and self.number_density.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
m_id : int
|
||||
Cell ID.
|
||||
Returns
|
||||
-------
|
||||
openmc.Material
|
||||
The OpenMC material filled with nuclides.
|
||||
"""
|
||||
|
||||
mat = openmc.Material()
|
||||
for key in dens_dict:
|
||||
mat.add_nuclide(key, 1.0e-24*dens_dict[key])
|
||||
mat.set_density('sum')
|
||||
|
||||
return mat
|
||||
|
|
|
|||
|
|
@ -9,7 +9,28 @@ import math
|
|||
|
||||
import numpy as np
|
||||
import openmc
|
||||
from openmc.deplete import density_to_mat
|
||||
|
||||
|
||||
def density_to_mat(dens_dict):
|
||||
"""Generates an OpenMC material from a cell ID and self.number_density.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
dens_dict : dict
|
||||
Dictionary mapping nuclide names to densities
|
||||
|
||||
Returns
|
||||
-------
|
||||
openmc.Material
|
||||
The OpenMC material filled with nuclides.
|
||||
|
||||
"""
|
||||
mat = openmc.Material()
|
||||
for key in dens_dict:
|
||||
mat.add_nuclide(key, 1.0e-24*dens_dict[key])
|
||||
mat.set_density('sum')
|
||||
|
||||
return mat
|
||||
|
||||
|
||||
def generate_initial_number_density():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue