FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
755 stars 188 forks source link

Can't load mesh generated by gmsh (gmsh==4.10.5) #236

Closed rustamNSU closed 2 years ago

rustamNSU commented 2 years ago

Dear FreeFem++ developers,

FreeFem++ v4.11 (Fri 08 Apr 2022 01:02:23 PM CEST - git v4.11)

Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy

I am trying to load mesh in FreeFem script from gmsh generator. For this, I'm using python script with gmsh=4.10.5 (but it is same result with gmsh=4.8.4) and writing mesh in "test.msh2" file. This python script I'm calling in FreeFem edp-file via system() command and then I use "gmsh" plugin for

Th = gmshload("test.msh2");

But the gmshload function interrupts in the middle of the process with error

Elem 70 72 73
Elem 71 73 1
Triangles 1 172 275 102
  current line = 12
Assertion fail : (area > 0)
        line :303, in file ./include/fem.hpp
Assertion fail : (area > 0)
        line :303, in file ./include/fem.hpp
 err code 6 ,  mpirank 0

To recreate this error, I added scripts and requirements.txt for creating python venv. loadgmsh_error.zip Could you please have a look and help? Thanks!

prj- commented 2 years ago

I don't know what the issue is, but here is a workaround.

1d0
< load "gmsh"
11,12c10,13
< verbosity = 100;
< Th = gmshload("test.msh2");
---
> load "PETSc"
> DM dm("test.msh2", communicator = mpiCommSelf);
> Th = dm;
> plot(Th);

Instead of using the Gmsh plugin, it will use PETSc DMPlex, and it works. It also support Gmsh format version 4. You need to run your script with ff-mpirun load_gmsh.edp -wg.

rustamNSU commented 2 years ago

Thank you very much! This solution solved the problem!