
[Sponsors] 
March 28, 2012, 03:46 
pyFoamPlotWatcher and customRegexp

#1 
Member
Martin
Join Date: Nov 2011
Posts: 35
Rep Power: 7 
Hello everybody,
I am having problems plotting of variables out of the logfiles with the help of pyFoam 0.5.5. Neither can I see any plot nor do I get any error while starting the plot. It would be nice if anyone can help me Thanks Code:
Custom01 { accumulation first; enabled yes; expr " MassFlows: inlet = (%f%) outlet = (%f%)"; name Custom01_massflow; persist no; raisit no; theTitle "Custom 1  MassFlows"; titles ( min max ); type regular; with lines; } Code:
... MassFlows: inlet = 0.03416099 outlet = 0.0341609 Time = 597 smoothSolver: Solving for Ux, Initial residual = 7.440172e05, Final residual = 3.728601e06, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.0001222075, Final residual = 1.202023e05, No Iterations 3 smoothSolver: Solving for Uz, Initial residual = 5.190061e05, Final residual = 4.436034e06, No Iterations 3 DILUPBiCG: Solving for h, Initial residual = 6.815629e05, Final residual = 4.644949e06, No Iterations 1 GAMG: Solving for p, Initial residual = 2.698017e05, Final residual = 1.007462e06, No Iterations 2 time step continuity errors : sum local = 0.0081001, global = 3.721162e05, cumulative = 0.4522695 rho max/min : 1.200515 1.06891 smoothSolver: Solving for omega, Initial residual = 1.341662e05, Final residual = 1.333425e06, No Iterations 3 bounding omega, min: 11603.2 max: 6.233842e+07 average: 106296.4 smoothSolver: Solving for k, Initial residual = 0.0003323861, Final residual = 2.379521e05, No Iterations 4 bounding k, min: 8.03594e05 max: 240.341 average: 3.479831 ExecutionTime = 3112.29 s ClockTime = 3258 s ... 

March 28, 2012, 07:49 

#2  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,994
Rep Power: 42 
Quote:
The way I usually "develop" a regexp is by copying a logline between "" and then replace the numbers I want to match with (%f%) 

March 28, 2012, 08:07 

#3 
Member
Martin
Join Date: Nov 2011
Posts: 35
Rep Power: 7 
Hello Bernhard,
what a honor to get the answer from the father of pyFoam itself. It is a realy helpfull set of tools. Actually like a swizz knife I found my Problem. I had to delete the space as you adviced and the customRegexpFile have to be placed where the logfile is. > now it works greatfull Thanks Bernhard, MARTIN 

March 28, 2012, 12:01 

#4  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,994
Rep Power: 42 
Quote:
Great. If you feel that information that would have helped you to avoid that problem in the first place is missing from the Wikipage could you be so kind to add it? Thanks 

December 12, 2012, 05:45 

#5 
Member
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 56
Rep Power: 12 
Hi PyFoamers,
is it possible to skip a value from the expression? E.g. plotting only the outlet value in the above example? Thanks in advance! Jan 

December 12, 2012, 13:38 

#6  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,994
Rep Power: 42 
Quote:
Code:
expr " MassFlows: inlet = (%f%) outlet = (%f%)" Code:
expr " MassFlows: inlet = %f% outlet = (%f%)" Code:
expr " MassFlows: inlet = .+ outlet = (%f%)"
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

December 13, 2012, 05:08 

#7 
Member
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 56
Rep Power: 12 
Hi Bernhard,
thanks a lot for the quick reply! Best regards, Jan 

March 5, 2013, 09:48 

#8 
Member
Join Date: Mar 2009
Posts: 75
Rep Power: 10 
Is there any way to plot, on the same graph axes, two variables which are on different lines of the log file? I am having trouble defining multiple expressions in a single graph!


March 5, 2013, 10:09 

#9  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,994
Rep Power: 42 
Quote:
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

September 26, 2013, 11:45 
Additional Information

#10 
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 200
Rep Power: 19 
I don't mean to hijack this thread, but I found out, that parentheses make problems with the regexp. I had this line of solver output
Code:
Concentration = 0.0823725 Min(T) = 0.00958365 Max(T) = 0.326796 Code:
{"expr":"Concentration = (%f%) Min(T) = (%f%) Max(T) = (%f%)","name":"Concentration"} Code:
Concentration = 0.0505933 Min T = 0.00492903 Max T = 0.217095 Code:
{"expr":"Concentration = (%f%) Min T = (%f%) Max T = (%f%)","name":"Concentration","titles":["avg","min","max"]} 

September 26, 2013, 13:12 

#11  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,994
Rep Power: 42 
Quote:
I think I wrote this in one of my PyFoampresentations (but probably not on the Wikipage)
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

September 27, 2013, 03:58 

#12  
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 200
Rep Power: 19 
Thanks for the explanation.
As you say on in the wiki Quote:
By the way: In the wiki in section 9.1.2 Information on regular expression both links to summaries on regular expressions are broken. 

September 27, 2013, 06:22 

#13  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,994
Rep Power: 42 
Quote:
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

December 3, 2014, 14:23 

#14 
New Member
Marko Josic
Join Date: Dec 2010
Posts: 5
Rep Power: 8 
Hallo may somebody can help me:
my logFile looks like: Code:
PIMPLE: converged in 3 iterations ExecutionTime = 75513.4 s ClockTime = 75651 s forces forces output: sum of forces: pressure : (0.603027 0.0244227 4.07056e21) viscous : (0.060363 0.0116136 1.30133e21) porous : (0 0 0) sum of moments: pressure : (2.66751e19 2.65314e17 1.75474e12) viscous : (5.0719e19 2.74569e18 0.000137971) porous : (0 0 0) pressure in x : 7.7394e19 pressure in y : 0.09 Thanl you for your help 

December 3, 2014, 17:48 

#15  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,994
Rep Power: 42 
Quote:
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

April 22, 2015, 14:10 
Plot residuals of any region in a multi region solver

#16 
Senior Member
Alex
Join Date: Oct 2013
Posts: 334
Rep Power: 14 
Hi all!
I apologize for pulling up this old thread but I'm struggling with some issue that I think that fits well in it... I'm solving some cases with chtMultiRegionSimpleFoam solver with a few solid regions and a fluid one. When I run pyFoamPlotWatcher it only shows the residuals plot for the fluid region. What I would like to study is the residuals for some of the solid regions and after having searched for some info in the net I think that it would be possible by using customRegexp. The problem is that I don't have enough knowledge to tackle it on my own so here comes my question: How should my file look like? The solver's output looks like Code:
Solving for solid region regionName DICPCG: Solving for h, Initial residual = 0.02194378, Final residual = 0.0001580524, No Iterations 4 DICPCG: Solving for h, Initial residual = 0.01952452, Final residual = 0.0001349324, No Iterations 4 DICPCG: Solving for h, Initial residual = 0.01921998, Final residual = 0.000115592, No Iterations 4 DICPCG: Solving for h, Initial residual = 0.01896599, Final residual = 0.0001086326, No Iterations 4 Min/max T:min(T) [0 0 0 1 0 0 0] 937.6767 max(T) [0 0 0 1 0 0 0] 962.7659 Code:
ReactionSpeed { expr "Reaction Speed: (%f%) min (%f%) max"; name Custom01_Reaction_speed; theTitle "Custom 1  Reaction speed"; titles ( min max ); type regular; } Any word of wisdom that can enlighten me about this matter will be much appreciated! Best regards, Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in! 

April 23, 2015, 09:40 

#17 
Senior Member
Alex
Join Date: Oct 2013
Posts: 334
Rep Power: 14 
After some attempts to make it work I didn't succeed...
My attempt was to create a file within the case directory with the name customRegexp as suggested in the wiki. In my case, the file contains the following information: Code:
alumina_residuals { expr "Solving for solid region alumina\n\nDICPCG: Solving for h, Initial residual = (%f%), Final residual = .+, No Iterations .+"; name Custom01_alumina_res; theTitle "Custom 1  Residuals for region alumina"; titles ( Initial Residuals ); type regular; } I'm using pyFoam version 0.6.4 and the order I type in the terminal is: Code:
pyFoamPlotWatcher.py silent progress nodefault log.chtMultiRegionSimpleFoam & Code:
Reading regular expressions from customRegexp Can anyone give me some advice on how to proceed correctly in order to write the proper regular expression to be able to plot the residuals for any region? I would really appreciate the help given! Best regards, Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in! 

April 24, 2015, 11:45 
Residuals plot with vertical axis in logarithmic scale

#18 
Senior Member
Alex
Join Date: Oct 2013
Posts: 334
Rep Power: 14 
Dear colleagues,
Finally I could manage to solve it (more or less). I get a a residuals plot by using this customRegexp file: Code:
alumina_residuals { expr "Solving for solid region alumina\nDICPCG: Solving for h, Initial residual = (%f%), Final residual = .+, No Iterations .+"; name Custom_alumina_res; theTitle "Residuals for region: alumina"; titles ( "h (1st iter.)" ); type regular; } Now I have another problem, the plot shows the residuals using a linear vertical axis instead of a logarithmical axis which is not much useful because I can barely see anything... I tried to add a line in the customRegexp file in order to convert the vertical axis into logarithmic scale using the gnuplot grammar, i.e. set logscale y, but it did nothing, the plot was done in linear scale any way. How can I plot the residuals with the vertical axis in logarithmic scale? Is it possible to do that? Many thanks in advance! Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in! 

May 18, 2015, 09:37 

#19 
Member
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 56
Rep Power: 12 
Code:
logscale true; 

May 18, 2015, 09:43 

#20 
Senior Member
Alex
Join Date: Oct 2013
Posts: 334
Rep Power: 14 
Amazing! As simple as that... Thanks!
Regards, Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in! 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
PyFoam  braennstroem  OpenFOAM  294  January 27, 2016 08:33 