CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [Tutorials] Tutorial of how to plot residuals ! (https://www.cfd-online.com/Forums/openfoam-community-contributions/64146-tutorial-how-plot-residuals.html)

sandy November 19, 2011 18:34

It's ok, I think. If p equation gets convergent, you can judge other equations have got convergent early.

Akuji April 19, 2012 03:53

Hello, everyone!

I use scripts for plot residuals and coefficients (thank you VERY MUCH).

Residuals are plotting, but coefficients - not. I have only grid of graphics, and a tip, that lift coeff have red color, drag - green.
I look inside file and change it according my solver.

Did I do something wrong? Or how can I get the graphic of force coefficients?

tanzil August 13, 2012 06:29

Thanks Wolfgang for the great script,

I was wondering what syntax is needed to plot Residual vs Time in transient case instead of Residual vs Iteration. Does anyone have an Idea?

Regards

ata August 14, 2012 01:33

Hi
May be you can use pyFoam

sdharmar November 2, 2012 02:05

how to save pyFoamPlotWatcher.py generated gunplots at the end of the run.

BR,
Suranga.

gschaider November 21, 2012 12:00

Quote:

Originally Posted by sdharmar (Post 389798)
how to save pyFoamPlotWatcher.py generated gunplots at the end of the run.

BR,
Suranga.

With all pyFoam-utilities the option "--help" is your friend. The option you're looking for is callled --hardcopy I believe (just because I write this stuff doesn't mean that I know how to use it ;) ). There are also options to write the data to postprocess it with other programs (going through pyFoamRedoPlot.py even allows you to write CSV-files that you can directly use in a Spreadsheet)

GPan1 November 29, 2012 16:41

This is quite nice, but is there anyway to import the data from the log file into excel for some nicer looking graphs?

calim_cfd November 29, 2012 16:50

hi! u can create a bash script to create a txt/csv like file so u can import it to excel..

the command "awk" is the best call imo

gl

gschaider November 29, 2012 17:55

Quote:

Originally Posted by GPan1 (Post 394929)
This is quite nice, but is there anyway to import the data from the log file into excel for some nicer looking graphs?

"This" you mean hardcopy in pyFoamPlotWatcher?

One possible way was described in the next sentence: read the file with the pickled data with pyFoamRedoPlot.py and instead of generating images write CSV-files (CSV is read by almost everyone including Excel)

Other way would be to let the Watcher write files with the --write-files-option and use pyFoamConvertToCSV.py

GPan1 November 29, 2012 18:16

oops, no I meant using gnuplot however I'll take a look at using pyFoamWatcher. CSV data would be perfect. Thanks!

gschaider November 29, 2012 19:10

Quote:

Originally Posted by GPan1 (Post 394939)
oops, no I meant using gnuplot however I'll take a look at using pyFoamWatcher. CSV data would be perfect. Thanks!

In the thread tree your posting showed up as a response to one of my postings. And that was all context there was for the "this". Didn't mean to impose PyFoam on you

GPan1 November 30, 2012 04:20

Ah right, the quick reply function is different here compared to other forums. Usually just adds a comment onto the thread without specifying who you reply to.

Found an easier way, simply copy and paste the log file into excel, split into columns by delimiting (use space and comma). Use an if/else function to select the row of the column that has (for me Uy) then return the row 3 columns to the right or return zero. Filter out the zeros, copy and paste the non-zero data into a new sheet as 'values' and you're sorted.

gschaider November 30, 2012 12:16

Quote:

Originally Posted by GPan1 (Post 394983)
Ah right, the quick reply function is different here compared to other forums. Usually just adds a comment onto the thread without specifying who you reply to.

Found an easier way, simply copy and paste the log file into excel, split into columns by delimiting (use space and comma). Use an if/else function to select the row of the column that has (for me Uy) then return the row 3 columns to the right or return zero. Filter out the zeros, copy and paste the non-zero data into a new sheet as 'values' and you're sorted.

Well. Whatever you consider easy ;)

despaired student December 7, 2012 10:25

Problems with plotting by gnuplot, simpleFoam Residuals
 
3 Attachment(s)
Hi foamers,

I have a maybe stupid question about how to plot the residuals of a simpleFoam Simulation.

I'm used to pyFoam but this is no longer an option so I've tried gnuplot and the script provided by W.Heydlauff.
As I understand the script it should plot the Final Residual of the log-file, right? But when I use it now it gives me the Initial Residual of the log-file. How comes?


Here is my gnuplot-script:

Quote:

set logscale y
set title "Residuals"
set ylabel 'Residual'
set xlabel 'Iteration'
plot "< cat Log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,\
"< cat Log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,\
"< cat Log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,\
"< cat Log | grep 'Solving for p' | cut -d' ' -f9 | sed -n 'p;N;N' | tr -d ','" title 'p' with lines
pause 1
reread
The Log-file and my plot are attached.


Thank you in advance.

tanzil December 7, 2012 11:33

It should be f13 instead of f9 to plot Final residual.

regards,
Tanzil

despaired student December 7, 2012 11:44

Sure? I've tried f12, f13 and f14 but these tries just produced error-messages...

dima December 10, 2012 06:31

1 Attachment(s)
Hi Sören,

with your gnuplot-script and the changes described by Tanzil the plot works without errors

Quote:

set logscale y
set title "Residuals"
set ylabel 'Residual'
set xlabel 'Iteration'
plot "< cat Log | grep 'Solving for Ux' | cut -d' ' -f13 | tr -d ','" title 'Ux' with lines,\
"< cat Log | grep 'Solving for Uy' | cut -d' ' -f13 | tr -d ','" title 'Uy' with lines,\
"< cat Log | grep 'Solving for Uz' | cut -d' ' -f13 | tr -d ','" title 'Uz' with lines,\
"< cat Log | grep 'Solving for p' | cut -d' ' -f13 | sed -n 'p;N;N' | tr -d ','" title 'p' with lines
pause 1
reread
regards,
dima

despaired student December 10, 2012 06:43

Thanks,

I copied your script - working fine. I guess that I've overlooked something in my script...


Thnaks for the quick help.

s.m December 18, 2012 12:15

how draw pressure coefficient in openFoam
 
hi dear Wolfgang:);
it was really useful post, it help me alot.
would you please tell us how can draw pressure coefficient on airfoil using paraview? our multi element airfoil have been solved with openFoam software.
thank you very much:)

bioexplore January 4, 2013 08:03

How about parallel situation
 
Hi, can this method applicable to parallel cases?


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