I would like to use different 2 meshes with PETSc.
Additionally, variables want to be copied from each other.
However, as shown following codes, the direct copy, such as “v=u”, does not work.
Dear Tak,
You can use the newly implemented routine transfer to help you go between one distributed solution to another. If you want the transfer PETSc Mat, you can use the transferMat function, see this new example PtAP-2d-PETSc.edp.
Here is the function used in your code, and the resulting screenshots.
I’m new to freefem. I’m trying to use the function transfer but I always have some errors. I ran this code that you’ve posted in your reply to Tak and it didn’t work. Is it necessary to have any archive in the same folder of the original code?
Is there any example where the solution to be interpolated is not defined analytically but read from a series of files (previously saved with something like ofstream sol(filename + mpirank + "_" + mpisize + ".sol"); sol << u[];)?
returns the following message:
“Out of bound 0 <=0 < 0 array type = P2KNIS_IlEE
current line = 424 mpirank 0 / 8
Exec error : Out of bound in operator []
– number :1
Exec error : Out of bound in operator []
– number :1
err code 8 , mpirank 0”
Right, I’ve replaced both readmesh by two cubes, and commented out the ifstream + sol >> u0[] lines (because I don’t have any of the files), and it’s working flawlessly, so the problem is in how you save or load the .sol, I guess.