OpenFOAM/C3/Installing-and-Running-PyFoam/English

From Script | Spoken-Tutorial
Revision as of 15:53, 3 May 2016 by Rahuljoshi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

­Tutorial 20 C2

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.


  1. What is PyFoam
  2. Checking installation of OpenFOAM
  3. Installing Python, Numpy and Gnuplot
  4. Install PyFoam using pip
  5. Install PyFoam using sources
  6. 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+

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.
  • 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.


Only narration (no slide) Note that PyFoam works over OpenFOAM.


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

Show Slide: Checking OpenFOAM First we check if our installation of OpenFOAM has been done properly.



Open terminal >> type icoFoam - help 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 Now, we will install the necessary prerequisites for PyFoam such as

-Python, Pip, Numpy and Gnuplot


using the terminal.

Switch to the terminal >> type sudo apt-get install python-dev First we will type

sudo apt-get install python-dev

Type

sudo apt-get install python-pip

Then, type

sudo apt-get install python-pip

Type

pip install Numpy

Then, type

pip install Numpy

Type

sudo apt-get install gnuplot gnuplot-x11

Then, type

sudo apt-get install gnuplot gnuplot-x11

With this, we are done with installing the pre-requisites.
Show Slide :

Install PyFoam

Now we will install PyFoam using pip.
Switch to the terminal >> type pip install PyFoam Open the terminal and type

pip install PyFoam

Show Slide :

Installing PyFoam

We can also install PyFoam from source.
Open browser >> type www.pypi.com To do so, go to www.pypi.com
Search for PyFoam >> Download from pypi website Search for PyFoam.
Download PyFoam Download PyFoam-0.6.5.tar.xz
On terminal >> go to Downloads folder In the terminal, go to the Downloads folder.
Untar the files Type tar -xvf PyFoam-0.6.5.tar.xz
Type cd PyFoam-0.6.5 Then type cd followed by name of the folder PyFoam-0.6.5
Install PyFoam After this, type sudo python setup.py install
Show Slides: Checking PyFoam Now we have to check whether PyFoam is detecting OpenFoam and working properly.
Switch to terminal Switch to the terminal again.
Type python Type python
Type import PyFoam Type import PyFoam



Type print PyFoam.FoamInformation


Type print PyFoam.FoamInformation.foamTutorials() >> Check the message

Type import PyFoam.FoamInformation foamTutorials()


Type print PyFoam.FoamInformation.foamTutorials()


This should print the directory of OpenFOAM tutorials.

Let us summarize.


In this tutorial, we learnt about PyFoam.


We also learnt to-

  1. check the installation of OpenFOAM
  2. install PyFoam using pip
  3. install PyFoam using sources
  4. 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


http://spoken-tutorial.org

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