Replies: 1 comment 4 replies
-
FiPy I would say that the behavior of [*] Internally, FiPy does have need to store irregular information for, e.g., the distances to neighboring cells for each cell of a mesh comprising arbitrary polygons or polyhedra. FiPy uses masked arrays for this. We keep all elements of the shape the same, except for the last one, so the number of values associated with a cell can change, but each of those values has the same shape. How these get created depends on what they are. |
Beta Was this translation helpful? Give feedback.
-
I plan to use fipy as a prototyping tool for radiation simulation. As a basic functionality
the need to store an array of arrays or lists in each cell arises. The length
of that array of arrays/lists should be allowed to differ from cell to cell.
To test this functionality the code below is used as a minimum working example.
valueNonUniform is the array populated with cell values. Since the grid has four cells,
the array has four entries.
The first entry "arrShort" differs from the following other entries "arrLong".
The corresponding CellVariable VarNonUniform behaves as expected:
But in case the array is populated with all entries being the same, which is demonstrated with the array
valueUniform, which is an array of arrays of kind arrLong, one gets some strange behavior:
VarNonUniform.value is of shape (4,)
fipy takes each entry of valueNonUniform and attributes it to one cell, but in case
of valueUniform, where all entries are the same, fipy seems to attribute the whole array valueUniform to each cell
and perform some transpose operations...
VarUniform.value is of shape (4,3,2,4)
Why is that and how to tell fipy to handle the array valueUniform in the exact same way as the array valueNonUniform?
It would be quite helpful to get a hint on how to avoid this behavior or understand the potential wisdom behind.
Beta Was this translation helpful? Give feedback.
All reactions