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

[PyFoam] Plotting values (e.g. residuals) from all iterations with pyFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2014, 08:52
Default Plotting values (e.g. residuals) from all iterations with pyFoam
  #1
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
I'm wondering if it is possible to have pyFoam plot residuals (or other values) during each iteration step. So far, I have only found out how to plot the values once each time step (depending on the accumulation property in customRegexp).

Alternatively, I can modify the solver so it prints time steps instead of iteration numbers, but this is not really a proper solution.

I know there are various other methods for plotting residuals, I'd just prefer to have one solution that works for all cases.
chriss85 is offline   Reply With Quote

Old   November 10, 2014, 18:20
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by chriss85 View Post
I'm wondering if it is possible to have pyFoam plot residuals (or other values) during each iteration step. So far, I have only found out how to plot the values once each time step (depending on the accumulation property in customRegexp).

Alternatively, I can modify the solver so it prints time steps instead of iteration numbers, but this is not really a proper solution.

I know there are various other methods for plotting residuals, I'd just prefer to have one solution that works for all cases.
You're a bit vague about "each iteration step". Iteration of the linear solver? SIMPLE/PISO-iteration?

If you mean "I have multiple instances of solving psi per timestep and want to visualize them all": online plotting won't work. But you can write out files (from the help of pyFoamPlotRunner.py)
Code:
Data files
----------
How data files are written

--single-data-files-only
                        Don't create consecutive data files 'value',
                        'value_2', 'value_3' etc but put all the data into a
                        single file
--write-files           Writes the parsed data to files
One of the reasons why there is no plotting of multiple residuals is: how do you assign t to them on the t-axis?
- all the same time? Doesn't look good and gives no indication of progress (that is what single-data-files will give you)
- distribute evenly between this and next time? Problem is that from "outside" (and that is from where PyFoam looks) there is no way to tell how many iterations there are going to be
__________________
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
gschaider is offline   Reply With Quote

Old   November 11, 2014, 03:54
Default
  #3
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
In my case I'm talking about PIMPLE/PISO loop.

You're right about the axis of course, but I think in such a case a simple counter would suffice. Using gnuplot, one could probably go more advaned, draw vertical lines and such, but I don't think this is really needed.

It would also be useful if it was possible to specify the regular expression of the loop iteration log file output manually. This way, plotting iterations of custom loops would also be possible.
chriss85 is offline   Reply With Quote

Old   November 11, 2014, 06:38
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by chriss85 View Post
In my case I'm talking about PIMPLE/PISO loop.

You're right about the axis of course, but I think in such a case a simple counter would suffice. Using gnuplot, one could probably go more advaned, draw vertical lines and such, but I don't think this is really needed.
As I said: the data can be written to file. And then you can do what you want with it.

I won't do it in online plotting because the algorithm that collects data for that and "coarsens" it (to make sure that runs with thousands of timesteps don't use all the CPU just for plotting) assumes that there is only one data item for each timestep

Quote:
Originally Posted by chriss85 View Post
It would also be useful if it was possible to specify the regular expression of the loop iteration log file output manually. This way, plotting iterations of custom loops would also be possible.
I'm not quite sure what you mean with "specify manually". Of course you can target the output of the linear solver with your own customRegexp too. Or do you mean something else? Two things that MIGHT help you there are "phases" (see the ReleaseNotes) or modifying in the configuration SolverOutput/timeregexp but I'll stay as vague with the answer as you are in your question
__________________
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
gschaider is offline   Reply With Quote

Old   November 11, 2014, 11:35
Default
  #5
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Quote:
Originally Posted by gschaider View Post
I'm not quite sure what you mean with "specify manually". Of course you can target the output of the linear solver with your own customRegexp too. Or do you mean something else? Two things that MIGHT help you there are "phases" (see the ReleaseNotes) or modifying in the configuration SolverOutput/timeregexp but I'll stay as vague with the answer as you are in your question
Indeed, the timeregexp might be what I'm looking for, as it would allow me to plot during each iteration step if I add a counting output during each iteration. I basically meant this setting, but specified for a single plot. This way should be fine though because it prevents having to modify the solver time output.

I didn't know about the configuration file before, thanks for pointing me to it!
chriss85 is offline   Reply With Quote

Old   November 11, 2014, 12:13
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by chriss85 View Post
Indeed, the timeregexp might be what I'm looking for, as it would allow me to plot during each iteration step if I add a counting output during each iteration. I basically meant this setting, but specified for a single plot. This way should be fine though because it prevents having to modify the solver time output.

I didn't know about the configuration file before, thanks for pointing me to it!
OK. But don't override it globally but in LocalConfigPyFoam in the case
__________________
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
gschaider is offline   Reply With Quote

Reply


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
Maximum number of iterations exceeded chtmultiregionsimpleFoam Moncef OpenFOAM Running, Solving & CFD 28 July 13, 2020 15:26
Problem with chtMultiregionFoam radiation boundary condition baran_foam OpenFOAM Running, Solving & CFD 10 December 17, 2019 18:36
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 14:12
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 14:58
Error while running rhoPisoFoam.. nileshjrane OpenFOAM Running, Solving & CFD 8 August 26, 2010 13:50


All times are GMT -4. The time now is 12:42.