CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to run solvers in the background (https://www.cfd-online.com/Forums/openfoam-solving/232974-how-run-solvers-background.html)

Stan Zhou January 7, 2021 21:37

How to run solvers in the background
 
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!

fanta January 8, 2021 01:03

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

Stan Zhou January 8, 2021 01:56

Quote:

Originally Posted by fanta (Post 792767)
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?

fanta January 8, 2021 02:53

as i wrote, type foamJob -help, there is a command running it in the background without logfile:


foamJob -parallel -no-log

Stan Zhou January 8, 2021 04:09

Quote:

Originally Posted by fanta (Post 792776)
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

fanta January 8, 2021 05:21

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.

Stan Zhou January 8, 2021 06:46

Quote:

Originally Posted by fanta (Post 792792)
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

Tobermory January 8, 2021 09:06

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 January 8, 2021 09:15

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.

Stan Zhou January 8, 2021 09:47

Quote:

Originally Posted by Tobermory (Post 792818)
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

Tobermory January 8, 2021 10:40

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!


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