Win10OpenSUSEShell by Stefan Radl
- contributor: Stefan Radl
- affiliation: Technische Universität Graz, Austria
- contact: click here for email address
- OpenFOAM version: 4.0/5.x/foam-extend/v1906
- Published under: CC BY-NC-SA license (creative commons licenses)
Go back to Tips.
Go back to 3 weeks series.
Go back to Stefan's collection
Purpose and Intro
Having an OpenSUSE shell on Win10 with OpenFOAM installed is of great advantage for Windows users that do not want to have a dual-boot or virtual maschine installed. I recommend the "shell on Win10" solution especially for installations on laptops, and users that would like to run simple cases and do not care about performance too much. It is hence ideal for beginners, students, and instructors that work with Windows users.
Note, some Linux users prefer the Ubuntu distribution. You will find Win10 shell tutorials for Ubuntu for example HERE (Jozsef Nagy's work).
How to install OpenFOAM in Windows 10 using an OpenSUSE Leap 42 shell
This section explains how to setup an OpenSUSE Leap 42 shell in Windows 10, and install OpenFOAM from source. The beautiful thing with such a "from source" installation is that you add libraries, solvers, external tools like CFDEM etc. as you need.
- Enable developer mode. E.g., see HERE
- Enable the Windows Subsystem for Linux (this may require a restart). E.g., see HERE
- Download and install OpenSUSE Leap 42 from the "Microsoft Store" in Win 10. Similarly, you can apply this for OpenSUSE Leap 15.1 (use different file below)
- Start an OpenSUSE shell, and install missing libraries using zypper (i.e., as a superuser, do "zypper in openmpi", "zypper in openmpi-devel", "zypper in zlib-devel", "zypper in zlib"). Note, the root password should be the same as that of the user. IMPORTANT: close and re-open the terminal AFTER the zypper installations are finished.
- on some systems you have to add this to your .bashrc file in order to be able to use openmpi:
- for OpenSUSE Leap 42: Un-tar THIS TAR FILE FOR OF4.x (contains a pre-compiled version of OF 4.x) OR THIS TAR FILE FOR OF5.x (contains a pre-compiled version of OF 5.x) into your newly available /opt/ directory of your OpenSUSE shell (you need root privileges to untar the file into /opt!). Ensure that you un-tar in your Linux shell, NOT the Windows file editor! To untar, use the linux command "tar xzf <fileName>". For OpenFOAM v1906 simply navigate to THE OpenFOAM v1906 PAGE, download and untar the tgz file as instructed there (works nicely on OpenSUSE as well! if the error "/lib64/libm.so.6: version `GLIBC_2.23' not found" pops up, you need to add a new repo to your WSL using “zypper ar https://download.opensuse.org/repositories/home:/canislycan/openSUSE_Leap_42.3/ canislycan” and then install specific glibc version (the canislycan repo provides the required version of glibc which is 2.25))
- for OpenSUSE Leap 15.1: Un-tar THIS TAR FILE FOR OF5.x (contains a pre-compiled version of OF 5.x) into your newly available /opt/ directory of your OpenSUSE shell. Untar same as for OpenSUSE Leap 42. foam-extend 4.0: the pre-compiled package for Leap 15.1 is AVAILABLE HERE.
- Alternatively to using the above pre-compiled OF source code, you could check-out the source code of the OpenFOAM version of your choice, and compile from source (tested with OF version 4.0 and 5.0).
- foam-extend: use the website https://aur.archlinux.org/cgit/aur.git/snapshot/libccmio.tar.gz for downloading the libccmio directory. The default path for foam-extend-foam-extend-4.0 seems to be broken. Before you can compile foam-extend from source, ensure that the following tools are installed (e.g., via zypper): flex, bison, cmake, rpmbuild, hostname. in the etc/bashrc it is recommended to use "SYSTEMOPENMPI" as WM_MPLIB.
- adjust your .bashrc file in your linux home to make linux understand where your OpenFOAM libs and execs are. To edit the .bashrc, ensure that you are not root user, navigate to your (linux) home directory (i.e., simply do "cd"), and do "vim .bashrc" (vim is a simple text editor). Press "i" in the editor to enter the insertion mode, and add the line source /opt/OpenFOAM-<VERSION>.x/etc/bashrc in the file in the last line (replace "<VERSION> with your OpenFOAM version). Press "CTRL+C", ":wq", and enter to save the modification to the .bashrc file.
- In the linux shell, now do source .bashrc to source the file and load your OpenFOAM environment.
File Structure and Arrangement
You need to be careful with the file structure, since this may mess up your OpenSUSE shell!
Thus, never try to access the LINUX file tree with your Windows explorer or the like (although you could: your linux system lifes in C:\Users\<userName>\AppData\Local\Packages\*SUSE.openSUSELeap42.2_*\LocalState. Never tough this in windows!)
It is not problematic to access the classical windows file structure from linux. Therefore, it is practical to create a symbolic link to the drives in your windows machines. These drives are mounted in the linux shell to /mnt. E.g., if you like to have a link named "winUser" in your linux system, simply do:
ln -s /mnt/c/Users/<yourUserName> winUser
Suggested Workflow for Running and Postprocessing OpenFOAM runs
- create a symbolic link (as above) to make it easy for you to navigate to your Windows file system from the linux shell
- change to your a directory on your windows file system in which you want to run simulations (it is NOT suggested to use the default OF run directory, since this is on the Linux file system, and hence data cannot be easily accessed there!)
- you can now easily feed information to your simulations from Windows (e.g., STLs, text files) since you work on the windows file system.
- compile/run/monitor your simulations in the linux shell
- Use paraview, Matlab/Octave, and other post-processing tools in your Windows installation, and load data from our windows directory that you used for running