jorgensd / dolfinx-tutorial

A reimplementation of the Springer book: https://github.com/hplgit/fenics-tutorial/, covering new topics as well as transitioning from dolfin to dolfinx
https://jorgensd.github.io/dolfinx-tutorial/
110 stars 63 forks source link

Issue on page /chapter1/complex_mode.html #129

Closed OsbertWang closed 1 year ago

OsbertWang commented 1 year ago

After reading the tutorial, I understand that Docker has the ability to switch between float64 and complex128. However, I am unsure of how to do this on Ubuntu 22.04. To begin, I ran the command dpkg -l | grep petsc and obtained a list of packages.

ii  libpetsc-complex3.15:amd64             3.15.5+dfsg1-1build2                    amd64        Shared libraries for version 3.15 of PETSc with Complex Numbers
ii  libpetsc-real3.15:amd64                3.15.5+dfsg1-1build2                    amd64        Shared libraries for version 3.15 of PETSc
ii  libpetsc-real3.15-dev:amd64            3.15.5+dfsg1-1build2                    amd64        Static libraries, shared links, header files for PETSc
ii  libpetsc3.15-dev-common                3.15.5+dfsg1-1build2                    all          Common header and support dev files for PETSc
ii  libpetsc3.15-dev-examples              3.15.5+dfsg1-1build2                    all          Static libraries, shared links, header files for PETSc
ii  python-petsc4py-doc                    3.15.1-2build1                          all          Python bindings for PETSc libraries: documentation and examples
ii  python3-petsc4py                       3.15.1-2build1                          all          Python 3 bindings for PETSc libraries
ii  python3-petsc4py-complex               3.15.1-2build1                          all          Python 3 bindings for PETSc libraries (complex numbers)
ii  python3-petsc4py-complex3.15           3.15.1-2build1                          amd64        Python 3 bindings for PETSc 3.15 libraries (complex numbers)
ii  python3-petsc4py-real                  3.15.1-2build1                          all          Python 3 bindings for PETSc libraries (real numbers)
ii  python3-petsc4py-real3.15              3.15.1-2build1                          amd64

From this list, I can see that pyhon3-petsc4py-complex is already installed. But the current scalar type in python3 is still <class 'numpy.float64'>. What steps should I take next to switch between float64 and complex128?

jorgensd commented 1 year ago

You can use either: https://packages.ubuntu.com/kinetic/python3-dolfinx-real or https://packages.ubuntu.com/kinetic/python3-dolfinx-complex as they are an either or dependency of https://packages.ubuntu.com/kinetic/python3-dolfinx