top of page
Search
  • Writer's pictureTakshak Shende

How to install Ubuntu, OpenFOAM 9, Foam-extend 4.1, GeoChemFoam 4.6, and Paraview on Windows 10

Updated: Jun 23, 2022

How to Install Ubuntu on Windows 10


A. Windows Subsystem for Linux

1. Search for "Turn Windows features on or off" in the Windows search bar

2. Turned on "Windows Subsystem for Linux” from the list

3. Restart machine


B. Install Ubuntu

1. Type "Microsoft Store" in the Windows search bar

2. Navigate to the Microsoft Store and look for Ubuntu.

3. Choose Ubuntu and then Install. It will take some time to install.

4. Once installed, a new bash window or terminal will appear and will ask you to set a username and password.

5. Now, Ubuntu is ready for use.

6. You can find more details here: https://wiki.ubuntu.com/WSL


We will use the following basic commands in the Ubuntu terminal.


To know what directory you are in, use command,

pwd

If you want to list the files inside the current directory use the command,

ls

If you want to create a directory or folder,

mkdir dir1

If you want to go to a different directory,

cd dir1

If you want to go back one directory,

cd ..

To go to your home directory,

cd ~

To copy a file into another directory,

cp file1.text dir1/file1.text

To move a file into another directory or file (rename),

mv file1.text file2.text
mv file2.text dir1 

To copy a file from a given directory into the current directory,

cp dir1/file2.txt .

To become a root user, follow these commands. This will give you absolute power over the system, so be very careful.

su 

Please visit the website below, which provides a very good introduction to Linux commands.



Install nano text editor (to read code or files in Ubuntu)

sudo apt install nano

How to install OpenFOAM 9 on Ubuntu WSL



OpenFOAM 9 is latest version released by OpenFOAM foundation (www.openfoam.org).

The detailed instructions on how to install OpenFOAM 9 on windows are given here https://openfoam.org/download/windows/


Please follows instruction below.

2. Copy and paste the following command:

sudo apt-get install build-essential
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 openfoam9

This will take some time to compile.


3. Only do this once after installing OpenFOAM 9. Open the .bashrc file in the user’s home directory in an editor, e.g. by typing in a terminal window (note the dot)

nano ~/.bashrc

4. At the bottom of that file, add the following line and save the file

alias of9='. /opt/openfoam9/etc/bashrc'

4. Please keep in mind that in order to activate the OpenFOAM 9 environment, you always need to type the following command every time you open a new Ubuntu terminal.

of9 

5. To check installation, run the following command in a new terminal.

simpleFoam -help

How to Install Foam-extend 4.1 on Ubuntu-WSL


Foam-extend 4.1 is available here for download: https://sourceforge.net/projects/foam-extend/

Please follow the procedure given below to install foam-extend 4.1.


A. Install dependencies

Run the following commands on a new Ubuntu terminal to install the requisite software/packages for compiling foam-extend 4.1

sudo apt-get update

sudo apt-get install git-core build-essential binutils-dev cmake flex \
zlib1g-dev libncurses5-dev curl bison \
libxt-dev rpm mercurial graphviz python python-dev  gcc-7 g++-7

B. Get the source code of foam-extend 4.1

The best way to install foam-extend is to get source code through git source code management system as we will get updated version of the code. Run the following command

cd ~
mkdir foam
cd foam
git clone git://git.code.sf.net/p/foam-extend/foam-extend-4.1 foam-extend-4.1

This will take some time to pull foam-extend 4.1 into your system.

C. Compile

1. Now, run following commands to compile the code

cd ~/foam/foam-extend-4.1
 
echo "export WM_CC='gcc-7'"  >> etc/prefs.sh
echo "export WM_CXX='g++-7'"  >> etc/prefs.sh
 
source etc/bashrc

2. Only do this once after installing Foam-extend 4.1. Open the .bashrc file in the user’s home directory in an editor, e.g. by typing in a terminal window (note the dot)

nano ~/.bashrc

3. At the bottom of that file, add the following line and save the file

alias fe41='. $HOME/foam/foam-extend-4.1/etc/bashrc' 	

4. Above command will create alias fe41. Now, run following command in the terminal.


sed -i -e 's=rpmbuild --define=rpmbuild --define "_build_id_links none" --define=' ThirdParty/tools/makeThirdPartyFunctionsForRPM
sed -i -e 's/gcc/\$(WM_CC)/' wmake/rules/linux64Gcc/c
sed -i -e 's/g++/\$(WM_CXX)/' wmake/rules/linux64Gcc/c++

3. Start compiling the foam-extend 4.1 code

./Allwmake.firstInstall

The compilation may take few hours of time, depending on your machine configurations.


D. For more details visit here



How to install GeoChemFOAM 4.6


Dr Julien Maes and Dr Hannah Menke of Heriot-Watt University, UK developed GeoChemFoam, an OpenFOAM-based package developed to perform reactive multiphase transport simulation at the micro-scale. To know more please visit https://github.com/GeoChemFoam/GeoChemFoam-4.6


Please follow instuction below to install GeoChemFoam solver


1. Launch a new Ubuntu terminal window.

2. To make a directory, copy and paste the following command.

mkdir $HOME/works
cd $HOME/works

3. Use the following command to clone GeoChemFoam 4.6 from github.

git clone https://github.com/GeoChemFoam/GeoChemFoam-4.6.git GeoChemFoam-4.6 

4. Make the following changes to the etc/bashrc file (i.e. copy and paste below text in etc/barshrc of the GeoChemFoam 4.6 ):

# .bashrc

# Change according to your GeoChemFoam installation directory
GCFOAM_DIR=$HOME/works/GeoChemFoam-4.6
GCFOAM_SRC=$GCFOAM_DIR/src
GCFOAM_APPBIN=$GCFOAM_DIR/bin
GCFOAM_LIBBIN=$GCFOAM_DIR/lib

# Change according to your openfoam installation directory
export FOAM_INST_DIR=$HOME/foam
source $HOME/foam/foam-extend-4.1/etc/bashrc
export OF9_DIR=$HOME/OpenFOAM

export GCFOAM_DIR
export GCFOAM_SRC
export GCFOAM_APPBIN
export GCFOAM_LIBBIN

export PATH=$PATH:$GCFOAM_APPBIN
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GCFOAM_LIBBIN
export PATH=$PATH:$MPI_ARCH_PATH

#Third party software
source $GCFOAM_DIR/ThirdParty/bashrc

alias dir='cd $GCFOAM_DIR'
alias src='cd $GCFOAM_DIR/src'
alias app='cd $GCFOAM_DIR/applications'
alias tut='cd $GCFOAM_DIR/tutorials'

Then source bashrc file

source etc/bashrc

Compile

First compiles PhreeqcRM. This module can be found in the ThirdParty folder.

cd ThirdParty
./Allwmake

This compilation will take some time. Now, move back to the previous folder and compile the GeoChemFoam solver. Run the following command on the Ubuntu terminal.

cd ..
./Allwmake

To check installation

./checkInstall.sh

How to install latest version of Paraview 5.10


We will install Paraview on a Windows system instead of Ubuntu.

1. Navigate to https://www.paraview.org/download/.

2. Download the Windows version 5.10 (ParaView-5.10.1-Windows-Python3.9-msvc2017-AMD64).

3. Double-click the downloaded file and follow the installation instructions on Windows.



A demonstration of the above procedure is given in the YouTube video below.



1,146 views0 comments

Comments


Post: Blog2_Post
bottom of page