Precompiled packages (MS-Windows)
Note:
Post-process with the native ParaView, for better
performance and easy configuration. Do not bother with the paraFoam
script.
The packages do not contain
visualization (eg, ParaView/runTimePostProcessing) or
external-solver (eg, PETSc) modules:
see the corresponding FAQ
MS-Windows
There are three different ways to run OpenFOAM on MS-Windows (10 or newer). These are listed in the likely order of preference:
-
WSL/WSL2 : Windows Subsystem for Linux
Many OpenFOAM users like WSL (Windows Subsystem for Linux) since it provides maximum flexibility for the user to compile new applications, use dynamic code compilation, and install additional programs.
Additionally, the OpenFOAM Linux packages are kept more up-to-date than cross-compiled or docker variants. -
Native Windows : Cross-compiled Windows binaries (mingw).
Provides a quick means of using OpenFOAM on windows, but does not currently include an OpenFOAM development environment (ie, cannot compile code, no dynamic code) -
Docker container : docker-windows
Equivalent to the WSL approach, except that the entire OpenFOAM installation is managed as a container.
Windows Subsystem for Linux
- Install WSL/WSL2 : The WSL information from Microsoft provides extensive information about installing and configuring WSL.
- Install Linux : You should choose a Linux distribution such as Ubuntu or openSUSE that receives regular OpenFOAM updates.
- Install OpenFOAM : Follow the regular installation/update instructions for Ubuntu or openSUSE.
Note
OpenFOAM requires a case sensitive file system to build.
If you attempt to build OpenFOAM from a location outside of the
WSL/WSL2 partition (for example a mounted drive, /mnt/c/Users/some/path
)
this will cause issues. To avoid such problems, there are two possible solutions:
-
Build OpenFOAM within the WSL/WSL2 partition. This partition is case sensitive.
-
or Create a case sensitive folder within the Windows Partition and build OpenFOAM there. The procedure for this approach is outlined below:
- Create a new folder within Windows (eg,
../Documents/OpenFOAM
). Folder must be empty to perform the next step! - Enable case sensitivity for this folder using the
fsutil.exe
utility. This is accomplished by running the commandfsutil.exe file setCaseSensitiveInfo <path/to/folder> enable
in PowerShell (see case sensitivity for Windows) - From inside the WSL/WSL2 environment/terminal, unpack the OpenFOAM-vXXXX.tgz/ThirdParty-vXXXX.tgz files or clone the repositories within this folder. Build OpenFOAM.
- Create a new folder within Windows (eg,
Graphical applications (X11) within WSL
To enable graphical applications such as ParaView, Gedit, GNUPlot etc. to be launched directly from WSL2, the following steps may be followed:
-
Download and install VcXsrv. Make sure to disable "active access control" (set checkmark) as well as "native OpenGL" (unset checkmark) under "Extra Settings" in the installation wizard.
-
Define a display variable in your file. For example, by adding the line
export DISPLAY=$(awk '/nameserver /{ print $2; exit }' /etc/resolv.conf 2>/dev/null):0
to your
~/.bashrc
file -
Run VcXsrv via XLaunch (installed with VcXsrv) or make sure an instance of VcXsrv is running (check for icon in taskbar).
-
Launch graphical applications from the WSL terminal. For example,
gedit &
Native-windows
Download the package of the latest OpenFOAM version by simply clicking the link below (Please ensure that you have at least 300MB of available storage space on your hard disk):
Link to OpenFOAM-windows-mingw.exe
The package is an executable. Run this executable to open the installation wizard, and simply follow the wizard's installation instructions specific to your system. (Please ensure that you have enough available storage space on your hard disk).
You may also need to install Microsoft MPI (MS-MPI) executable. Similary, download
the following package (i.e. msmpisetup.exe
), and follow its installation
wizard:
Upon completion of the above steps, an icon will be created on your desktop.
Double-click this icon to launch a terminal window. Running this icon will load
the OpenFOAM environment. Verify the contents of OpenFOAM in a terminal as follows
($
is the command prompt, indicating that the
terminal is ready to
accept a command.):
$ ls -p
OpenFOAM/
$ cd $WM_PROJECT_DIR
$ ls -p
bin/ COPYING etc/ etc-mingw META-INFO platforms/ README.md ThirdParty/ tutorials/
Docker
- Install Docker: Follow the Docker for windows information.
- Follow general OpenFOAM + Docker information.
Copyright (C) 2021-2023 OpenCFD Ltd.