FreeFem/FreeFem-sources

PETSc and export .vtu files

ABoisneault opened this issue · 1 comments

Hello

I think there is a bug with the export of .vtu files when "PETSc" is loaded before "iovtk". Three files instead of one are then created, and in their name is added _0000 (the extensions of file are .pvtu, .vtu and .pvd).
If "iovtk" is loaded before "PETSc", the export work as intended.

I attach a file, which is inspired from the example diffusion-2d-PETSc.edp.

Sincerely

Code :
`// run with MPI: ff-mpirun -np 1 PETSC_export.edp

// load "iovtk"
load "PETSc" // PETSc plugin
load "iovtk"

macro dimension()2// EOM // 2D or 3D
include "macro_ddm.idp" // additional DDM functions

macro grad(u)[dx(u), dy(u)]// EOM // two-dimensional gradient
func Pk = P1; // finite element space
mesh Th = square(getARGV("-global", 40), getARGV("-global", 40)); // global mesh
fespace Wh(Th, Pk); // local finite element space

Mat A;
MatCreate(Th, A, Pk); // or CreateMat for older versions of FreeFem

varf vPb(u, v) = int2d(Th)(grad(u)' * grad(v)) + int2d(Th)(v) + on(1, u = 0.0);
real[int] rhs = vPb(0, Wh);

Wh u; // local solution
A = vPb(Wh, Wh);
u[] = A^-1 * rhs;
// plotMPI(Th, u, Pk, def, real, cmm = "Global solution");

int[int] Order = [1];
string DataName = "u";
savevtk("u.vtu", Th, u, dataname=DataName, order=Order);
`

prj- commented

This is the expected behavior. The order does matter (in fact, if you load PETSc, loading iovtk after is superfluous).