CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Announcements from Other Sources (
-   -   Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 (

wyldckat September 6, 2010 09:11

Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64
Dear FOAMers and Windows users,

We at blueCAPE have continued our work on getting OpenFOAM being cross-compiled to the fullest, from Linux to Windows, from and to either 32 or 64 bit architectures. This time we are releasing our latest patches for OpenFOAM 1.7.0. We haven't tested yet applying them to the latest OpenFOAM 1.7.1, but hopefully it won't require too much manual editing.
Thanks to the Mingw-w64 project, the MPICH2 project and Symscape's efforts on cross-compiling OpenFOAM since version 1.4.1, we have been able to make another step forward and making possible of getting OpenFOAM cross-compiled to the fullest, thus bringing parallel computing, libmetis and libscotch to the working grounds of Windows.

We've updated the pages related to these patches on, in order to bring you a detailed step by step guide that now is split into the two versions:
We have not updated the previous patches to reflect some of the fixes made in the new patches, due to time restrictions.
These new patches for OpenFOAM 1.7.0 were based on Symscape's patch version 11 for OpenFOAM 1.6.x, as well with the experience gathered from the previous patches made by us.
If you wish to compile OpenFOAM directly in Windows, the only current solution is to use Cygwin and cross-compile OpenFOAM from there. The instructions are also provided in the wiki here.

Unfortunately, there still are some limitations to this cross-compiling version, but now we have been able to test all of the tutorials (albeit not all were left to run till completion, due to them taking very long) and we have been able to make all tutorials run successfully! At least as successfully as OpenFOAM 1.7.0 in Linux ;) The main issue with our previous patches was the solvers that are chemistry related, got locked in an endless loop, simply due to a bug in the patch for Random.C. The more complete list of things added by these patches can be found here.
Although we have tested all of the tutorials, we still haven't been able to fully test the resulting product, due to insufficient knowledge of all solvers and utilities that OpenFOAM has. The known limitations for the new patches for OpenFOAM 1.7.0 are described on the wiki here.

Hopefully, with these patches, as well as Symscape's latest patches, anyone can do the step of mixing the two together and coming up with updated versions. And there is a script named foamDiff, that can aid in making patches, without requiring to clean up the binaries and objects. This script was made because we didn't use the git version of OpenFOAM.

The support thread for these patches is still the same:

We've updated our timings with the motorBike case from OpenFOAM 1.6.x, with single and dual core, 32 and 64bit, Linux and Windows (sorry, no Wine). We didn't update the case so the results could be compared with our previous timings. This means that the mesh decomposition for the parallel runs still isn't good enough, since the performance increase with dual core was only of about 30%.

As for MPI, we decided to continue to only use MPICH2 for the following reasons:
  • Albeit not being GPL licensed, the MPICH2 license seems to be fairly compatible;
  • It is available already built, so it's some time saved in the build process;
  • Although Open MPI is as of version 1.3.3 buildable in Windows, it can only be built with Microsoft's Visual Studio. This is good for performance, but annoying to have to build Open MPI in Windows, then go to Linux to build OpenFOAM, and then come back to Windows when done. Some effort was put into attempting to build Open MPI with MinGW(-w64), but there are too many changes necessary to make the code functionable with both MSVS and MinGW.
  • The MS-MPI or MS HPC SDK was not used in these patches, because of some issues:
  1. one which we cannot discuss due to the MS HPC SDK's EULA.
  2. this is in its EULA:

    You may not disclose the results of any benchmark tests of the software to any third party without Microsoft’s prior written approval;
    This would impair us from disclosing any timings as we have done before.
  3. In order to build both 32 and 64 builds, we specifically need two Windows architectures (32 and 64) in order to retrieve the necessary DLLs and header files.
Nonetheless, you can adapt Symscape's instructions to use MS-MPI into our patches. And for Open MPI, we have provided some brief instructions in the wiki here.

Feel free to comment!

Best Regards and happy mass paralleling on Windows :)
Bruno Santos

wyldckat September 7, 2010 11:39

Greetings to all!

This is just to report that the patches have been updated. There were a couple of glitches in the first posted version.

Best regards,

wangzy September 8, 2010 02:38

excellent work!

Thanks for the excellent work of porting OF to Windows!

I have complied OpenFOAM 1.6 with Cygwin on Windows, under your instructions on the wiki page. I'll try 1.7 when I am free in time.

By the way, is foamToTecplot360 included in your ported package?

Best regards

wyldckat September 8, 2010 07:25

Greetings Zhiyong and welcome to the forum!

The aim of these patches is to have everything working :)
Although not everything was tested and foamToTecplot360 is one of the applications I haven't tested yet :( But it should work as intended!

Best regards,

All times are GMT -4. The time now is 18:19.