Hello everyone. I have a problem storing the data from the numerical solutions generated by FreeFem++. This is my mesh.
real R = 0.1;
real xc = 0.5, yc = 0.5;
border bottom(t=0,1){ x=t; y=0; label=1; }
border right(t=0,1){ x=1; y=t; label=2; }
border top(t=0,1){ x=1-t; y=1; label=3; }
border left(t=0,1){ x=0; y=1-t; label=4; }
border hole(t=0,2*pi){ x = xc + R*cos(t); y = yc + R*sin(t); label=5; }
mesh Th = buildmesh(bottom(20) + right(20) + top(20) + left(20) + hole(-40));
This is my defined finite element spaces.
fespace Vh(Th, [P2, P2]);
fespace Mh(Th, P1);
fespace Xh(Th, RT1Ortho);
Vh [ux,uy], [vx,vy], [wx,wy], [uxtilde,uytilde], [uxhat, uyhat], [uxold2, uyold2];
Mh p, pp;
Xh [Bx, By], [cx, cy], [Bxtilde, Bytilde], [Bxhat, Byhat], [Bxold2, Byold2];
Now I want to store the numerical solutions [ux,uy], p, [Bx,By] and mesh Th (ideally all in a txt or dat file) for plotting. I need to plot velocity streamlines and magnetic field lines.
However, I’m unsure of the correct method. I’ve tried several saving methods by using ofstream, but all have resulted in problems.