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.
Note: We do not support older versions of Windows, e.g. 7 or 8, because Microsoft does not support them.
Activate Windows Subsystem for Linux
- Follow the Guide to Install WSL and install the Ubuntu 20.04 LTS Linux Distribution.
- Make a note of the WSL version you are running, either v1 or v2.
- Launch the Ubuntu distribution through WSL.
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 the latest version of OpenFOAM (currently v11) or the current development version (or both).
- Installing OpenFOAM 11
sudo sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -" sudo add-apt-repository http://dl.openfoam.org/ubuntu sudo apt-get update sudo apt-get install openfoam11
- Installing OpenFOAM-dev
sudo sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -" sudo add-apt-repository "http://dl.openfoam.org/ubuntu 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.
- One Time Only: At the bottom of the user’s
.bashrc
file, source thebashrc
file in the OpenFOAM installation which contains the environment settings. Foropenfoam11
, the following command avoids the need to open an editor (for OpenFOAM-dev, replaceopenfoam11
withopenfoam-dev
):echo ". /opt/openfoam11/etc/bashrc" >> $HOME/.bashrc
- One Time Only: register the change to the
.bashrc
file by typing at the terminal prompt (note the dots):. $HOME/.bashrc
- Test that the
simpleFoam
application, from the OpenFOAM package, is working by typingsimpleFoam -help
- A “Usage” message should appear. Your installation and user configuration is complete.
If more than one OpenFOAM package is installed, e.g. both openfoam11
and openfoam-dev
, the user’s .bashrc
file should contain only the source...
command for the version they currently wish to use.
Enabling Graphical Applications
To run graphical Linux applications, such as ParaView or the gedit editor, requires the installation of X server software. The most popular X server software for Windows is VcXsrv, which can be installed as described below.
- Download the VcXsrv installer.
- (if the above link does not work, go to the VcXsrv files page and download the latest vcxsrv-64.X.X.X.X.installer.exe file).
- Run XLaunch that was installed by VcXsrv.
- Open the “Extra settings” window and: a) Deselect (uncheck) “Native opengl”; b) Select “Disable access control”.
When a bash
shell is opened, the DISPLAY
environment variable needs to point to the X server that is running. To make this addition permanent, set the DISPLAY
in the user’s .bashrc
file by the following command:
- for WSL v1
echo "export DISPLAY=:0" >> ${HOME}/.bashrc
- for WSL v2
echo "export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0" >> ${HOME}/.bashrc
Source the .bashrc
file again, i.e. execute one time only:
. $HOME/.bashrc
With graphics enabled, users may wish to install other useful supporting graphical applications for OpenFOAM, such as the gedit file editor, the GnuPlot graph drawing package, and mplayer video player (and mencoder encoder) software, e.g.
sudo apt-get install gedit gedit-plugins sudo apt-get install gnuplot gnuplot-x11 gnuplot-doc libgd-tools sudo apt-get install mplayer mencoder
Problem running ParaView
Try to start ParaView from a terminal by typing:
paraview
There is a bug in WSL v1 only which may cause ParaView to fail to open with the message:
/opt/paraviewopenfoam510/lib/paraview: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
If this occurs, enter the following commands (copy/paste) in the terminal:
sudo cp /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 /opt/paraviewopenfoam510/mesa/lib/ sudo strip --remove-section=.note.ABI-tag /opt/paraviewopenfoam510/mesa/lib/libQt5Core.so.5
Next Steps
See OpenFOAM on Ubuntu: Getting Started. If the user has enabled graphical applications, they can open the gedit editor in the background (&
) with
gedit &
Otherwise without graphical support, 3 popular editors which can work through a terminal are:
nano
: the easiest of the 3 editors for the purpose, seenano
basics guide;emacs
: powerful editor that uses a more complex set of key commands,emacs
basics;vim
: another editor with arguably a less familiar set of key commands, seevim
quick guide.
It is worth knowing the command to exit the editor you use in case a problem arises:
nano
exits withC-x
(C
=Control key)emacs
exits withC-x C-c
(preceded byC-g
, if needed)vim
exits withESC :q!
Download
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.
Preliminaries
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
lsb_release -a
Install OpenFOAM
- 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 .
Note
- 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
Enter your linux password to allow the process to start.
Note- 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.
OpenFOAM is available from the OpenFOAM Foundation which licenses it free and open source under the General Public Licence. The OpenFOAM downloads are produced and maintained by us — CFD Direct — on behalf of the Foundation, in two forms for Ubuntu, Other Linux, macOS and Windows:
- OpenFOAM Version 11: the latest version release.
- OpenFOAM Development Line (
OpenFOAM-dev
): weekly builds with cutting-edge technology.
Ubuntu Linux
Packaged version of OpenFOAM for Ubuntu Linux, with a simple installation using the Apt package manager.
Other Linux OS
Simple installation of the OpenFOAM package for Ubuntu on other distributions using the Docker container environment.
macOS
Simple installation of the OpenFOAM package for Ubuntu on macOS using the Docker container environment.
Windows
Installation options for Windows with Bash on Windows 10
Features
- Mesh Generation
- Incompressible flows
- Multiphase flows
- Buoyancy-driven flows
- Conjugate heat transfer
- Combustion
- Compressible flows
- Particle methods (DEM, DSMC, MD)
- Turbulence modelling
- Transport/rheology models
- Thermophysical models
- Lagrangian particle tracking
- Reaction kinetics / chemistry
- ParaView and VTK post-processing
- Run-time post-processing
- Third-party post-processing
- Parallel computing
Project Samples
License
GNU General Public License version 3.0 (GPLv3)
A unified test automation platform built for Agile and DevOps teams. Testsigma enables everyone on your team to automate testing for web, mobile web, android, iOS apps, and APIs easily. No coding skills required.
User Ratings
4.3
out of 5 stars
★★★★★
★★★★
★★★
★★
★
ease
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
4 / 5
features
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
5 / 5
design
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
5 / 5
support
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
4 / 5
OPENFOAM FOR WINDOWS
Free, natively compiled package for running OpenFOAM® in Windows
OpenFOAM® for Windows is a comprehensive CFD software package allowing to run OpenFOAM® (originally designed for Linux) in Microsoft Windows. OpenFOAM® for Windows is free of charge.
At CFD Support we understand the challenges of modern companies workflow. Our long term goal is building bridges between top-class development and real practice. In the past we have received many requirements on providing and supporting OpenFOAM® software under Microsoft Windows. As a result, we have delivered to the market OpenFOAM® for Windows.
OpenFOAM® for Windows goes well together with CFD Support’s other products and services: Turbomachinery CFD created to enable a quick and efficient design optimization of turbomachinery components. Turbo Blade Post created to enable an efficient visual postprocessing of turbomachinery.
We also recommend our OpenFOAM® Training which may help you to upgrade your OpenFOAM® skills to proper level.
OpenFOAM® for Windows is fully supported, see General OpenFOAM® Support. OpenFOAM® for Windows is maintained regularly updated together with latest OpenFOAM® versions.
OpenFOAM® for Windows was primarily tested in Wndows 10 and also quite well tested in Wndows 7 and Wndows 8.1. Installation instructions can be found here.
Technical Specifications & Software Features
-
Free for All -
No Cross-Compilation Linux->Windows -
Native Windows Compilation -
Windows 64-bit
-
Full Functionality -
Regularly Updated with latest OpenFOAM® -
Support Available -
Already Compiled, just download and go
OpenFOAM® for Windows includes:
-
Complete set of instructions — how to run OpenFOAM® under Microsoft Windows -
Compiled OpenFOAM® — all the project executables *.exe and dynamic libraries *.dll -
Source Code — all the OpenFOAM® source code allowing further developing and understanding the functionalities -
Other software — supporting OpenFOAM® workflow under Windows -
Long-term Support Available — highly recommended, also includes regular software updates and maintenance -
Training Available — both on-site and off-site trainings
Install OpenFOAM® for Windows
When running OpenFOAM® in Windows we recommend to use Cygwin software to keep the workflow consistent with Linux as much as possible. There are many other ways of using OpenFOAM® for Windows, depending on your previous experiences, preferred applications and other circumstances. This page describes just one of those ways.
After downloaded OpenFOAM® for Windows installation file, simply run it. We recommend to follow the installation default options.
Example 1 : first case run
- run OpenFOAM for Windows
-
$ mc
mc command runs midnight commander, which is truly powerful tool when working in terminal, note you can always switch by ctrl+o to command line to run commands and again ctrl+o back to manage files
-
$ run
run alias jumps to your working directory
-
$ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity ./
copy the cavity tutorial case here
-
$ cd cavity
change directory to cavity
-
$ blockMesh.exe
create the computational mesh
-
$ icoFoam.exe
run the solver
-
$ paraFoam
view results in ParaView
Example 2 : run OpenFOAM for Windows in parallel
- run OpenFOAM for Windows
-
$ mc
-
$ run
-
$ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily ./
-
$ cd pitzDaily
-
$ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/motorBike/system/decomposeParDict ./system/
-
$ blockMesh.exe
-
$ decomposePar.exe
-
$ mpiexec -n 6 simpleFoam -parallel
-
$ reconstructPar.exe
-
$ paraFoam
Example 3 : create new solver (compilation)
- run OpenFOAM for Windows
-
$ mc
-
$ run
-
$ mkdir myFirstWindowsOpenFOAMSolver
-
$ cd myFirstWindowsOpenFOAMSolver
-
$ cp -r $FOAM_SOLVERS/incompressible/icoFoam/* ./
-
$ sed -i "s/\/icoFoam/\/myFirstWindowsOpenFOAMSolver/g" Make/files
-
$ wmake
-
$ run
-
$ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity ./
-
$ cd cavity/
-
$ blockMesh.exe
-
$ myFirstWindowsOpenFOAMSolver.exe
-
$ paraFoam
Example 4 : motorBike
- run OpenFOAM for Windows
-
$ mc
-
$ run
-
$ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/motorBike ./
-
$ cd motorBike
-
$ find ./ -type f | xargs sed -i "s/WM_PROJECT_DIR/OPENFOAM_INSTALL_PATH/g"
-
$ ./Allrun
-
$ paraFoam
Download OpenFOAM for Windows
This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.