pyccx icon indicating copy to clipboard operation
pyccx copied to clipboard

Crash on import: ValueError: setting an array element with a sequence.

Open FranseFrikandel opened this issue 1 year ago • 2 comments

Hello there!

When trying to import pyccx, the statement 'import pyccx' causes a crash. This is done similarly as the example python file.

Simply commenting out the WEDGE6 class in mesher.py appears to fix it for now for me, but this class is presumably needed somewhere and should probably be fixed.

Traceback (most recent call last):
  File "/mnt/c/Users/CRGam/Documents/tandwielen/calculate.py", line 1, in <module>
    import pyccx
  File "/mnt/c/Users/CRGam/Documents/tandwielen/pyccx/pyccx/__init__.py", line 2, in <module>
    from . import mesh
  File "/mnt/c/Users/CRGam/Documents/tandwielen/pyccx/pyccx/mesh/__init__.py", line 1, in <module>
    from .mesher import ElementType, Mesher, MeshingAlgorithm
  File "/mnt/c/Users/CRGam/Documents/tandwielen/pyccx/pyccx/mesh/mesher.py", line 19, in <module>
    class ElementType:
  File "/mnt/c/Users/CRGam/Documents/tandwielen/pyccx/pyccx/mesh/mesher.py", line 79, in ElementType
    class WEDGE6:
  File "/mnt/c/Users/CRGam/Documents/tandwielen/pyccx/pyccx/mesh/mesher.py", line 84, in WEDGE6
    faces = np.array([[1,2,3], [4,5,6], [1,2,5,4], [2,3,6,5], [3,1,4,6]])
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

FranseFrikandel avatar Sep 01 '23 15:09 FranseFrikandel

Hi,

This is a known issue that has appeared with later versions of python/numpy.

This will be resolved in future version (v0.2) with a new approach to elements and mapping their faces.

For now you can comment the line out, unless you specifically need Wedge elements.

drlukeparry avatar Sep 01 '23 18:09 drlukeparry

Thanks. I've indeed commented it out for now, but decided to report it here incase it wasn't known.

I've also encountered another issue, but I'll have to take a look for creating the issue tomorrow when I'm back at my computer. Happy to see this repo is still actively maintained!

FranseFrikandel avatar Sep 01 '23 20:09 FranseFrikandel