Skip to content

Commit

Permalink
Fixing thKernel setting data type (#1855)
Browse files Browse the repository at this point in the history
The thKernel setting is meant to store the name of the primary
thermal hydraulics solver for a run. The default value was False,
causing the data type of thKernel to be bool. When a user set the
value of thKernel to anything in the settings file, it would only
be set to True. Changing the default value to an empty string
changes its data type to str, allowing the setting to work as
originally intended.
  • Loading branch information
daleazer authored Sep 9, 2024
1 parent f9f4f69 commit f318392
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion armi/physics/thermalHydraulics/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def defineSettings():
),
setting.Setting(
CONF_TH_KERNEL,
default=False,
default="",
label="Thermal Hydraulics Kernel",
description="Name of primary T/H solver in this run",
),
Expand Down
13 changes: 13 additions & 0 deletions armi/physics/thermalHydraulics/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2024 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.

"""Unit tests for the thermal hydraulics plugin."""
from armi.physics import thermalHydraulics
from armi.physics.thermalHydraulics.settings import CONF_DO_TH, CONF_TH_KERNEL
from armi.settings import caseSettings
from armi.tests.test_plugins import TestPlugin


class TestThermalHydraulicsPlugin(TestPlugin):
plugin = thermalHydraulics.ThermalHydraulicsPlugin

def test_thermalHydraulicsSettingsLoaded(self):
"""Test that the thermal hydraulics case settings are loaded."""
cs = caseSettings.Settings()

self.assertIn(CONF_DO_TH, cs)
self.assertIn(CONF_TH_KERNEL, cs)

def test_thermalHydraulicsSettingsSet(self):
"""Test that the thermal hydraulics case settings are applied correctly."""
cs = caseSettings.Settings()
thKernelName = "testKernel"

cs[CONF_DO_TH] = True
cs[CONF_TH_KERNEL] = thKernelName

self.assertTrue(cs[CONF_DO_TH])
self.assertEqual(cs[CONF_TH_KERNEL], thKernelName)
1 change: 1 addition & 0 deletions doc/release/0.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Bug Fixes
---------
#. Fixed ``DerivedShape.getArea`` for ``cold=True``. (`PR#1831 <https://github.com/terrapower/armi/pull/1831>`_)
#. Fixed error parsing command line integers in ``ReportsEntryPoint``. (`PR#1824 <https://github.com/terrapower/armi/pull/1824>`_)
#. Changed data type of ``thKernel`` setting from ``bool`` to ``str`` in ``ThermalHydraulicsPlugin``. (`PR#1855 <https://github.com/terrapower/armi/pull/1855>`_)
#. TBD

Quality Work
Expand Down

0 comments on commit f318392

Please sign in to comment.