mfem / mfem

Lightweight, general, scalable C++ library for finite element methods
http://mfem.org
BSD 3-Clause "New" or "Revised" License
1.71k stars 499 forks source link

Command line doesn't recognize the examples #670

Closed Skyzerks closed 6 years ago

Skyzerks commented 6 years ago

I wanted to see the demonstration of mfem example. But after this:

nemo@Skyzerks:/mnt/e/_Workspace/FEM/attempt/mfem-3.4/examples$ make
g++  -O3 -I..  ex1.cpp -o ex1 -L.. -lmfem -lrt
g++  -O3 -I..  ex2.cpp -o ex2 -L.. -lmfem -lrt
g++  -O3 -I..  ex3.cpp -o ex3 -L.. -lmfem -lrt
g++  -O3 -I..  ex4.cpp -o ex4 -L.. -lmfem -lrt
g++  -O3 -I..  ex5.cpp -o ex5 -L.. -lmfem -lrt
g++  -O3 -I..  ex6.cpp -o ex6 -L.. -lmfem -lrt
g++  -O3 -I..  ex7.cpp -o ex7 -L.. -lmfem -lrt
g++  -O3 -I..  ex8.cpp -o ex8 -L.. -lmfem -lrt
g++  -O3 -I..  ex9.cpp -o ex9 -L.. -lmfem -lrt
g++  -O3 -I..  ex10.cpp -o ex10 -L.. -lmfem -lrt
g++  -O3 -I..  ex14.cpp -o ex14 -L.. -lmfem -lrt
g++  -O3 -I..  ex15.cpp -o ex15 -L.. -lmfem -lrt
g++  -O3 -I..  ex16.cpp -o ex16 -L.. -lmfem -lrt
g++  -O3 -I..  ex17.cpp -o ex17 -L.. -lmfem -lrt
g++  -O3 -I..  ex18.cpp -o ex18 -L.. -lmfem -lrt
g++  -O3 -I..  ex19.cpp -o ex19 -L.. -lmfem -lrt

I only get this:

nemo@Skyzerks:/mnt/e/_Workspace/FEM/attempt/mfem-3.4/examples$ ex1 -m ../data/star.mesh

Command 'ex1' not found, did you mean:

  command 'exp' from deb alliance
  command 'ex' from deb vim
  command 'ex' from deb vim-gtk3
  command 'ex' from deb vim-tiny
  command 'ex' from deb neovim
  command 'ex' from deb nvi
  command 'ex' from deb vim-athena
  command 'ex' from deb vim-gtk
  command 'ex' from deb vim-nox

Try: sudo apt install <deb name>

Do I need to install something from the list? Or what should I do next then?

v-dobrev commented 6 years ago

Use ./ex1 in the command line instead of ex1. If you want to avoid adding the ./, you can add the current directory to your path: PATH=$PATH:. (if you are using sh/bash) or set path=($path .) (if you are using csh/tcsh). You can check which shell you are using with echo $SHELL.

Skyzerks commented 6 years ago

I'm good with the ./(example). Now I have tried to get a visualization with a running GLVis server:

nemo@Skyzerks:/mnt/e/_Workspace/FEM/attempt/mfem-3.4/examples$ export DISPLAY=:0
nemo@Skyzerks:/mnt/e/_Workspace/FEM/attempt/mfem-3.4/examples$ ./ex1 -m ../data/star.mesh
Options used:
   --mesh ../data/star.mesh
   --order 1
   --no-static-condensation
   --visualization
Number of finite element unknowns: 20801
Size of linear system: 20801
   Iteration :   0  (B r, r) = 0.00111712
   Iteration :   1  (B r, r) = 0.00674088
   Iteration :   2  (B r, r) = 0.0123008
...

But there seems to be a problem:

nemo@Skyzerks:/mnt/e/_Workspace/FEM/attempt/glvis-3.4$ ./glvis

       _/_/_/  _/      _/      _/  _/
    _/        _/      _/      _/        _/_/_/
   _/  _/_/  _/      _/      _/  _/  _/_/
  _/    _/  _/        _/  _/    _/      _/_/
   _/_/_/  _/_/_/_/    _/      _/  _/_/_/

Waiting for data on port 19916 ...
Can't connect to display!
Initializing the visualization failed.

What can be the problem here? As a X server I have Xming Server installed. It worked well when I wanted to visualize meshes. The examples builded with CMake have this same problem

tzanio commented 6 years ago

Just to confirm -- the following works?

nemo@Skyzerks:/mnt/e/_Workspace/FEM/attempt/glvis-3.4$ ./glvis -m ../mfem-3.4/data/escher.mesh 
Skyzerks commented 6 years ago

@tzanio Yes, it does. Screenshot

tzanio commented 6 years ago

And you get a DISPLAY error if you just run ./glvis in the same terminal?

That's very strange...

Skyzerks commented 6 years ago

I run two terminals. The one in the background has the error from the last issue. I didn't rerun it. Here's how it looks after a restart: Screenshot

tzanio commented 6 years ago

Can you try in the same terminal, maybe the environment variables are different for some reason?

Skyzerks commented 6 years ago

It's displayed as a one process in Task manager. And how am I supposed to run GLVis server and type in the command for visualization in the same window? In working condition they will be in a continouos state. Task Manager: Full details

jakubcerveny commented 6 years ago

I think you need to run ./glvis with the DISPLAY variable set, e.g., DISPLAY=:0 ./glvis, or export it first in the same terminal and then run glvis.

Skyzerks commented 6 years ago

@jakubcerveny it worked, thanks. This is so strange. When i run the export DISPLAY=:0 in the same window where I run the command to execute visualization - it worked fine. Even if I don't do it in the other command line before running GLVis server. Screenshot

jakubcerveny commented 6 years ago

The computation program (e.g., ex1) doesn't need the DISPLAY variable. What's important is that GLVis gets the variable, whether it is run as a server or a single visualization command. But there may be something else, I've never tried this on Windows.

Skyzerks commented 6 years ago

I'm using "Ubuntu Subsystem for Windows".