Helmholtz/complex/xdmf contains zeros only

Hi everybody,

I’m quite new to dolfin-x. As an example, I tried to solve the complex-valued Helmholtz-equation based on this example: dolfinx/demo_helmholtz_2d.py at main · FEniCS/dolfinx · GitHub

Unfortunately, the result file (exported via xdmffile) contains only zeros in complex mode. Opening the xdmf-file in paraview shows, that both the imaginary and the real part were exported. Everything works fine in real mode.

I’m using the latest version from the ppa on focal fossa (ubuntu 18.04).

I would be glad if anyone has an idea of what’s going on.

Best Regards

As far as I am aware dolfin-x is not built for ubuntu-18.04, see: Install dolfinx on Ubuntu server and WSL - #4 by dparsons
I am also uncertain if the PPA allows you to install the complex support version of dolfinx, @dparsons would know more about this.

To run a working version of the code, I would suggest the following:

docker run -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/root/shared -w /root/shared --rm --shm-size=512m dolfinx/dolfinx
source dolfinx-complex-mode

which should run fine and produce correct plots in paraview.

1 Like

Please check your Ubuntu version. I think you mean Ubuntu 20.04 not 18.04. focal is 20.04. (dolfinx does not build easily on bionic 18.04 since it needs PETSC >= 3.10. bionic only provides PETSc 3.7).

My guess is that your installation is fine (check you have python3-dolfinx-complex installed). Probably the problem is activating the complex build

Debian (and hence Ubuntu) offers multiple builds. In particular both real and complex number builds are available. Different groups working on the same computer might have different requirements, so I’ve enabled parallel installation of both builds, both can be used on the same computer.

The default build is the real number build, keyed to the default PETSc linked through /usr/lib/petsc.

The configuration of PETSc applications is controlled through PETSC_DIR. So you’ll probably find it works if you specify that you need complex PETSc,

export PETSC_DIR=/usr/lib/petscdir/petsc-complex

(or look around /usr/lib/petscdir/ for other alternatives).

See /usr/share/doc/python3-dolfinx/README.Debian for more detail.

2 Likes

You can check at runtime if you’re accessing the complex build by checking the value of dolfinx.has_petsc_complex

Sorry for confusing you - I’m using 20.04 (focal fossa). The variable “has_petsc_complex” is True. For me, it seems correctly installed.

Thank you very much!

@dokken, as you argued, the docker-version works correctly.

@dparsons, are there differences in these two packages (ppa vs. docker)? For me, the ppa-version would be a bit handier. Sorry for any inconvenience.

Thank all of you

The PPA provides the recent 0.1.0 release, that would be the version you’re testing.

I’ve checked I can reproduce the problem on a fresh cloud installation of focal. On my own system (Debian unstable, PETSc 3.15) a nontrivial solution is generated, but on focal the PPA build generates a zero solution (running as PETSC_DIR=/usr/lib/petscdir/petsc3.12/x86_64-linux-gnu-complex/ python3 demo_helmholtz_2d.py after also installing python3-dev).

Will have to dig deeper to see if the problem is with the PPA build or with the older PETSc version 3.12.

The build log is at amd64 build of fenics-dolfinx 1:0.1.0-2~ppa1~focal3 : FEniCS PPA : “FEniCS Packages Team” team . I can’t see any obvious irregularities there though with respect to the complex build. Build-time tests appear to have passed, though perhaps they passed by generating trivial zero solutions.

I’ve filed a bug report at complex number tests generate zero solution on ubuntu focal 20.04 (PPA build) · Issue #1612 · FEniCS/dolfinx · GitHub

@dokken can you confirm whether the docker build uses the local ubuntu installation of petsc or provides its own petsc? If the latter, which PETSc version is it?

The Docker image uses 3.15.1, as seen here: dolfinx/Dockerfile at main · FEniCS/dolfinx · GitHub

OK. PETSc 3.12 remains a suspect then.

The ubuntu test cloud available to me only offers the LTS releases (bionic and focal). @Mario-B , are you in a position to be able to upgrade your Ubuntu installation to hirsute (21.04). That uses PETSc 3.14.

I’ll check if version 0.1.0 with petsc 3.15 works later today

I guess you mean check with petsc 3.12 ? That will be a useful test, to see if it reproduces the zero solution.

So, the docker image is currently using dolfinx main branch, which uses PETSc 3.15.1.
Therefore i figured testing dolfinx:0.1.0 with petsc 3.15.1 would test it without me having to install an old petsc.

Yes, but PETSc 3.15 has already been tested successfully. What we don’t know is whether PETSc 3.12 always yields a failed test.

I´ll see what I can build locally:)

@dparsons upgrading to hirsute might be possible in the beginning of next week. I’ll do my best.

@dparsons, under hirsute (21.04), everything looks fine. For me, PETsc 3.14 works correctly.

By the way, in the ppa, xtensor-blas-dev conflicts with libxtensor-blas-dev. The same happens under focal fossa (20.04).

Great to hear hirsute is confirmed to work. I’ll upload a fix for the xtensor-blas-dev conflict.

I can reproduce the problem with a fresh build of PETSc 3.12 on Debian unstable (where PETSc 3.14 or 3.15 is otherwise used). That suggests PETSc 3.12 is the problem here, and the error should be reproducible in Docker.

Hi,
I’m trying to move to the dolfin-x version. I’ve installed the debian package python3-dolfinx-complex however when I import it, dolfinx.has_petsc_complex returns false.

I tried what you mentioned about exporting the PETS_DIR variable (which previously was empty) and now I cannot import dolfinx, as I receive the error:

RuntimeError: Could not find DOLFIN pkg-config file. Please make sure appropriate paths are set.

I don’t know I’m missing something on your answer.

Thanks