OpenFOAM for Windows

The packaged distributions of OpenFOAM for Ubuntu can be installed directly on Microsoft Windows 10 and 11 using Windows Subsystem for Linux (WSL).  WSL provides a full compatibility layer for running Linux applications on Windows by performing real-time translation of Linux system calls into Windows OS system calls.  The system can support graphical Linux applications such as ParaView that can access the reader modules within OpenFOAM (to load OpenFOAM cases). 

Note: If graphical applications fail on WSL, report it to Microsoft’s WSL project on GitHub.  In particular, if ParaView fails, do not report the issue to its producer Kitware, as they do not officially support ParaView on WSL.  For any problems with the instructions below, go to the OpenFOAM Issue Tracking system.

Running OpenFOAM in WSL

Microsoft provides a guide to Install WSL which provides detailed information about the process. The steps to get OpenFOAM running on WSL are described below.  The installation is specifically for WSL version 2 (not v1) with the Ubuntu 22.04 LTS Linux Distribution.

Step 1: Open Windows Command Prompt

  • Open the Start menu, type “cmd” in the Search until the “Command Prompt” appears.
  • Click with right mouse button to open a menu where you can then click Run as Administrator.
  • When prompted  “Do you want to allow this app to make changes to your device”, select Yes.

Step 2: Check if WSL is installed

  • Check if WSL is already installed by pasting the following command at the command prompt:
    wsl -l -v
  • If there is no WSL installed in your machine, you will see a similar response to the following:
    Windows subsystem for Linux has no installed distributions
  • Otherwise, if WSL is installed, it will print a table including the distribution NAME and WSL VERSION.
  • If NAME is Ubuntu and VERSION is 2, WSL is installed correctly; otherwise install WSL according to Step 3.

Step 3: Install WSL with Ubuntu 22.04

  • Install WSL with Ubuntu 22.04 by typing the following command at the command prompt:
    wsl --install -d Ubuntu-22.04
  • When prompted during the installation, enter a username and password of your choice.
  • After installation, confirm NAME is Ubuntu and VERSION is 2 from the wsl -l -v command above.

Step 4: Starting WSL

  • To start WSL: Either open the Start menu, search for “Ubuntu” and, when the Ubuntu WSL appears, click Open.
  • Or, from the command prompt, type:
  • A Linux terminal will open on the screen, running the Bash shell.

Installing OpenFOAM

  • To install OpenFOAM 11, paste the following commands in the the Linux terminal:
    sudo add-apt-repository
    sudo apt update
    sudo apt -y install openfoam11
  • For OpenFOAM-dev, paste the following commands:
    sudo add-apt-repository " dev"
    sudo apt update
    sudo apt -y install openfoam-dev
  • The installations above will automatically install Ubuntu’s paraview package.
  • We recommend installing our openfoam-dev-nopv-deps or openfoam11-nopv-deps package to enable compilation of applications and libraries in OpenFOAM, e.g.
    sudo apt -y install openfoam-dev-nopv-deps

Next Steps