CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Announcements from Other Sources (https://www.cfd-online.com/Forums/openfoam-news-announcements-other/)
-   -   OpenFoam log file monitor (https://www.cfd-online.com/Forums/openfoam-news-announcements-other/204513-openfoam-log-file-monitor.html)

gregor July 25, 2018 05:34

OpenFoam log file monitor
 
Hi guys,

I uploaded an early version of my log file monitoring tool to my github page https://github.com/greole/foamMon . The tool aims to give an overview of
the progress of long running simulations. Feel free to try it out.


Cheers,
Gregor

gregor September 5, 2018 02:22

Version 0.2.2
 
If you're interested I just released version 0.2.2, available on github and Pypi. The usage has changed slightly. To start it just run foamMon in any Simulation (or parent) folder. Tester and feedback are welcome.

guin September 5, 2018 10:44

Quote:

Originally Posted by gregor (Post 700399)
Hi guys,

I uploaded an early version of my log file monitoring tool to my github page https://github.com/greole/foamMon . The tool aims to give an overview of
the progress of long running simulations. Feel free to try it out.


Cheers,
Gregor

Not sure how to try it (...maybe due to my ignorance regarding pip)

Code:

me@work:~$ python3 -m pip install foamMon
Collecting foamMon
  Using cached https://files.pythonhosted.org/packages/0b/09/8bf8da90eee7dd58cdb6b770df3c8677ef16c8887dd71c03d016d8c5563a/foamMon-0.2.2-py3-none-any.whl
Collecting docopt (from foamMon)
Collecting colorama (from foamMon)
  Using cached https://files.pythonhosted.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl
Installing collected packages: docopt, colorama, foamMon
Successfully installed colorama-0.3.9 docopt-0.6.2 foamMon-0.0.0
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

me@work:~$ foamMon
foamMon: command not found

me@work:~$ python3 -m foamMon
/usr/bin/python3: No module named foamMon

me@work:~$ ls .local/lib/python3.5/site-packages/
colorama                  docopt.py        foamMon-0.0.0-py3.5.egg
colorama-0.3.9.dist-info  easy-install.pth  foamMon-0.2.2.dist-info
docopt-0.6.2.dist-info    FoamMon          __pycache__


gregor September 6, 2018 09:36

Hey Rodrigo,


thanks for giving it a try. Can you run


Code:

~/.local/bin/foamMon
?

guin September 6, 2018 10:01

Quote:

Originally Posted by gregor (Post 705500)
Hey Rodrigo,


thanks for giving it a try. Can you run


Code:

~/.local/bin/foamMon
?

...well, here is my output:
Code:

me@work:~$ .local/bin/foamMon
Traceback (most recent call last):
  File ".local/bin/foamMon", line 26, in <module>
    from FoamMon import cui
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/__init__.py", line 3, in <module>
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/FoamDataStructures.py", line 11, in <module>
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/cui.py", line 1, in <module>
ImportError: No module named 'urwid'

Unfortunately, I do not (yet) speak Pythonian... :o

gregor September 7, 2018 02:45

Ok, it seems that ~/.local/bin is not in your $PATH variable. What distro are you using or do you use any virtualenv like conda? Sometimes simply opening a new shell helps otherwise add a
Code:

export PATH=$PATH:$HOME/.local/bin
to your bashrc.


Regarding the urwid error, I forgot to add urwid to the depencies. After running
Code:

python3 -m pip install foamMon --upgrade
it should hopefully work.

guin September 7, 2018 03:34

Great, this worked. "foamMon" is now installed and it can be called.

BTW: conventional Ubuntu 16.04 installation.

guin September 7, 2018 03:39

So, let's keep going step by step... (that's why I put it in a separate post) ...first running issues:

Code:

me@work:~/OpenFOAM/me-6/run/snappy_with_AMR$ foamMon
Traceback (most recent call last):
  File "/home/me/.local/bin/foamMon", line 26, in <module>
    from FoamMon import cui
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/__init__.py", line 3, in <module>
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/FoamDataStructures.py", line 11, in <module>
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/cui.py", line 19, in <module>
ImportError: cannot import name 'Cases'

me@work:~/OpenFOAM/me-6/run/snappy_with_AMR$ tree -L 2 ./
./
└── windAroundBuildings
    ├── 0
    ├── 1
    ├── 10
    ├── 11
    ├── 12
    ├── 13
    ├── 14
    ├── 2
    ├── 3
    ├── 4
    ├── 5
    ├── 6
    ├── 7
    ├── 8
    ├── 9
    ├── Allclean
    ├── Allrun
    ├── constant
    ├── log
    ├── log.blockMesh
    ├── log.snappyHexMesh
    ├── log.surfaceFeatures
    ├── README.txt
    ├── system
    └── visualizationExample.pvsm

18 directories, 8 files


guin September 7, 2018 03:42

For some reason, it seems not to find this class https://github.com/greole/foamMon/bl...uctures.py#L64

guin September 7, 2018 04:25

WARNING to potential readers: this starts to become less and less related to CFD/OpenFOAM. Keep reading under your responsibility.


See following:

Code:

me@work:~$ foamMon
Traceback (most recent call last):
  File "/home/me/.local/bin/foamMon", line 26, in <module>
    from FoamMon import cui
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/__init__.py", line 3, in <module>
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/FoamDataStructures.py", line 11, in <module>
  File "/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/cui.py", line 19, in <module>
ImportError: cannot import name 'Cases'

me@work:~$ find $HOME/.local/lib/python3.5 -name "FoamDataStructures.py"
/home/me/.local/lib/python3.5/site-packages/FoamMon/FoamDataStructures.py

me@work:~$ cd $HOME/.local/lib/python3.5/site-packages/

me@work:~/.local/lib/python3.5/site-packages$ tree -L 1 ./
./
├── colorama
├── colorama-0.3.9.dist-info
├── docopt-0.6.2.dist-info
├── docopt.py
├── easy-install.pth
├── FoamMon
├── foamMon-0.0.0-py3.5.egg
├── foamMon-0.2.2.dist-info
├── foamMon-0.2.3.dist-info
├── __pycache__
├── urwid
└── urwid-2.0.1.dist-info

9 directories, 3 files

me@work:~/.local/lib/python3.5/site-packages$ ls foamMon* FoamMon
foamMon-0.0.0-py3.5.egg

FoamMon:
cui.py  FoamDataStructures.py  header.py  __init__.py  Log.py  __pycache__  version.py

foamMon-0.2.2.dist-info:
INSTALLER  METADATA  RECORD  top_level.txt  WHEEL

foamMon-0.2.3.dist-info:
INSTALLER  METADATA  RECORD  top_level.txt  WHEEL

As I said, I am not an expert in Pyhon, but I noticed that the errors correspond to code lines of the type:

Code:

from .<filename-starting-with-a-dot> import <some-class>
Furthermore, it searches files at
Code:

/home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg/FoamMon/
(foamMon-0.0.0-py3.5.egg is not a directory) that are actually in
Code:

/home/me/.local/lib/python3.5/site-packages/FoamMon/

gregor September 7, 2018 10:10

If you have a github account we could move the discussion to https://github.com/greole/foamMon/issues

Regarding the import issue: Could you remove the /home/me/.local/lib/python3.5/site-packages/foamMon-0.0.0-py3.5.egg folder, and try again?

guin September 7, 2018 17:22

Hi Gregor,

I've just tried it again at home from another machine (Ubuntu 18.04) and everything works fine finally. I will debug myself the installation in my other machine after the weekend, so don't worry anymore for it.



Installation steps for the interested reader:

Code:

python3 -m pip install foamMon
Warning: If you are using Ubuntu, it is currently not a good idea to update pip from pip (despite pip's suggestion)

add following line to the .bashrc file (Gregor, you may want to add this step to the instructions in the repository README file):

Code:

export PATH="$PATH:$HOME/.local/bin"
Note: Don't forget to reload the bash profile (or simply open a new terminal) after doing it.

... and that's it. It is a small great tool! Quite intuitive and useful. Just 2 questions:

- What does "Writeout" indicate? it looks like how long it would take to fill up the storage capacity at this writing rate... is it right?


- What does "Press (T) to toggle active" does? I keep pressing it (both "T" and "t") but it seems to have no effect.


Thanks again Gregor for the help! :)




PS: Is there any administrator among the readers willing to move this thread to the Community Contributions section?

gregor September 10, 2018 04:07

Hi Rodrigo,


thanks for your feedback und for testing.


- "Writeout" is the estimated time till a new timestep is written to disk.

- "T" should hide all cases that are currently not running. I think it is not active at the moment.


Currently there still some bugs and rough edges, which I'll try to fix over time.


Cheers,
Gregor

gregor September 24, 2018 09:23

Quote:

Originally Posted by guin (Post 705662)
PS: Is there any administrator among the readers willing to move this thread to the Community Contributions section?


Ok, since I cannot move this thread, I created a new one https://www.cfd-online.com/Forums/op...tml#post707259


All times are GMT -4. The time now is 13:13.