anstmichaels / emopt

A suite of tools for optimizing the shape and topology of electromagnetic structures.
BSD 3-Clause "New" or "Revised" License
97 stars 41 forks source link

MMI_splitter_3D_FDFD issue #24

Open YUJING-HE opened 2 years ago

YUJING-HE commented 2 years ago

I have encountered a problem when running ~/emopt-master/examples/MMI_splitter_3D/mmi_1x2_splitter_3D_fdfd.py

[INFO] Building system matrices... Traceback (most recent call last): File "~/emopt-master/emopt/fdfd.py", line 2482, in buildA A[i, jEx] = 1jeps.get_value(xh+0.5divl,yh,zh-0.5*divl) # todo: partial grid steps File "PETSc/Mat.pyx", line 276, in petsc4py.PETSc.Mat.setitem File "PETSc/petscmat.pxi", line 1072, in petsc4py.PETSc.mat_setitem File "PETSc/petscmat.pxi", line 825, in petsc4py.PETSc.matsetvalues File "PETSc/arraynpy.pxi", line 140, in petsc4py.PETSc.iarray_s File "PETSc/arraynpy.pxi", line 121, in petsc4py.PETSc.iarray TypeError: Cannot cast array data from dtype('complex128') to dtype('float64') according to the rule 'safe'

It seems that the data types of Maxwell operator and its elements are not consistent.

YUJING-HE commented 2 years ago

I have already solve the problem by reconfiguring the installation of PETSc PETSc configure option : --with-scalar-type=complex