Skip to content

Commit

Permalink
Fix applyInputParams bug when values are zero (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
keckler committed Sep 28, 2021
1 parent 62b85d6 commit 5729a29
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion armi/materials/b4c.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class B4C(material.Material):
def applyInputParams(
self, B10_wt_frac=None, theoretical_density=None, *args, **kwargs
):
if B10_wt_frac:
if B10_wt_frac is not None:
# we can't just use the generic enrichment adjustment here because the
# carbon has to change with enrich.
self.adjustMassEnrichment(B10_wt_frac)
Expand Down
19 changes: 16 additions & 3 deletions armi/materials/mox.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,29 @@ class MOX(UraniumOxide):
def applyInputParams(
self, U235_wt_frac=None, TD_frac=None, mass_frac_PU02=None, *args, **kwargs
):
if U235_wt_frac:
if U235_wt_frac is not None:
self.adjustMassEnrichment(U235_wt_frac)

td = TD_frac
if td:
if td is not None:
if td > 1.0:
runLog.warning(
"Theoretical density frac for {0} is {1}, which is >1"
"".format(self, td),
single=True,
label="Large theoretical density",
)
elif td == 0:
runLog.warning(
"Theoretical density frac for {self} is zero!",
single=True,
label="Zero theoretical density",
)
self.adjustTD(td)
else:
self.adjustTD(1.00) # default to fully dense.

if mass_frac_PU02:
if mass_frac_PU02 is not None:
self.setMassFracPuO2(mass_frac_PU02)
material.FuelMaterial.applyInputParams(self, *args, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion armi/materials/sulfur.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Sulfur(material.Fluid):
name = "Sulfur"

def applyInputParams(self, sulfur_density_frac=None):
if sulfur_density_frac:
if sulfur_density_frac is not None:
self.fullDensFrac = float(sulfur_density_frac)

def setDefaultMassFracs(self):
Expand Down
2 changes: 1 addition & 1 deletion armi/materials/thU.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def getEnrichment(self):
def applyInputParams(self, U233_wt_frac=None, *args, **kwargs):
runLog.warning("Material {} has not yet been tested for accuracy".format("ThU"))

if U233_wt_frac:
if U233_wt_frac is not None:
self.adjustMassEnrichment(U233_wt_frac)
material.FuelMaterial.applyInputParams(self, *args, **kwargs)

Expand Down
10 changes: 8 additions & 2 deletions armi/materials/uraniumOxide.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,24 @@ def getTD(self):
return self.theoreticalDensityFrac

def applyInputParams(self, U235_wt_frac=None, TD_frac=None, *args, **kwargs):
if U235_wt_frac:
if U235_wt_frac is not None:
self.adjustMassEnrichment(U235_wt_frac)

td = TD_frac
if td:
if td is not None:
if td > 1.0:
runLog.warning(
"Theoretical density frac for {0} is {1}, which is >1"
"".format(self, td),
single=True,
label="Large theoretical density",
)
elif td == 0:
runLog.warning(
"Theoretical density frac for {self} is zero!",
single=True,
label="Zero theoretical density",
)
self.adjustTD(td)
else:
self.adjustTD(1.00) # default to fully dense.
Expand Down

0 comments on commit 5729a29

Please sign in to comment.