terrapower.physics.neutronics.dragon.dragonWriter module

Write DRAGON inputs based on data contained in ARMI objects.

This uses templates and attempts to do most of the logic in code to build the appropriate data structures. Then, the template engine is responsible for transforming that data into the format required for DRAGON to process it as input.

Classes here are intended to be specialized with more design-specific subclasess in design-specific ARMI apps (or other clients).

class terrapower.physics.neutronics.dragon.dragonWriter.DragonWriter(armiObjs, options)[source]

Bases: object

Write a DRAGON input file using a template.

This base class should strive to avoid any design-specific assumptions.

Initialize a writer.

Parameters
  • armiObjs (list) – The ARMI object(s) to process into template data. These represent the parts of a reactor you want to model.

  • options (DragonOptions) – Data structure that contains execution and modeling controls

write()[source]

Write a DRAGON input file.

_readTemplate()[source]

Read the template file.

_buildTemplateData()[source]

Return data to be sent to the template to produce the DRAGON input.

_makeGroupStructure()[source]

Make energy group structure bounds.

DRAGON only needs group boundary values between 0 and the max. It assumes lowest boundary is 0 eV and the upper most boundary is the highest energy fine group boundary in the specified library.

class terrapower.physics.neutronics.dragon.dragonWriter.DragonWriterHomogenized(armiObjs, options)[source]

Bases: terrapower.physics.neutronics.dragon.dragonWriter.DragonWriter

Write DRAGON inputs with homogenized compositions.

This subclass assumes that the DRAGON case will represent one or more armi objects.

The current implementation is capable of writing MIX cards for multiple compositions at once but does not yet have the ability to write geometry representation for anything beyond 0-D.

Initialize a writer.

Parameters
  • armiObjs (list) – The ARMI object(s) to process into template data. These represent the parts of a reactor you want to model.

  • options (DragonOptions) – Data structure that contains execution and modeling controls

_buildTemplateData()[source]

Return data to be sent to the template to produce the DRAGON input.

_makeMixtures()[source]

Make a DragonMixture from each object slated for inclusion in the input.

class terrapower.physics.neutronics.dragon.dragonWriter.MixtureNuclide[source]

Bases: tuple

Data structure for a nuclide in a DRAGON mixture.

Create new instance of MixtureNuclide(armiName, dragName, xsid, ndens, selfShield)

armiName

Alias for field number 0

dragName

Alias for field number 1

xsid

Alias for field number 2

ndens

Alias for field number 3

selfShield

Alias for field number 4

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_field_types = {'armiName': <class 'str'>, 'dragName': <class 'str'>, 'ndens': <class 'float'>, 'selfShield': <class 'str'>, 'xsid': <class 'str'>}
_fields = ('armiName', 'dragName', 'xsid', 'ndens', 'selfShield')
_fields_defaults = {}
classmethod _make(iterable)

Make a new MixtureNuclide object from a sequence or iterable

_replace(**kwds)

Return a new MixtureNuclide object replacing specified fields with new values

class terrapower.physics.neutronics.dragon.dragonWriter.DragonMixture(armiObj, options, index)[source]

Bases: object

Data structure for a single mixture in Dragon.

Each mixture can be associated with:
  • A temperature

  • A number density vector

  • A mapping between library names and internal nuclide names

  • A self-shielding vector

getTempInK()[source]

Return the mixture temperature in Kelvin.

Notes

Only 1 temperature can be specified per mixture in DRAGON. For 0-D cases, the temperature of the fuel component is used for the entire mixture.

For heterogeneous models, component temperature should be used. Component temperature may not work well yet for non BOL cases since

Warning

The ARMI cross section group manager does not currently set the fuel component temperature to the average component temperatures when making a representative block. Thus, for the time being, fuel temperature of an arbitrary block in each representative block’s parents will be obtained.

getMixVector()[source]

Generate mixture composition table.

getSelfShieldingFlag(nucBase, nDens) → str[source]

Get self shielding flag for a given nuclide.

Figuring out how to structure resonant region index (inrs) requires some engineering judgment.

Need index to make sure each mixture gets different fine-group flux.

Flags self-sheilding if density is greater than a threshold or if it is a heavy metal

terrapower.physics.neutronics.dragon.dragonWriter.getDragLibNucID(nucBase, thermalScatteringInfo)[source]

Return the DRAGLIB isotope name for this nuclide.

Parameters

nucBase (NuclideBase) – The nuclide to get the DRAGLIB ID for.

Notes

These IDs are compatible with DRAGLIB nuclear data format which is available: https://www.polymtl.ca/merlin/libraries.htm

terrapower.physics.neutronics.dragon.dragonWriter.getNuclideThermalScatteringData(armiObj)[source]

Make a mapping between nuclideBases in an armiObj and relevant thermal scattering laws.

In some cases, a nuclide will be present both with a TSL and without (e.g. hydrogen in water and hydrogen in concrete in the same armiObj). While this could conceptually be handled somehow, we simply error out at this time.

Notes

This code is copy/pasted originally from the test case in the framework. The code reviewer would not allow this to be put in the framework so we are forced to copy paste… Sorry.

Returns

tslByNuclideBase – A dictionary with NuclideBase keys and ThermalScattering values

Return type

dict

Raises

RuntimeError – When a armiObj has nuclides subject to more than one TSL, or subject to a TLS in one case and no TSL in another.

Examples

>>> tslInfo = getNuclideThermalScatteringData(armiObj)
>>> if nucBase in tslInfo:
>>>     aceLabel = tslInfo[nucBase].aceLabel