ChangeNumbering

The command

ChangeNumbering(A, u[], inPETSc, inverse = true, exchange = true);//

is because the number

real[int] tab(10);//i=0,1,2,…,9

of FreeFem + + starts from zero, while the number of PETSc starts from one,
so you want to switch the command?

This is not at all what the ChangeNumbering command is used for. Please go through this tutorial to understand what this command does: Pierre Jolivet introduction to parallel FreeFEM part 1 - YouTube.

Hello, the video explanation is not very detailed, so I don’t quite understand the function of this command

changeNumbering(dA, inOut, inOutPetsc, inverse = bool, exchange = bool)

Maybe this example will help FreeFem-tutorial - Section 8 - example2.edp? ChangeNumbering is just to go from PETSc to FreeFEM numbering back and forth. Both numbering start from 0, one is global while the other is local, that’s the only difference.

Hello, Professor, take the solution vector u[] as an example. PETSc is the number on the global grid, and freefem++ is the number of the local grid?

No, u[] is in FreeFEM numbering (with overlap/duplicated unknowns) and the resulting vector is in PETSc numbering (without overlap/duplicated unknowns).

Hello, according to your reply, will there be repeated unknowns because of ghost element? But what is ghost element?

This is explained in the screencast. These are buffer values shared among neighboring subdomains. This is very common in finite elements codes.

In fact, the u[] of the solution is the value on the grid node, and its number is determined, equal to u[] .ndof, which does not produce repeated unknowns?

No, there are duplicated unknowns in u.