Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to activate plotting with docker #5

Open
silgon opened this issue Sep 1, 2020 · 7 comments
Open

How to activate plotting with docker #5

silgon opened this issue Sep 1, 2020 · 7 comments

Comments

@silgon
Copy link

silgon commented Sep 1, 2020

X11 can be used within docker with the options -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix within the docker run command and enabling it with xhost +local:root.
However, in this docker image I'm not able to display the first tutorial code:

// Define mesh boundary
border C(t=0, 2*pi){x=cos(t); y=sin(t);}
// The triangulated domain Th is on the left side of its boundary
mesh Th = buildmesh(C(50));
// The finite element space defined over Th is called here Vh
fespace Vh(Th, P1);
Vh u, v;// Define u and v as piecewise-P1 continuous functions
// Define a function f
func f= x*y;
// Get the clock in second
real cpu=clock();
// Define the PDE
solve Poisson(u, v, solver=LU)
    = int2d(Th)(    // The bilinear part
          dx(u)*dx(v)
        + dy(u)*dy(v)
    )
    - int2d(Th)(    // The right hand side
          f*v
    )
    + on(C, u=0);   // The Dirichlet boundary condition
// Plot the result
plot(u);
// Display the total computational time
cout << "CPU time = " << (clock()-cpu) << endl;

I know that X11 is working because I test it with the command xeyes (after installing x11-apps in the container), however the plot of the previous code is not being displayed.

One hint that I have is when I type FreeFem++ alone, there is a line after the help that says without default ffglut: ffglut. However I do not know how to install it or what flag to activate to be able to install it.

Any ideas?

@prj-
Copy link
Member

prj- commented Sep 8, 2020

I'd recommend just using ParaView.

@silgon
Copy link
Author

silgon commented Sep 10, 2020

I don't understand how using ParaView can help. Could you be more specific @prj- ? Thanks

@prj-
Copy link
Member

prj- commented Sep 10, 2020

You can output your results using the .vtu format. Then, transfer between the container and the host. And open your transferred files with ParaView?

@silgon
Copy link
Author

silgon commented Sep 10, 2020

Oops.... sorry my question sounded so naive. I wanted to know if that's the only way. I actually thought that the output would be an image that I'm unable to zoom in. I suppose that vtu is a kind of mesh file with the information of the analysis. I'll give it a try either tomorrow or the beginning of next week. I was really looking forward to have the visualization in the same docker container, but if that is the way you people who develop the software use, that should be good enough =).

Thanks for the reply @prj- and I'll either close the issue once I tested or I'll come back with more questions. =D

@prj-
Copy link
Member

prj- commented Sep 10, 2020

We don't really use the Docker image to be perfectly honest. Why don't you compile FreeFEM or use a prebuilt image?
But ParaView is really nice, much much better than ffglut, so you are not missing out on anything!

@silgon
Copy link
Author

silgon commented Sep 11, 2020

I use a lot docker because you don't have to compile anything and it's really convenient for a lot of repeatability task (I use it in my every day personal and professional projects). However, I gave it a shot to the FreeFEM installation, I got some dependency problems that I tried to solve for probably an hour and I wasn't willing to spend a lot of time seeing why, since I'm using FreeFEM out of curiosity and it's not a requirement for anything I'm doing. =)

@PierreMarchand20
Copy link

... I was really looking forward to have the visualization in the same docker container, ...

If you really do not want to install anything on your computer, you could also try to install paraview in the same docker image. Or you could use the docker image of FreeFEM and the one of paraview, and share a volume between those two.

But just sharing a folder between the host and the docker container to recover the output of freefem (vtu files), and then call paraview on your computer may be the easiest way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants