CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

foamLog problem

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

Like Tree3Likes
  • 2 Post By paka
  • 1 Post By Fine

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2010, 05:53
Default foamLog problem
  #1
Senior Member
 
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 15
Rickard.Solsjo is on a distinguished road
I everyone!
I want to plot my residuals, however when i run the command foamLog log I receive the output

Executing: awk -f ./logs/foamLog.awk log
awk: ./logs/foamLog.awk:29: N-DODECANECnt=0
awk: ./logs/foamLog.awk:29: ^ syntax error
awk: ./logs/foamLog.awk:30: N-DODECANEFinalResCnt=0
awk: ./logs/foamLog.awk:30: ^ syntax error
awk: ./logs/foamLog.awk:31: N-DODECANEItersCnt=0
awk: ./logs/foamLog.awk:31:

Generated XY files for:
C
CFinalRes
CIters
CO2
CO2FinalRes
CO2Iters
contCumulative
contGlobal
contLocal
CourantMax
CourantMean
executionTime
h
H2O
H2OFinalRes
H2OIters
hFinalRes
hIters
k
kFinalRes
kIters
N-DODECANE
N-DODECANEFinalRes
N-DODECANEIters
O2
O2FinalRes
O2Iters
p
pFinalRes
pIters
rho
rhoFinalRes
rhoIters
Separator
Time
Ux
UxFinalRes
UxIters
Uy
UyFinalRes
UyIters
Uz
UzFinalRes
UzIters[/SIZE]

Okay, so it looks like the n-dodecane doesnt work, I dont care.
But when i open the logs folder

foamLog.awk
¨
This is all I have. Can it be a problem if the run was stopped before the endtime or whatever? Someone who got an idea?
Rickard.Solsjo is offline   Reply With Quote

Old   August 30, 2010, 10:01
Default
  #2
New Member
 
yvin
Join Date: Dec 2009
Posts: 7
Rep Power: 16
camille.yvin is on a distinguished road
try this :

http://www.cfd-online.com/Forums/ope...residuals.html
camille.yvin is offline   Reply With Quote

Old   August 30, 2010, 13:29
Default
  #3
Senior Member
 
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 15
Rickard.Solsjo is on a distinguished road
Fixed it.
Removed the fuel n-dodecane

sed -e "/$N-DODECANE/d" log > newLog
then use diff log newlog to make sure
Rickard.Solsjo is offline   Reply With Quote

Old   September 23, 2010, 00:03
Default
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
I also step into some trouble...


-------- output --------
users-macbook:cavity user$ foamLog log
Using:
log : log
database : /Users/user/OpenFOAM/OpenFOAM-1.7.x/bin/foamLog.db
awk file : ./logs/foamLog.awk
files to : ./logs

Executing: awk -f ./logs/foamLog.awk log
awk: ./logs/pFinalRes_1 makes too many open files
input record number 47, file log
source line number 72

Generated XY files for:
CourantMax
CourantMean
Separator
Time
Ux
UxFinalRes
UxIters
Uy
UyFinalRes
UyIters
contCumulative
contGlobal
contLocal
executionTime
p
pFinalRes
pIters
users-macbook:cavity user$
-------- end of output --------------

I tried to run it on different cases, sometimes it will say 'too many open files' on different log file.

For example, for icoFoam/cavity tutorial, Ux_0 log (cat logs/Ux_0) looks like that:
0.005 1

just one line, nothing else. Other log files look similarly. They are all _0.

Any tip here?

Thanks,
K
paka is offline   Reply With Quote

Old   September 23, 2010, 08:25
Default
  #5
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
Greetings all!

Reading more about awk I learned it cannot handle too big files. Appears the whole 'log' file is just too large.

Somebody must have had similar problem. I'm not running large cases, for example, one from icoFoam/cavity tutorial. That case is quite small, but the awk error appears anyway.

Does anyone here use foamLog?

Any workaround for this problem?

Thanks,
K
paka is offline   Reply With Quote

Old   September 23, 2010, 09:00
Default
  #6
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
OK. Problem solved.

In each loop for each of output variables (i.e. Ux_0) the files were not closed, so AWK was getting "stuck" or whatever you call it. The result was the AWK error message saying "too many files opened".

Reading more about AWK I learned each time something is written into file the files should be closed properly, which means, use 'close(file)' command.

I modified slightly the foamLog file adding at line 395 the following statement:
echo " close(file)" >> $AWKFILE

This solves the problem and all the residuals are in logs/ folder.

I think this should be added as a fix into distribution.

Best,
K
Bernhard and liviajatoba like this.
paka is offline   Reply With Quote

Old   September 23, 2010, 17:11
Default
  #7
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
'close(file)' syntax should be also added to lines 366, 373, 380. I think it is easier to substitute your own foamLog with the one attached here. Put it in OpenFOMA-X.X.X/bin/ folder.

Have a wonderful day everyone,
K
Attached Files
File Type: zip foamLog.zip (3.8 KB, 65 views)
paka is offline   Reply With Quote

Old   September 23, 2010, 17:28
Default
  #8
Senior Member
 
Join Date: Mar 2009
Posts: 225
Rep Power: 18
paka is on a distinguished road
Hmm... I just tried to use the tool with interFoam and it seems the error still persists. When I run the tool it produces logs, but each of the log file has only one line with only one initial sample. All the files are the same, i.e.:


users:inflowtest user$ du -sh logs/*
4.0K logs/CourantMax_0
4.0K logs/CourantMax_1
4.0K logs/CourantMax_2
4.0K logs/CourantMean_0
4.0K logs/CourantMean_1
4.0K logs/CourantMean_2
4.0K logs/Separator_0
4.0K logs/Time_0
4.0K logs/alpha1FinalRes_0
4.0K logs/alpha1FinalRes_1
4.0K logs/alpha1Iters_0
4.0K logs/alpha1Iters_1
4.0K logs/alpha1_0
4.0K logs/alpha1_1
4.0K logs/contCumulative_0
4.0K logs/contCumulative_1
4.0K logs/contCumulative_2
4.0K logs/contGlobal_0
4.0K logs/contGlobal_1
4.0K logs/contGlobal_2
4.0K logs/contLocal_0
4.0K logs/contLocal_1
4.0K logs/contLocal_2
4.0K logs/executionTime_0
4.0K logs/foamLog.awk
4.0K logs/p_rghFinalRes_0
4.0K logs/p_rghFinalRes_1
4.0K logs/p_rghFinalRes_2
4.0K logs/p_rghIters_0
4.0K logs/p_rghIters_1
4.0K logs/p_rghIters_2
4.0K logs/p_rgh_0
4.0K logs/p_rgh_1
4.0K logs/p_rgh_2
4.0K logs/pcorrFinalRes_0
4.0K logs/pcorrIters_0
4.0K logs/pcorr_0
users:inflowtest user$
paka is offline   Reply With Quote

Old   February 13, 2013, 18:36
Default
  #9
New Member
 
Robin Debroux
Join Date: Oct 2012
Posts: 22
Rep Power: 13
robdeb is on a distinguished road
Quote:
Originally Posted by paka View Post
I also step into some trouble...


-------- output --------
users-macbook:cavity user$ foamLog log
Using:
log : log
database : /Users/user/OpenFOAM/OpenFOAM-1.7.x/bin/foamLog.db
awk file : ./logs/foamLog.awk
files to : ./logs

Executing: awk -f ./logs/foamLog.awk log
awk: ./logs/pFinalRes_1 makes too many open files
input record number 47, file log
source line number 72

Generated XY files for:
CourantMax
CourantMean
Separator
Time
Ux
UxFinalRes
UxIters
Uy
UyFinalRes
UyIters
contCumulative
contGlobal
contLocal
executionTime
p
pFinalRes
pIters
users-macbook:cavity user$
-------- end of output --------------

I tried to run it on different cases, sometimes it will say 'too many open files' on different log file.

For example, for icoFoam/cavity tutorial, Ux_0 log (cat logs/Ux_0) looks like that:
0.005 1

just one line, nothing else. Other log files look similarly. They are all _0.

Any tip here?

Thanks,
K
Hello paka,

I know it's an old post but I got the same error.
Do you finally find a solution?
I try to use your foamLog but OpenFOAM can't read it.

Thank you
robdeb is offline   Reply With Quote

Old   February 14, 2013, 03:10
Default
  #10
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
If this error is clearly reproducable for multiple cases, you may want to file a bugreport: http://www.openfoam.org/bugs/
Bernhard is offline   Reply With Quote

Old   October 12, 2013, 07:33
Default
  #11
Member
 
Olabanji
Join Date: Jan 2013
Location: U.S.A
Posts: 31
Rep Power: 13
banji is on a distinguished road
With regards to paka's problem, I had a similar problem but i only modified the foamLog file adding at line 395 the following statement:
echo " close(file)" >> $AWKFILE

as he said. It works fine. (Thanks so much, Paka)

Modifying other lines created a new problem - printed the result for the last iteration, only i.e. just one line.
banji is offline   Reply With Quote

Old   November 19, 2014, 21:57
Default foamLog fix
  #12
New Member
 
Josefine Wilms
Join Date: Sep 2009
Posts: 10
Rep Power: 16
Fine is on a distinguished road
Hi

ran into the same problem of having too many files open. Fixed with a trick similar to that of Paka:

Change 1:
In foamLog file place a single "close file" command:
Code:
varName=varNameVal[1] "Iters"
        file=varName "_" subIter[varName]++
        file="$outputDir/" file
        extract(\$0, "No Iterations ", val)
        print $timeName "\t" val[1] > file
        close(file)
Change 2:
awk uses ">" to place a value in a file an overwrite any previous data in it. If you wish to append data to an existing file use ">>": I.e. the following section:
Code:
echo "    print $timeName \"\\t\" val[1] > file" >> $AWKFILE
should be replaced with:
Code:
echo "    print $timeName \"\\t\" val[1] >> file" >> $AWKFILE
Change 3 is the one that paka proposed the first time: place an
Code:
echo "    close(file)" >> $AWKFILE
after
Code:
echo "    ${counter}++" >> $AWKFILE
Attached is the modified foamLog file which works with OpenFOAM221. This can be extracted and copied and pasted in the $WM_PROJECT_DIR/bin folder.
Attached Files
File Type: gz foamLog.tar.gz (3.6 KB, 25 views)
paka likes this.

Last edited by Fine; November 24, 2014 at 05:04.
Fine is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 05:43
Incoherent problem table in hollow-fiber spinning Gianni FLUENT 0 April 5, 2008 11:33
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 15:52


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