FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
770 stars 191 forks source link

Error for mesh partitioning using HPDDM in v4.11 #240

Closed mbarzegary closed 1 year ago

mbarzegary commented 1 year ago

Hi,

Is there any breaking changes in FF 4.11 for macro_ddm and HPDDM plugins? I faced it while debugging a model that started to crash on the new version of FF. I prepared the following minimal working example to show the problem. I have checked it on Windows 10 and Ubuntu 22.04.

This code runs fine with FF 4.8 and 4.10 but encounters errors on FF 4.11:

load "PETSc"
macro dimension()3// EOM
include "macro_ddm.idp"

mesh3 Mesh = cube(20, 20, 20);
fespace SpaceP1(Mesh, P1);

int[int] n2oGlobal;
macro MeshN2O()n2oGlobal//

Mat A;
buildDmesh(Mesh);

The bug surprisingly lies in the name of the array. If we change n2oGlobal to anything else, like n2oGlob, the code works normally on FF 4.11.

load "PETSc"
macro dimension()3// EOM
include "macro_ddm.idp"

mesh3 Mesh = cube(20, 20, 20);
fespace SpaceP1(Mesh, P1);

int[int] n2oGlob;
macro MeshN2O()n2oGlob//

Mat A;
buildDmesh(Mesh);
prj- commented 1 year ago

Thanks for the report. The faulty commit is https://github.com/FreeFem/FreeFem-sources/commit/95892e4772ee7ef40735e50a1bfe385575638cb6. I'm investigating.

prj- commented 1 year ago

Oops, never mind, it's actually a very trivial error, you define a variable named n2oGlobal in your script, but there is the same variable in macro_ddm.idp. I'll rename the unexposed one to n2oGlobalPrivate.

prj- commented 1 year ago

Fixed, sorry for the inconvenience.

mbarzegary commented 1 year ago

No problem. Glad to know the issue is fixed. By the way, since my model is shared on github, I think the safest option for me is to change the name of the array to n2oGlob, otherwise the users may come back to me saying that the code doesn't work on FF4.11. Fortunately, now I can tell them to use v4.12 whenever it comes.