I am new to fenics and somewhat baffled by the complex number support. My OS is Ubuntu 22.04 and believe I have installed the complex number packages for petsc, slepc and fenics. Changing the PETSC_DIR and SLEPC_DIR environment variables changes the PETSc scalar type as expected. The Poisson demo with complex numbers seemed to run as expected (although a hanging pyvista required addressing). The “Solving PDEs with different scalar (float) types” demo however fails with:
NotImplementedError: Type <class ‘numpy.complex64’> not supported.
The error is independent of the PETSc scalar type and looks similar to the types of errors appearing in my own code. I appreciate fenicsx is still under development but are complex numbers and this demo program expected to work? Are the ubuntu 22.04 packages expected to work? Is compiling from source expected to work? Have I got something obvious wrong?
andy@tavy:~/work/fenicsx/modanal$ python test4.py
Traceback (most recent call last):
File "/home/andy/work/fenicsx/modanal/test4.py", line 126, in <module>
uh = solve(dtype=np.complex64)
File "/home/andy/work/fenicsx/modanal/test4.py", line 72, in solve
a0 = fem.form(a, dtype=dtype)
File "/usr/lib/petscdir/petsc3.15/x86_64-linux-gnu-complex/lib/python3/dist-packages/dolfinx/fem/forms.py", line 121, in form
raise NotImplementedError(f"Type {dtype} not supported.")
NotImplementedError: Type <class 'numpy.complex64'> not supported.
andy@tavy:~/work/fenicsx/modanal$
This was later followed by adding additional complex number related packages via synaptic and pip as I tried to get complex numbers to work. I don’t have a full record but it was all done with packages rather than compilation.
The demo program you linked to runs correctly. It doesn’t include the complex64 type unlike the (presumably earlier?) demo program I was using. Apologies for the misinformation.
My problems are with a refusal to create complex128 stiffness matrices but now I have a working example it may help me to work out what is going on. Thanks for your help.