Parallelization save data

Dear all,

I am now using PETSc for solving the Navier-Stokes equation in 16 cores, but when I want to save the data of the velocity for x=0.5 (export as a txt file), it always repeatedly store some parts that are repeated in 16 divisions. The code is as follow:

ofstream ff("velocity_simulation.txt", append);
  for (real yaxis = 0; yaxis <= 1; yaxis += 0.001){
    ff<<umag(0.5, yaxis)<<endl;

Could you please help me with this?

Thanks in advance. Look forward for your kind reply.

Please look at Pierre Jolivet introduction to parallel FreeFEM part 1 - YouTube to understand how to gather the solution on a single rank so that you can save data using only a single process so there is no duplication.

Thank you! I am going to check this!