Newbie hoping for a toolchain that does not exist?

,

In my ignorant mind, the desired toolchain should work something like this:

  1. If necessary, generate 3D geometries in some CAD program.
  2. Create the mesh interactively with the gmsh GUI, including the naming/definition of boundary subsets.
  3. If necessary, convert the mesh file exported from gmsh, to some more suitable format.
  4. Import that file into my FEniCSx Python program.

After scouting around a bit on internet, trying this, trying that, it seems that I am constantly running into dead ends.

  • “All” tutorials generate their meshes with gmsh Python-API instructions. It is self-containing, but not a good sign for my quest.
  • The debian packages I have installed, come with the file gmshio.py, but __init__.py will not include it unless adios2 is present.
  • …but there is no Debian package for adios2. (I would like to avoid starting to compile things.)
  • meshio — its command line tools, as well as its Python functions — “converts” a msh-file into some kind of half empty xdmf-file.
  • meshx wants dolfin, not dolfinx
  • So far, I have found no convenient way of translating gmsh geo code into gmsh Python API code.

Now I wonder:

  • Am I chasing the wrong kind of toolchain?
  • Do I have to bite the bullet and build FEniCSx, dolfinx, adios2 etc from source?

This seems like a bug in debian packaging then, as the init file in DOLFINx includes the read_from_msh (read gmsh msh file) and model_to_mesh (read gmsh python model) commands even if adios2 is notpresent: dolfinx/python/dolfinx/io/__init__.py at main · FEniCS/dolfinx · GitHub

Reading msh files is for instance shown in: Defining subdomains for different materials — FEniCSx tutorial

You could also use meshio, as explained in the next section: Defining subdomains for different materials — FEniCSx tutorial

This doesn’t make sense. As dokken mentioned, dolfinx.io is designed to load gmshio, with or without adios2. Are you sure python3-gmsh is installed and gmsh imports (independently of dolfinx)?

There has been a debian package for adios2 for more than a year now. Check your versions are up to date.

1 Like

I am really impressed and grateful for the prompt and useful feedback! You helped me stop barking up the wrong forest.

In hindsight, I am glad the first word of the subject is “Newbie”, since my confusion turned out to be caused by a rather trivial mistake.

For some reason I had tried to use gmshio like this:

from dolfinx import io
my_mesh = io.gmshio.read_from_msh( ...

Maybe I “thought” that hierarchic Python modules can be imported/used like files in file structures. This works much better:

from dolfinx.io import gmshio
my_mesh = gmsio.read_from_msh( ...

After that mistake, I got the impression that gmshio was not available, to the point that my eyes brushed over __init__.py without really noticing what is actually going on there.

After reading your replies, and checking again, it is clear that you are absolutely right. Even though the FEniCSx and dolfinx standard Debian packages seem to lag slightly behind the official current releases, __init__.py still includes gmshio, even when adios2 is not there.

The tip that python3-gmsh must be present, was really helpful. I guess I must have expected that the installation fenicsx and dolfinx should have triggered the installation of all necessary components. This is no doubt mentioned somewhere in the documentation, and I will no doubt spot it exactly 6 minutes after uploading this reply.

At the time of writing, it does not look as if I will need adios2. However, I still have a hard time finding its Debian package.

Starting at its pipy page, I end up on repology.org, where it is suggested that there is an adios2-package for Debian 13, “trixie”. Judging from the release schedule, “trixie” is yet to happen.

It is also possible to find adios2 in unstable Debian-releases, but I’m not brave enough to try that.

I will now study the links you supplied, with great interest.

That this doesn’t work is by design.
As gmsh is not a core dependency of dolfinx, we have not exposed it directly in dolfinx.io.

I’ll let @dparsons comment on the state of debian, as I am not well versed in that area.

To get both MPI and serial support, you’ll want

sudo apt install python3-adios2 python3-adios2-mpi python3-adios2-serial

But dolfinx will want to use the mpi build.
You’ll want to upgrade your debian installation to get the (relatively) new packages though, which brings us to

The Debian stable releases are “stable” in the sense that they can be considered fit for datacentre installations running continuously over many years.
For end-users that level of stability is generally overkill. Most end-users will tend to want access to more recent software versions, at the cost of needing to reboot occasionally for updated kernels.

It’s reasonable for you to fear the unstable release. It does live up to its name from time to time, especially in the middle of large library transitions where all dependent packages need to be rebuilt against new library versions.

The sweet spot for end-users, who want some protection from disruptions that might happen in unstable, is the testing distribution. This is the staging ground for the next stable release. trixie is the current testing version. If you’re brave enough to install debian in the first place, then you’re brave enough to use testing.

I recommend going ahead and updating to trixie.

Using a recent ubuntu release is also an alternative option. It’s much the same system as debian, but they run on a different release schedule. We maintain a FEniCS repository (PPA) building the latest fenicsx release for supported recent ubuntu releases.