CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

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

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 19, 2011, 13:18
Question mpirun--> output be written in both Log file and Terminal
  #1
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 17
maysmech is on a distinguished road
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
maysmech is offline   Reply With Quote

Old   January 19, 2011, 13:31
Default
  #2
Senior Member
 
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22
cnsidero is on a distinguished road
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.
cnsidero is offline   Reply With Quote

Old   January 19, 2011, 13:37
Default
  #3
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
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.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   January 19, 2011, 15:30
Default
  #4
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 17
maysmech is on a distinguished road
Thanks, i will try to do your suggestions.
maysmech is offline   Reply With Quote

Old   June 23, 2017, 00:31
Default
  #5
New Member
 
Vitor Moura
Join Date: Dec 2016
Posts: 4
Rep Power: 10
vitormoura is on a distinguished road
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.
vitormoura is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Residuals in the log file jml OpenFOAM Programming & Development 1 July 20, 2012 09:13
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
Residuals in the log file jml OpenFOAM 0 October 29, 2009 07:05
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 21:51


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