OpenFOAM® Installation on Windows 10
From OpenFOAM-v1706, users can now run OpenFOAM using Bash on Ubuntu on Windows. This utility, referred to as the Windows Subsystem for Linux (WSL) uses the genuine Ubuntu image provided by Canonical, the group behind Ubuntu Linux. Bash on Ubuntu on Windows does not support graphics directly. For GUI-based processing users are recommended to download and use the ParaView Windows native build.
Activate Ubuntu Bash and create a user account. Note: this will require a computer reboot. Additional guidance can be found in https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
To run OpenFOAM under the Windows10, users should have the latest Ubuntu bash (16.04 or above). Version information can be found using the command in the bash terminal
- Click on the link OpenFOAM-v2012-windows10.tgz to download OpenFOAM-v2012.
- Start Bash on Ubuntu by typing bash in search toolbar, and click on the Desktop app Bash on Ubuntu on Windows
- In the bash-terminal, copy OpenFOAM-v2012-windows10.tgz from the Download folder to the local bash-environment by typing command
cp -ar /mnt/c/Users/<USER>/Downloads/OpenFOAM-v2012-windows10.tgz .
- Replace the string with your own user name when copying the file, e.g. here shown by the user pgh
- The final dot (.) is required to specify the current location
- Untar the OpenFOAM installation by running the following command
sudo tar -xvzf OpenFOAM-v2012-windows10.tgz -C /opt/ sudo chown -R $USER /opt/OpenFOAM
- it may take some minutes to complete the process
- if tar is not installed, please install it using the command
sudo apt install tar
- Install the additional dependencies
sudo apt install bison flex m4
Configure the bash-shell to run OpenFOAM
Run the following command to set the OpenFOAM working environment (once only)
echo "source /opt/OpenFOAM/OpenFOAM-v2012/etc/bashrc" >> ~/.bashrc source $HOME/.bashrc
Check everything is OK
The installation can be verified by running your first OpenFOAM tutorial.
mkdir -p /mnt/c/Users/<USER>/tutorial cd /mnt/c/Users/<USER>/tutorial cp -ar $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity . cd cavity blockMesh icoFoam touch cavity.foam
The case can then be visually checked using ParaView.