Difference between revisions of "OpenFOAM-version-7/C3/Flow-in-a-Convergent-Divergent-Nozzle/English"
(Created page with "'''Title of the script''': Flow in a Convergent-Divergent Nozzle '''Author''': Ashley Melvin, Biraj Khadka '''Keywords''': OpenFOAM, ParaView, CFD, computational fluid dynam...") |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
'''Author''': Ashley Melvin, Biraj Khadka | '''Author''': Ashley Melvin, Biraj Khadka | ||
− | '''Keywords''': OpenFOAM, ParaView, CFD, computational fluid dynamics, blockMesh, axi-symmetry, wedge geometry, spline, compressible flow, inviscid, convergent-divergent nozzle, rhoCentralFoam, shock, FOSSEE, spoken tutorial, video tutorial | + | '''Keywords''': OpenFOAM, ParaView, CFD, computational fluid dynamics, blockMesh, axi-symmetry, wedge geometry, spline, compressible flow, inviscid, convergent-divergent nozzle, rhoCentralFoam, shock, FOSSEE, spoken tutorial, video tutorial. |
+ | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | {| border=1 | ||
+ | |- | ||
+ | || '''Visual Cue''' | ||
+ | || '''Narration''' | ||
+ | |- | ||
+ | || '''Slide''': | ||
'''Opening Slide''' | '''Opening Slide''' | ||
− | | Welcome to the spoken tutorial on '''Flow in a Convergent-Divergent Nozzle'''. | + | || Welcome to the spoken tutorial on '''Flow in a Convergent-Divergent Nozzle'''. |
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
− | '''Learning | + | '''Learning Objectives''' |
− | | | + | || |
In this tutorial, we will learn to: | In this tutorial, we will learn to: | ||
− | + | * Create an '''axi-symmetric''' geometry using '''blockMesh''' | |
− | + | * Create '''spline''' curved edge using '''blockMesh''', and | |
− | + | * Set up and run a case of '''compressible flow''' | |
− | + | ||
|- | |- | ||
− | | | + | || |
'''Slide:''' | '''Slide:''' | ||
'''System Specifications''' | '''System Specifications''' | ||
− | | | + | ||To record this tutorial, I am using, |
− | To record this tutorial, I am using, | + | |
− | + | * '''Ubuntu Linux''' OS version 22.04 | |
− | + | ||
− | + | * '''OpenFOAM''' version 9 | |
− | + | ||
− | + | * '''ParaView''' version 5.6.3, and | |
+ | |||
+ | * '''gedit''' Text editor | ||
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Prerequisites''' | '''Prerequisites''' | ||
'''https://spoken-tutorial.org''' | '''https://spoken-tutorial.org''' | ||
− | | | + | ||As a prerequisite: |
− | As a prerequisite: | + | |
− | + | * You should have basic knowledge of '''compressible flows''' and '''gas dynamics'''. | |
− | + | ||
− | + | * You should be familiar with '''setting up a case''' and '''creating a mesh''' in '''OpenFOAM'''. | |
− | + | ||
+ | * If not, please go through the prerequisite '''OpenFOAM''' tutorials on this website. | ||
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Code Files''' | '''Code Files''' | ||
− | | | + | || |
− | The files used in this tutorial are available in the '''Code''' '''Files''' link on the tutorial page | + | * The files used in this tutorial are available in the '''Code''' '''Files''' link on the tutorial page |
− | Please download and extract them | + | * Please download and extract them |
− | Make a copy and then use them while practising. | + | * Make a copy and then use them while practising. |
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Convergent-Divergent Nozzle''' | '''Convergent-Divergent Nozzle''' | ||
− | | | + | ||We will be solving flow through a '''convergent-divergent nozzle'''. |
− | We will be solving flow through a '''convergent-divergent nozzle'''. | + | |
Note that: | Note that: | ||
− | + | at the '''inlet''', '''total pressure''' is specified, and | |
− | + | at the '''outlet''', '''static pressure''' is specified. | |
− | + | ||
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Convergent-Divergent Nozzle''' | '''Convergent-Divergent Nozzle''' | ||
− | | The geometry is a '''converging-diverging''' duct. | + | || The geometry is a '''converging-diverging''' duct. |
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Convergent-Divergent Nozzle''' | '''Convergent-Divergent Nozzle''' | ||
− | | Variation of the cross-sectional area is given by this '''cosine''' function along the length. | + | || Variation of the cross-sectional area is given by this '''cosine''' function along the length. |
|- | |- | ||
− | | Press CTRL + ALT + T keys. | + | || Press CTRL + ALT + T keys. |
− | | Open the '''terminal''' by pressing '''Ctrl''', '''Alt''' and '''T''' keys together. | + | || Open the '''terminal''' by pressing '''Ctrl''', '''Alt''' and '''T''' keys together. |
|- | |- | ||
− | | | + | || |
[Terminal] Type: | [Terminal] Type: | ||
'''cd $FOAM_RUN''' | '''cd $FOAM_RUN''' | ||
− | | At the prompt type this '''command''' and press '''Enter''' to go into the '''run directory'''. | + | || At the prompt type this '''command''' and press '''Enter''' to go into the '''run directory'''. |
|- | |- | ||
− | | | + | || |
[Terminal] Type: | [Terminal] Type: | ||
'''cp -r ~/Downloads/Nozzle .''' | '''cp -r ~/Downloads/Nozzle .''' | ||
− | | | + | ||We have downloaded and extracted the case folder. |
− | We have downloaded and extracted the case folder. | + | |
Let’s now copy it into the '''run directory'''. | Let’s now copy it into the '''run directory'''. | ||
|- | |- | ||
− | | | + | || |
[Terminal] Type: | [Terminal] Type: | ||
'''cd Nozzle''' | '''cd Nozzle''' | ||
− | | Let’s move into the case folder using the '''cd''' '''command'''. | + | || Let’s move into the case folder using the '''cd''' '''command'''. |
|- | |- | ||
− | | | + | || |
[Terminal] Type: | [Terminal] Type: | ||
'''gedit system/blockMeshDict''' | '''gedit system/blockMeshDict''' | ||
− | | Let’s open the '''blockMeshDict''' file in a text editor. | + | || Let’s open the '''blockMeshDict''' file in a text editor. |
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Axi-symmetric Geometry''' | '''Axi-symmetric Geometry''' | ||
− | | | + | || |
− | + | * '''Axi-symmetric''' geometry can be created in '''OpenFOAM''' using the '''wedge''' patch type. | |
− | + | * The geometry is a '''wedge''' of a small angle, usually less than '''5<sup>o</sup>'''. | |
− | + | * It has '''1 cell''' normal to the '''planes of symmetry'''. | |
− | + | ||
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Axi-symmetric Geometry''' | '''Axi-symmetric Geometry''' | ||
− | | A typical '''wedge''' geometry is shown in the figure. | + | || A typical '''wedge''' geometry is shown in the figure. |
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Axi-symmetric Geometry''' | '''Axi-symmetric Geometry''' | ||
− | | The '''wedge''' geometry used for the '''convergent-divergent nozzle''' is shown in the figure. | + | || The '''wedge''' geometry used for the '''convergent-divergent nozzle''' is shown in the figure. |
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Vertices''' | '''Vertices''' | ||
− | | | + | ||The geometry has '''6 vertices'''. |
− | The geometry has '''6 vertices'''. | + | |
The '''vertices''' of the geometry are numbered as shown. | The '''vertices''' of the geometry are numbered as shown. | ||
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Vertex Coordinates''' | '''Vertex Coordinates''' | ||
− | | Let us consider the '''inlet''' plane. | + | || Let us consider the '''inlet''' plane. |
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Vertex Coordinates-Inlet''' | '''Vertex Coordinates-Inlet''' | ||
− | | | + | ||The '''inlet''' is along the '''y-z-plane''' at '''x = 0'''. |
− | + | '''Vertex 0''' is at the '''origin'''. | |
− | + | ||
− | + | The cross-sectional area at the '''inlet''' is '''2.5 m<sup>2</sup>'''. | |
− | + | ||
− | + | The radius at the '''inlet''' is therefore, '''0.892 m'''. | |
− | + | ||
− | + | The '''y''' and '''z coordinates''' of '''vertex 1''' are as indicated in the diagram. | |
+ | |||
+ | The coordinates of '''vertex 2''' are evaluated. | ||
|- | |- | ||
− | | | + | ||'''Slide:''' |
− | '''Slide:''' | + | |
'''Vertex Coordinates-Outlet''' | '''Vertex Coordinates-Outlet''' | ||
− | | | + | ||The '''outlet''' is along the '''yz-plane''' at '''x = 10''' and its cross-sectional area is '''2.5 m<sup>2</sup>'''. |
− | The '''outlet''' is along the '''yz-plane''' at '''x = 10''' and its cross-sectional area is '''2.5 m<sup>2</sup>'''. | + | |
The '''vertices''' of the '''outlet''' plane are indicated in the diagram. | The '''vertices''' of the '''outlet''' plane are indicated in the diagram. | ||
|- | |- | ||
− | | | + | ||[gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
Vertices List [https://imgur.com/w77RPX6 <span class="underline">Link</span>] | Vertices List [https://imgur.com/w77RPX6 <span class="underline">Link</span>] | ||
− | | The '''6 vertices''' are entered in the ascending order of their '''vertex numbers''' as shown. | + | || The '''6 vertices''' are entered in the ascending order of their '''vertex numbers''' as shown. |
|- | |- | ||
− | | | + | || |
[gedit - '''blockMeshDict'''] Highlight: | [gedit - '''blockMeshDict'''] Highlight: | ||
'''0 3 5 2''' [https://imgur.com/pPDfXQ5 <span class="underline">Link</span>] | '''0 3 5 2''' [https://imgur.com/pPDfXQ5 <span class="underline">Link</span>] | ||
− | | | + | ||Let’s define the '''block'''. |
− | Let’s define the '''block'''. | + | |
We first enter the '''vertices''' of the lower '''xy-plane'''. | We first enter the '''vertices''' of the lower '''xy-plane'''. | ||
Line 196: | Line 178: | ||
In this case, that would be the lower plane, when viewed along the '''negative z direction'''. | In this case, that would be the lower plane, when viewed along the '''negative z direction'''. | ||
|- | |- | ||
− | | | + | || |
[gedit - '''blockMeshDict'''] Highlight: | [gedit - '''blockMeshDict'''] Highlight: | ||
'''0 3 4 1''' [https://imgur.com/UegK4aR <span class="underline">Link</span>] | '''0 3 4 1''' [https://imgur.com/UegK4aR <span class="underline">Link</span>] | ||
− | | Similarly, the '''vertices''' of the '''front''' plane are ordered as shown. | + | || Similarly, the '''vertices''' of the '''front''' plane are ordered as shown. |
|- | |- | ||
− | | | + | ||[gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
'''100 20''' [https://imgur.com/undefined <span class="underline">Link</span>] | '''100 20''' [https://imgur.com/undefined <span class="underline">Link</span>] | ||
− | | | + | ||The '''axis''' of the '''nozzle''' is along the '''x direction'''. |
− | The '''axis''' of the '''nozzle''' is along the '''x direction'''. | + | |
There are '''100 cells''' along the '''x direction''' and '''20 cells''' along the '''y direction'''. | There are '''100 cells''' along the '''x direction''' and '''20 cells''' along the '''y direction'''. | ||
|- | |- | ||
− | | | + | ||[gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
'''1''' [https://imgur.com/WVkOqWV <span class="underline">Link</span>] | '''1''' [https://imgur.com/WVkOqWV <span class="underline">Link</span>] | ||
− | | | + | || The '''z direction''' is normal to the '''plane of symmetry''', also known as the '''azimuthal direction'''. |
− | The '''z direction''' is normal to the '''plane of symmetry''', also known as the '''azimuthal direction'''. | + | |
There is only '''1 cell''' along the '''z axis'''. | There is only '''1 cell''' along the '''z axis'''. | ||
|- | |- | ||
− | | | + | ||[gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
'''edges''' [https://imgur.com/q3hgXOI <span class="underline">Link</span>] | '''edges''' [https://imgur.com/q3hgXOI <span class="underline">Link</span>] | ||
− | + | ||
− | We have '''curved edges''' that define the '''nozzle'''. | + | ||We have '''curved edges''' that define the '''nozzle'''. |
We need to specify these '''edges'''. | We need to specify these '''edges'''. | ||
|- | |- | ||
− | | Slide: '''Spline''' | + | || Slide: |
− | | | + | |
− | '''Spline''' curves can be created in '''blockMesh''' using the keyword '''spline'''. | + | '''Spline''' |
+ | || '''Spline''' curves can be created in '''blockMesh''' using the keyword '''spline'''. | ||
It requires: | It requires: | ||
− | + | * The '''2 vertices''' that '''edge''' connects, and | |
− | + | ||
− | + | * The '''interpolation points''' through which '''edge''' passes | |
|- | |- | ||
− | | Slide: '''Front Edge''' | + | || Slide: |
− | | | + | |
− | Let’s look at the '''front edge''' of the '''nozzle'''. | + | '''Front Edge''' |
+ | || Let’s look at the '''front edge''' of the '''nozzle'''. | ||
'''Front edge''' connects the '''vertices 1''' and '''4'''. | '''Front edge''' connects the '''vertices 1''' and '''4'''. | ||
|- | |- | ||
− | | | + | ||[gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
'''spline 1 4''' [https://imgur.com/3eURiww <span class="underline">Link</span>] | '''spline 1 4''' [https://imgur.com/3eURiww <span class="underline">Link</span>] | ||
− | | We have used the keyword '''spline''' to indicate that a '''spline''' curve connects the '''vertices 1''' and '''4'''. | + | || We have used the keyword '''spline''' to indicate that a '''spline''' curve connects the '''vertices 1''' and '''4'''. |
+ | |||
|- | |- | ||
− | | | + | || Slide: |
− | | | + | |
− | + | ||
− | + | '''Interpolation Points''' | |
− | + | || Let us calculate the '''interpolation points''' for the '''front edge''': | |
− | + | ||
− | + | ||
− | + | ||
− | + | Let us calculate the coordinates of a point on the '''edge''' at '''x = 1'''. | |
− | < | + | |
+ | From the '''cosine''' relation, at '''x = 1''', the cross-sectional area is 2.357 '''m<sup>2</sup>'''. | ||
+ | |||
+ | The radius of the '''nozzle''' is therefore '''0.866 m'''. | ||
+ | |||
+ | We follow the same procedure as calculating the '''vertex''' coordinates earlier. | ||
+ | |||
+ | The '''y''' and '''z coordinates''' are found to be '''0.865''' and '''0.0378'''. | ||
|- | |- | ||
− | | | + | || [gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
'''spline 2 5''' [https://imgur.com/s1iuZPN <span class="underline">Link</span>] | '''spline 2 5''' [https://imgur.com/s1iuZPN <span class="underline">Link</span>] | ||
− | | Using the same procedure, we define the '''spline edge''' connecting '''vertices 2''' and '''5'''. | + | || Using the same procedure, we define the '''spline edge''' connecting '''vertices 2''' and '''5'''. |
|- | |- | ||
− | | | + | || Slide: |
− | | | + | |
− | + | ||
− | + | '''Boundary''' | |
− | + | ||
− | + | || The '''boundaries''' of the geometry are: | |
− | + | ||
− | + | * '''inlet''' and '''outlet''' | |
+ | * '''nozzle''' | ||
+ | * '''back''', and | ||
+ | * '''front''' | ||
|- | |- | ||
− | | | + | ||[gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
Boundaries List [https://i.imgur.com/sRRBRAj.png <span class="underline">Link</span>] | Boundaries List [https://i.imgur.com/sRRBRAj.png <span class="underline">Link</span>] | ||
− | | We define the '''5 boundaries''' as shown. | + | || We define the '''5 boundaries''' as shown. |
|- | |- | ||
− | | | + | || [gedit - '''blockMeshDict'''] Highlight: |
− | [gedit - '''blockMeshDict'''] Highlight: | + | |
wedge >> wedge [https://i.imgur.com/gG8r6RO.png <span class="underline">Link</span>] | wedge >> wedge [https://i.imgur.com/gG8r6RO.png <span class="underline">Link</span>] | ||
− | + | ||
− | Note that the '''back''' and '''front faces''' are of the type '''wedge'''. | + | ||Note that the '''back''' and '''front faces''' are of the type '''wedge'''. |
This indicates that the '''front''' and '''back faces''' are '''axi-symmetric wedge planes'''. | This indicates that the '''front''' and '''back faces''' are '''axi-symmetric wedge planes'''. | ||
|- | |- | ||
− | | | + | || [gedit - '''blockMeshDict'''] |
− | [gedit - '''blockMeshDict'''] | + | |
Close the window | Close the window | ||
− | | Close the '''blockMeshDict''' file. | + | || Close the '''blockMeshDict''' file. |
|- | |- | ||
− | | [Terminal] Type: '''gedit 0/p''' | + | || [Terminal] Type: '''gedit 0/p''' |
− | | Let’s view the initial and '''boundary''' '''values''' of '''pressure'''. | + | || Let’s view the initial and '''boundary''' '''values''' of '''pressure'''. |
|- | |- | ||
− | | | + | ||[gedit - '''p'''] Highlight: |
− | [gedit - '''p'''] Highlight: | + | |
'''internalField uniform 10000''' [https://i.imgur.com/EhEocHs.png <span class="underline">Link</span>] | '''internalField uniform 10000''' [https://i.imgur.com/EhEocHs.png <span class="underline">Link</span>] | ||
− | | The '''domain''' is '''initialized''' with 10,000 '''Pa'''. | + | |
+ | || The '''domain''' is '''initialized''' with 10,000 '''Pa'''. | ||
|- | |- | ||
− | + | ||
− | [gedit - '''p'''] Highlight: | + | || [gedit - '''p'''] Highlight: |
'''type totalPressure''' [https://i.imgur.com/RBvQXkt.png <span class="underline">Link</span>] | '''type totalPressure''' [https://i.imgur.com/RBvQXkt.png <span class="underline">Link</span>] | ||
− | | At the '''inlet''', we have the '''total pressure''' condition. | + | |
+ | || At the '''inlet''', we have the '''total pressure''' condition. | ||
|- | |- | ||
− | | | + | ||[gedit - '''p'''] Highlight: |
− | [gedit - '''p'''] Highlight: | + | |
'''gamma 1.4''' [https://i.imgur.com/hF1Cnr9.png <span class="underline">Link</span>] | '''gamma 1.4''' [https://i.imgur.com/hF1Cnr9.png <span class="underline">Link</span>] | ||
− | + | ||
− | Since the flow is compressible, we need to specify the '''ratio of specific heats'''. | + | || Since the flow is compressible, we need to specify the '''ratio of specific heats'''. |
We consider the fluid to be '''air''' in this simulation. | We consider the fluid to be '''air''' in this simulation. | ||
Line 327: | Line 305: | ||
The '''ratio of specific heats''', '''gamma''', of '''air''' is '''1.4'''. | The '''ratio of specific heats''', '''gamma''', of '''air''' is '''1.4'''. | ||
|- | |- | ||
− | | | + | || [gedit - '''p'''] Highlight: |
− | [gedit - '''p'''] Highlight: | + | |
'''p0 uniform 10000''' [https://i.imgur.com/qMpO2T2.png <span class="underline">Link</span>] | '''p0 uniform 10000''' [https://i.imgur.com/qMpO2T2.png <span class="underline">Link</span>] | ||
− | | The '''total pressure''' at the '''inlet''' is set to 10,000 '''Pa'''. | + | |
+ | || The '''total pressure''' at the '''inlet''' is set to 10,000 '''Pa'''. | ||
|- | |- | ||
− | | | + | ||[gedit - '''p'''] Highlight: |
− | [gedit - '''p'''] Highlight: | + | |
'''value uniform 10000''' [https://i.imgur.com/sxEMkAv.png <span class="underline">Link</span>] | '''value uniform 10000''' [https://i.imgur.com/sxEMkAv.png <span class="underline">Link</span>] | ||
− | | For the '''type totalPressure''', '''value''' is just a '''placeholder''' for the first '''time-step'''. | + | |
+ | || For the '''type totalPressure''', '''value''' is just a '''placeholder''' for the first '''time-step'''. | ||
|- | |- | ||
− | | | + | || [gedit - '''p'''] Highlight: |
− | [gedit - '''p'''] Highlight: | + | |
back and front BC [https://i.imgur.com/41FTbr3.png <span class="underline">Link</span>] | back and front BC [https://i.imgur.com/41FTbr3.png <span class="underline">Link</span>] | ||
− | + | ||
− | The '''back''' and '''front faces''' are the '''axi-symmetric wedge planes'''. | + | || The '''back''' and '''front faces''' are the '''axi-symmetric wedge planes'''. |
Therefore, the '''wedge''' '''boundary condition''' is used. | Therefore, the '''wedge''' '''boundary condition''' is used. | ||
|- | |- | ||
− | | [gedit - '''p'''] Close the window | + | || [gedit - '''p'''] Close the window |
− | | Close the '''p''' file. | + | || Close the '''p''' file. |
|- | |- | ||
− | | Slide: | + | || Slide: |
− | + | ||
− | + | ||
− | + | '''Boundary Conditions''' | |
− | + | ||
+ | || Let’s now look at the '''boundary values''' of '''temperature''' and '''velocity'''. | ||
+ | |||
+ | They are tabulated as shown. | ||
|- | |- | ||
− | | | + | || Slide: |
− | Slide: Boundary Conditions | + | |
+ | '''Boundary Conditions''' | ||
Highlight: '''slip''' [https://i.imgur.com/N48sg9z.png <span class="underline">Link</span>] | Highlight: '''slip''' [https://i.imgur.com/N48sg9z.png <span class="underline">Link</span>] | ||
− | | Note that '''slip''' condition is imposed at the '''nozzle wall''' as the flow is '''inviscid'''. | + | || Note that '''slip''' condition is imposed at the '''nozzle wall''' as the flow is '''inviscid'''. |
|- | |- | ||
− | | Slide: '''Thermophysical Properties''' | + | || '''Slide''': |
− | | | + | |
− | + | '''Thermophysical Properties''' | |
− | + | ||The '''molecular weight''' of '''air''' is '''29 g/mol'''. | |
− | + | ||
− | + | The '''specific heat at constant pressure''' ('''c<sub>p</sub>''') is '''1005 J/kg-K'''. | |
+ | |||
+ | Since we don’t consider any '''phase change''', the '''heat of fusion''' ('''H<sub>f</sub>''') can be taken as '''0'''. | ||
|- | |- | ||
− | | | + | || '''Slide''': |
− | | | + | |
− | + | ||
− | + | '''Transport Properties''' | |
− | + | ||Since the flow is '''inviscid''', '''viscosity''' and '''thermal conductivity''' effects are ignored. | |
− | + | ||
+ | '''Viscosity''' ('''μ''') can be taken as '''0''', and | ||
+ | |||
+ | The '''Prandtl number''' ('''Pr''') can be taken as '''1'''. | ||
You may assign any other '''non-zero''' value for the '''Prandtl number'''. | You may assign any other '''non-zero''' value for the '''Prandtl number'''. | ||
|- | |- | ||
− | | [Terminal] Type: '''gedit constant/thermophysicalProperties''' | + | || [Terminal] Type: '''gedit constant/thermophysicalProperties''' |
− | | Now, let’s view the '''thermophysicalProperties''' file. | + | || Now, let’s view the '''thermophysicalProperties''' file. |
|- | |- | ||
− | | [gedit - '''thermophysicalProperties'''] Highlight: Properties values [https://i.imgur.com/64PTynu.png <span class="underline">Link</span>] | + | || [gedit - '''thermophysicalProperties'''] Highlight: Properties values [https://i.imgur.com/64PTynu.png <span class="underline">Link</span>] |
− | | The '''thermophysical properties''' are entered as shown. | + | |
+ | || The '''thermophysical properties''' are entered as shown. | ||
|- | |- | ||
− | | | + | ||[gedit - '''thermophysicalProperties'''] |
− | [gedit - '''thermophysicalProperties'''] | + | |
Close the window | Close the window | ||
− | | Close the '''thermophysicalProperties''' file. | + | || Close the '''thermophysicalProperties''' file. |
|- | |- | ||
− | | | + | ||[Terminal] Type: |
− | [Terminal] Type: | + | |
'''gedit system/controlDict''' | '''gedit system/controlDict''' | ||
− | | Let’s open the '''controlDict''' file. | + | || Let’s open the '''controlDict''' file. |
|- | |- | ||
− | | | + | ||[gedit - '''controlDict'''] Highlight: |
− | [gedit - '''controlDict'''] Highlight: | + | |
'''adjustTimeStep yes''' [https://i.imgur.com/gMwalLV.png <span class="underline">Link</span>] | '''adjustTimeStep yes''' [https://i.imgur.com/gMwalLV.png <span class="underline">Link</span>] | ||
− | | | + | || We have enabled the '''adjustTimeStep'''. |
− | We have enabled the '''adjustTimeStep'''. | + | |
− | It calculates '''time step''' after every iteration based on the | + | It calculates '''time step''' after every iteration based on the specific '''maximum Courant number'''. |
|- | |- | ||
− | | | + | ||[gedit - '''controlDict'''] Highlight: |
− | [gedit - '''controlDict'''] Highlight: | + | |
'''maxCo 0.9''' [https://i.imgur.com/blWSJNN.png <span class="underline">Link</span>] | '''maxCo 0.9''' [https://i.imgur.com/blWSJNN.png <span class="underline">Link</span>] | ||
− | | The '''maximum Courant number''' is set as '''0.9'''. | + | |
+ | || The '''maximum Courant number''' is set as '''0.9'''. | ||
+ | |||
+ | The time step is calculated after every iteration ensuring that the '''Courant number''' is 0.9. | ||
|- | |- | ||
− | | | + | || [gedit - '''controlDict'''] Highlight: |
− | [gedit - '''controlDict'''] Highlight: | + | |
'''maxDeltaT 1''' [https://i.imgur.com/oTWQKiS.png <span class="underline">Link</span>] | '''maxDeltaT 1''' [https://i.imgur.com/oTWQKiS.png <span class="underline">Link</span>] | ||
− | | The '''maximum time step''' is set as '''1'''. | + | || The '''maximum time step''' is set as '''1'''. |
|- | |- | ||
− | | | + | || [gedit - '''controlDict'''] Highlight: |
− | [gedit - '''controlDict'''] Highlight: | + | |
'''writeControl adjustableRunTime''' [https://i.imgur.com/UFZqUOt.png <span class="underline">Link</span>] | '''writeControl adjustableRunTime''' [https://i.imgur.com/UFZqUOt.png <span class="underline">Link</span>] | ||
− | | Since the '''time step''' is not constant, the '''write control''' is also made adjustable. | + | |
+ | || Since the '''time step''' is not constant, the '''write control''' is also made adjustable. | ||
|- | |- | ||
− | | | + | || [gedit - '''controlDict'''] Highlight: |
− | [gedit - '''controlDict'''] Highlight: | + | |
'''deltaT 1e-6''' [https://i.imgur.com/CVmHtlG.png <span class="underline">Link</span>] | '''deltaT 1e-6''' [https://i.imgur.com/CVmHtlG.png <span class="underline">Link</span>] | ||
− | + | ||
− | The first '''time step''' is '''1 micro second'''. | + | || The first '''time step''' is '''1 micro second'''. |
Value is chosen such that the '''Courant number''' is less than '''0.9''' for the first '''time step'''. | Value is chosen such that the '''Courant number''' is less than '''0.9''' for the first '''time step'''. | ||
|- | |- | ||
− | | | + | || [gedit - '''controlDict'''] |
− | [gedit - '''controlDict'''] | + | |
Close the window | Close the window | ||
− | | Close the '''controlDict''' file. | + | || Close the '''controlDict''' file. |
|- | |- | ||
− | | [Terminal] Type: '''blockMesh''' | + | || [Terminal] Type: '''blockMesh''' |
− | | Let’s '''mesh''' the geometry using the '''blockMesh''' '''command'''. | + | || Let’s '''mesh''' the geometry using the '''blockMesh''' '''command'''. |
|- | |- | ||
− | | Slide: '''rhoCentralFoam''' | + | ||''' Slide''': |
− | | | + | |
− | We will be using the '''rhoCentralFoam''' solver in this simulation. | + | '''rhoCentralFoam''' |
+ | || We will be using the '''rhoCentralFoam''' solver in this simulation. | ||
It is: | It is: | ||
− | + | * A '''density-based''' '''compressible flow''' solver | |
− | + | ||
− | + | * Based on '''central-upwind schemes''' of '''Kurganov''' and '''Tadmor''' | |
|- | |- | ||
− | | [Terminal] Type: '''rhoCentralFoam''' | + | || [Terminal] Type: '''rhoCentralFoam''' |
− | | Let’s start the simulation using the following '''command'''. | + | || Let’s start the simulation using the following '''command'''. |
|- | |- | ||
− | | Cursor in the terminal. | + | || Cursor in the terminal. |
− | | The simulation may take some time to complete. | + | || The simulation may take some time to complete. |
|- | |- | ||
− | | [Terminal] Highlight: '''End''' | + | || [Terminal] Highlight: '''End''' |
− | | The simulation is now complete. | + | || The simulation is now complete. |
|- | |- | ||
− | | [Terminal] Type: '''paraFoam''' | + | || [Terminal] Type: '''paraFoam''' |
− | | | + | ||Let’s view the simulated results in '''ParaView'''. |
− | Let’s view the simulated results in '''ParaView'''. | + | |
Type '''paraFoam''' at the prompt. | Type '''paraFoam''' at the prompt. | ||
|- | |- | ||
− | | | + | ||[ParaView] '''Properties''' '''Tab''' |
− | [ParaView] '''Properties''' '''Tab''' | + | |
Click on '''Apply''' | Click on '''Apply''' | ||
− | | Click on the '''Apply''' button to view the geometry. | + | || Click on the '''Apply''' button to view the geometry. |
|- | |- | ||
− | | | + | ||[ParaView] '''Active Variable Controls''' |
− | [ParaView] '''Active Variable Controls''' | + | |
Click on '''vtkBlockColors''' >> Click on '''p''' | Click on '''vtkBlockColors''' >> Click on '''p''' | ||
− | | | + | || Let’s view the '''pressure contours''' for the simulation. |
− | Let’s view the '''pressure contours''' for the simulation. | + | |
− | Click on the '''vtkBlockColors''' | + | Click on the '''vtkBlockColors''' drop down in the '''Active Variable Controls''' and select '''p'''. |
− | Click on the '''p''' option with a '''point icon''' and not the '''box icon''', in the | + | Click on the '''p''' option with a '''point icon''' and not the '''box icon''', in the drop down. |
|- | |- | ||
− | | | + | || [ParaView] '''VCR Controls''' |
− | [ParaView] '''VCR Controls''' | + | |
Click on '''Last Frame''' | Click on '''Last Frame''' | ||
− | | | + | || Let’s view the '''contours''' at the end of the simulation. |
− | Let’s view the '''contours''' at the end of the simulation. | + | |
Click on the '''Last Frame''' button in the '''VCR Controls'''. | Click on the '''Last Frame''' button in the '''VCR Controls'''. | ||
Line 497: | Line 470: | ||
You can now see the '''steady-state pressure contour'''. | You can now see the '''steady-state pressure contour'''. | ||
|- | |- | ||
− | | | + | ||[ParaView] '''Active Variable Controls''' |
− | [ParaView] '''Active Variable Controls''' | + | |
Click on '''Rescale to Data Range''' | Click on '''Rescale to Data Range''' | ||
− | | Click on '''Rescale to Data Range''' | + | || Click on '''Rescale to Data Range''' |
|- | |- | ||
− | | | + | || [ParaView] '''Layout Window''' |
− | [ParaView] '''Layout Window''' | + | |
Point to Shock | Point to Shock | ||
− | | | + | || Notice the sudden jump in '''pressure''' in the '''diverging section''' of the '''nozzle'''. |
− | Notice the sudden jump in '''pressure''' in the '''diverging section''' of the '''nozzle'''. | + | |
This jump indicates the presence of '''normal shock''' in the '''nozzle'''. | This jump indicates the presence of '''normal shock''' in the '''nozzle'''. | ||
|- | |- | ||
− | | [ParaView] '''Close ParaView''' | + | || [ParaView] '''Close ParaView''' |
− | | Close the '''ParaView''' window. | + | || Close the '''ParaView''' window. |
|- | |- | ||
− | | Only Narration | + | || Only Narration |
− | | | + | ||With this we have come to the end of the tutorial. |
− | With this we have come to the end of the tutorial. | + | |
Let’s summarize. | Let’s summarize. | ||
|- | |- | ||
− | | | + | ||''' Slide''': |
− | + | ||
− | + | ||
− | + | '''Summary''' | |
− | + | || In this tutorial, we have learnt to: | |
− | + | ||
− | + | * Create an '''axi-symmetric''' geometry using '''blockMesh''' | |
+ | * Create '''spline''' curved edge using '''blockMesh''', and | ||
+ | * Set up and run a case of '''compressible flow''' | ||
|- | |- | ||
− | | | + | || '''Slide''': |
− | + | ||
− | + | ||
− | + | '''Assignment''' | |
− | + | || As an assignment: | |
− | + | ||
− | + | * Change the '''outlet pressure''' to '''8900 Pa'''. | |
+ | * Keep all the other parameters the same and run the simulation. | ||
+ | * View the '''steady-state pressure contour''' in '''ParaView''' | ||
|- | |- | ||
− | | Slide: '''About the Spoken Tutorial Project''' | + | || '''Slide''': |
− | | | + | |
− | The video at the following link summarises the Spoken Tutorial project. | + | '''About the Spoken Tutorial Project''' |
+ | ||The video at the following link summarises the Spoken Tutorial project. | ||
Please download and watch it. | Please download and watch it. | ||
|- | |- | ||
− | | Slide: '''Spoken Tutorial Workshops''' | + | | '''Slide''': |
− | | | + | |
− | We conduct workshops using Spoken Tutorials and give certificates. | + | '''Spoken Tutorial Workshops''' |
+ | ||We conduct workshops using Spoken Tutorials and give certificates. | ||
Please contact us. | Please contact us. | ||
|- | |- | ||
− | | Slide: '''Spoken Tutorial Forum''' | + | || '''Slide''': |
− | | Please post your timed queries in this forum. | + | |
+ | '''Spoken Tutorial Forum''' | ||
+ | || Please post your timed queries in this forum. | ||
|- | |- | ||
− | | Slide: '''FOSSEE Forum''' | + | || '''Slide''': |
− | | | + | |
− | + | '''FOSSEE Forum''' | |
− | + | ||Do you have any general/technical questions? | |
− | + | ||
+ | Please visit the forum given in the link. | ||
|- | |- | ||
− | | Slide: '''FOSSEE Case Study Project''' | + | || '''Slide''': |
− | | | + | |
− | + | '''FOSSEE Case Study Project''' | |
− | + | || | |
− | + | * The FOSSEE team coordinates solving feasible CFD problems of reasonable complexity using OpenFOAM. | |
− | + | * We give honorarium and certificates to those who do this. | |
+ | * For more details, please visit these sites. | ||
|- | |- | ||
− | | Slide: '''Acknowledgements''' | + | | '''Slide''': |
− | | The Spoken Tutorial Project was established by the Ministry of Education, Govt. of India. | + | |
+ | '''Acknowledgements''' | ||
+ | || The Spoken Tutorial Project was established by the Ministry of Education, Govt. of India. | ||
|- | |- | ||
− | | Only Narration | + | || Only Narration |
− | | This tutorial is contributed by Ashutosh P. Shridhar, Binayak Lohani, Biraj Khadka and Payel Mukherjee from IIT Bombay. Thanks for joining. | + | || This tutorial is contributed by Ashutosh P. Shridhar, Binayak Lohani, Biraj Khadka and Payel Mukherjee from IIT Bombay. |
+ | |||
+ | Thanks for joining. | ||
|} | |} |
Latest revision as of 21:59, 27 September 2024
Title of the script: Flow in a Convergent-Divergent Nozzle
Author: Ashley Melvin, Biraj Khadka
Keywords: OpenFOAM, ParaView, CFD, computational fluid dynamics, blockMesh, axi-symmetry, wedge geometry, spline, compressible flow, inviscid, convergent-divergent nozzle, rhoCentralFoam, shock, FOSSEE, spoken tutorial, video tutorial.
Visual Cue | Narration |
Slide:
Opening Slide |
Welcome to the spoken tutorial on Flow in a Convergent-Divergent Nozzle. |
Slide:
Learning Objectives |
In this tutorial, we will learn to:
|
Slide: System Specifications |
To record this tutorial, I am using,
|
Slide:
Prerequisites |
As a prerequisite:
|
Slide:
Code Files |
|
Slide:
Convergent-Divergent Nozzle |
We will be solving flow through a convergent-divergent nozzle.
Note that: at the inlet, total pressure is specified, and at the outlet, static pressure is specified. |
Slide:
Convergent-Divergent Nozzle |
The geometry is a converging-diverging duct. |
Slide:
Convergent-Divergent Nozzle |
Variation of the cross-sectional area is given by this cosine function along the length. |
Press CTRL + ALT + T keys. | Open the terminal by pressing Ctrl, Alt and T keys together. |
[Terminal] Type: cd $FOAM_RUN |
At the prompt type this command and press Enter to go into the run directory. |
[Terminal] Type: cp -r ~/Downloads/Nozzle . |
We have downloaded and extracted the case folder.
Let’s now copy it into the run directory. |
[Terminal] Type: cd Nozzle |
Let’s move into the case folder using the cd command. |
[Terminal] Type: gedit system/blockMeshDict |
Let’s open the blockMeshDict file in a text editor. |
Slide:
Axi-symmetric Geometry |
|
Slide:
Axi-symmetric Geometry |
A typical wedge geometry is shown in the figure. |
Slide:
Axi-symmetric Geometry |
The wedge geometry used for the convergent-divergent nozzle is shown in the figure. |
Slide:
Vertices |
The geometry has 6 vertices.
The vertices of the geometry are numbered as shown. |
Slide:
Vertex Coordinates |
Let us consider the inlet plane. |
Slide:
Vertex Coordinates-Inlet |
The inlet is along the y-z-plane at x = 0.
Vertex 0 is at the origin. The cross-sectional area at the inlet is 2.5 m2. The radius at the inlet is therefore, 0.892 m. The y and z coordinates of vertex 1 are as indicated in the diagram. The coordinates of vertex 2 are evaluated. |
Slide:
Vertex Coordinates-Outlet |
The outlet is along the yz-plane at x = 10 and its cross-sectional area is 2.5 m2.
The vertices of the outlet plane are indicated in the diagram. |
[gedit - blockMeshDict] Highlight:
Vertices List Link |
The 6 vertices are entered in the ascending order of their vertex numbers as shown. |
[gedit - blockMeshDict] Highlight: 0 3 5 2 Link |
Let’s define the block.
We first enter the vertices of the lower xy-plane. In this case, that would be the lower plane, when viewed along the negative z direction. |
[gedit - blockMeshDict] Highlight: 0 3 4 1 Link |
Similarly, the vertices of the front plane are ordered as shown. |
[gedit - blockMeshDict] Highlight:
100 20 Link |
The axis of the nozzle is along the x direction.
There are 100 cells along the x direction and 20 cells along the y direction. |
[gedit - blockMeshDict] Highlight:
1 Link |
The z direction is normal to the plane of symmetry, also known as the azimuthal direction.
There is only 1 cell along the z axis. |
[gedit - blockMeshDict] Highlight:
edges Link |
We have curved edges that define the nozzle.
We need to specify these edges. |
Slide:
Spline |
Spline curves can be created in blockMesh using the keyword spline.
It requires:
|
Slide:
Front Edge |
Let’s look at the front edge of the nozzle.
Front edge connects the vertices 1 and 4. |
[gedit - blockMeshDict] Highlight:
spline 1 4 Link |
We have used the keyword spline to indicate that a spline curve connects the vertices 1 and 4. |
Slide:
Interpolation Points |
Let us calculate the interpolation points for the front edge:
Let us calculate the coordinates of a point on the edge at x = 1. From the cosine relation, at x = 1, the cross-sectional area is 2.357 m2. The radius of the nozzle is therefore 0.866 m. We follow the same procedure as calculating the vertex coordinates earlier. The y and z coordinates are found to be 0.865 and 0.0378. |
[gedit - blockMeshDict] Highlight:
spline 2 5 Link |
Using the same procedure, we define the spline edge connecting vertices 2 and 5. |
Slide:
Boundary |
The boundaries of the geometry are:
|
[gedit - blockMeshDict] Highlight:
Boundaries List Link |
We define the 5 boundaries as shown. |
[gedit - blockMeshDict] Highlight:
wedge >> wedge Link |
Note that the back and front faces are of the type wedge.
This indicates that the front and back faces are axi-symmetric wedge planes. |
[gedit - blockMeshDict]
Close the window |
Close the blockMeshDict file. |
[Terminal] Type: gedit 0/p | Let’s view the initial and boundary values of pressure. |
[gedit - p] Highlight:
internalField uniform 10000 Link |
The domain is initialized with 10,000 Pa. |
[gedit - p] Highlight:
type totalPressure Link |
At the inlet, we have the total pressure condition. |
[gedit - p] Highlight:
gamma 1.4 Link |
Since the flow is compressible, we need to specify the ratio of specific heats.
We consider the fluid to be air in this simulation. The ratio of specific heats, gamma, of air is 1.4. |
[gedit - p] Highlight:
p0 uniform 10000 Link |
The total pressure at the inlet is set to 10,000 Pa. |
[gedit - p] Highlight:
value uniform 10000 Link |
For the type totalPressure, value is just a placeholder for the first time-step. |
[gedit - p] Highlight:
back and front BC Link |
The back and front faces are the axi-symmetric wedge planes.
Therefore, the wedge boundary condition is used. |
[gedit - p] Close the window | Close the p file. |
Slide:
Boundary Conditions |
Let’s now look at the boundary values of temperature and velocity.
They are tabulated as shown. |
Slide:
Boundary Conditions Highlight: slip Link |
Note that slip condition is imposed at the nozzle wall as the flow is inviscid. |
Slide:
Thermophysical Properties |
The molecular weight of air is 29 g/mol.
The specific heat at constant pressure (cp) is 1005 J/kg-K. Since we don’t consider any phase change, the heat of fusion (Hf) can be taken as 0. |
Slide:
Transport Properties |
Since the flow is inviscid, viscosity and thermal conductivity effects are ignored.
Viscosity (μ) can be taken as 0, and The Prandtl number (Pr) can be taken as 1. You may assign any other non-zero value for the Prandtl number. |
[Terminal] Type: gedit constant/thermophysicalProperties | Now, let’s view the thermophysicalProperties file. |
[gedit - thermophysicalProperties] Highlight: Properties values Link | The thermophysical properties are entered as shown. |
[gedit - thermophysicalProperties]
Close the window |
Close the thermophysicalProperties file. |
[Terminal] Type:
gedit system/controlDict |
Let’s open the controlDict file. |
[gedit - controlDict] Highlight:
adjustTimeStep yes Link |
We have enabled the adjustTimeStep.
It calculates time step after every iteration based on the specific maximum Courant number. |
[gedit - controlDict] Highlight:
maxCo 0.9 Link |
The maximum Courant number is set as 0.9.
The time step is calculated after every iteration ensuring that the Courant number is 0.9. |
[gedit - controlDict] Highlight:
maxDeltaT 1 Link |
The maximum time step is set as 1. |
[gedit - controlDict] Highlight:
writeControl adjustableRunTime Link |
Since the time step is not constant, the write control is also made adjustable. |
[gedit - controlDict] Highlight:
deltaT 1e-6 Link |
The first time step is 1 micro second.
Value is chosen such that the Courant number is less than 0.9 for the first time step. |
[gedit - controlDict]
Close the window |
Close the controlDict file. |
[Terminal] Type: blockMesh | Let’s mesh the geometry using the blockMesh command. |
Slide:
rhoCentralFoam |
We will be using the rhoCentralFoam solver in this simulation.
It is:
|
[Terminal] Type: rhoCentralFoam | Let’s start the simulation using the following command. |
Cursor in the terminal. | The simulation may take some time to complete. |
[Terminal] Highlight: End | The simulation is now complete. |
[Terminal] Type: paraFoam | Let’s view the simulated results in ParaView.
Type paraFoam at the prompt. |
[ParaView] Properties Tab
Click on Apply |
Click on the Apply button to view the geometry. |
[ParaView] Active Variable Controls
Click on vtkBlockColors >> Click on p |
Let’s view the pressure contours for the simulation.
Click on the vtkBlockColors drop down in the Active Variable Controls and select p. Click on the p option with a point icon and not the box icon, in the drop down. |
[ParaView] VCR Controls
Click on Last Frame |
Let’s view the contours at the end of the simulation.
Click on the Last Frame button in the VCR Controls. You can now see the steady-state pressure contour. |
[ParaView] Active Variable Controls
Click on Rescale to Data Range |
Click on Rescale to Data Range |
[ParaView] Layout Window
Point to Shock |
Notice the sudden jump in pressure in the diverging section of the nozzle.
This jump indicates the presence of normal shock in the nozzle. |
[ParaView] Close ParaView | Close the ParaView window. |
Only Narration | With this we have come to the end of the tutorial.
Let’s summarize. |
Slide:
Summary |
In this tutorial, we have learnt to:
|
Slide:
Assignment |
As an assignment:
|
Slide:
About the Spoken Tutorial Project |
The video at the following link summarises the Spoken Tutorial project.
Please download and watch it. |
Slide:
Spoken Tutorial Workshops |
We conduct workshops using Spoken Tutorials and give certificates.
Please contact us. |
Slide:
Spoken Tutorial Forum |
Please post your timed queries in this forum. |
Slide:
FOSSEE Forum |
Do you have any general/technical questions?
Please visit the forum given in the link. |
Slide:
FOSSEE Case Study Project |
|
Slide:
Acknowledgements |
The Spoken Tutorial Project was established by the Ministry of Education, Govt. of India. |
Only Narration | This tutorial is contributed by Ashutosh P. Shridhar, Binayak Lohani, Biraj Khadka and Payel Mukherjee from IIT Bombay.
Thanks for joining. |