|
[Sponsors] |
May 18, 2021, 10:56 |
Monitor residuals with OpenFoam ESI
|
#1 |
Member
Join Date: Mar 2021
Posts: 39
Rep Power: 5 |
Hello to all,
I am using OpenFoam 2012 and would like to plot the residuals of pressure and velocity during the execution of the simulation. I am using the functionObject solverInfo as: Code:
solverInfo { type solverInfo; libs ("libutilityFunctionObjects.so"); fields (U p); writeResidualFields no; executeControl timeStep; executeInterval 10; } Afterwards, when I plot the residuals with foamMonitor the plot gets very crowded. Is it possible to restrict the information output from the functionObject to just the initial residuals? Or alternatively to just plot the initial residuals of variables with foamMonitor? |
|
May 18, 2021, 18:04 |
|
#2 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 250
Rep Power: 22 |
There's also a very powerful python tool called "pyFoam" for that purpose.
It includes utilities like pyFoamRunner and pyFoamPlotWatcher which are relevant for the purpose you mention. You should also have a look at youtube e.g. "How to plot residuals in OpenFOAM: functionObject and pyFoam utilities" which goes into custom configuration of residual plots to some extend. |
|
May 19, 2021, 04:40 |
|
#3 | |
Member
Join Date: Mar 2021
Posts: 39
Rep Power: 5 |
Quote:
Hi, Thanks for the reply. I ended up using solverInfo functionObject but filtered the data with an executable script. The code bellow will look for _initial termination and plot only the variables with it. Code:
filename=$1 gnuplot -persist <<-EOFMarker set datafile commentschars "" set datafile separator tab set key noenhanced set logscale y set title 'Residuals' set ylabel 'Residual' set xlabel 'Iteration' myHeaders = system("head $filename | grep -o '[^ ]*_initial[^ ]*'") plot for [i=1:words(myHeaders)] '$filename' u "# Time":word(myHeaders,i) skip 1 w l ti columnheader EOFMarker Create a file called foamPlot. Paste the code inside. Make it an executable file with: Code:
chmod +x foamPlot Use it with: Code:
foamPlot solverInfo.dat |
||
May 20, 2021, 16:04 |
|
#4 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12 |
Would you mind to comment on what could be improved/what should be done item by item in the "solverInfo" function object, so that the user might have lesser pain?
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
May 20, 2021, 17:57 |
|
#5 | |
Member
Join Date: Mar 2021
Posts: 39
Rep Power: 5 |
Quote:
Hi, Sure! Just put a switch to just filter the initial residuals instead of "everything". This would be a similar behavior to what OpenFOAM foundation has: https://github.com/OpenFOAM/OpenFOAM...ties/residuals This way, you could just plot the residuals with : Code:
foamMonitor -l solverInfo.dat |
||
May 21, 2021, 16:19 |
|
#6 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12 |
hmm interesting. The "solverInfo" FO is the updated version of the "residuals"; in fact, it was renamed. I have put it at the end of my to-do list (which is longer than Gandalf's hair atm).
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting Started with OpenFOAM | wyldckat | OpenFOAM | 25 | August 14, 2022 13:55 |
Map of the OpenFOAM Forum - Understanding where to post your questions! | wyldckat | OpenFOAM | 10 | September 2, 2021 05:29 |
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology | wyldckat | OpenFOAM | 17 | November 10, 2017 15:54 |
OpenFOAM Training Beijing 22-26 Aug 2016 | cfd.direct | OpenFOAM Announcements from Other Sources | 0 | May 3, 2016 04:57 |
The OpenFOAM extensions project | mbeaudoin | OpenFOAM | 16 | October 9, 2007 09:33 |