mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Added routines to Python API for nuclide-based scattering laws
This commit is contained in:
parent
e8d2a5e86b
commit
25d9f8b2a3
2 changed files with 36 additions and 2 deletions
|
|
@ -271,6 +271,12 @@ class Material(object):
|
|||
self._sab.append((name, xs))
|
||||
|
||||
|
||||
def make_isotropic_in_lab(self):
|
||||
|
||||
for nuclide_name in self._nuclides:
|
||||
self._nuclides[nuclide_name][0].make_isotropic_in_lab()
|
||||
|
||||
|
||||
def get_all_nuclides(self):
|
||||
|
||||
nuclides = {}
|
||||
|
|
@ -331,6 +337,9 @@ class Material(object):
|
|||
if not nuclide[0]._xs is None:
|
||||
xml_element.set("xs", nuclide[0]._xs)
|
||||
|
||||
if not nuclide[0]._scattering is None:
|
||||
xml_element.set("scattering", nuclide[0]._scattering)
|
||||
|
||||
return xml_element
|
||||
|
||||
|
||||
|
|
@ -496,6 +505,11 @@ class MaterialsFile(object):
|
|||
|
||||
self._materials.remove(material)
|
||||
|
||||
def make_isotropic_in_lab(self):
|
||||
|
||||
for material in self._materials:
|
||||
materials.make_isotropic_in_lab()
|
||||
|
||||
|
||||
def create_material_subelements(self):
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class Nuclide(object):
|
|||
self._name = ''
|
||||
self._xs = None
|
||||
self._zaid = None
|
||||
self._scattering = None
|
||||
|
||||
# Set the Material class attributes
|
||||
self.name = name
|
||||
|
|
@ -54,6 +55,11 @@ class Nuclide(object):
|
|||
return self._zaid
|
||||
|
||||
|
||||
@property
|
||||
def scattering(self):
|
||||
return self._scattering
|
||||
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
|
||||
|
|
@ -87,10 +93,24 @@ class Nuclide(object):
|
|||
self._zaid = zaid
|
||||
|
||||
|
||||
@scattering.setter
|
||||
def scattering(self, scattering):
|
||||
|
||||
if not scattering in ['ace', 'lab']:
|
||||
msg = 'Unable to set scattering for Nuclide to {0} ' \
|
||||
'which is not "ace" or "lab"'.format(scattering)
|
||||
raise ValueError(msg)
|
||||
|
||||
self._scattering = scattering
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
string = 'Nuclide - {0}\n'.format(self._name)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tXS', '=\t', self._xs)
|
||||
if self._zaid is not None:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tZAID', '=\t', self._zaid)
|
||||
return string
|
||||
string += '{0: <16}{1}{2}\n'.format('\tZAID', '=\t', self._zaid)
|
||||
if self._scattering is not None:
|
||||
string += '{0: <16}{1}{2}\n'.format('\tscattering', '=\t',
|
||||
self._scattering)
|
||||
return string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue