Plotting 2D P2 Finite Elements solutions imported from FreeFem++ in Matlab

175 Views Asked by At

I really need your help, for a project I need to display in Matlab the solution to a PDE obtained in FreeFem++. I can plot any P1 solution but with higher order (which is required for my problem) it doesn't work because the solution has more points than the Mesh (in P2 there are "middle points"). Do you have any idea how I could plot P2 or P3 solutions in Matlab? I know it is possible, I found some code once that allowed be to plot a P2 solution, but Ican't find it anywhere.

Thank you in advance, Théo BERTRAND.

1

There are 1 best solutions below

2
On BEST ANSWER

You can create a P1 mesh and project your solution onto this new mesh.

At some point you must have something like


mesh Th = ...

fespace Vh(Th,P2);

Vh f1;


Just define a P1 finite element space for the same mesh


fespace Wh(Th,P1);

Wh f2;


and finally set f1 = f2;