I use DMplex for reading GMSH meshes, how to save in Freefem format?

Dear sir,

I need to import a GMSH mesh comprising some physical volumes/surfaces.
Following your suggestion, I tried to use DMplex instead of standard freefem mesh loader, as often suggested by you.
Now, after some effort I was able to generate a mesh (version 4.1) and apparently no errors reading it with DMplex. However, I am unable to save the mesh in Freefem format: if I add the line:

savemesh(Th,“meshSrc.mesh”);

then segmentation fault appears.

Please notice that since PETSc seems to require MPI, and since I am working on Windows, I used:
“mpiexec.exe -np 2 FreeFem+±mpi.exe meshtest5.edp”

Thanks very much in advance
Riccardo

meshtest5.edp (668 Bytes)
tritrasd.zip (215.7 KB)

Hi,

I tested you code and I get no segmentation fault. I am using FreeFem v4.11. If you are using an older FreeFem version, I suggest you consider upgrading it. Otherwise, I have no idea what might causes the segmentation fault.

Thanks for your prompt reply!
Yes, I am using version 4.11 that I downloaded few days ago.
More precisely, I downloaded the PETSc version, already in binary format, for Windows.
I tried with:

mpiexec.exe -np 2 FreeFem+±mpi.exe meshtest5.edp
FreeFem+±mpi.exe meshtest5.edp

from both PowerShell and Command Prompt. Same answer:

Number of triangle(s) = 14169
Mesh area = 60978.2
Border length = 12548.4
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range […]

BUT I ALSO DISCOVERED THAT I HAVE THE SAME PROBLEM ON ANY 3D MESH.
HERE A VERY SIMPLE EXAMPLE:

This FAILS with seg fault, creating a file “meshCubeDiff.mesh” with size equal to zero:

load “PETSc” // PETSc plugin
macro dimension()3// EOM // 2D or 3D
include “macro_ddm.idp” // additional DDM functions
int[int] LL = [1,2, 1,2, 1,1];
mesh3 Tht = cube(10,10,10, [x, y, z], label = LL); // global mesh
savemesh(Tht,“meshCubeDiff.mesh”);

However THIS WORKS LIKE A CHARM (PERFECTLY), creating two mesh files:

load “PETSc” // PETSc plugin
macro dimension()2// EOM // 2D or 3D
include “macro_ddm.idp” // additional DDM functions
mesh Th2D = square(50, 10, [5 * x, y]);
savemesh(Th2D,“meshSquareDiff.mesh”);

THE ONLY DIFFERENCE I SEE IS THAT THE FIRST IS A 3D MESH WHILE THE SECOND IS A 2D MESH.
Square.edp (313 Bytes)
Cube.edp (364 Bytes)

These are very simple examples.
Do you see the same results?
Thanks again
Best regards
Riccardo

This is a Windows-specific issue, I believe. Do you have access to another machine?

Dear sir,
I tried to reinstall freefem++ (“FreeFem+±4.11-win64-petsctest.exe”) but no change.

I have Ubuntu on a Windows Subsystem for Linux (WSL 2.0). I tried to build it. Everythings was fine, until it failed to set an environment variable because it pointed to the Windows system (I guess, because it is a subsystem).
Finally the “make check” failed.

If you try on a non-Windows machine, you’ll see it works. I don’t know why it’s failing there, I don’t have a fix available, sorry.