Conda install dolfinx for complex-valued problem

Hello all,

Any way I can install or switch the conda installation to complex-valued dolfinx?

Thanks for the help,

Ricardo

See: dolfinx/conda.yml at main · FEniCS/dolfinx · GitHub

Hi there,

I ran those commands in the command line in JupyterLab and it changed the environment and the tests don’t produce any errors.

However, when I go back to a notebook, there is still no option to change the kernel and

from petsc4py import PETSc
print(PETSc.ScalarType)

produces

<class 'numpy.float64'>

Am I missing a step? Thanks in advance,

Katie

First of all,
what was the output of:

conda create -n env3-10-complex -c conda-forge python=3.10 fenics-dolfinx petsc=*=complex* mpich

Secondly, how are you running jupyterlab?

Thirdly, does the installation of petsc work if you run from commandline?

Finally see: How to set up a Conda environment with a Jupyter kernel | by Yara Kyrychenko | Medium

1 Like

Hi Dokken,

Following the steps in the article you sent, I managed to get it working!
The steps were to run in the command line

conda create -n env3-10-complex -c conda-forge python=3.10 fenics-dolfinx petsc=*=complex* mpich
conda activate env3-10-complex
conda install -c conda-forge ipykernel
python -m ipykernel install --user --name=env3-10-complex

and now it is an option in the notebook.

Thank you for your help!
Katie

1 Like

@dokken Hello,
Is there an alternative, if you don’t have conda installed. I do my installations using pip. Thanks. https://fenicsproject.discourse.group/t/assertion-error-on-poisson-problem-with-complex-option/13987/2?u=noah_william

You can install the complex mode with either apt-Get, space or use the docker images. Please provide some details as to how you have currently installed dolfinx.

sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt update
sudo apt install fenicsx

Then:

sudo apt install python3-dolfinx-complex

dolfinx.__version
0.8.0

See https://fenicsproject.org/download/ , section “Complex number support”

@francesco-ballarin Is there a specific location where I am supposed to place scripts or in any directory. Please clarify (share any other information which can help me in the implementation).

Also, clarify on the python3 demo_dolfinx.py in PETSC_DIR=/usr/lib/petscdir/petsc-complex python3 demo_dolfinx.py it is not available in this directory for my case.

demos are installed in /usr/share/dolfinx/demo-python/ by the dolfinx-doc package (which you probably already have installed)

From Debian -- File list of package dolfinx-doc/sid/all there are the following demos

/usr/share/dolfinx/demo-python/demo_axis/demo_axis.py
/usr/share/dolfinx/demo-python/demo_axis/mesh_sphere_axis.py
/usr/share/dolfinx/demo-python/demo_biharmonic.py
/usr/share/dolfinx/demo-python/demo_cahn-hilliard.py
/usr/share/dolfinx/demo-python/demo_elasticity.py
/usr/share/dolfinx/demo-python/demo_gmsh.py
/usr/share/dolfinx/demo-python/demo_helmholtz.py
/usr/share/dolfinx/demo-python/demo_interpolation-io.py
/usr/share/dolfinx/demo-python/demo_lagrange_variants.py
/usr/share/dolfinx/demo-python/demo_mixed-poisson.py
/usr/share/dolfinx/demo-python/demo_navier-stokes.py
/usr/share/dolfinx/demo-python/demo_pml/demo_pml.py
/usr/share/dolfinx/demo-python/demo_pml/efficiencies_pml_demo.py
/usr/share/dolfinx/demo-python/demo_pml/mesh_wire_pml.py
/usr/share/dolfinx/demo-python/demo_poisson.py
/usr/share/dolfinx/demo-python/demo_poisson_matrix_free.py
/usr/share/dolfinx/demo-python/demo_pyvista.py
/usr/share/dolfinx/demo-python/demo_scattering_boundary_conditions/analytical_efficiencies_wire.py
/usr/share/dolfinx/demo-python/demo_scattering_boundary_conditions/demo_scattering_boundary_conditions.py
/usr/share/dolfinx/demo-python/demo_scattering_boundary_conditions/mesh_wire.py
/usr/share/dolfinx/demo-python/demo_static-condensation.py
/usr/share/dolfinx/demo-python/demo_stokes.py
/usr/share/dolfinx/demo-python/demo_tnt-elements.py
/usr/share/dolfinx/demo-python/demo_types.py
/usr/share/dolfinx/demo-python/demo_waveguide/analytical_modes.py
/usr/share/dolfinx/demo-python/demo_waveguide/demo_half_loaded_waveguide.py

and demo_dolfinx.py is a placeholder for anyone of them.

Worked it out. Thanks a lot @dokken @francesco-ballarin :saluting_face: