# foamLog

 Register Blogs Members List Search Today's Posts Mark Forums Read

 March 22, 2012, 07:53 foamLog #1 Member   Join Date: Nov 2011 Posts: 44 Rep Power: 7 Hello I use foamLog for the log-file that I have, which has several thousand time-steps, and each time-step has many iterations for different parameters. When i use foamLog, it gives me a logs folder output, however the usually just contain a single number. Rather confused, since I was expecting many thousands of values at least for each timestep with regards to residuals... Any ideas? F

March 30, 2012, 16:42
#2
New Member

Gilles De Neyer
Join Date: Nov 2011
Posts: 18
Rep Power: 7
Hello,

I got the same problem with foamLog. Finally, I did a small app(really poor programming ...) reading the log file as I wished. It's done to read the drag and lift coefficient but you can easily change it to plot the residuals.

I put my code in attachment but if you find the solution for foamLog I would be happy to have further informations ;-)
Attached Files
 main.c (4.4 KB, 77 views)

 April 6, 2012, 17:05 #3 Member   Join Date: Nov 2011 Posts: 44 Rep Power: 7 Hmm hello thank you for the script. So if my time step was 0.01, and each time step looked like the thing below... what would i need to change? Thank you. Francesco -------------- Time = 0.01 Courant Number mean: 0 max: 0.136 Iteration No 1 DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 2.99476e-08, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0 DICPCG: Solving for p, Initial residual = 1, Final residual = 9.41218e-08, No Iterations 737 time step continuity errors : sum local = 7.34978e-12, global = -2.46208e-14, cumulative = -2.46208e-14 DICPCG: Solving for p, Initial residual = 3.59809e-05, Final residual = 9.55252e-08, No Iterations 604 time step continuity errors : sum local = 1.37508e-08, global = -2.92546e-11, cumulative = -2.92792e-11 DICPCG: Solving for p, Initial residual = 4.44746e-07, Final residual = 9.49638e-08, No Iterations 4 time step continuity errors : sum local = 1.29697e-08, global = 1.91066e-10, cumulative = 1.61787e-10 DICPCG: Solving for PotE, Initial residual = 0, Final residual = 0, No Iterations 0 Iteration No 2 DILUPBiCG: Solving for Ux, Initial residual = 0.00227304, Final residual = 1.46529e-07, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 0.00270324, Final residual = 2.49839e-07, No Iterations 2 DICPCG: Solving for p, Initial residual = 0.000117855, Final residual = 9.99383e-08, No Iterations 451 time step continuity errors : sum local = 1.32192e-08, global = -1.70539e-09, cumulative = -1.5436e-09 DICPCG: Solving for p, Initial residual = 1.19641e-05, Final residual = 9.84828e-08, No Iterations 400 time step continuity errors : sum local = 1.30281e-08, global = 1.83845e-11, cumulative = -1.52522e-09 DICPCG: Solving for p, Initial residual = 1.42252e-06, Final residual = 8.98636e-08, No Iterations 4 time step continuity errors : sum local = 1.1888e-08, global = 1.05161e-10, cumulative = -1.42006e-09 DICPCG: Solving for PotE, Initial residual = 0, Final residual = 0, No Iterations 0 Iteration No 3 DILUPBiCG: Solving for Ux, Initial residual = 1.68533e-05, Final residual = 4.37189e-07, No Iterations 1 DILUPBiCG: Solving for Uy, Initial residual = 2.16801e-05, Final residual = 5.83916e-07, No Iterations 1 DICPCG: Solving for p, Initial residual = 1.83766e-06, Final residual = 8.53894e-08, No Iterations 10 time step continuity errors : sum local = 1.12961e-08, global = 7.52266e-11, cumulative = -1.34483e-09 DICPCG: Solving for p, Initial residual = 2.3926e-07, Final residual = 9.16602e-08, No Iterations 1 time step continuity errors : sum local = 1.21256e-08, global = 7.26966e-11, cumulative = -1.27213e-09 DICPCG: Solving for p, Initial residual = 9.89624e-08, Final residual = 9.89624e-08, No Iterations 0 time step continuity errors : sum local = 1.30916e-08, global = 7.25284e-11, cumulative = -1.19961e-09 DICPCG: Solving for PotE, Initial residual = 0, Final residual = 0, No Iterations 0 ExecutionTime = 4.13 s ClockTime = 4 s

 April 6, 2012, 19:02 #4 New Member   Gilles De Neyer Join Date: Nov 2011 Posts: 18 Rep Power: 7 as you see I begin each block with a test condition to see if I get - DragCoefficient - pressureDragCoefficient - viscDragCoefficient - liftCoefficient the code strstr(chaine,"DragCoefficient") returns 1 if DragCoefficient is into the line chaine and 0 if not. so if you want to plot the p final residual for example, you'll need to put the condition strstr(chaine,"Solving for p") which will be equal to 1 just for the good lines and then index = stristr(chaine,"Final residual ="); which will return the index of the letter "F" (first letter of the subchain) and finally index = index + 17; // index of the first number after Final residual char* souschaine; souschaine = strsub(chaine, index, index + 8); // souschaine is the substring token from chaine with first index given by "index" and final index given by "index+8" just don't make mistake with the initial if condition, as you have several times "Final residual", you need to put the condition well to be sure you're loading the good one

April 9, 2012, 17:57
#5
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
Quote:
 Originally Posted by gdeneyer as you see I begin each block with a test condition to see if I get - DragCoefficient - pressureDragCoefficient - viscDragCoefficient - liftCoefficient the code strstr(chaine,"DragCoefficient") returns 1 if DragCoefficient is into the line chaine and 0 if not. so if you want to plot the p final residual for example, you'll need to put the condition strstr(chaine,"Solving for p") which will be equal to 1 just for the good lines and then index = stristr(chaine,"Final residual ="); which will return the index of the letter "F" (first letter of the subchain) and finally index = index + 17; // index of the first number after Final residual char* souschaine; souschaine = strsub(chaine, index, index + 8); // souschaine is the substring token from chaine with first index given by "index" and final index given by "index+8" just don't make mistake with the initial if condition, as you have several times "Final residual", you need to put the condition well to be sure you're loading the good one
Guys, I really admire you: parsing text files in C is .... something for the dedicated. That kind of job is programmed MUCH faster using some kind of scripting language (awk, perl, mighty python ...) using regular expressions (which also exist for C BTW). And even if the final C-solution is 2-3 times faster than the script .... you'll have to parse a lot of logs to make up for the extra time it took you to program it

I'm not 100% sure which intermediate iteration data you need, but maybe pyFoamPlotWatcher.py with a right cutomRegexp and the --write-files-option might be what you want (it writes multiple files if the residual of that name is there multiple times during a timestep)

Last edited by gschaider; April 9, 2012 at 17:58. Reason: Clarification

 May 18, 2012, 06:12 #6 Member   Join Date: Nov 2011 Posts: 44 Rep Power: 7 Hi I just installed pyFoam and am trying to use it on my old log files... Installation was very easy. Now I tried "pyFoamPlotWatcher.py proc4_out" but I get the following error: sh: gnuplot: command not found sh: gnuplot: command not found sh: gnuplot: command not found Traceback (most recent call last): File "/usr/local/bin/pyFoamPlotWatcher.py", line 5, in PlotWatcher() File "/Library/Python/2.6/site-packages/PyFoam/Applications/PlotWatcher.py", line 35, in __init__ nr=1) File "/Library/Python/2.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 213, in __init__ result=self.run() File "/Library/Python/2.6/site-packages/PyFoam/Applications/PlotWatcher.py", line 132, in run run.start() File "/Library/Python/2.6/site-packages/PyFoam/Execution/BasicWatcher.py", line 73, in start self.lineHandle(line) File "/Library/Python/2.6/site-packages/PyFoam/Execution/AnalyzedCommon.py", line 75, in lineHandle self.analyzer.analyzeLine(line) File "/Library/Python/2.6/site-packages/PyFoam/LogAnalysis/FoamLogAnalyzer.py", line 125, in analyzeLine self.analyzers[nm].doAnalysis(line) File "/Library/Python/2.6/site-packages/PyFoam/LogAnalysis/TimeLineAnalyzer.py", line 43, in doAnalysis self.notifyNewTime(m) File "/Library/Python/2.6/site-packages/PyFoam/LogAnalysis/TimeLineAnalyzer.py", line 32, in notifyNewTime self.notify(float(m.group(2))) File "/Library/Python/2.6/site-packages/PyFoam/LogAnalysis/LogLineAnalyzer.py", line 65, in notify f(*data) File "/Library/Python/2.6/site-packages/PyFoam/LogAnalysis/FoamLogAnalyzer.py", line 71, in setTime listener.timeChanged() File "/Library/Python/2.6/site-packages/PyFoam/Execution/StepAnalyzedCommon.py", line 32, in timeChanged self.timeHandle() File "/Library/Python/2.6/site-packages/PyFoam/Execution/GnuplotRunner.py", line 271, in timeHandle self.plots[p].redo() File "/Library/Python/2.6/site-packages/PyFoam/Basics/GeneralPlotTimelines.py", line 112, in redo self.doReplot() File "/Library/Python/2.6/site-packages/PyFoam/Basics/GnuplotTimelines.py", line 115, in doReplot self.replot() File "/Library/Python/2.6/site-packages/PyFoam/ThirdParty/Gnuplot/_Gnuplot.py", line 333, in replot self.refresh() File "/Library/Python/2.6/site-packages/PyFoam/ThirdParty/Gnuplot/_Gnuplot.py", line 226, in refresh self(self.plotcmd + ' ' + string.join(plotcmds, ', ')) File "/Library/Python/2.6/site-packages/PyFoam/ThirdParty/Gnuplot/_Gnuplot.py", line 210, in __call__ self.gnuplot(s) File "/Library/Python/2.6/site-packages/PyFoam/ThirdParty/Gnuplot/gp_macosx.py", line 144, in __call__ self.flush() IOError: [Errno 32] Broken pipe Ideas? I see you're one of the developers... awesome stuff!! F Last edited by fferroni; May 18, 2012 at 06:32.

 May 18, 2012, 06:42 #7 Member   Join Date: Nov 2011 Posts: 44 Rep Power: 7 Dear Bernhard, It appears to have done something if I use 'pyFoamStandardLogAnalyzer.py' I get separate files with continuity and many other variables that I was logging, in columns of time, local, global, and cumulative. Just to check, I get 9 separate files for i.e. pressure. Is that because it gives a separate file for each time in runs DICPGG (3 x 3 iterations)? Thank you, F

May 18, 2012, 11:11
#8
Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,748
Blog Entries: 39
Rep Power: 103
Greetings to all!

Quote:
Well, I would say the first few lines are self explanatory... you don't have "gnuplot" installed! Either that, or the gnuplot command is something like gnuplot44.

I haven't got much experience (yet) with pyFoam, so I can't answer your latest post...

Best regards,
Bruno
__________________

May 21, 2012, 17:05
#9
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
Quote:
 Originally Posted by fferroni Dear Bernhard, It appears to have done something if I use 'pyFoamStandardLogAnalyzer.py' I get separate files with continuity and many other variables that I was logging, in columns of time, local, global, and cumulative. Just to check, I get 9 separate files for i.e. pressure. Is that because it gives a separate file for each time in runs DICPGG (3 x 3 iterations)? Thank you, F
Exactly. Usually you'll want to use the first because it should have the "worst" residual (the pyFoamPlotWatcher.py uses this for instance)

About your other problem: I agree with wyldcat: probably there is no gnuplot installed. Or under a different name

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Rickard.Solsjo OpenFOAM Post-Processing 11 November 19, 2014 21:57 A.D.E OpenFOAM Post-Processing 3 November 8, 2011 09:18 liamm OpenFOAM Running, Solving & CFD 14 August 29, 2010 05:12 rubenparedes OpenFOAM Post-Processing 2 May 27, 2010 23:25 liugx212 OpenFOAM Running, Solving & CFD 9 June 18, 2008 13:12

All times are GMT -4. The time now is 05:08.