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

How to run solvers in the background

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2021, 21:37
Default How to run solvers in the background
  #1
Member
 
Haoran Zhou
Join Date: Nov 2019
Posts: 49
Rep Power: 6
Stan Zhou is on a distinguished road
Hi all,

Is there any way to make openfoam run the solver in the background without outputting information on the terminal, nor outputting it to the log file? Especially when computing in parallel.

Thanks in advance!
Stan Zhou is offline   Reply With Quote

Old   January 8, 2021, 01:03
Default
  #2
Member
 
Join Date: Oct 2011
Posts: 49
Rep Power: 14
fanta is on a distinguished road
i use the foamJob command. e.g. foamJob -parallel *solvername* then it runs in the Background, creating a log file. Type foamJob -help
Regards, fanta
fanta is offline   Reply With Quote

Old   January 8, 2021, 01:56
Default
  #3
Member
 
Haoran Zhou
Join Date: Nov 2019
Posts: 49
Rep Power: 6
Stan Zhou is on a distinguished road
Quote:
Originally Posted by fanta View Post
i use the foamJob command. e.g. foamJob -parallel *solvername* then it runs in the Background, creating a log file. Type foamJob -help
Regards, fanta
Thanks for your reply.

In my colleague's opinion, writing the output information may slow down the calculation efficiency. However, using foamJob command still redirects the output to a log file.

Therefore, I still wonder if there is a possible way to make solvers run in the background without writing output information neither to the terminal nor a log file? Or in OpenFOAM, the output information must be written into a log file while running solvers in the background?
Stan Zhou is offline   Reply With Quote

Old   January 8, 2021, 02:53
Default
  #4
Member
 
Join Date: Oct 2011
Posts: 49
Rep Power: 14
fanta is on a distinguished road
as i wrote, type foamJob -help, there is a command running it in the background without logfile:


foamJob -parallel -no-log
fanta is offline   Reply With Quote

Old   January 8, 2021, 04:09
Default
  #5
Member
 
Haoran Zhou
Join Date: Nov 2019
Posts: 49
Rep Power: 6
Stan Zhou is on a distinguished road
Quote:
Originally Posted by fanta View Post
as i wrote, type foamJob -help, there is a command running it in the background without logfile:


foamJob -parallel -no-log
I've checked the command 'foamJob -help' but didn't find the option '-no-log'. There are seven options:
-case<dir>; -parallel; -screen; -append; -wait; -version<ver> and -help.

The solver I used is olaFlow. After 'decomposePar', I tried ' foamJob -parallel olaFlow -no-log'. The information in the terminal is:
Parallel processing using SYSTEMOPENMPI with 4 processors
Executing: /home/zhr/OpenFOAM/OpenFOAM-4.1/bin/mpirun -np 4 -x FOAM_SETTINGS /home/zhr/OpenFOAM/OpenFOAM-4.1/bin/foamExec -prefix /home/zhr/OpenFOAM olaFlow -no-log -parallel > log 2>&1

At the same time, there is still a log file in the case directory which includes FOAM FATAL ERROR:
Invalid option: -no-log
FOAM parallel run exiting

Thanks
Stan Zhou is offline   Reply With Quote

Old   January 8, 2021, 05:21
Default
  #6
Member
 
Join Date: Oct 2011
Posts: 49
Rep Power: 14
fanta is on a distinguished road
Hi,
im am using OpenFOAM v2012 and i am not familiar with OLAFLOW, but are you using OpenFOAM 4.1? I might be wrong, but as far as i remember the option -no-log was introduced in later versions of OpenFOAM. I am sorry i cannot help.
fanta is offline   Reply With Quote

Old   January 8, 2021, 06:46
Default
  #7
Member
 
Haoran Zhou
Join Date: Nov 2019
Posts: 49
Rep Power: 6
Stan Zhou is on a distinguished road
Quote:
Originally Posted by fanta View Post
Hi,
im am using OpenFOAM v2012 and i am not familiar with OLAFLOW, but are you using OpenFOAM 4.1? I might be wrong, but as far as i remember the option -no-log was introduced in later versions of OpenFOAM. I am sorry i cannot help.
Thanks for your suggestions! Maybe the problem occurs because of the vertion. I'll install a later version to have a try.

Best regards,
Stan
Stan Zhou is offline   Reply With Quote

Old   January 8, 2021, 09:06
Default
  #8
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
I don't think that there is any significant loss in efficiency by writing to the log files, for the vast majority of real-life simulations. Remember, much of your run time is typically spent solving the pressure equation, and the time taken to write to a disk log file should be negligible compared to this, unless your model size is tiny and the pressure solver is not doing anything, in which case the simulation will finish rapidly anyway!

If you really want to do this, then you can redirect the screen output to /dev/null, eg:
Code:
 simpleFoam > /dev/null
Tobermory is offline   Reply With Quote

Old   January 8, 2021, 09:15
Default
  #9
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
In fact, out of interest, I ran the pitzDaily tutorial case 3 different ways:
1. outputing the log file to screen: 11.1sec
2. redirecting into a disk log file: 9.9sec
3. redirecting into /dev/null: 9.8sec

Remember that this case is tiny, requires little work from the pressure solver and therefore prints out the iteration data very regularly - it did 500 iterations in 10secs, ie 50 iterations a second. The data above shows that in this case, printing to screen is holding the run back, but printing to disk file is not.

With a more normal simulation, where each iteration will take more than a second, then even printing to screen will not hold the run back.
Tobermory is offline   Reply With Quote

Old   January 8, 2021, 09:47
Default
  #10
Member
 
Haoran Zhou
Join Date: Nov 2019
Posts: 49
Rep Power: 6
Stan Zhou is on a distinguished road
Quote:
Originally Posted by Tobermory View Post
In fact, out of interest, I ran the pitzDaily tutorial case 3 different ways:
1. outputing the log file to screen: 11.1sec
2. redirecting into a disk log file: 9.9sec
3. redirecting into /dev/null: 9.8sec

Remember that this case is tiny, requires little work from the pressure solver and therefore prints out the iteration data very regularly - it did 500 iterations in 10secs, ie 50 iterations a second. The data above shows that in this case, printing to screen is holding the run back, but printing to disk file is not.

With a more normal simulation, where each iteration will take more than a second, then even printing to screen will not hold the run back.
Thanks for your suggestions! This is exactly what I need and I'd like to do a second check with my cases which is not tiny to find out whether the difference in time spent is that little.

Best regards,
Stan
Stan Zhou is offline   Reply With Quote

Old   January 8, 2021, 10:40
Default
  #11
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
Sounds like a good plan. By the way, the simplest way to time the runs is with the "time" command, e.g.

Code:
time simpleFoam > /dev/null
which gives the following output:
Quote:
real 0m10.185s
user 0m7.531s
sys 0m2.641s
and the "real" is the elapsed, clocktime value that you want to focus on. Good luck!
Tobermory 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
linear solver crashing during transient run on HPC cluster Geoff67 CFX 3 August 28, 2020 18:53
[snappyHexMesh] How to run snappyhexmesh without changing background atieh OpenFOAM Meshing & Mesh Conversion 0 December 16, 2015 17:25
Pinning the processors in cluster to run a solver coolcrasher OpenFOAM Running, Solving & CFD 0 November 5, 2015 06:11
Ignition fails in parallel run combustion solvers msha OpenFOAM Bugs 17 January 17, 2009 03:49
How to run Fluent on the background? David FLUENT 4 January 17, 2004 02:20


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