CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   how to use foamLog? (https://www.cfd-online.com/Forums/openfoam-post-processing/129149-how-use-foamlog.html)

mehdi8619 January 29, 2014 16:46

how to use foamLog?
 
Hey guys, I'm a rookie and trying to figure out how to use foamLog.

1- Is these two lines all I'm supposed to do? for "cavity" as an example
famouri@ubuntu:~/cavity$ foamJob icoFoam
famouri@ubuntu:~/cavity$ foamLog log

2- Is there any way to have all those data in one file? Like a file with more than two columns.

3- How can I add something not listed there as default?

Thank you in Advance
Mehdi

elmo555 February 5, 2016 04:59

I'd be interested in this as well.

Bazinga February 5, 2016 09:56

1) Basically, yes.
Here is a bit more information:
http://web.student.chalmers.se/group...ngLucchini.pdf

2) To my knowledge, no. You need to read each file separately.

3) Doesn't foamLog already take basically all information of the log file? What kind of information do you want? I think you would need to work in the code of the utility to change things.

Malthe Eisum March 29, 2016 05:08

deltaT from foamLog
 
Quote:

Originally Posted by mehdi8619 (Post 472417)
3- How can I add something not listed there as default?

Quote:

Originally Posted by Bazinga (Post 583873)
3) Doesn't foamLog already take basically all information of the log file? What kind of information do you want? I think you would need to work in the code of the utility to change things.

I have the same question.
Below is an example of a log file (pimpleFoam, slightly modified)

Code:

Courant Number mean: 0 max: 0 velocity magnitude: 0
deltaT = 0.00107403
Time = 0.00107403

dU0dt = dU0dt [0 1 -2 0 0 0 0] (3.51258e-06 0 0)
DILUPBiCG:  Solving for Ux, Initial residual = 1, Final residual = 2.89979e-10, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for p, Initial residual = 2.91879e-09, Final residual = 2.91879e-09, No Iterations 0
time step continuity errors : sum local = 1.47332e-28, global = 4.77833e-29, cumulative = 4.77833e-29
GAMG:  Solving for p, Initial residual = 3.51043e-09, Final residual = 3.51043e-09, No Iterations 0
time step continuity errors : sum local = 1.77196e-28, global = 7.76479e-29, cumulative = 1.25431e-28
dU0dt = dU0dt [0 1 -2 0 0 0 0] (3.51258e-06 0 0)
DILUPBiCG:  Solving for Ux, Initial residual = 2.87496e-09, Final residual = 2.87496e-09, No Iterations 0
DILUPBiCG:  Solving for Uy, Initial residual = 4.41294e-11, Final residual = 4.41294e-11, No Iterations 0
GAMG:  Solving for p, Initial residual = 3.116e-09, Final residual = 3.116e-09, No Iterations 0
time step continuity errors : sum local = 1.57287e-28, global = 5.77382e-29, cumulative = 1.83169e-28
GAMG:  Solving for p, Initial residual = 3.54987e-09, Final residual = 3.54987e-09, No Iterations 0
time step continuity errors : sum local = 1.79187e-28, global = 6.37111e-29, cumulative = 2.46881e-28
ExecutionTime = 0.05 s  ClockTime = 0 s

Courant Number mean: 1.56175e-29 max: 8.27559e-12 velocity magnitude: 4.59998e-10
deltaT = 0.0012803
Time = 0.00235434

dU0dt = dU0dt [0 1 -2 0 0 0 0] (3.52066e-06 0 0)
DILUPBiCG:  Solving for Ux, Initial residual = 0.999568, Final residual = 3.42989e-10, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 4.96118e-11, Final residual = 4.96118e-11, No Iterations 0
GAMG:  Solving for p, Initial residual = 3.97586e-08, Final residual = 3.97586e-08, No Iterations 0
time step continuity errors : sum local = 2.39233e-27, global = 2.16449e-27, cumulative = 2.41137e-27
GAMG:  Solving for p, Initial residual = 3.47099e-08, Final residual = 3.47099e-08, No Iterations 0
time step continuity errors : sum local = 2.08854e-27, global = 1.8607e-27, cumulative = 4.27207e-27
dU0dt = dU0dt [0 1 -2 0 0 0 0] (3.52066e-06 0 0)
DILUPBiCG:  Solving for Ux, Initial residual = 1.58338e-09, Final residual = 1.58338e-09, No Iterations 0
DILUPBiCG:  Solving for Uy, Initial residual = 9.32757e-11, Final residual = 9.32757e-11, No Iterations 0
GAMG:  Solving for p, Initial residual = 3.28166e-08, Final residual = 3.28166e-08, No Iterations 0
time step continuity errors : sum local = 1.97462e-27, global = 1.74678e-27, cumulative = 6.01885e-27
GAMG:  Solving for p, Initial residual = 2.58746e-08, Final residual = 2.58746e-08, No Iterations 0
time step continuity errors : sum local = 1.55691e-27, global = 1.17718e-27, cumulative = 7.19603e-27
ExecutionTime = 0.05 s  ClockTime = 0 s

If i run
Code:

formLog
i get the following outputs.
  • CourantMax
  • CourantMean
  • Separator
  • Time
  • Ux
  • UxFinalRes
  • UxIters
  • Uy
  • UyFinalRes
  • UyIters
  • contCumulative
  • contGlobal
  • contLocal
  • executionTime
  • p
  • pFinalRes
  • pIters

Is there a way I can get foamLog to output deltaT ? it is listed the same way as Time.

Writing this post I realised I can use the xy file of Time and still get the initial time step. But post any way out of professional curiosity :) and I know how to modify the solver to log a line of text with a value and can see the combination of this and formLog as a good combination in future use

Bloerb April 7, 2016 17:46

One thing to consider is that a new residuals function object was introduced in 2.4.0 to make this simpler.

You can add this to your controlDict. Should look something like this.
Code:

functions
{
    residuals
    {
        functionObjectLibs ("libutilityFunctionObjects.so");
        type            residuals;
        outputControl  timeStep;
        outputInterval  1;
        fields
        (
            U
            p
        );
    }
}

It outputs it way easier to handle

More importantly you should learn about typical linux commands like sed awk cat and grep to make your life easier.

Quick example: grep searches for a pattern and outputs the line containing it. This outputs every line with "delta T =" in it. You can add > myFile to output this command to a file.
Code:

grep 'deltaT = ' log
The same can be done with sed. foamLog is just a shell around these commands. If you look into the code behind it you can for example see
Code:

getSolvedVars()
{
    fgrep ' Solving for ' $1 | fgrep ',' | sed -e 's/.* Solving for \([^,]*\)[,:].*/\1/' | sort -u
}

fgrep is equal to grep -f which stops error outputs. $1 is the name of your logfile.
The | is a pipeline command. It gives the result of the first to the second query.... I think the fastest way to learn on how to extract only the value of deltaT or something more fancy is googling how to do it with grep, awk or sed since it is possible with all three of them.


All times are GMT -4. The time now is 16:46.