CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   How to change Iterations Output format (http://www.cfd-online.com/Forums/openfoam/120835-how-change-iterations-output-format.html)

woodwick July 15, 2013 22:59

How to change Iterations Output format
 
Hello,

Do you know how the iteration output format is controlled in openFOAM?
for example if we take the output of simpleFoam:
Code:

smoothSolver:  Solving for Ux, Initial residual = 0.205736, Final residual = 0.140782, No Iterations 1000
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 0.00808331, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 1, Final residual = 0.0090793, No Iterations 1
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.0525214, No Iterations 1
time step continuity errors : sum local = 8.60297e-16, global = 3.22238e-17, cumulative = 3.22238e-17
smoothSolver:  Solving for omega, Initial residual = 0.00905611, Final residual = 0.00024144, No Iterations 1
smoothSolver:  Solving for k, Initial residual = 1, Final residual = 0.0303447, No Iterations 1
ExecutionTime = 0.09 s  ClockTime = 0 s

Suppose that we want to print on screen just the Ux and omit Uy and Uz. Is it possible? Which and where are the files that control the format and can I modify them?

Thank you in advance.

cutter July 16, 2013 04:17

Hi,

what do you really want to achieve? Plot the residuals? There's a nice tool named pyFoamPlotWatcher to do these kind of things.

A nice way to filter out the interesting values is to pipe the solver's output through the Unix grep and awk commands for example. This will keep you from changing you solvers' output formats constantly.

To answer your last question: You need to read the code of your particular solver. The print statements (Info << "some string") are usually scattered throughout the solver loop and the library functions (see includes).

Cutter

woodwick July 16, 2013 07:37

Thanks Cutter,

yes, my question was raised from plotting the residuals from an output with multi-regions, I had several domains with temperature residuals,

Code:

Solving for solid region case
GAMG:  Solving for T, Initial residual = 0.0045469064, Final residual = 0.00016222444, No Iterations 1
GAMG:  Solving for T, Initial residual = 0.00016208411, Final residual = 6.5429215e-06, No Iterations 7
Min/max T:279.34359 289.03605
.....

---Solving for SOLID region: shaft ---

Solving for solid region shaft
GAMG:  Solving for T, Initial residual = 0.0027614384, Final residual = 0.00013059475, No Iterations 14 

....ect

I wanted to extract just one of those and if I use grep 'Solving for T' I get all regions. I ended up following your advice, using awk :

Code:

set logscale y
set title "Case"
set ylabel 'Temperature Residuals'
set xlabel 'Iteration'
plot "< cat log | awk '/Solving for solid region case/{getline; print}'| cut -d' ' -f9 | tr -d ','" title 'T' with lines
pause 1
reread

[essentially the same script from wolfgang, just a little bit modified]
Still after doing that, I was thinking: what if one day I need a variable or residual that the solver does not give on output. Can I modify the output of the solver itself? How does it work? So if I understood well your suggestion, to get an idea of how the solver collect and send the output on the screen I have to type:
Code:

grep -r  "info <<" /path_of_the_solver_of_interest
+ check the includes , you mean for example in the case of simpleFoam all those that I find in at the beginning of simpleFoam.C?
Code:

#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "simpleControl.H"
#include "fvIOoptionList.H"


Tobias Adam February 7, 2014 05:24

Hello,

I have a different problem with my solver output.

My solver doesnīt give me any information about the Residuals.
I didnīt change the options, or disabled the output manually ( as far as I know :-D )

My output is as follows
Code:

Time = 1

time step continuity errors : sum local = 511.432, global = 31.4965, cumulative = 31.4965
bounding omega, min: -5403.9 max: 1.7591e+11 average: 1.91796e+07
ExecutionTime = 3542.94 s  ClockTime = 3551 s

Thank you for your advice :-)

best regards Tobi

Tobias Adam February 12, 2014 10:22

It definitely has something to do with the openFoam-version.

Normally I use OF 2.2.0, but we already installed OF 2.2.x_131223 in our office.
Does anybody know, if the missing solver output is a bug of this version? Or maybe I just have to do a little entry in a dict-file to enable the output again.
I would be very happy to see some answers :-)

thanks in advance
and best regards Tobi


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