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

plotting residuals

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree19Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 28, 2020, 16:30
Default
  #21
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Hi,

I use 4 PIMPLE iterations. The pyFoamPlotWatcher shows the residuls of the first PIMPLE iteration only. I am wondering how would I display the last PIMPLE iteration?

Thanks.
Bodo1993 is offline   Reply With Quote

Old   May 18, 2020, 10:13
Default
  #22
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 6
otaolafr is on a distinguished road
hello!
i am using ubuntu in a Wls from windows. i can not make work pyFoamPlotWatcher. i have installed already python 3(sudo apt-get install python3), and it does not find the command
Quote:
pyFoamPlotWatcher.py: command not found
.

any idea? thanks
otaolafr is offline   Reply With Quote

Old   May 20, 2020, 11:41
Default
  #23
Member
 
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9
PositronCascade is on a distinguished road
Hello. Can you verify that PyFoam is installed and works correctly in your system? You can do that by evoking
Code:
python
or
Code:
python3
interactive shell and

Code:
import PyFoam
import PyFoam.FoamInformation
print PyFoam.FoamInformation.foamTutorials()
then it returns this for me, as I have installed Of7 in my system:

Code:
/opt/openfoam7/tutorials
If it works for you as well, you just need to go to the folder of log file and call the log file named log1 as

Code:
pyFoamPlotWatcher.py log1
I use WSL as well and it works for me.
PositronCascade is offline   Reply With Quote

Old   May 20, 2020, 11:45
Default
  #24
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 6
otaolafr is on a distinguished road
Quote:
Originally Posted by PositronCascade View Post
Hello. Can you verify that PyFoam is installed and works correctly in your system? You can do that by evoking
Code:
python
or
Code:
python3
interactive shell and

Code:
import PyFoam
import PyFoam.FoamInformation
print PyFoam.FoamInformation.foamTutorials()
then it returns this for me, as I have installed Of7 in my system:

Code:
/opt/openfoam7/tutorials
If it works for you as well, you just need to go to the folder of log file and call the log file named log1 as

Code:
pyFoamPlotWatcher.py log1
I use WSL as well and it works for me.
hello, well i think i have not PyFoam installed...
already doing python3
and after import PyFoam i get
Code:
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyFoam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyFoam'
I thought that it was installed already, sorry.... i will have a look.
franco
otaolafr is offline   Reply With Quote

Old   May 20, 2020, 11:47
Default
  #25
Member
 
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9
PositronCascade is on a distinguished road
That's okay. You just need to install it using pip or pip3 whichever you have.

Code:
pip3 install PyFoam
Quote:
Originally Posted by otaolafr View Post
hello, well i think i have not PyFoam installed...
already doing python3
and after import PyFoam i get
Code:
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyFoam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyFoam'
I thought that it was installed already, sorry.... i will have a look.
franco
otaolafr likes this.
PositronCascade is offline   Reply With Quote

Old   May 22, 2020, 12:37
Default
  #26
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 6
otaolafr is on a distinguished road
Quote:
Originally Posted by PositronCascade View Post
That's okay. You just need to install it using pip or pip3 whichever you have.

Code:
pip3 install PyFoam
thanks a lot hasan,
Small (and last, i promise!) question, I am running my simulation from an Allrun file, is it possible to add the pyFoam to the Allrun file? can i run it before running the solver with adding " &"?
or i am obligated each time i run the simulation to open another terminal and do it? (or "run ./Allrun &")
best regards,
franco
otaolafr is offline   Reply With Quote

Old   May 23, 2020, 18:49
Default
  #27
Member
 
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9
PositronCascade is on a distinguished road
Hello, I would rather use RunFunctions if you are on a local computer.

Evoke it by

Code:
. $WM_PROJECT_DIR/bin/tools/RunFunctions
Then, you can call the application

Code:
runApplication simpleFoam &
or

Code:
runParallel simpleFoam &

It will give you a log file called log.simpleFoam. Press enter and you will be back to your terminal then write

Code:
pyFoamPlotWatcher.py log.simpleFoam
You can change the application from simpleFoam to anything as you wish.


When you need to kill the application, check top and it will give you PID number of the Openfoam application. Then, write kill PID_number.

Quote:
Originally Posted by otaolafr View Post
thanks a lot hasan,
Small (and last, i promise!) question, I am running my simulation from an Allrun file, is it possible to add the pyFoam to the Allrun file? can i run it before running the solver with adding " &"?
or i am obligated each time i run the simulation to open another terminal and do it? (or "run ./Allrun &")
best regards,
franco
PositronCascade is offline   Reply With Quote

Old   May 24, 2020, 13:37
Default
  #28
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 6
otaolafr is on a distinguished road
Quote:
Originally Posted by PositronCascade View Post
Hello, I would rather use RunFunctions if you are on a local computer.

Evoke it by

Code:
. $WM_PROJECT_DIR/bin/tools/RunFunctions
Then, you can call the application

Code:
runApplication simpleFoam &
or

Code:
runParallel simpleFoam &

It will give you a log file called log.simpleFoam. Press enter and you will be back to your terminal then write

Code:
pyFoamPlotWatcher.py log.simpleFoam
You can change the application from simpleFoam to anything as you wish.


When you need to kill the application, check top and it will give you PID number of the Openfoam application. Then, write kill PID_number.
hello,
thanks for the answer, yes, it is what i am doing actually using runParallel, my only doubt it was if i used the " &" at the end, it means that it continues running the script at the same time that it runs in this case, simpleFoam, so if there is a line after this that uses the results of simpleFoam it would give an error, no? to be more clear with an easier example:
if i do:
Code:
runApplication blockMesh &
runApplication snappyHexMesh
it would create an error, no? as snappy uses the result of the blockMesh and from the script they will run more or less at the same time, no? it was my issue with this, for the case with pyFoamPlotWatcher.py i though maybe do it before running the simpleFoam with runApplication pyFoamPlotWatcher.py &? so this would not be a problem. or I am missing something?
thanks
otaolafr is offline   Reply With Quote

Old   January 20, 2021, 15:11
Default foamMonitor: command not found
  #29
New Member
 
Join Date: Dec 2020
Posts: 26
Rep Power: 5
OlivierM is on a distinguished road
Hello,

I try to plot residuals on the fly using foamMonitor but this fails.
(I'm on OFv2012 Ubuntu 20.04 WSL2)

I run the command below:

$ foamMonitor -l postProcessing/residuals1/0/solverInfo.dat


which returns:

$ foamMonitor: command not found


Does anyone know how to solve this ?

thank you
OlivierM is offline   Reply With Quote

Old   January 22, 2021, 05:31
Default
  #30
New Member
 
Join Date: Dec 2020
Posts: 26
Rep Power: 5
OlivierM is on a distinguished road
I follow your message. I think I have PyFoam installed as you can see below :

#
$ pip3 install PyFoam
Requirement already satisfied: PyFoam in ./.local/lib/python3.8/site-packages (2020.5)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from PyFoam) (1.17.4)
#

but then there is that error:

#$ import PyFoam
import-im6.q16: unable to open X server `:0' @ error/import.c/ImportImageCommand/359.
#

what could be the issue ?

thanks
OlivierM is offline   Reply With Quote

Old   May 21, 2024, 03:54
Default Tried residual code at the end of controldict, only outputs initial residuals
  #31
New Member
 
King Rollan
Join Date: Feb 2024
Location: Philippines
Posts: 1
Rep Power: 0
kaizer is on a distinguished road
Greetings!

I would like to revive this thread by saying that the code for residuals stated above does not output the final residuals, only the initial residuals. Does anyone have a fix for this?

If it helps, I am running it on OpenFOAM.org v9.

Cheers,
King
kaizer is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
plotting grid-wise residuals defrak OpenFOAM 1 May 20, 2015 03:30
[PyFoam] Plotting values (e.g. residuals) from all iterations with pyFoam chriss85 OpenFOAM Community Contributions 5 November 11, 2014 11:13
Plotting residuals krembil OpenFOAM Running, Solving & CFD 2 August 16, 2014 03:38
Plotting Residuals using HelyxOS EFoster2 OpenFOAM Running, Solving & CFD 0 February 17, 2014 20:05
Plotting Residuals ata OpenFOAM 12 July 8, 2011 02:50


All times are GMT -4. The time now is 00:54.