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/)
-   -   [PyFoam] for Windows? (https://www.cfd-online.com/Forums/openfoam-community-contributions/110864-windows.html)

Vitterfolk December 23, 2012 01:45

for Windows?
 
Hey guys, I'm new here so sorry if this has been asked before, but is it possible to install the PyFoam libraries on windows? I'm running the windows compatible version 1.5. I'm rather inexperienced with anything beyond the syntax and logic of programming (Haven't played much with command prompt or programming beyond matlab or lessons on code academy). I'm willing to do the research on installing libraries and stuff on my own, but I just wanted to know if linux was required prior to dumping a bunch of time on it. Thanks!

wyldckat December 24, 2012 10:24

Greetings Alex and welcome to the forum!

PyFoam has been developed and tested to work on Linux and Mac OS X.

AFAIK, PyFoam on Windows is currently only available in blueCFD (http://www.bluecape.com.pt/blueCFD/ - I'm the guy responsible for blueCFD) and it is still very limited, in the sense that most of the functionalities will not work. We haven't made much more progress, due to the current workload we've had since its release nearly a year ago. Public release of the changes we've made so far is still pending internal review and approval at blueCAPE (which is where I work).

Anyway, the main problem is that there are several functions in Python that PyFoam uses that will only work out-of-the-box in POSIX systems, such as Linux and Mac.
For making it work on Windows, it's necessary to search for the Python libraries that can help replace the missing functions that the Python version for Windows doesn't have by default. And some of those missing functions might still have to be coded, in case the external libraries that have been found don't have them...

Best regards,
Bruno

PS: I've moved this thread to the sub-forum dedicated to Installation on Windows, Mac and other Unsupported Platforms

wyldckat January 11, 2013 13:23

Greetings!

FYI, we've finally released the patches here: http://sourceforge.net/p/openfoam-ex...etspyfoam/166/

Best regards,
Bruno

wyldckat July 15, 2014 06:50

Greetings to all!

I have some interesting updates on this topic. We at blueCAPE Lda (where I work) have created a new PyFoam repository at Github, dedicated to continuing the porting development of PyFoam to fully work on Windows: https://github.com/blueCFD/PyFoam

We made our first attempts to porting PyFoam to Windows back in 2011; later provided our modifications to the official PyFoam version in January 2013, which were introduced into PyFoam 0.6.0: www.cfd-online.com/Forums/openfoam-news-announcements-other/87114-new-release-pyfoam.html#post414040 - post #3

Unfortunately, the porting process was very incomplete back then and we haven't managed to pull any more efforts into porting PyFoam to Windows.
Therefore, we've started the project at Github yesterday, in hopes that this work can be continued by either ourselves or others.

The objective of this new repository at Github is to create a development environment for continuing the work that has been done so far: The very first release "PyFoam-Windows-0.6.3.tar.gz" is already available on the Releases page. For installing PyFoam 0.6.3 for Windows in blueCFD-Core, simply follow the instructions provided in the file "README.Windows".


A bug was already fixed today, but 3 are still open. Everyone is welcome to contribute!

Best regards,
Bruno

fertinaz January 13, 2015 08:02

pyFoam on windows
 
1 Attachment(s)
Hi all,

Hopefully this is the correct place to create this thread. The question is about running pyFoamPlotWatcher on windows.

I did install pyFoam on a windows pc after a few hours of work. This is the project: https://github.com/blueCFD/PyFoam

Some minor modifications needed for a proper installation but it works fine. However when I try to see residuals & continuity plots following issue is exactly the problem I have: https://github.com/blueCFD/PyFoam/issues/3

Nothing appears when I run pyFoamPlotWatcher and it becomes visible for a second when Ctrl+C is hit then disappears again. You can see the attached file.

I would like to know if there any recommendations to cope with it.

Fatih.

wyldckat January 13, 2015 10:51

Greetings Fatih,

I've moved your post from the post-processing forum to this thread, because this is a question specific to this port of PyFoam for Windows.

I need a few more details, in order to be able to help you:
  1. Which exact download package did you use and/or did you use "git clone"?
  2. Can you be more specific on the details regarding this statement:
    Quote:

    Originally Posted by fertinaz (Post 527287)
    Some minor modifications needed for a proper installation but it works fine.

    The smallest detail is more than enough to not have a working installation.
Best regards,
Bruno

fertinaz January 13, 2015 13:48

Hello Bruno,

Thanks for your respond, this looks like a more appropriate location for this thread :)

The steps I followed in details:

1- Naturally I started with the installation of python. I decided to use version 2.7

2- Then downloaded the project zip file: https://github.com/blueCFD/PyFoam and extracted it in the OF folder I have on windows (this is the OF2.1 version ported by symscape)

3- Applied the commands written in README.windows which are
mkdir %WM_PROJECT_DIR%\etc\config.d\
xcopy contrib\Windows\PyFoam.* %WM_PROJECT_DIR%\etc\config.d\
call %WM_PROJECT_DIR%\etc\config.d\PyFoam.bat
.\winsetup.bat
These commands are run in the OpenFOAM command prompt

3- To successfully accomplish the installation I had to modify the winsetup.bat file in which the setup.py is called:
- python setup.py install --prefix="%PYFOAM_ARCH_PATH%"
+ C:\FullPathPython\python setup.py install --prefix="%PYFOAM_ARCH_PATH%"
Otherwise one should see the irritating msg: "python is not recognized as an internal or external command"

4- Had to install numpy. Downloaded numpy‑1.8.2‑cp27‑none‑win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and installed it using pip.

5- Had to install gnuplot. Downloaded gp510-20141006-win64-mingw.exe.zip from http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/

6- After completing the gnuplot installation the full path for the gnuplot executable had to be written in PyFoam/PyFoam/ThirdParty/Gnuplot/gp_win32.py
- gnuplot_command = r'gnuplot.exe'
+ gnuplot_command = r'"C:\FullPathGnuplot\bin\gnuplot.exe"'
Note the "" here.

7- Run pyFoamPlotWatcher.bat with a sample log/simpleFoam.log

As far as I remember this must be it. I cannot check right now because I am not in the office at the moment but I guess these are the steps I followed today.

Thanks for your time.

wyldckat January 13, 2015 15:56

Hi Fatih,

You didn't download the pre-release version "0.6.3-win" from here: https://github.com/blueCFD/PyFoam/releases - or did you?
Because if you downloaded that specific version, then that explains the problem.

Either way, please confirm if the changes indicated in this commit are present in your source code snapshot: https://github.com/blueCFD/PyFoam/co...5caf947bdf603c - because these changes are meant to be the ones that fix this problem you're having.

edit: I forgot to mention that I've only tested this with gnuplot 4.6 so far... using the binary package downloaded directly from the gnuplot's project at Sourceforge.net.

Best regards,
Bruno

fertinaz January 14, 2015 02:54

1 Attachment(s)
Ok, so started from scratch.
1- Downloaded "0.6.3-win" from https://github.com/blueCFD/PyFoam/releases
2- Applied changes in the commit you mentioned above: winhacks.py, gp_win32.py and FoamThread.py
3- Downgraded to gnuplot 4.6.6
4- Removed existing ThirdParty folder and installed 0.6.3-win
5- Run pyFoamPlotWatcher.bat log.simpleFoam
6- Result: Please see attached file.

Would be it be that gnuplot cannot access to the log file because some other application invoked by pyfoam locks it at the same time? I am not sure though it is just a guess.

wyldckat January 14, 2015 17:28

Hi Fatih,

Actually the "0.6.3-win" version is the one for which this feature you're trying to use will not work properly.
If you originally downloaded the one from the big "Download ZIP" button on the main page: https://github.com/blueCFD/PyFoam - then that is the latest code snapshot for this port. But even the latest version is still very experimental. I haven't been able to check properly what happens when I install this in another installation of blueCFD-Core on another machine. I'll try to look into this better either tomorrow or in the weekend.

Best regards,
Bruno

fertinaz January 15, 2015 05:34

Ok that was what I initially did, using the package comes by clicking "Download ZIP" button. The only difference between this version and the commit you mentioned is in the PyFoam/Execution/FoamThread.p

The code comes with the package is:
Code:

if self.isWindows:
replaced with:
Code:

if uname()[0]=="Windows":
I tried both with gnuplot 5 and 4.6 but unfortunately did not seem to resolve the problem.

Many thanks for your time though. It would be nice if you can post here when you have a chance to dig deeper.

wyldckat January 18, 2015 13:37

Hi Fatih,

OK, I've fixed a couple of additional issues. Please get the latest ZIP from https://github.com/blueCFD/PyFoam

Now it should no longer give the problem with "unlink" after Ctrl+C is pressed and it should be able to show the graphs without exiting immediately, nor locking up... although please do keep in mind that the "--persist" option does not work on Windows, due to a limitation in gnuplot/Windows, at least as far as I can figure out.

Best regards,
Bruno

fertinaz January 20, 2015 01:50

Hi Bruno, many thanks for your time and effort. It works fine now.

Have a nice day.

verboomj November 29, 2016 03:43

I follow all instructions according to the windows.readme file, but after the last command I get the warning that Numpy is not installed.

However, if I go to my C:/Python34 map in the command window, Numpy is working properly and is up to date.

Furthermore my if I use the command PyFoam in my BlueCFD shell it doesn't recognize the command.

Any idea?

Jeroen

wyldckat November 29, 2016 05:29

Greetings Jeroen,

I haven't been able to update PyFoam to the latest version, to make it work on Windows.
Nonetheless, the old version should still work as intended with PyFoam 2.7.*

Therefore, I need to know a few details about the steps you've taken:
Quote:

Originally Posted by verboomj (Post 627350)
I follow all instructions according to the windows.readme file, but after the last command I get the warning that Numpy is not installed.

Which exact package did you download? Was it "PyFoam-Windows-0.6.3.tar.gz" or did you download from our "blueCFD-Core" branch at https://github.com/blueCFD/PyFoam/ ?

Quote:

Originally Posted by verboomj (Post 627350)
However, if I go to my C:/Python34 map in the command window, Numpy is working properly and is up to date.

I haven't tested our port with Python 3.4, I only tested it with Python 2.7. Which leads me to the next questions:

Quote:

Originally Posted by verboomj (Post 627350)
Furthermore my if I use the command PyFoam in my BlueCFD shell it doesn't recognize the command.

Which version of blueCFD-Core did you install?

And what steps did you take to integrate Python 3.4 into the blueCFD-Core shell?

Best regards,
Bruno


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