<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=OpenFOAM%2FC3%2FUsing-Template-files-in-PyFoam%2FEnglish-timed</id>
		<title>OpenFOAM/C3/Using-Template-files-in-PyFoam/English-timed - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=OpenFOAM%2FC3%2FUsing-Template-files-in-PyFoam%2FEnglish-timed"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=OpenFOAM/C3/Using-Template-files-in-PyFoam/English-timed&amp;action=history"/>
		<updated>2026-04-18T13:45:09Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=OpenFOAM/C3/Using-Template-files-in-PyFoam/English-timed&amp;diff=38587&amp;oldid=prev</id>
		<title>Pratik kamble: Created page with &quot;{| border=1 | '''Time''' | '''Narration'''  |- | 00:01 | Hello and welcome to the spoken tutorial on '''Using Template files in PyFoam.'''  |- | 00:07 | In this tutorial we wi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=OpenFOAM/C3/Using-Template-files-in-PyFoam/English-timed&amp;diff=38587&amp;oldid=prev"/>
				<updated>2017-09-05T10:22:27Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| border=1 | &amp;#039;&amp;#039;&amp;#039;Time&amp;#039;&amp;#039;&amp;#039; | &amp;#039;&amp;#039;&amp;#039;Narration&amp;#039;&amp;#039;&amp;#039;  |- | 00:01 | Hello and welcome to the spoken tutorial on &amp;#039;&amp;#039;&amp;#039;Using Template files in PyFoam.&amp;#039;&amp;#039;&amp;#039;  |- | 00:07 | In this tutorial we wi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
| '''Time'''&lt;br /&gt;
| '''Narration'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:01&lt;br /&gt;
| Hello and welcome to the spoken tutorial on '''Using Template files in PyFoam.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:07&lt;br /&gt;
| In this tutorial we will:  Understand the function of '''PyFoam Utilities'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:13&lt;br /&gt;
|  Create and use template files &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:17&lt;br /&gt;
|  Use '''PyFoamFromTemplate dot py '''for solving the '''supersonic flow over wedge'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:24&lt;br /&gt;
| We can run this for different '''wedge angles '''using '''template '''files.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:29&lt;br /&gt;
| To record this tutorial I am using  '''Ubuntu Linux '''Operating System 14.04&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:36&lt;br /&gt;
|  '''OpenFOAM''' 2.3.0&lt;br /&gt;
'''PyFoam-0.6.5'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:42&lt;br /&gt;
| To practice this tutorial the user should have :  Basic Knowledge of using '''Linux terminal'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:49&lt;br /&gt;
|  Experience of running and analyzing '''OpenFOAM '''cases&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:54&lt;br /&gt;
| If not, please refer to the spoken tutorial series on '''Linux '''and '''OpenFOAM'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:00&lt;br /&gt;
| What are '''template '''files?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:03&lt;br /&gt;
| '''Template '''files are used to generate '''OpenFOAM '''files like '''blockMeshDict or controlDict'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:10&lt;br /&gt;
| '''Template '''files can be programmed, hence we can procedurally generate data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:16&lt;br /&gt;
| A '''template '''file should be an '''OpenFOAM '''file, with the following -&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:22&lt;br /&gt;
|  Any line beginning with '''$$ '''is a '''Python program '''line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:28&lt;br /&gt;
|  It will be executed by '''Python'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:31&lt;br /&gt;
|  Any variable can be substituted in the file by using the syntax '''vertical pipe dash variable name dash vertical pipe'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:42&lt;br /&gt;
| The following steps should be followed to use a '''template '''file :&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:47&lt;br /&gt;
|  First copy an existing file&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:50&lt;br /&gt;
| After this create a '''template '''file&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:54&lt;br /&gt;
| Then run '''PyFoamFromTemplate dot py'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:58&lt;br /&gt;
| '''Template '''file will be created for '''blockMeshDict.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:02&lt;br /&gt;
| We will use the '''supersonic flow '''over a wedge as an example case. The case file is available in the '''rhoCentralFoam solver.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:12&lt;br /&gt;
| Open the '''terminal'''. Type the '''path '''for the '''rhoCentralFoam '''inside '''compressible solvers.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:22&lt;br /&gt;
| Now copy the '''Wedge15Ma5 case directory '''into '''OpenFOAM directory''' by typing '''cp space minus r space Wedge15Ma5 ''' space type the path of '''your OpenFOAM directory''' and press '''Enter.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:46&lt;br /&gt;
| On the '''terminal, '''type the path for '''Wedge15Ma5 folder '''inside '''OpenFOAM directory.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:53&lt;br /&gt;
| Type the '''path '''for '''blockMeshDict file '''inside '''polyMesh directory '''inside '''constant.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:00&lt;br /&gt;
| Open the '''blockMeshDict '''file in any editor of your choice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:06&lt;br /&gt;
| We can see the '''vertices '''section.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:09&lt;br /&gt;
| We need to calculate the '''co-ordinates '''of the end points of the '''slope'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:14&lt;br /&gt;
| Based on the '''angle, '''change the following lines&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:19&lt;br /&gt;
| Switch back to the '''terminal'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:22&lt;br /&gt;
| Copy your '''blockMeshDict '''file into a file called '''blockMeshDict dot template'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:29&lt;br /&gt;
| Type the following- '''cp space minus r space blockMeshDict space blockMeshDict dot template'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:40&lt;br /&gt;
| Open the '''blockMeshDict dot template''' file using '''gedit'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:46&lt;br /&gt;
| Add the following lines above '''convertToMeters'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:51&lt;br /&gt;
| Any line preceded with '''$$ (dollar dollar) ''' is a '''Python ''' line, and will be interpreted and executed by '''Python'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:02&lt;br /&gt;
| Modify the '''vertices '''entry as&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:06&lt;br /&gt;
| '''Python variables '''assigned in the '''template '''file, should be substituted at any location in the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:14&lt;br /&gt;
| To do so, use ''' vertical pipe dash variable name dash vertical pipe '''in the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:22&lt;br /&gt;
| We can see the changes made into this file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:26&lt;br /&gt;
| Now, let's create a blank file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:30&lt;br /&gt;
| On the '''terminal''', type '''gedit templateFileConst '''and press '''Enter.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:40&lt;br /&gt;
| Create a dummy entry inside it by typing  '''dummy space 1.0 semicolon '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:48&lt;br /&gt;
| A dummy entry is mandatory.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:51&lt;br /&gt;
| An external '''dict '''has to be provided with any '''constant '''that is to be used in the '''template '''file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:59&lt;br /&gt;
| Save and close the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:04&lt;br /&gt;
| We have to run the '''template command''' now.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:08&lt;br /&gt;
| Type this command in '''terminal '''and press '''Enter'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:15&lt;br /&gt;
| We can see that  2 new files are generated the '''blockMeshDict''' and a '''Python '''file is also generated.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|05:24&lt;br /&gt;
| Do not edit the '''Python '''file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|05:27&lt;br /&gt;
| Open the '''blockMeshDict '''file by typing   '''gedit space blockMeshDict '''and press '''Enter.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:36&lt;br /&gt;
| We had changed the '''wedge angle '''from '''15 deg '''to '''10 deg.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:41&lt;br /&gt;
| The end points of the '''slope '''have also changed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:45&lt;br /&gt;
| We can now run the '''case '''file by executing the '''OpenFOAM commands'''&lt;br /&gt;
&lt;br /&gt;
'''blockMesh''',  '''rhoCentralFoam''',  visualize the results using '''Paraview.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:57&lt;br /&gt;
| As an assignment, use the following '''wedge angles '''and run the '''template''' commands.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:03&lt;br /&gt;
| Let us summarize.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:05&lt;br /&gt;
| In this tutorial, we learnt about '''PyFoam Template Files'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:10&lt;br /&gt;
| We also learnt to-  Create and use '''template files'''  and using the '''PyFoamFromTemplate dot py '''command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:19&lt;br /&gt;
| Please post your timed queries in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:23&lt;br /&gt;
| Please post your general queries on '''OpenFOAM '''in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:28&lt;br /&gt;
| The '''FOSSEE '''team coordinates the TBC project.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:32&lt;br /&gt;
| The Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India. For more details , visit this website.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:41&lt;br /&gt;
| This is Rahul Joshi from IIT Bombay signing off. Thanks for watching&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pratik kamble</name></author>	</entry>

	</feed>