Difference between revisions of "OpenFOAM-version-7/C3/Flow-in-a-Convergent-Divergent-Nozzle/English"
Line 21: | Line 21: | ||
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''' | |
|- | |- | ||
| | | | ||
Line 33: | Line 33: | ||
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 | |
|- | |- | ||
| | | | ||
Line 48: | Line 48: | ||
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. | |
|- | |- | ||
| | | | ||
Line 73: | Line 73: | ||
Note that: | Note that: | ||
− | + | ||
− | + | at the '''inlet''', '''total pressure''' is specified, and | |
− | + | at the '''outlet''', '''static pressure''' is specified. | |
|- | |- | ||
| | | | ||
Line 124: | Line 124: | ||
'''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'''. | |
|- | |- | ||
| | | | ||
Line 161: | Line 161: | ||
'''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. | |
− | + | Similarly, the coordinates of '''vertex 2''' are evaluated. | |
|- | |- | ||
| | | | ||
Line 234: | Line 234: | ||
It requires: | It requires: | ||
− | + | ||
− | + | The '''2 vertices''' that '''edge''' connects, and | |
− | + | The '''interpolation points''' through which '''edge''' passes | |
|- | |- | ||
| Slide: '''Front Edge''' | | Slide: '''Front Edge''' | ||
Line 254: | Line 254: | ||
Let us calculate the '''interpolation points''' for the '''front edge''': | 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'''. | ||
|- | |- | ||
| | | | ||
Line 273: | Line 273: | ||
The '''boundaries''' of the geometry are: | The '''boundaries''' of the geometry are: | ||
− | + | ||
− | + | '''inlet''' and '''outlet''' | |
− | + | '''nozzle''' | |
− | + | '''back''', and | |
− | + | '''front''' | |
|- | |- | ||
| | | | ||
Line 354: | Line 354: | ||
Let’s now look at the '''boundary values''' of '''temperature''' and '''velocity'''. | Let’s now look at the '''boundary values''' of '''temperature''' and '''velocity'''. | ||
− | + | ||
− | + | They are tabulated as shown. | |
|- | |- | ||
| | | | ||
Line 365: | Line 365: | ||
| 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''' | | Slide: '''Transport Properties''' | ||
Line 374: | Line 374: | ||
Since the flow is '''inviscid''', '''viscosity''' and '''thermal conductivity''' effects are ignored. | 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'''. | ||
Line 449: | Line 449: | ||
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''' | ||
Line 524: | Line 524: | ||
In this tutorial, we have learnt to: | 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''' | | Slide: '''Assignment''' | ||
Line 533: | Line 533: | ||
As an 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: '''About the Spoken Tutorial Project''' | ||
Line 555: | Line 555: | ||
| 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: '''Acknowledgements''' |
Revision as of 18:01, 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 Objective |
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 |
The files used in this tutorial are available in the Code Files link on the tutorial page Please download and extract them Make a copy and then use them while practising. |
Slide: Convergent-Divergent Nozzle |
We will be solving flow through a convergent-divergent nozzle. Note that:
|
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 |
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 5o. It has 1 cell normal to the planes of symmetry. |
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. Similarly, 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:
|
[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.
|
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.
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 specified maximum Courant number. |
[gedit - controlDict] Highlight: maxCo 0.9 Link |
The maximum Courant number is set as 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 dropdown in the Active Variable Controls and select p. Click on the p option with a point icon and not the box icon, in the dropdown. |
[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 |
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 | 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. |