CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   mpirun--> output be written in both Log file and Terminal (https://www.cfd-online.com/Forums/openfoam/84072-mpirun-output-written-both-log-file-terminal.html)

maysmech January 19, 2011 12:18

mpirun--> output be written in both Log file and Terminal
 
Hi,

How can i use parallel run and have output not only in log file, also in terminal window.

Only in log file:
Quote:

mpirun -np 8 icoFoam -parallel > log &
Only in terminal:
Quote:

mpirun -np 8 icoFoam -parallel

cnsidero January 19, 2011 12:31

Option 1) Try 'tee'. E.g.

Code:

mpirun -np 8 icoFoam -parallel | tee log
Check the man pages for 'tee'

Option 2) Redirect the output to a log file like for your first command:

Code:

mpirun -np 8 icoFoam -parallel  > log &
and then use the -f with 'tail' to view log file dynamically:

Code:

tail -f log
Option 3) Use screen:

Open an new screen:

Code:

screen
Launch your job:

Code:

mpirun -np 8 icoFoam -parallel
Detach your screen: CTRL+A+D

Reattach your screen to view your running job later:

Code:

screen -r
I prefer #2 if I'm running on a local workstation and #3 if I'm running remotely. 'screen' is the most flexible and powerful method - I would suggest spending some time to learn how to use 'screen'. Look in the man pages or check the web.

l_r_mcglashan January 19, 2011 12:37

Isn't dumping it all to both screen AND file a bit unnecessary? Why not output it to log and use 'tail log' to look at the log file? Or if you're interested in looking at residuals use foamLog / pyFoam.

maysmech January 19, 2011 14:30

Thanks, i will try to do your suggestions.

vitormoura June 22, 2017 23:31

I was lurking and saw this thread. I got a solution that might help others (since the post is old).
On a second terminal, use this command:

Code:

watch -n(secondsinterval) tail -n(numberoflines) logfile
someone gave me that tip to avoid excess of process on simulation.


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