|
[Sponsors] |
November 26, 2020, 19:15 |
Plotting the residuals using pyFoamPlotWatcher from bash under windows 10
|
#1 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Hi guys;
I am using OpenFOAM version 2006 (20 06) in Windows 10, through Ubuntu 18.04 (Ubuntu 18.04.2 LTS, bionic, bash version 4.4.19(1)-release). The OpenFOAM itself has been running flawlessly so far. My question is about setting up the requirements to use pyFoamPlotWatcher to monitor the residuals from simpleFoam. So, I ran one of my cases and also output a log file called log.simpleFoam in my case directory. When I type pyFoamPlotWatcher.py log.simpleFoam in the bash, first the bash opens the log file and at the end it says: gnuplot: unable to open display '' gnuplot: X11 aborted. I currently have python (Version 3.8.0a1), gnuplot (Version 5.2 patchlevel 8), and Xming (Version 6.9), installed on my windows. I have been spending the last 5 hours digging into different discussion forums, but have been unable to come up with a solution for my issue. I have also taken a look at this post (Tutorial of how to plot residuals !), which did not help me much. Any help is appreciated. Thanks Last edited by mmohaqeqf; November 28, 2020 at 00:10. Reason: better title |
|
November 27, 2020, 01:42 |
|
#2 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Ok I found the answer for my own question, so I am posting the solution here in case others get stuck with similar issue.
Please refer to the following link for the solution: https://askubuntu.com/questions/9488...-on-windows-10 |
|
November 28, 2020, 00:08 |
|
#3 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Just a few more points for future reference, in order to be able to plot anything using gnuplot from the bash that is installed within the windows:
1) You need gnuplot only installed on your bash, not on your windows. 2) You need Xming on your windows, not on your bash. 3) You need to add the following line to your bashrc (and source it once) to set a terminal for the gnuplot to be able to show the plots: export DISPLAY=:0 gnuplot Note: Make sure the Xming is active and running on your Windows (double click on the Xming icon and look at the taskbar to make sure it is running) when you try to plot residuals from the bash terminal. Hope this information helps some one. Last edited by mmohaqeqf; December 2, 2020 at 13:09. |
|
January 22, 2021, 03:55 |
|
#4 | |
New Member
Join Date: Dec 2020
Posts: 26
Rep Power: 5 |
Quote:
I am a bit lost because your last step is: export DISPLAY=:0 gnuplot but in tle link you shared the last step was: export DISPLAY=localhost:0.0 and then the way you succeed to monitor the residuals remains unclear for me. do you use a script ? which command do you use ? do you launch a specific program ? I am able to run simpleFoam but all I have tested so far, pyFoam or gnuplot, has failed ... would you mind clarifying your monitoring process ? thanks |
||
January 23, 2021, 13:14 |
|
#5 | |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Quote:
Hi there; Regarding the link I sent in the above post, I was talking about the answer by the user Ptheguy. Regarding the plotting itself, first you have to make sure you are logging the residuals from the simpleFoam. When you want to run simpleFoam, use the following command, this will create a log file: $ simpleFoam > log.simpleFoam (NOTE: you don't need to type the $ sign; it is actually the prompt!) Once the simulation is finished, make sure the log.simpleFoam is present in your case root directory. Then run the following command (make sure Xming is running in your Windows before running the following command): $ pyFoamPlotWatcher.py log.simpleFoam (NOTE= depending on your system setting, you may not need to use .py at the end of the pyFoamPlotWatcher. If you use the tab to auto-complete the command, the auto-complete tells you which one you have to use.) Let me know if it works for you. Last edited by mmohaqeqf; January 26, 2021 at 01:57. |
||
January 25, 2021, 04:12 |
|
#6 |
New Member
Join Date: Dec 2020
Posts: 26
Rep Power: 5 |
Hi,
thanks for your help I did it on the icoFoam cavity case. The log.icoFoam goes properly in the case root directory. Also 'VcXsrv windows xserver' is running (which includes Xming) Then here is what I got whit the command 'pyFoamPlotWatcher.py': # $ pyFoamPlotWatcher.py log.icoFoam > Traceback (most recent call last): File "/usr/local/bin/pyFoamPlotWatcher.py", line 4, in <module> __import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamPlotWatcher.py') File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1452, in run_script raise ResolutionError(pkg_resources.ResolutionError: Script 'scripts/pyFoamPlotWatcher.py' not found in metadata at '/home/<USER>/.local/lib/python3.8/site-packages/PyFoam-2020.5.dist-info' # Do you have any idea of what's going on ? |
|
January 26, 2021, 01:56 |
|
#7 | |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Quote:
Try typing pyFoamPlotW (note that it is missing the last few letters) and then hit tab, if it doesn't auto complete it, then it means you don't have pyFoam installed. More info: https://openfoamwiki.net/index.php/Contrib/PyFoam Otherwise, I am not really sure where the issue is coming from. |
||
March 29, 2022, 05:57 |
|
#8 | |
Senior Member
Sakun
Join Date: Nov 2019
Location: United Kingdom
Posts: 143
Rep Power: 7 |
Quote:
did you mange to get the solution ? |
||
September 5, 2022, 15:16 |
A better Way to do this
|
#9 |
New Member
Brandon Johnson
Join Date: Jul 2017
Posts: 6
Rep Power: 9 |
Thought I'd chime in.
I've never had luck using a Windows X Server like XMing, VcXsrv, etc (maybe got it to work once on one of my machines after hours and hours of testing). I've found an excellent tutorial on using an RDP connection to your WSL Ubuntu instance that works much better. This video shows how to setup xrdp on WSL Ubuntu. This solution is much easier to achieve, and produced no errors for me. I'll post the steps followed here, in case this video gets taken down. # Refresh/upgrade apt/ubuntu Code:
sudo apt update && sudo apt -y upgrade Code:
sudo apt install xrdp Code:
sudo apt install -y xfce4 # Install additional goodies for xfce4 Code:
sudo apt install -y xfce4-goodies Code:
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini Code:
sudo nano /etc/xrdp/startwm.sh Add the line: Code:
startxfce4 Code:
echo xfce4-session > ~/.xsession Code:
sudo /etc/init.d/xrdp start Open up RDP (Remote Desktop Connection) Address: localhost:3390 (or default port 3389, or whatever you changed it to) Login using your ubuntu credentials. As long as you have gnuplot, etc installed, you should be able to run your commands via this RDP and have zero issues getting UIs like gnuplot to work. Happy foaming. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Tutorials] Tutorial of how to plot residuals ! | wolle1982 | OpenFOAM Community Contributions | 171 | February 20, 2024 03:55 |
Plot Residuals in Postprocessing | Dog766 | FLUENT | 8 | March 23, 2023 13:52 |
Plot the residuals over all the domain | Douglas | OpenFOAM Post-Processing | 0 | June 27, 2017 17:01 |
Odd residuals plot using NITA | Jehosh | Fluent Multiphase | 1 | January 8, 2016 01:02 |
plot of residuals | hawkeye321 | OpenFOAM | 5 | December 7, 2012 10:05 |