-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update material modifications to use consistent keyword for theoretic…
…al density
- Loading branch information
Showing
4 changed files
with
130 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
Tests for boron carbide. | ||
""" | ||
|
||
import unittest | ||
|
||
from armi.materials.tests.test_materials import _Material_Test | ||
from armi.materials.b4c import B4C | ||
from armi.materials.b4c import DEFAULT_THEORETICAL_DENSITY_FRAC | ||
|
||
|
||
class B4C_TestCase(_Material_Test, unittest.TestCase): | ||
MAT_CLASS = B4C | ||
|
||
def setUp(self): | ||
_Material_Test.setUp(self) | ||
self.mat = B4C() | ||
|
||
self.B4C_theoretical_density = B4C() | ||
self.B4C_theoretical_density.applyInputParams(theoretical_density=0.5) | ||
|
||
self.B4C_TD_frac = B4C() | ||
self.B4C_TD_frac.applyInputParams(TD_frac=0.4) | ||
|
||
self.B4C_both = B4C() | ||
self.B4C_both.applyInputParams(theoretical_density=0.5, TD_frac=0.4) | ||
|
||
def test_theoretical_density(self): | ||
ref = self.mat.density(500) | ||
|
||
reduced = self.B4C_theoretical_density.density(500) | ||
self.assertAlmostEqual( | ||
ref * 0.5 / DEFAULT_THEORETICAL_DENSITY_FRAC, | ||
reduced | ||
) | ||
|
||
reduced = self.B4C_TD_frac.density(500) | ||
self.assertAlmostEqual( | ||
ref * 0.4 / DEFAULT_THEORETICAL_DENSITY_FRAC, | ||
reduced | ||
) | ||
|
||
reduced = self.B4C_both.density(500) | ||
self.assertAlmostEqual( | ||
ref * 0.4 / DEFAULT_THEORETICAL_DENSITY_FRAC, | ||
reduced | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
Tests for sulfur. | ||
""" | ||
|
||
import unittest | ||
|
||
from armi.materials.tests.test_materials import _Material_Test | ||
from armi.materials.sulfur import Sulfur | ||
|
||
|
||
class Sulfur_TestCase(_Material_Test, unittest.TestCase): | ||
MAT_CLASS = Sulfur | ||
|
||
def setUp(self): | ||
_Material_Test.setUp(self) | ||
self.mat = Sulfur() | ||
|
||
self.Sulfur_sulfur_density_frac = Sulfur() | ||
self.Sulfur_sulfur_density_frac.applyInputParams(sulfur_density_frac=0.5) | ||
|
||
self.Sulfur_TD_frac = Sulfur() | ||
self.Sulfur_TD_frac.applyInputParams(TD_frac=0.4) | ||
|
||
self.Sulfur_both = Sulfur() | ||
self.Sulfur_both.applyInputParams(sulfur_density_frac=0.5, TD_frac=0.4) | ||
|
||
def test_sulfur_density_frac(self): | ||
ref = self.mat.density(500) | ||
|
||
reduced = self.Sulfur_sulfur_density_frac.density(500) | ||
self.assertAlmostEqual(ref * 0.5, reduced) | ||
|
||
reduced = self.Sulfur_TD_frac.density(500) | ||
self.assertAlmostEqual(ref * 0.4, reduced) | ||
|
||
reduced = self.Sulfur_both.density(500) | ||
self.assertAlmostEqual(ref * 0.4, reduced) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |