Difference between revisions of "OpenFOAM/C3/Installing-and-Running-PyFoam/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with "= ­Tutorial 20 C2 = '''Title of script''': '''Installing and Running PyFoam''' '''Script : Anmol Sahoo, Rahul Joshi''' '''Narration : Rahul Joshi''' '''Keywords: OpenFOAM,...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
= ­Tutorial 20 C2 =
 
 
'''Title of script''': '''Installing and Running PyFoam'''
 
'''Title of script''': '''Installing and Running PyFoam'''
 +
  
 
'''Script : Anmol Sahoo, Rahul Joshi'''
 
'''Script : Anmol Sahoo, Rahul Joshi'''
 +
  
 
'''Narration : Rahul Joshi'''
 
'''Narration : Rahul Joshi'''
 +
  
 
'''Keywords: OpenFOAM, PyFoam, CFD, Spoken Tutorial, Python'''
 
'''Keywords: OpenFOAM, PyFoam, CFD, Spoken Tutorial, Python'''
Line 20: Line 22:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slide : Learning Objectives
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slide : Learning Objectives
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| In this tutorial, we will learn how to install and check '''PyFoam''' and the required steps for the same.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| In this tutorial, we will learn how to Install and check '''PyFoam''' and the required steps for the same.
 +
 
 +
 
 +
- What is '''PyFoam'''
 +
 
 +
 
 +
- Checking installation of '''OpenFOAM'''
 +
 
 +
 
 +
- Installing '''Python, Numpy and Gnuplot '''
 +
 
 +
 
 +
- Install '''PyFoam''' using '''pip'''
  
  
# What is '''PyFoam'''
+
- Install '''PyFoam''' using sources  
# Checking installation of '''OpenFOAM'''
+
# Installing '''Python, Numpy and Gnuplot '''
+
# Install '''PyFoam''' using '''pip'''
+
# Install '''PyFoam''' using sources  
+
# Check if '''PyFoam''' is working
+
  
  
 +
- Check if '''PyFoam''' is working
  
 
|-
 
|-
Line 38: Line 48:
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| To record this tutorial I am using  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| To record this tutorial I am using  
  
* '''Ubuntu''' Linux Operating system '''14.04'''
 
* '''OpenFOAM''' version 2.3.0
 
  
Note that '''PyFoam''' will also work with '''OpenFoam v1.6+ '''
+
- '''Ubuntu Linux''' Operating system '''14.04'''
 +
 
 +
 
 +
- '''OpenFOAM''' version 2.3.0
 +
 
 +
 
 +
- Note that '''PyFoam''' will also work with '''OpenFoam v1.6+ and above '''
  
 
|-
 
|-
Line 49: Line 63:
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| To practice this tutorial, the user should have  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| To practice this tutorial, the user should have  
  
* Basic knowledge '''of Linux terminal commands'''
 
* Experience with running and analyzing '''OpenFOAM''' cases
 
  
If not, please go through the '''Linux '''tutorial series on this website.
+
- Basic knowledge '''of Linux terminal commands'''
 +
 
 +
 
 +
- Experience with running and analyzing '''OpenFOAM''' cases
 +
 
 +
 
 +
- If not, please go through the '''Linux''' tutorial series on this website
  
 
|-
 
|-
Line 60: Line 78:
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| What is '''PyFoam? '''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| What is '''PyFoam? '''
  
* '''PyFoam''' is a collection of Python libraries and utilities.
 
* It can be used to manipulate '''OpenFOAM simulations.'''
 
* It is designed to make working with '''OpenFOAM''' easier.
 
  
 +
-'''PyFoam''' is a collection of Python libraries and utilities
  
 +
 +
-It can be used to manipulate '''OpenFOAM simulations''' and
 +
 +
 +
-It is Designed to make working with '''OpenFOAM''' easier
  
 
|-
 
|-
Line 77: Line 98:
  
 
* '''iteratively''' running '''simulations'''
 
* '''iteratively''' running '''simulations'''
 +
 
* automate data collection
 
* automate data collection
* parametrically modify case files and many other such useful activities.
 
  
 +
* parametrically modify case files and
  
 +
* many other such useful activities.
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Only narration (no slide)
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Note that '''PyFoam '''works over '''OpenFOAM.'''
 
  
 +
Note that '''PyFoam '''works over '''OpenFOAM'''
  
So, we need to always have an installation of '''OpenFOAM''' in our computer.
+
 
 +
So, we need to always have an installation of '''OpenFOAM''' in our computer.  
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slide: Checking OpenFOAM  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slide: Checking OpenFOAM  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| First we check if our installation of '''OpenFOAM''' has been done properly.
 
  
  
 +
Open terminal
  
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Open '''terminal''' >> type '''icoFoam - help'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Open the '''terminal''' and type '''icoFoam -help'''
 
  
 +
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| First we check if our installation of '''OpenFOAM''' has been done properly.
  
You should get the details of''' icoFoam''' and '''OpenFOAM''' version and help text.
+
 
 +
Open the '''terminal''', and type '''icoFoam -help'''
 +
 
 +
 
 +
You should get the details of''' icoFoam''' and '''OpenFOAM''' version and help text  
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slide : Installing Pre-Requisites
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slide : Installing Pre-Requisites
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now, we will install the necessary prerequisites for '''PyFoam''' such as
 
  
-'''Python, Pip, Numpy''' and '''Gnuplot'''
 
  
 +
Open Terminal
 +
 +
 +
type in terminal
 +
 +
 +
type in terminal
 +
 +
 +
type in terminal
 +
 +
 +
type in terminal
 +
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now we will install the necessary prerequisites for '''PyFoam''', such as
 +
 +
*'''Python, Pip, Numpy''' and '''Gnuplot'''
  
 
using the '''terminal'''.  
 
using the '''terminal'''.  
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Switch to the '''terminal''' >> type '''sudo apt-get install python-dev'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| First we will type
 
  
'''sudo apt-get install python-dev'''
+
First we type -
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type
 
  
'''sudo apt-get install python-pip'''
+
'''sudo apt-get install python-dev '''and press '''Enter'''.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Then, type
+
  
'''sudo apt-get install python-pip'''
 
  
|-
+
After this, type
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type
+
  
'''pip install Numpy'''
+
'''sudo apt-get install python-pip '''and press '''Enter'''.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Then, type  
+
 
 +
 
 +
Then, type  
  
 
'''pip install Numpy'''
 
'''pip install Numpy'''
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type
 
  
'''sudo apt-get install gnuplot gnuplot-x11 '''
+
Then, type  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Then, type  
+
  
'''sudo apt-get install gnuplot gnuplot-x11 '''
+
'''sudo apt-get install gnuplot gnuplot-x11 '''and press '''Enter'''.
  
|-
+
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|
+
With this we are done with installing the pre-requisites.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| With this, we are done with installing the pre-requisites.
+
  
 
|-
 
|-
Line 150: Line 178:
  
 
Install PyFoam  
 
Install PyFoam  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now we will install '''PyFoam''' using '''pip.'''
 
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Switch to the '''terminal''' >> type '''pip install PyFoam'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Open the '''terminal''' and type
 
  
'''pip install PyFoam'''
+
Open terminal
 +
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now we will installing '''PyFoam''' using '''pip'''.
 +
 
 +
 
 +
Open the '''terminal''' and type: '''pip install PyFoam '''
  
 
|-
 
|-
Line 162: Line 190:
  
 
Installing PyFoam  
 
Installing PyFoam  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| We can also install '''PyFoam''' from '''source.'''
 
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Open browser >> type [http://www.pypi.com/ www.pypi.com]
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| To do so, go to [http://www.pypi.com/ www.pypi.com]
 
  
|-
+
Open browser
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Search for '''PyFoam >> '''Download from '''pypi '''website
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Search for '''PyFoam.'''
+
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Download PyFoam
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Download '''PyFoam-0.6.5.tar.xz'''
 
  
|-
+
Download PyFoam
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| On '''terminal''' >> go to '''Downloads '''folder
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| In the '''terminal''', go to the '''Downloads''' folder.
+
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Untar the files
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Type '''tar -xvf PyFoam-0.6.5.tar.xz '''
 
  
|-
+
Open terminal : go to Downloads folder
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type''' cd PyFoam-0.6.5'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Then type '''cd''' followed by name of the folder '''PyFoam-0.6.5'''
+
  
|-
+
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Install PyFoam
+
Untar the files
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| After this, type '''sudo''' '''python setup.py install'''  
+
 
 +
 
 +
install PyFoam
 +
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| We can also install '''PyFoam''' from '''source'''
 +
 
 +
 
 +
To do so, open the browser and in the URL window, type
 +
 
 +
'''[http://www.pypi.com/ www.pypi.com]'''
 +
 
 +
 
 +
Search for '''PyFoam '''
 +
 
 +
 
 +
Download '''PyFoam-0.6.5.tar.xz'''
 +
 
 +
 
 +
In the '''terminal''', go to '''Downloads folder'''.
 +
 
 +
 
 +
Type '''tar -xvf PyFoam-0.6.5.tar.xz '''
 +
 
 +
 
 +
Type '''cd''' followed by the name of the folder '''PyFoam-0.6.5'''
 +
 
 +
 
 +
After this, type '''sudo python setup.py' space install'''  
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slides: Checking PyFoam
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Show Slides: Checking PyFoam
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now we have to check whether '''PyFoam '''is detecting '''OpenFoam '''and working properly.
 
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Switch to '''terminal'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Switch to the '''terminal''' again.
 
  
|-
+
Open Terminal : To Check PyFoam working
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''python'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Type '''python'''
+
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''import PyFoam '''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Type '''import PyFoam'''
 
  
 +
type in terminal
  
  
 +
type in terminal
  
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''print PyFoam.FoamInformation'''
 
  
 +
type in terminal
  
Type '''print PyFoam.FoamInformation.foamTutorials() >> '''Check the message
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Type '''import PyFoam.FoamInformation foamTutorials()'''
 
  
 +
check the message
 +
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now we have check if '''PyFoam''' is detecting
  
Type '''print''' '''PyFoam.FoamInformation.foamTutorials()'''
+
'''OpenFoam''' and working properly.  
  
  
This should print the directory of '''OpenFOAM''' tutorials.  
+
Switch to '''terminal''' again.
 +
 
 +
 
 +
Type '''python'''
 +
 
 +
 
 +
Type '''import PyFoam'''
 +
 
 +
 
 +
'''import PyFoam dot FoamInformation '''
 +
 
 +
 
 +
Then type '''print PyFoam dot FoamInformation dot foamTutorials''' followed by open-close brackets.
 +
 
 +
 
 +
This should print the directory of '''OpenFOAM Tutorials'''.  
 +
 
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Summary Slide
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Let us summarize.
+
 
 +
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now let us summarise.
  
  
In this tutorial, we learnt about '''PyFoam.'''
+
In this tutorial, we learnt about '''PyFoam'''.
  
 +
We also learnt to
  
We also learnt to-
+
*check the installation of '''OpenFoam'''
  
# check the installation of '''OpenFOAM'''
+
* install '''PyFoam''' using '''pip'''
# install '''PyFoam''' using '''pip'''  
+
# install '''PyFoam''' using sources
+
# and check if '''PyFoam''' is working
+
  
 +
* install '''PyFoam''' using '''sources'''
  
 +
* and check if '''PyFoam''' is working
  
 
|-
 
|-
Line 247: Line 294:
 
Forum to answer questions
 
Forum to answer questions
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Please post your timed queries in this forum.
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Please post your timed queries in this forum.
 
 
 
  
 
|-
 
|-
Line 256: Line 300:
  
 
Forum to answer questions
 
Forum to answer questions
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Please post your general queries on '''OpenFOAM''' in this forum.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Please post your general queries on OpenFOAM in this forum.
  
 
|-
 
|-
Line 271: Line 315:
  
  
http://spoken-tutorial.org
+
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India  
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| The Spoken Tutorial project is funded by NMEICT, MHRD, Govt. of India  
  
  

Latest revision as of 11:29, 9 May 2016

Title of script: Installing and Running PyFoam


Script : Anmol Sahoo, Rahul Joshi


Narration : Rahul Joshi


Keywords: OpenFOAM, PyFoam, CFD, Spoken Tutorial, Python


Visual Cue
Narration
Show Slide : Title Hello and welcome to the spoken tutorial on installing and running PyFoam
Show Slide : Learning Objectives In this tutorial, we will learn how to Install and check PyFoam and the required steps for the same.


- What is PyFoam


- Checking installation of OpenFOAM


- Installing Python, Numpy and Gnuplot


- Install PyFoam using pip


- Install PyFoam using sources


- Check if PyFoam is working

Show Slide :

System Requirement

To record this tutorial I am using


- Ubuntu Linux Operating system 14.04


- OpenFOAM version 2.3.0


- Note that PyFoam will also work with OpenFoam v1.6+ and above

Show Slide :

Pre-requisite

To practice this tutorial, the user should have


- Basic knowledge of Linux terminal commands


- Experience with running and analyzing OpenFOAM cases


- If not, please go through the Linux tutorial series on this website

Show Slide :

Introduction to PyFoam

What is PyFoam?


-PyFoam is a collection of Python libraries and utilities


-It can be used to manipulate OpenFOAM simulations and


-It is Designed to make working with OpenFOAM easier

Show Slide :

Introduction to PyFoam


PyFoam can be also be used for


  • iteratively running simulations
  • automate data collection
  • parametrically modify case files and
  • many other such useful activities.


Note that PyFoam works over OpenFOAM


So, we need to always have an installation of OpenFOAM in our computer.

Show Slide: Checking OpenFOAM


Open terminal


First we check if our installation of OpenFOAM has been done properly.


Open the terminal, and type icoFoam -help


You should get the details of icoFoam and OpenFOAM version and help text

Show Slide : Installing Pre-Requisites


Open Terminal


type in terminal


type in terminal


type in terminal


type in terminal

Now we will install the necessary prerequisites for PyFoam, such as
  • Python, Pip, Numpy and Gnuplot

using the terminal.


First we type -


sudo apt-get install python-dev and press Enter.


After this, type

sudo apt-get install python-pip and press Enter.


Then, type

pip install Numpy


Then, type

sudo apt-get install gnuplot gnuplot-x11 and press Enter.


With this we are done with installing the pre-requisites.

Show Slide :

Install PyFoam


Open terminal

Now we will installing PyFoam using pip.


Open the terminal and type: pip install PyFoam

Show Slide :

Installing PyFoam


Open browser


Download PyFoam


Open terminal : go to Downloads folder


Untar the files


install PyFoam

We can also install PyFoam from source


To do so, open the browser and in the URL window, type

www.pypi.com


Search for PyFoam


Download PyFoam-0.6.5.tar.xz


In the terminal, go to Downloads folder.


Type tar -xvf PyFoam-0.6.5.tar.xz


Type cd followed by the name of the folder PyFoam-0.6.5


After this, type sudo python setup.py' space install

Show Slides: Checking PyFoam


Open Terminal : To Check PyFoam working


type in terminal


type in terminal


type in terminal


check the message

Now we have check if PyFoam is detecting

OpenFoam and working properly.


Switch to terminal again.


Type python


Type import PyFoam


import PyFoam dot FoamInformation


Then type print PyFoam dot FoamInformation dot foamTutorials followed by open-close brackets.


This should print the directory of OpenFOAM Tutorials.


Summary Slide Now let us summarise.


In this tutorial, we learnt about PyFoam.

We also learnt to

  • check the installation of OpenFoam
  • install PyFoam using pip
  • install PyFoam using sources
  • and check if PyFoam is working
Show Slide


Forum to answer questions

Please post your timed queries in this forum.
Show Slide


Forum to answer questions

Please post your general queries on OpenFOAM in this forum.
Show Slide


Textbook Companion

The FOSSEE team coordinates the TBC project.
Show Slide

Acknowledgement


The Spoken Tutorial project is funded by NMEICT, MHRD, Govt. of India


For more details , visit this website.

Thank You The script is prepared by Anmol Sahoo and this is Rahul Joshi from IIT Bombay signing off. Thanks for watching

Contributors and Content Editors

Nancyvarkey, Rahuljoshi