armi.cases.suiteBuilder module¶
Contains classes that build case suites from perturbing inputs.
The general use case is to create a SuiteBuilder with a base
Case, use addDegreeOfFreedom()
to adjust inputs according to the supplied arguments, and finally use
.buildSuite to generate inputs. The case suite can then be discovered, submitted, and analyzed
using the standard CaseSuite objects.
This module contains a variety of InputModifier objects as well, which are examples
of how you can modify inputs for parameter sweeping. Power-users will
generally make their own ``Modifier``s that are design-specific.
-
class
armi.cases.suiteBuilder.SuiteBuilder(baseCase)[source]¶ Bases:
objectClass for constructing a CaseSuite from combinations of modifications on base inputs.
-
baseCase¶ A Case object to perturb
- Type
-
modifierSets¶ Contains a list of tuples of
InputModifierinstances. A single case is constructed by running a series (the tuple) of InputModifiers on the case.NOTE: This is public such that someone could pop an item out of the list if it is known to not work, or be unnecessary.
- Type
list(tuple(InputModifier))
-
addDegreeOfFreedom(inputModifiers)[source]¶ Add a degree of freedom to the SweepBuilder.
The exact application of this is dependent on a subclass.
- Parameters
inputModifiers (list(callable(CaseSettings, Blueprints, SystemLayoutInput))) – A list of callable objects with the signature
(CaseSettings, Blueprints, SystemLayoutInput). When these objects are called they should perturb the settings, blueprints, and/or geometry by some amount determined by their construction.
-
buildSuite(namingFunc=None)[source]¶ Builds a
CaseSuitebased on the modifierSets contained in the SuiteBuilder.For each sequence of modifications, this creates a new
Casefrom thebaseCase, and runs the sequence of modifications on the newCase’s inputs. The modifiedCaseis then added to aCaseSuite. The resultingCaseSuiteis returned.- Parameters
namingFunc (callable(index, case, tuple(InputModifier)), (optional)) –
Function used to name each case. It is supplied with the index (int), the case (Case), and a tuple of InputModifiers used to edit the case. This should be enough information for someone to derive a meaningful name.
The function should return a string specifying the path of the
CaseSettings, this allows the user to specify the directories where each case will be run.If not supplied the path will be
./case-suite/<0000>/<title>-<0000>, where<0000>is the four-digit case index, and<title>is thebaseCase.title.- Raises
RuntimeError – When order of modifications is deemed to be invalid.
- Returns
caseSuite – Derived from the
baseCaseand modifications.- Return type
-
-
class
armi.cases.suiteBuilder.FullFactorialSuiteBuilder(baseCase)[source]¶ Bases:
armi.cases.suiteBuilder.SuiteBuilderBuilds a suite that has every combination of each modifier.
-
addDegreeOfFreedom(inputModifiers)[source]¶ Add a degree of freedom to the SuiteBuilder.
Creates the Cartesian product of the
inputModifierssupplied and those already applied.For example:
class SettingModifier(InputModifier): def __init__(self, settingName, value): self.settingName = settingName self.value = value def __call__(self, cs, bp, geom): cs[settignName] = value builder = FullFactorialSuiteBuilder(someCase) builder.addDegreeOfFreedom(SettingsModifier('settingName1', value) for value in (1,2)) builder.addDegreeOfFreedom(SettingsModifier('settingName2', value) for value in (3,4,5))
would result in 6 cases:
Index |settingName1|settingName2|—– | —————- | —————- |0 | 1 | 3 |1 | 2 | 3 |2 | 1 | 4 |3 | 2 | 4 |4 | 1 | 5 |5 | 2 | 5 |See also
-
-
class
armi.cases.suiteBuilder.FullFactorialSuiteBuilderNoisy(baseCase, noiseFraction)[source]¶ Bases:
armi.cases.suiteBuilder.FullFactorialSuiteBuilderAdds a bit of noise to each independent variable to avoid duplicates.
This can be useful in some statistical postprocessors.
Warning
Use with caution. This is part of ongoing research.
-
addDegreeOfFreedom(inputModifiers)[source]¶ Add a degree of freedom to the SuiteBuilder.
Creates the Cartesian product of the
inputModifierssupplied and those already applied.For example:
class SettingModifier(InputModifier): def __init__(self, settingName, value): self.settingName = settingName self.value = value def __call__(self, cs, bp, geom): cs[settignName] = value builder = FullFactorialSuiteBuilder(someCase) builder.addDegreeOfFreedom(SettingsModifier('settingName1', value) for value in (1,2)) builder.addDegreeOfFreedom(SettingsModifier('settingName2', value) for value in (3,4,5))
would result in 6 cases:
Index |settingName1|settingName2|—– | —————- | —————- |0 | 1 | 3 |1 | 2 | 3 |2 | 1 | 4 |3 | 2 | 4 |4 | 1 | 5 |5 | 2 | 5 |See also
-
-
class
armi.cases.suiteBuilder.SeparateEffectsSuiteBuilder(baseCase)[source]¶ Bases:
armi.cases.suiteBuilder.SuiteBuilderVaries each degree of freedom in isolation.
-
addDegreeOfFreedom(inputModifiers)[source]¶ Add a degree of freedom to the SuiteBuilder.
Adds a case for each modifier supplied.
For example:
class SettingModifier(InputModifier): def __init__(self, settingName, value): self.settingName = settingName self.value = value def __call__(self, cs, bp, geom): cs[settignName] = value builder = SeparateEffectsSuiteBuilder(someCase) builder.addDegreeOfFreedom(SettingsModifier('settingName1', value) for value in (1,2)) builder.addDegreeOfFreedom(SettingsModifier('settingName2', value) for value in (3,4,5))
would result in 5 cases:
Index |settingName1|settingName2|—– | —————- | —————- |0 | 1 | default |1 | 2 | default |2 | default | 3 |3 | default | 4 |4 | default | 5 |See also
-
-
class
armi.cases.suiteBuilder.InputModifier(independentVariable=None)[source]¶ Bases:
objectObject that modifies input definitions in some well-defined way.
(This class is abstract.)
Subclasses must implement a
__call__method accepting aCaseSettings,Blueprints, andSystemLayoutInput.The class attribute
FAIL_IF_AFTERshould be a tuple defining what, if any, modifications this should fail if performed after. For example, one should not adjust the smear density (a function of Cladding ID) before adjusting the Cladding ID.Some subclasses are provided, but you are expected to make your own design-specific modifiers in most cases.
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
FAIL_IF_AFTER= ()¶
-
class
armi.cases.suiteBuilder.NeutronicMeshsSizeModifier(multFactor)[source]¶ Bases:
armi.cases.suiteBuilder.InputModifierAdjust the neutronics mesh in all assemblies by a multiplication factor.
This can be useful when switching between nodal and finite difference approximations, or when doing mesh convergence sensitivity studies.
-
multFactor¶ Factor to multiply the number of axial mesh points per block by.
- Type
int
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
-
class
armi.cases.suiteBuilder.FullCoreModifier(independentVariable=None)[source]¶ Bases:
armi.cases.suiteBuilder.InputModifierGrow the SystemLayoutInput to from a symmetric core to a full core.
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
class
armi.cases.suiteBuilder.SmearDensityModifier(value)[source]¶ Bases:
armi.cases.suiteBuilder._PinTypeAssemblyModifierAdjust the smeared density to the specified value.
This is effectively how much of the space inside the cladding tube is occupied by fuel at fabrication.
See also
armi.reactor.blocks.Block.adjustSmearDensityActually adjusts the smeared density
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
class
armi.cases.suiteBuilder.CladThicknessByODModifier(value)[source]¶ Bases:
armi.cases.suiteBuilder._PinTypeAssemblyModifierAdjust the cladding thickness by adjusting the inner diameter of all cladding components.
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
FAIL_IF_AFTER= (<class 'armi.cases.suiteBuilder.SmearDensityModifier'>,)¶
-
class
armi.cases.suiteBuilder.CladThicknessByIDModifier(value)[source]¶ Bases:
armi.cases.suiteBuilder._PinTypeAssemblyModifierAdjust the cladding thickness by adjusting the outer diameter of the cladding component.
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
FAIL_IF_AFTER= (<class 'armi.cases.suiteBuilder.SmearDensityModifier'>,)¶
-
class
armi.cases.suiteBuilder.NeutronicConvergenceModifier(value)[source]¶ Bases:
armi.cases.suiteBuilder.InputModifierAdjust the neutronics convergence parameters
epsEig,epsFSAvg, andepsFSPoint.The supplied value is used for
epsEig.epsFSAvgandepsFSPointare set to 100 times the supplied value.This can be used to perform sensitivity studies on convergence criteria.
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
class
armi.cases.suiteBuilder.SettingsModifier(settingName, value)[source]¶ Bases:
armi.cases.suiteBuilder.InputModifierAdjust settings to specified values.
Constuctor.
- Parameters
independentVariable (dict or None, optional) – Name/value pairs to associate with the independent variable being modified by this object. Will be analyzed and plotted against other modifiers with the same name.
-
bad_setting_names= {'epsEig': <class 'armi.cases.suiteBuilder.NeutronicConvergenceModifier'>, 'epsFSAvg': <class 'armi.cases.suiteBuilder.NeutronicConvergenceModifier'>, 'epsFSPoint': <class 'armi.cases.suiteBuilder.NeutronicConvergenceModifier'>}¶