OpenFOAM – OpenFOAM on Windows

Written by

March 19, 2020


Source: CFD Direct

OpenFOAM for Windows 10

The packaged distributions of OpenFOAM for Ubuntu can now be installed directly on Microsoft Windows 10 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 the version of ParaView that includes the OpenFOAM reader module, with additional X server software (see below).  Running OpenFOAM applications in parallel using WSL is reported to work effectively.

Activate Windows Subsystem for Linux

Installing OpenFOAM

The packaged distributions of OpenFOAM on Ubuntu Linux can now be installed from within the Bash environment.  We recommend users install the Ubuntu pack of OpenFOAM v7 or the current development version (or both).

  • Installing OpenFOAM 7
    sudo sh -c "wget -O - | apt-key add -"
    sudo add-apt-repository
    sudo apt-get update
    sudo apt-get install openfoam7
  • Installing OpenFOAM-dev
    sudo sh -c "wget -O - | apt-key add -"
    sudo add-apt-repository " dev"
    sudo apt-get update
    sudo apt-get install openfoam-dev

Compilation Tools

In order to compile applications and libraries in OpenFOAM, the user should install additional compilation tools by the following command:

sudo apt-get install build-essential

User Configuration

In order to use the installed OpenFOAM package, the user needs to set their environment for OpenFOAM as follows.

  1. One Time Only: At the bottom of the user’s .bashrc file, source the bashrc file in the OpenFOAM installation which contains the environment settings.  For openfoam7, the following command avoids the need to open an editor (for OpenFOAM-dev, replace openfoam7 with openfoam-dev):
    echo ". /opt/openfoam7/etc/bashrc" >> $HOME/.bashrc
  2. One Time Only: register the change to the .bashrc file by typing at the terminal prompt (note the dots):
    . $HOME/.bashrc
  3. Test that the simpleFoam application, from the OpenFOAM package, is working by typing
    simpleFoam -help
  4. A “Usage” message should appear. Your installation and user configuration is complete.

If more than one OpenFOAM package is installed, e.g. both openfoam7 and openfoam-dev, the user’s .bashrc file should contain only the source... command for the version they currently wish to use.

In this tutorial, you will learn hoe to install OpenFOAM on Windows 10.

Tutorial: Heat transfer through pipes using ANSYS Fluent.

Related Articles

Stay Up to Date With The Latest News & Updates

Help us keep growing

CFD.NINJA is financed with its own resources, if you want to support us we will be grateful.

Join Our Newsletter

Subscribe to receive emails with detailed information related to the CFD.

Follow Us

Subscribe to our social networks to receive notifications about our new tutorials

Pin It on Pinterest


Share This

Share this post with your friends!

Advertisment ad adsense adlogger