bueler / p4pdes

C and Python examples from my book on using PETSc and Firedrake to solve PDEs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redesign ch10/msh2petsc.py

bueler opened this issue · comments

It needs to work with different gmsh formats. Currently it expects format version 2.2, but that is at least at 4.1 now.

The script already reads a section at a time. Note that from the Gmsh format spec we have

To represent a simple mesh, the minimal sections that should be present in the file are $MeshFormat, $Nodes and $Elements. Nodes are assumed to be defined before elements.

But in Chapter 10 we also need $PhysicalNames. All other sections (e.g. $Entities) are already ignored by the design of msh2petsc.py.

The Gmsh doc site has a page for the legacy format which seems to be 2.2.

Plans:

  • Change check_mesh_format() to get_mesh_format() which also gets the version number. (Major,Minor? Or a legacy flag?)
  • Pass the version number into `read_SECTION()' functions, and have them act accordingly.

Workaround for chapter 10 gmsh, until msh2petsc.py is improved:

  • Update to latest Gmsh.
  • Add -format msh22 whenever running gmsh.

This is substantially done. (See branch update-to-gmsh41.) But there is an unwarranted line format assumption revealed by the koch/ example. So TODO: fix msh2petsc.py to remove unwarranted, and build regression to check.

The koch example now works. As far as I can tell msh2petsc.py is correct. But there is a mysterious hang, at least on galago, for koch5 and higher.

The mysterious hang is not present on thelio with latest petsc.

This issue is fixed in master.

The "mysterious hang" on galago was fixed by upgrading the ubuntu 20.04 version of openblas. See OpenMathLib/OpenBLAS#2642