armi.utils.asciimaps module¶
ASCII maps are little grids of letters/numbers that represent some kind of a lattice.
These are commonly used in nuclear analysis to represent core maps, pin layouts, etc. in input files. This module reads various text and interprets them into meaningful data structures.
We make classes for different geometries to share code. This will eventually be expanded for various symmetries that are applicable to cores, assemblies, etc.
-
class
armi.utils.asciimaps.AsciiMap(lattice=None)[source]¶ Bases:
objectBase class for maps.
These should be able to read and write ASCII maps.
-
readMap(text)[source]¶ Iterate over an ASCII map and read it into a data structure.
- Parameters
text (str) – The ascii lattice input text
- Returns
lattice – A mapping between (i,j) indices and specifiers, which can be one or more non-space chars.
- Return type
dict
See also
armi.reactor.grids()Grid objects that this information can be turned into
-
-
class
armi.utils.asciimaps.AsciiMapCartesian(lattice=None)[source]¶ Bases:
armi.utils.asciimaps.AsciiMapRead a square or rectangular ascii map.
This may represent a full assembly or core or some symmetry of that.
-
class
armi.utils.asciimaps.AsciiMapHexThird(lattice=None)[source]¶ Bases:
armi.utils.asciimaps.AsciiMapRead a 1/3-symmetric hex map with flat ends up/down.
This is often useful for core maps in hex-assembly reactors like VVERs or SFRs. This should be missing the overlapping assemblies on the 120-degree line like in a nodal DIF3D case.
This has 2 axes that are at a 60-degree angle. i marches up and down the 30-degree ray and j marches up and down the 90-degree ray. The center is (0,0). Negative indices are found beyond these rays in the 1/3 symmetric map.
In reading a third core, you just need to figure out what the left-hand (i,j) starting point (base) is of any row. Then, as you go across the column from left to right, i increments by 2 each time, and j decrements by 1 each time.
The base hexes (LHS) as a function of rows from bottom are: Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 Base: (0,0), (1,0) (0,1), (1,1), (0,2), (-1,3), (0,3), (-1,4), (-2,5), (-1,5), (-2,6), (-3,7) (-2,7)
After the first 3, it’s stepping up the 120-degree ray, two steps left, one step right, repeat. Very 3-based.
First, find which triplet you’re in (beyond the first): row//3
Triplet: 0 1 2 3 4 Base: N/A (1,1) (0,3) (-1,5) (-2,7) Pattern (>0): (2-triplet, triplet*2-1)
Then stride inside your triplet by position: row%3 base = (tI-pos, tJ+pos)
Of course, this breaks down as soon as you roll off the 120-degree symmetry line towards the top of the map. Here we either have to make whitespace count or insert dummy placeholders. The placeholders are going to be less fragile.
-
class
armi.utils.asciimaps.AsciiMapHexFullTipsUp(lattice=None)[source]¶ Bases:
armi.utils.asciimaps.AsciiMapRead a full hexagonal ASCII map with tips of hexagons pointing up.
This is often useful for pins inside a hexagonal assembly that has flat ends of the assembly up.
In this case, the axes are also 60-degrees offset (above x-axis), with i incrementing horizontally and j incrementing up along the 60-degree ray.
This reads in a full hex and puts 0,0 at the center point (using a shift).
-
readMap(text)[source]¶ Iterate over an ASCII map and read it into a data structure.
- Parameters
text (str) – The ascii lattice input text
- Returns
lattice – A mapping between (i,j) indices and specifiers, which can be one or more non-space chars.
- Return type
dict
See also
armi.reactor.grids()Grid objects that this information can be turned into
-