Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update key for enrichment material modification in Lithium material class #546

Merged
merged 14 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions armi/materials/lithium.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,37 @@
.. WARNING:: Whenever you irradiate lithium you will get tritium.
"""

from armi import runLog
from armi import utils
from armi.materials import material
from armi.nucDirectory import nuclideBases as nb


class Lithium(material.Fluid):
name = "Lithium"
references = {"density": "Wikipedia"}
enrichedNuclide = "LI6"

def applyInputParams(self, LI_wt_frac=None, *args, **kwargs):
enrich = utils.getFloat(LI_wt_frac)
def applyInputParams(self, LI_wt_frac=None, LI6_wt_frac=None, *args, **kwargs):
if LI_wt_frac is not None:
runLog.warning(
"The 'LI_wt_frac' material modification for Lithium will be deprecated"
" Update your inputs to use 'LI6_wt_frac' instead.",
single=True,
)
if LI6_wt_frac is not None:
runLog.warning(
"Both 'LI_wt_frac' and 'LI6_wt_frac' are specified "
f"for {self}. 'LI6_wt_frac' will be used.",
single=True,
)

LI6_wt_frac = LI6_wt_frac or LI_wt_frac

enrich = utils.getFloat(LI6_wt_frac)
# allow 0.0 to pass in!
if enrich is not None:
self.adjustMassEnrichment(LI_wt_frac)
self.adjustMassEnrichment(LI6_wt_frac)

def density(self, Tk=None, Tc=None):
r"""
Expand All @@ -43,8 +60,8 @@ def density(self, Tk=None, Tc=None):
return 0.512 # g/cc

def setDefaultMassFracs(self):
self.setMassFrac("LI6", 0.075)
self.setMassFrac("LI7", 0.925)
self.setMassFrac("LI6", nb.byName["LI6"].abundance)
john-science marked this conversation as resolved.
Show resolved Hide resolved
self.setMassFrac("LI7", nb.byName["LI7"].abundance)

def meltingPoint(self):
return 453.69 # K
Expand Down
53 changes: 53 additions & 0 deletions armi/materials/tests/test_lithium.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2022 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Tests for lithium.
"""

import unittest

from armi.materials.tests.test_materials import _Material_Test
from armi.materials.lithium import Lithium
from armi.nucDirectory import nuclideBases as nb


class Lithium_TestCase(_Material_Test, unittest.TestCase):
MAT_CLASS = Lithium
defaultMassFrac = nb.byName["LI6"].abundance

def setUp(self):
_Material_Test.setUp(self)
self.mat = Lithium()

self.Lithium_LI_wt_frac = Lithium()
self.Lithium_LI_wt_frac.applyInputParams(LI_wt_frac=0.5)

self.Lithium_LI6_wt_frac = Lithium()
self.Lithium_LI6_wt_frac.applyInputParams(LI6_wt_frac=0.6)

self.Lithium_both = Lithium()
self.Lithium_both.applyInputParams(LI_wt_frac=0.7, LI6_wt_frac=0.8)

def test_Lithium_material_modifications(self):
self.assertEqual(self.mat.getMassFrac("LI6"), self.defaultMassFrac)

self.assertEqual(self.Lithium_LI_wt_frac.getMassFrac("LI6"), 0.5)

self.assertEqual(self.Lithium_LI6_wt_frac.getMassFrac("LI6"), 0.6)

self.assertEqual(self.Lithium_both.getMassFrac("LI6"), 0.8)


if __name__ == "__main__":
unittest.main()