From 3b199b648f150d31b925d2466ed30095f4e321c6 Mon Sep 17 00:00:00 2001 From: John Stilley <1831479+john-science@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:40:44 -0800 Subject: [PATCH] Fixing copper density curve (#1150) --- armi/materials/copper.py | 4 +-- armi/materials/tests/test_materials.py | 35 ++++++++++++++++++++------ doc/release/0.2.rst | 1 + 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/armi/materials/copper.py b/armi/materials/copper.py index 2f78c4940..177e70824 100644 --- a/armi/materials/copper.py +++ b/armi/materials/copper.py @@ -29,8 +29,8 @@ def setDefaultMassFracs(self): self.setMassFrac("CU63", 0.6915) self.setMassFrac("CU65", 0.3085) - def density(self, Tk=None, Tc=None): - return 8.913 + def density3(self, Tk=None, Tc=None): + return 8.913 # g/cm3 def linearExpansionPercent(self, Tk=None, Tc=None): """ diff --git a/armi/materials/tests/test_materials.py b/armi/materials/tests/test_materials.py index 0917cc8e9..96dcddacc 100644 --- a/armi/materials/tests/test_materials.py +++ b/armi/materials/tests/test_materials.py @@ -15,8 +15,8 @@ r"""Tests materials.py""" # pylint: disable=missing-function-docstring,missing-class-docstring,abstract-method,protected-access,no-member,invalid-name -import pickle import math +import pickle import unittest from numpy import testing @@ -49,12 +49,6 @@ def test_density3(self): """Test that all materials produce a zero density from density3""" self.assertNotEqual(self.mat.density3(500), 0) - def test_getChildren(self): - self.assertEqual(len(self.mat.getChildren()), 0) - - def test_getChildrenWithFlags(self): - self.assertEqual(len(self.mat.getChildrenWithFlags("anything")), 0) - def test_TD(self): self.assertEqual(self.mat.getTD(), self.mat.theoreticalDensityFrac) @@ -913,6 +907,33 @@ def test_propertyValidTemperature(self): self.assertGreater(len(self.mat.propertyValidTemperature), 0) +class Copper_TestCase(_Material_Test, unittest.TestCase): + MAT_CLASS = materials.Cu + + def test_setDefaultMassFracs(self): + cur = self.mat.massFrac + ref = {"CU63": 0.6915, "CU65": 0.3085} + self.assertEqual(cur, ref) + + def test_densityNeverChanges(self): + for tk in [200.0, 400.0, 800.0, 1111.1]: + cur = self.mat.density3(tk) + self.assertAlmostEqual(cur, 8.913, 4) + + def test_linearExpansionPercent(self): + temps = [100.0, 200.0, 600.0] + expansions = [-0.2955, -0.1500, 0.5326] + for i, temp in enumerate(temps): + cur = self.mat.linearExpansionPercent(Tk=temp) + self.assertAlmostEqual(cur, expansions[i], 4) + + def test_getChildren(self): + self.assertEqual(len(self.mat.getChildren()), 0) + + def test_getChildrenWithFlags(self): + self.assertEqual(len(self.mat.getChildrenWithFlags("anything")), 0) + + class Sulfur_TestCase(_Material_Test, unittest.TestCase): MAT_CLASS = materials.Sulfur diff --git a/doc/release/0.2.rst b/doc/release/0.2.rst index 3ff305477..18c6ca055 100644 --- a/doc/release/0.2.rst +++ b/doc/release/0.2.rst @@ -32,6 +32,7 @@ What's new in ARMI #. Bug fix for Magnessium density curve. (`PR#1126 https://github.com/terrapower/armi/pull/1126`_) #. Bug fix for Potassium density curve. (`PR#1128 https://github.com/terrapower/armi/pull/1128`_) #. Bug fix for Concrete density curve. (`PR#1131 https://github.com/terrapower/armi/pull/1131`_) +#. Bug fix for Copper density curve. (`PR#1150 https://github.com/terrapower/armi/pull/1150`_) #. Bug fix for Component.density. (`PR#1149 https://github.com/terrapower/armi/pull/1149`_) #. Calculate block kgHM and kgFis on core loading and after shuffling. (`PR#1136 https://github.com/terrapower/armi/pull/1136`_)