OpenFOAM-version-7/C2/Setting-up-a-Test-Case-in-OpenFOAM/English-timed

From Script | Spoken-Tutorial
Revision as of 13:21, 20 September 2022 by PoojaMoolya (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time Narration
00:01 Hello and welcome to this tutorial on Setting up a test case in OpenFOAM.
00:07 In this tutorial, we will learn to:

Set up a case in OpenFOAM

00:13 Access the case files using terminal
00:17 Pre-process a case
00:20 Run a case, and Post-process a case
00:25 This tutorial is recorded using,

Ubuntu Linux OS version 18.04

00:34 OpenFOAM version 7
00:37 ParaView version 5.6.0, and gedit Text editor
00:45 You may use any other text editor of your choice.
00:50 As a prerequisite: You should be familiar with basic Linux commands.
00:58 If not, please go through the prerequisite Linux tutorials on this website.
01:04 In this tutorial, we will learn to set up the lid driven cavity case.
01:10 Lid driven cavity is one of the most widely used 2D test cases for the validation of a CFD code.
01:19 This is the diagram of Lid Driven Cavity Flow.
01:24 It consists of 3 fixed walls and a moving top wall.
01:30 Open a terminal by pressing the Ctrl, Alt and T keys together.
01:37 Here onwards please remember to press the Enter key after typing each command.
01:44 Now, let’s create a RUN directory.
01:48 To do so, type the command as shown.
01:52 Tutorial cases will later be copied into the RUN directory.
01:57 Go to the RUN directory using the cd command.
02:02 Now our present working directory is the RUN directory.
02:07 OpenFOAM installation comes with a set of test cases.
02:12 The TUTORIALS directory contains these test cases.
02:17 The Lid driven cavity case already exists inside the TUTORIALS directory.
02:23 We’ll now copy the Lid driven cavity case from the TUTORIALS directory into the RUN directory.
02:31 To do so, type the following command.
02:36 The mesh generator for OpenFOAM is a utility called blockMesh.
02:42 The input dictionary for blockMesh utility is blockMeshDict.
02:49 The blockMeshDict file is located in the system folder.
02:55 Open the blockMeshDict file in a text editor.
03:00 Now let’s look at the contents of the file.
03:04 The blockMeshDict contains details of the geometry like vertices, blocks, edges and boundaries.
03:17 Close the blockMeshDict file.
03:20 The 0 folder contains the initial and boundary conditions for the simulation.
03:27 Type the following command to move into the 0 folder inside the cavity case directory.
03:35 Type ls and press Enter to view the files in the 0 folder.
03:41 The 0 folder contains the kinematic pressure file p and the velocity file U.
03:49 Open the kinematic pressure file p in a text editor.
03:54 The p file contains the initial and boundary conditions of kinematic pressure.
04:01 The dimensions of kinematic pressure is meter squared per second squared.
04:07 The internalField defines the values in the interior of the domain.
04:13 The initial field is set as 0 kinematic pressure.
04:17 This field is uniform across the domain.
04:21 You can see that all walls are imposed with a zero gradient pressure boundary condition.
04:29 Let us close the p file.
04:32 Now open the velocity file U in a text editor.
04:37 The U file contains the initial and boundary conditions of velocity.
04:43 You can see that the moving wall is imposed with a velocity of 1 m/s in the x direction.
04:52 Also notice that the no-slip condition is imposed on the three fixed walls.
04:59 Now let us close the U file.
05:02 We’ll go back to the cavity folder.

Type cd (space)(dot)(dot)

05:10 Next, we will view the transport properties file which is in the constant folder.
05:17 The transportProperties file contains the details of kinematic viscosity.
05:24 The dimensions of kinematic viscosity is meter squared per second.
05:30 The kinematic viscosity is defined by: nu equals magnitude of U times d by Re
05:41 where velocity is 1 m per second
05:45 characteristic length is 0.1 meters
05:50 The Reynolds number (Re) for the flow is taken as 10.
05:55 The kinematic viscosity is therefore 0.01 meter squared per second
06:01 Now let me switch back to transportProperties file.
06:05 The value of kinematic viscosity is indicated in the transportProperties file.
06:11 Close the transportProperties file.
06:14 To move into the system folder, type the following command.
06:19 Type ls to view the contents of the system folder.
06:24 The system folder contains the following files:

blockMeshDict, controlDict, fvSchemes and fvSolution.

06:37 The fvSchemes dictionary contains the finite volume discretisation schemes.
06:44 The fvSolution dictionary contains the linear equation solvers and tolerances.
06:51 It contains other algorithm controls as well.
06:56 The controlDict dictionary contains the simulation control parameters.
07:02 The dictionary input includes the control of time and reading and writing of the solution data.
07:09 Let’s open the controlDict file in a text editor.
07:14 The start and stop times and the time step for the run must be set.
07:21 The start time is set at 0 seconds.
07:25 The time at which the simulation stops, is specified using the keyword stopAt.
07:32 Here, stopAt is specified using the keyword endTime.
07:38 The endTime is set at 0.5 seconds.
07:43 This means that simulation stops after 0.5 seconds.
07:49 The value of the keyword deltaT defines the time step for the simulation.
07:56 The time step for the current simulation is set as 0.005 seconds.
08:03 Temporal accuracy and numerical stability is essential while running the simulation.
08:10 To achieve this, a Courant number of less than 1 is required.
08:16 Keeping this in mind, the time step is set to 0.005 seconds.
08:22 Please refer to the additional reading material on this tutorial page for details.
08:28 It mentions the steps used to calculate the time-step.
08:33 icoFoam is the OpenFOAM solver used to simulate the lid driven cavity flow.
08:39 Close the controlDict file.
08:42 Go back to the cavity folder using cd command.
08:47 Type the command blockMesh and press Enter to mesh the geometry.
08:53 The command takes input from the blockMeshDict dictionary and creates the geometry and meshes it.
09:01 The meshing is now complete.
09:04 The lid driven cavity flow is an incompressible flow.
09:09 It is solved using the OpenFOAM solver icoFoam.
09:14 To start the simulation, type icoFoam in the terminal.
09:20 The iterations are now complete.
09:23 Let us view the simulated results in ParaView.

So, type paraFoam in the terminal.

09:32 In the ParaView window, go to the Properties tab on the left.

Then click on the green coloured Apply button.

09:41 Go to the Active Variable Controls at the top.
09:46 Click on the vtkBlockColors dropdown and select U.
09:52 Ensure that you click on the U option with a point icon and not the box icon, in the dropdown.
10:00 The box icon would display contours without any grading.
10:04 The velocity contour at the start of the simulation is now displayed in the layout.
10:11 Let us see how the velocity contours develop through the simulation.
10:16 To do so, go to the VCR Controls and click on the Play button.
10:23 The velocity contour at the end of the simulation is now displayed in the layout.
10:30 Close the ParaView window.
10:34 With this we have come to the end of the tutorial.
10:36 To summarise, in this tutorial we have learnt to:
10:42 Set up a case in OpenFOAM
10:45 Access the case files using terminal
10:49 Pre-process a case

Run a case, and

10:54 Post-process a case
10:57 The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

11:05 We conduct workshops using Spoken Tutorials and give certificates.

Please contact us.

11:13 Please post your timed queries in this forum.
11:17 Do you have any general/technical questions?

Please visit the forum given in this link.

11:24 The FOSSEE team coordinates solving feasible CFD problems of reasonable complexity using OpenFOAM.
11:31 We give honorarium and certificates to those who do this.
11:35 For more details, please visit these sites.
11:39 The Spoken Tutorial project is supported by MHRD, Govt. of India.

The script for this tutorial is contributed by Ashley Melvin.

11:49 And this is Swetha Sridhar from IIT Bombay signing off.

Thank you for joining.

Contributors and Content Editors

PoojaMoolya