Now track OpenCG lattice names. Now strip hyphens on nuclide names

This commit is contained in:
Will Boyd 2016-08-11 11:31:29 -04:00
parent 4edede450e
commit 043c56f338
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,6 @@
from numbers import Integral
import sys
import warnings
from openmc.checkvalue import check_type
@ -98,7 +99,14 @@ class Nuclide(object):
@name.setter
def name(self, name):
check_type('name', name, basestring)
self._name = name
if '-' in name:
new_name = name.strip('-', '')
msg = 'OpenMC nuclide names follow the GND standard. Nuclide ' \
'"{}" is being transformed to "{}".'.format(name, new_name)
warnings.warn(msg, DeprecationWarning)
self._name = name.replace('-', '')
@xs.setter
def xs(self, xs):

View file

@ -911,6 +911,7 @@ def get_openmc_lattice(opencg_lattice):
if lattice_id in OPENMC_LATTICES:
return OPENMC_LATTICES[lattice_id]
name = opencg_lattice.name
dimension = opencg_lattice.dimension
width = opencg_lattice.width
offset = opencg_lattice.offset
@ -941,7 +942,7 @@ def get_openmc_lattice(opencg_lattice):
((np.array(width, dtype=np.float64) *
np.array(dimension, dtype=np.float64))) / -2.0
openmc_lattice = openmc.RectLattice(lattice_id=lattice_id)
openmc_lattice = openmc.RectLattice(lattice_id=lattice_id, name=name)
openmc_lattice.pitch = width
openmc_lattice.universes = universe_array
openmc_lattice.lower_left = lower_left