|
[Sponsors] |
August 27, 2010, 05:53 |
foamLog problem
|
#1 |
Senior Member
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 16 |
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? |
|
August 30, 2010, 10:01 |
|
#2 |
New Member
yvin
Join Date: Dec 2009
Posts: 7
Rep Power: 17 |
||
August 30, 2010, 13:29 |
|
#3 |
Senior Member
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 16 |
Fixed it.
Removed the fuel n-dodecane sed -e "/$N-DODECANE/d" log > newLog then use diff log newlog to make sure |
|
September 23, 2010, 00:03 |
|
#4 |
Senior Member
Join Date: Mar 2009
Posts: 225
Rep Power: 18 |
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 |
|
September 23, 2010, 08:25 |
|
#5 |
Senior Member
Join Date: Mar 2009
Posts: 225
Rep Power: 18 |
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 |
|
September 23, 2010, 09:00 |
|
#6 |
Senior Member
Join Date: Mar 2009
Posts: 225
Rep Power: 18 |
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 |
|
September 23, 2010, 17:11 |
|
#7 |
Senior Member
Join Date: Mar 2009
Posts: 225
Rep Power: 18 |
'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 |
|
September 23, 2010, 17:28 |
|
#8 |
Senior Member
Join Date: Mar 2009
Posts: 225
Rep Power: 18 |
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$ |
|
February 13, 2013, 18:36 |
|
#9 | |
New Member
Robin Debroux
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
Quote:
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 |
||
February 14, 2013, 03:10 |
|
#10 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
If this error is clearly reproducable for multiple cases, you may want to file a bugreport: http://www.openfoam.org/bugs/
|
|
October 12, 2013, 07:33 |
|
#11 |
Member
Olabanji
Join Date: Jan 2013
Location: U.S.A
Posts: 31
Rep Power: 13 |
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. |
|
November 19, 2014, 21:57 |
foamLog fix
|
#12 |
New Member
Josefine Wilms
Join Date: Sep 2009
Posts: 10
Rep Power: 17 |
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) 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 Code:
echo " print $timeName \"\\t\" val[1] >> file" >> $AWKFILE Code:
echo " close(file)" >> $AWKFILE Code:
echo " ${counter}++" >> $AWKFILE Last edited by Fine; November 24, 2014 at 05:04. |
|
|
|
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 |