Savesol readsol for P2 FE fields?

Hi to all,
I guess this is a question to Frédéric Hetch or close collaborators :

The documentation only describe order=0 and order=1 options for saving a field with savesol and all examples I have seen only do it for P1 FE fields. I have tested savesol readsol for P1 fields and it works fine. However, for P2 fields, even if the option order=2 is accepted there is a MISSING DATA warning when executing and readsol does not work properly.

Is there some project to extend savesol readsol funcitons for P2 FE fields ?

Dear User,

The savsol, is make to do graphic, not really to save the solution.

The best way to save the solution is

  1. save the mesh ( do not rebuild because if you change of machin the risk to get a different mesh is important)
  2. save the array of dof

when

  1. read les mesh
  2. def. the finite element space ( Generally you know it, but it is impossible to make a generic code)
  3. read the solution

remark, if you want the know the dof numbing, you can save the numbering by element

Many thanks Frédéric. It works indeed. Here are some line codes for people interested :

fespace Vh(Th, P2);
Vh c, ctest;
// copy the data c into a vector
ctest= c;
// save the P2 FE field
{ofstream ff(“csol.txt”); ff << ctest<< endl;
}
read the P2 FE field
{ifstream gg(“csol.txt”); gg >> ctest3;
}
// plot the read data
plot(ctest3, Th, value=true, wait=true);


Hi , i tried this, my code is plotting the mesh instead of the solution that my i saved in the save.txt

or am i doing something wrong in saving

Tried with the first example in learning by examples. So, what could be the possible reason of not receiving the plot of u. Attaching the save-read code and result



Because you the mesh after with fill=1 so you don not see the solution so change the order

thank you very much, it works now