|
[Sponsors] |
August 23, 2016, 11:58 |
plotting residuals
|
#1 |
Member
subhankar
Join Date: May 2016
Posts: 36
Rep Power: 10 |
Hi everyone,
I am solving flow past cylinder between two parallel channel(laminar case). I am using pisoFoam solver.After completion of iterations, i tried to plot the residuals by creating log files and then plotting by using the command ./plot. But it didn't plot anything. It also didn't create files in the log folder. Can anybody tell what might have gone wrong? Thanks in advance... regards Subhankar |
|
August 23, 2016, 12:24 |
|
#2 |
Member
Charles K.
Join Date: Feb 2016
Location: Germany
Posts: 37
Rep Power: 10 |
I usually use the following commands:
Code:
pisoFoam > log1 & pyFoamPlotWatcher.py log1 to save the residualplot, use Code:
pyFoamPlotWatcher.py log1 --hardcopy --format-of-hardcopy=pdf Hope this will help you |
|
August 24, 2016, 02:52 |
|
#3 |
Member
subhankar
Join Date: May 2016
Posts: 36
Rep Power: 10 |
Hi McCharles,
Thanks for the reply. I used the commands. But it didn't plot anything.It shows "pyFoamPlotWatcher.py: command not found". Also I think i have done some mistakes in the files because in the log file it shows "No finite volume options present". and there is no information about the initial iteration. Can you tell me where i went wrong. Any suggestions are appreciated. Thanks in advance, best regards Subhankar |
|
August 24, 2016, 03:45 |
|
#4 |
Member
Charles K.
Join Date: Feb 2016
Location: Germany
Posts: 37
Rep Power: 10 |
Is python installed on your Computer? The commands you used are correct, so there is certainly something wrong with your Python installation.
The "no finite volume option present" message is due to the fact that you're not using any options in fvOption, which isn't a problem. What do you mean by "no information about the initial iteration" ? |
|
August 24, 2016, 10:35 |
|
#5 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
To plot residuals, you can use the function object called, as expected, residuals. It comes alongside the installation of OF. All you need to do is to add a few lines to your controlDict in the block called functions.
Code:
functions { residuals { type residuals; functionObjectLibs ("libutilityFunctionObjects.so"); enabled true; outputControl timeStep; outputInterval 1; fields ( p U k epsilon ); } } Code:
foamMonitor -l postProcessing/residuals/0/residuals.dat |
|
September 8, 2016, 12:15 |
|
#6 | |
Senior Member
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 17 |
Quote:
Code:
--> FOAM FATAL ERROR: Unknown function type residuals Valid functions are : 21 ( CourantNo DESModelRegions Lambda2 Peclet Q blendingFactor coded dsmcFields patchProbes pressureTools probes scalarTransport setTimeStep sets surfaces timeActivatedFileUpdate turbulenceFields vorticity wallShearStress yPlusLES yPlusRAS ) From function functionObject::New(const word& name, const Time&, const dictionary&) in file db/functionObjects/functionObject/functionObject.C at line 92. FOAM exiting Best, |
||
September 9, 2016, 04:16 |
|
#7 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
It looks like the function object did not compile when you installed OpenFOAM. That should be no problem though, the source code is still present in your installation. You only need to compile it.
The function object residuals is located in $FOAM_SRC/postProcessing/functionObjects/utilities/residuals. Check that the C files, which define the residuals, have been included in the corresponding library:
residuals/residuals.C residuals/residualsFunctionObject.C
Now the function object can be used by any solver. |
|
September 9, 2016, 13:02 |
|
#8 | |
Senior Member
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 17 |
Quote:
Thank you for the quick repsonse. I am using OpenFoam version 2.3.1. The function residual it is not in the directory at all. I don't know what to do next. I look forward to hearing from you. Best, |
||
September 9, 2016, 13:20 |
|
#9 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
There are several options. If you check the source codes of OpenFOAM in github, you can see that version 2.3.x has a code for the function object residuals available. So just download it and compile it. Maybe a simple update of your OF package would do the trick.
Alternatively, you may think about upgrading your OF version. Or, you can use another way of plotting residuals. There is the option of doing so using some Python scripts (pyFoam). I have never used these though. I am relatively new to OF and so I have experience only with the versions 3 and 4. |
|
September 10, 2016, 12:34 |
|
#10 | |
Senior Member
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 17 |
Quote:
Thanks again for you reply. I have copied the residuals residuals.tar.gz function in the directory $FOAM_SRC/postProcessing/functionObjects/utilities/ as you stated. Then I relocate to the directory as follows; /OpenFOAM/OpenFOAM-2.3.1/src/postProcessing/functionObjects$ Then I typed ./Allmake. However, the function is still not working. Do you have any other trick that could save me install Openfoam? I look forward to hearing from you. Best regards, |
||
September 10, 2016, 14:56 |
|
#11 | |
Member
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 10 |
Why don't you plot it using gnuplot? It is very easy if you have a log file. You just need to write one simple file to read residuals. You can find it online or I can share it with you if you can't.
Quote:
|
||
September 10, 2016, 15:01 |
|
#12 |
Senior Member
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 17 |
Hello Hasan,
The problem of using "log.simpleFoam" or any solver using gnuplot is that I can not export the data to be read in matlab. Therefore, residual function makes the data readable in matalb, so that you can make nice eps plots. I hope that you understand why I need it to work in OpenFoam 2.3.1 Best, |
|
September 10, 2016, 15:12 |
|
#13 | |
Member
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 10 |
Oh, I see. I hope you can find an easy way to do it. If you can't find a solution and if you really need to obtain residuals in Matlab, I may suggest you to work with log file in the sense of gnuplot. You can try to catch the number followed by a string. As an example what I mean, please check this link:
https://www.mathworks.com/matlabcent...ng-in-txt-file I wish you good luck! Quote:
|
||
September 11, 2016, 07:48 |
|
#14 | |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
Quote:
|
||
September 13, 2016, 11:48 |
|
#15 |
New Member
Join Date: Aug 2016
Posts: 12
Rep Power: 10 |
Hey! I am trying to use the wallShearStress function but i get the error library not found. what can i do about it?
|
|
September 13, 2016, 11:58 |
|
#16 | |
Senior Member
CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 17 |
Quote:
You need to download the source files from github. Then paste the files into the following directory; OpenFoam/OpenFoamV/src/postProcessing/functionObjects/utilities Finally, go to the following directory; OpenFoam/OpenFoamV/src/postProcessing/functionObjects/utilities/Make/ Open the file "files" and add the following lines; wallShearStress/wallShearStress.C wallShearStress/wallShearStressFunctionObject.C Hit cd ../cd .. to relocate to OpenFoam/OpenFoamV/src/postProcessing/functionObjects And then ./Allwmake Best, |
||
September 13, 2016, 12:27 |
|
#17 | |
New Member
Join Date: Aug 2016
Posts: 12
Rep Power: 10 |
Quote:
+ wmake libso field ./Allwmake: 6: ./Allwmake: wmake: not found + wmake libso forces ./Allwmake: 7: ./Allwmake: wmake: not found + wmake libso IO ./Allwmake: 8: ./Allwmake: wmake: not found + wmake libso utilities ./Allwmake: 9: ./Allwmake: wmake: not found + wmake libso jobControl ./Allwmake: 10: ./Allwmake: wmake: not found + wmake libso systemCall ./Allwmake: 11: ./Allwmake: wmake: not found Your help would be greatly appreciated. Last edited by sage; September 13, 2016 at 15:52. |
||
January 7, 2017, 05:31 |
foamMonitor for chtMultiRegionSimpleFoam
|
#18 |
Member
Join Date: Sep 2016
Posts: 63
Rep Power: 10 |
Happy New Year everybody,
I use OF4.0. For the cavity case I can plot the residuals by adding the following lines in controlDict functions { #includeFunc residuals } and run the following command foamMonitor -l postProcessing/residuals/0/residuals.dat The same method does not work for chtMultiRegionSimpleFoam. The solver broke the computation and in the log.chtMultiRegionSimpleFoam it is written: --> FOAM FATAL IO ERROR: "ill defined primitivEntry starting at keyword 'residuals'... " in the log.foamMonitor it is written: file postprocessing/residuals/0/residuals.dat does not exit Does anyone know to to plot residuals for chtMultiRegionSimpleFoam? Thank you very much in advance! |
|
May 28, 2017, 09:37 |
|
#19 | ||
Member
Matt Ridzon
Join Date: Jun 2014
Posts: 91
Rep Power: 12 |
Quote:
Quote:
Thanks, M Ridzon |
|||
August 5, 2018, 22:59 |
|
#20 |
Senior Member
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17 |
Ok guys. Anyone knows how to plot variables from log file not just residuals. I have tried making logs directory and see alpha values when I list,ie, execute ls. But when I execute
Code:
plot './alpha.water_0' with lines Cheers, Elham |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
plotting grid-wise residuals | defrak | OpenFOAM | 1 | May 20, 2015 04:30 |
[PyFoam] Plotting values (e.g. residuals) from all iterations with pyFoam | chriss85 | OpenFOAM Community Contributions | 5 | November 11, 2014 12:13 |
Plotting residuals | krembil | OpenFOAM Running, Solving & CFD | 2 | August 16, 2014 04:38 |
Plotting Residuals using HelyxOS | EFoster2 | OpenFOAM Running, Solving & CFD | 0 | February 17, 2014 21:05 |
Plotting Residuals | ata | OpenFOAM | 12 | July 8, 2011 03:50 |