Eomys/pyleecan

get_demag

Opened this issue · 0 comments

dear all,
does anyone know what is this error when happen that I want to use get_demag function
I attach my code.
Best regards,
Faraz Mirali

out_femm.mag.get_demag(Hmax = -100, group_name = "rotor magnets") # for example Hmax = -100

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[239], line 1
----> 1 out_femm.mag.get_demag(Hmax = -100, group_name = "rotor magnets")

File c:\users\faraz\appdata\local\programs\python\python38\lib\site-packages\pyleecan\Methods\Output\OutMag\get_demag.py:32, in get_demag(self, Hmax, group_name)
     30     group_name = "rotor magnets"
     31 if group_name in self.meshsolution.group.keys():
---> 32     inds = get_indices_limited(
     33         self.meshsolution, label="H", group_names=group_name, max_value=Hmax
     34     )
     36     area_ref = get_area(self.meshsolution, group_names=group_name)
     37     area = get_area(self.meshsolution, group_names=group_name, indices=inds)

File c:\users\faraz\appdata\local\programs\python\python38\lib\site-packages\pyleecan\Functions\MeshSolution\get_indices_limited.py:45, in get_indices_limited(meshsolution, label, group_names, max_value, min_value)
     42 field = grp.get_field(label=label)
     44 # TODO check field size and axes
---> 45 field_mag = (field[:, :, 0] ** 2 + field[:, :, 1] ** 2) ** (1 / 2)
     46 field_max = field_mag.max(axis=0)
     47 field_min = field_mag.min(axis=0)

IndexError: too many indices for array: array is 1-dimensional, but 3 were indexed