Difference between revisions of "OpenFOAM-version-7/C3/Simulating-1D-Conduction-through-a-Bar/English"
(Created page with "'''Title of the script''': Simulating 1-D Conduction through a Bar '''Author''': Mano Prithvi Raj '''Keywords''': OpenFOAM, ParaView, CFD, computational fluid dynamics, bloc...") |
|||
Line 4: | Line 4: | ||
'''Keywords''': OpenFOAM, ParaView, CFD, computational fluid dynamics, blockMesh, heat transfer, conduction, laplacianFoam, transport properties, FOSSEE, spoken tutorial, video tutorial | '''Keywords''': OpenFOAM, ParaView, CFD, computational fluid dynamics, blockMesh, heat transfer, conduction, laplacianFoam, transport properties, FOSSEE, spoken tutorial, video tutorial | ||
+ | |||
{| border=1 | {| border=1 | ||
− | |- | + | |- |
|| '''Visual Cue''' | || '''Visual Cue''' | ||
|| '''Narration''' | || '''Narration''' | ||
− | |- | + | |- |
− | || '''Slide''': | + | || '''Slide''': |
'''Opening Slide''' | '''Opening Slide''' | ||
|| Welcome to the spoken tutorial on '''Simulating 1D Conduction through a Bar'''. | || Welcome to the spoken tutorial on '''Simulating 1D Conduction through a Bar'''. | ||
− | |- | + | |- |
− | || '''Slide''': | + | || '''Slide''': |
'''Learning Objective''' | '''Learning Objective''' | ||
Line 22: | Line 23: | ||
* Simulate a '''conduction heat transfer case '''using a''' laplacianFoam''' solver | * Simulate a '''conduction heat transfer case '''using a''' laplacianFoam''' solver | ||
− | |- | + | |- |
|| Slide: '''System Specifications''' | || Slide: '''System Specifications''' | ||
|| To record this tutorial, I am using, | || To record this tutorial, I am using, | ||
Line 31: | Line 32: | ||
However, you may use any other editor of your choice. | However, you may use any other editor of your choice. | ||
− | |- | + | |- |
− | || '''Slide''': | + | || '''Slide''': |
'''Prerequisites''' | '''Prerequisites''' | ||
* If not, please go through the prerequisite '''OpenFOAM ''' tutorials on https://spoken-tutorial.org | * If not, please go through the prerequisite '''OpenFOAM ''' tutorials on https://spoken-tutorial.org | ||
+ | |||
|| As a prerequisite: | || As a prerequisite: | ||
Line 44: | Line 46: | ||
* If not, please go through the prerequisite '''OpenFOAM '''tutorial on this website. | * If not, please go through the prerequisite '''OpenFOAM '''tutorial on this website. | ||
− | |- | + | |- |
|| Slide: '''Code Files''' | || Slide: '''Code Files''' | ||
− | || | + | || |
− | * The files used in this tutorial are provided in the '''Code''' '''Files''' link on this tutorial | + | * The files used in this tutorial are provided in the '''Code''' '''Files''' link on this 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''': |
'''Geometry''' | '''Geometry''' | ||
Line 58: | Line 60: | ||
* The bar is '''1 meter '''long. | * The bar is '''1 meter '''long. | ||
− | |- | + | |- |
|| Slide: '''Geometry''' | || Slide: '''Geometry''' | ||
− | || | + | || |
* The '''left face''' is maintained at a higher temperature compared to the '''right face'''. | * The '''left face''' is maintained at a higher temperature compared to the '''right face'''. | ||
* The '''top''' and '''bottom faces''' of the bar are '''adiabatic'''. | * The '''top''' and '''bottom faces''' of the bar are '''adiabatic'''. | ||
Line 66: | Line 68: | ||
* We will simulate this case using the '''laplacianFoam solver'''. | * We will simulate this case using the '''laplacianFoam solver'''. | ||
− | |- | + | |- |
|| Only Narration | || Only Narration | ||
|| Let’s look at the structure of '''laplacianFoam ''' and how its equations are modeled. | || Let’s look at the structure of '''laplacianFoam ''' and how its equations are modeled. | ||
− | |- | + | |- |
|| Slide: '''laplacianFoam''' | || Slide: '''laplacianFoam''' | ||
− | || | + | || |
* '''laplacianFoam '''is a basic '''OpenFOAM '''solver | * '''laplacianFoam '''is a basic '''OpenFOAM '''solver | ||
* '''laplacianFoam''' solves simple Laplace equations | * '''laplacianFoam''' solves simple Laplace equations | ||
* An example of such an equation is thermal diffusion in a solid | * An example of such an equation is thermal diffusion in a solid | ||
− | |- | + | |- |
− | || '''Slide''': | + | || '''Slide''': |
'''laplacianFoam''' | '''laplacianFoam''' | ||
Line 86: | Line 88: | ||
where, | where, | ||
− | * '''alpha''' is the''' thermal diffusivity''' | + | * '''alpha''' is the''' thermal diffusivity''' |
− | * '''T '''is | + | * '''T '''is temperature |
− | |- | + | |- |
|| Point to the equation. | || Point to the equation. | ||
|| Let’s see how this equation is implemented in '''OpenFOAM''' | || Let’s see how this equation is implemented in '''OpenFOAM''' | ||
− | |- | + | |- |
|| CTRL + ALT + T | || CTRL + ALT + T | ||
|| Open the '''terminal''' by pressing '''Ctrl''', '''Alt''' & '''T''' keys. | || Open the '''terminal''' by pressing '''Ctrl''', '''Alt''' & '''T''' keys. | ||
− | |- | + | |- |
|| [Terminal] Type: | || [Terminal] Type: | ||
'''cd $FOAM_SOLVERS''' | '''cd $FOAM_SOLVERS''' | ||
|| Type the following '''command''' and press '''Enter''' to move into the '''solvers directory'''. | || Type the following '''command''' and press '''Enter''' to move into the '''solvers directory'''. | ||
− | |- | + | |- |
|| [Terminal] Type: | || [Terminal] Type: | ||
'''cd basic/laplacianFoam''' | '''cd basic/laplacianFoam''' | ||
|| Type this '''command''' and press '''Enter''' to move into the''' directory '''of '''laplacianFoam'''. | || Type this '''command''' and press '''Enter''' to move into the''' directory '''of '''laplacianFoam'''. | ||
− | |- | + | |- |
|| [Terminal] Type: '''ls''' | || [Terminal] Type: '''ls''' | ||
|| Type '''ls '''to view the files present in the '''laplacianFoam '''directory. | || Type '''ls '''to view the files present in the '''laplacianFoam '''directory. | ||
− | |- | + | |- |
|| [Terminal] Type: | || [Terminal] Type: | ||
'''gedit laplacianFoam.C''' | '''gedit laplacianFoam.C''' | ||
|| Type the following command to open the '''source code '''for '''laplacianFoam'''. | || Type the following command to open the '''source code '''for '''laplacianFoam'''. | ||
− | |- | + | |- |
|| [gedit '''laplacianFoam.C'''] Highlight: | || [gedit '''laplacianFoam.C'''] Highlight: | ||
Line no. 62 to 67 | Line no. 62 to 67 | ||
|| This is the code for solving the '''laplace '''equation in every timestep. | || This is the code for solving the '''laplace '''equation in every timestep. | ||
− | |- | + | |- |
|| [gedit '''laplacianFoam.C'''] Highlight: | || [gedit '''laplacianFoam.C'''] Highlight: | ||
'''fvm::ddt(T)''' | '''fvm::ddt(T)''' | ||
|| The first term represents the time derivative for temperature field '''T'''. | || The first term represents the time derivative for temperature field '''T'''. | ||
− | |- | + | |- |
|| [gedit '''laplacianFoam.C'''] Highlight: | || [gedit '''laplacianFoam.C'''] Highlight: | ||
'''fvm::laplacian(DT,T)''' | '''fvm::laplacian(DT,T)''' | ||
− | || The second term represents the '''laplacian''' of temperature field '''T'''. | + | || The second term represents the '''laplacian''' of temperature field '''T'''. |
'''DT '''stands for thermal diffusivity. | '''DT '''stands for thermal diffusivity. | ||
− | |- | + | |- |
|| [gedit '''laplacianFoam.C'''] Highlight: | || [gedit '''laplacianFoam.C'''] Highlight: | ||
'''fvModels.source(T)''' | '''fvModels.source(T)''' | ||
− | || The last term is on the right hand side of the equation. | + | || The last term is on the right hand side of the equation. |
It is used to add source terms to the equation. | It is used to add source terms to the equation. | ||
− | |- | + | |- |
|| Click on Close to close the gedit file. | || Click on Close to close the gedit file. | ||
− | || Let’s move on to the simulation. | + | || Let’s move on to the simulation. |
− | You can now close gedit. | + | You can now close gedit. |
− | |- | + | |- |
|| [Terminal] Type: | || [Terminal] Type: | ||
'''cd $FOAM_RUN''' | '''cd $FOAM_RUN''' | ||
|| Type the following '''command''' and press '''Enter''' to move into the '''run directory'''. | || Type the following '''command''' and press '''Enter''' to move into the '''run directory'''. | ||
− | |- | + | |- |
|| [Terminal]: '''Ctrl + L''' | || [Terminal]: '''Ctrl + L''' | ||
|| Press '''Ctrl''' and '''L''' keys together to clear the screen | || Press '''Ctrl''' and '''L''' keys together to clear the screen | ||
|- | |- | ||
||Only Narration | ||Only Narration | ||
− | ||Please remember to press '''Enter''' key after typing each '''command''' in the '''terminal'''. | + | ||Please remember to press '''Enter''' key after typing each '''command''' in the '''terminal'''. |
− | |- | + | |- |
|| [Terminal] Type: '''cp -r ~/Downloads/conductionBar .''' | || [Terminal] Type: '''cp -r ~/Downloads/conductionBar .''' | ||
− | || Copy the case folder that you had downloaded and extracted, into the '''run directory'''. | + | || Copy the case folder that you had downloaded and extracted, into the '''run directory'''. |
− | |- | + | |- |
|| [Terminal] Highlight: | || [Terminal] Highlight: | ||
+ | |||
'''Downloads/conductionBar''' | '''Downloads/conductionBar''' | ||
Line 167: | Line 170: | ||
Please use the appropriate '''command''' while copying the folder. | Please use the appropriate '''command''' while copying the folder. | ||
− | |- | + | |- |
− | || [Terminal] Type: | + | || [Terminal] Type: |
'''cd conductionBar''' | '''cd conductionBar''' | ||
|| Let’s move into the case folder using the '''cd''' '''command'''. | || Let’s move into the case folder using the '''cd''' '''command'''. | ||
− | |- | + | |- |
|| Slide: '''Boundaries''' | || Slide: '''Boundaries''' | ||
|| The '''computational domain''' has '''4 boundaries''', namely '''top''', '''bottom''', '''left''', and '''right'''. | || The '''computational domain''' has '''4 boundaries''', namely '''top''', '''bottom''', '''left''', and '''right'''. | ||
Line 178: | Line 181: | ||
All '''4 boundaries''' are '''fixed'''. | All '''4 boundaries''' are '''fixed'''. | ||
− | |- | + | |- |
|| [Terminal Type]: | || [Terminal Type]: | ||
gedit system/blockMeshDict | gedit system/blockMeshDict | ||
|| The details of the '''mesh''' can be found in the '''blockMeshDict''' file in the '''system folder'''. | || The details of the '''mesh''' can be found in the '''blockMeshDict''' file in the '''system folder'''. | ||
+ | |||
Type the following command to open '''blockMeshDict '''in a text editor. | Type the following command to open '''blockMeshDict '''in a text editor. | ||
− | |- | + | |- |
|| [gedit blockMeshDict] | || [gedit blockMeshDict] | ||
'''Point to vertices''' | '''Point to vertices''' | ||
|| These are the '''vertices''' used to make a rectangular '''domain'''. | || These are the '''vertices''' used to make a rectangular '''domain'''. | ||
− | |- | + | |- |
|| [gedit blockMeshDict] | || [gedit blockMeshDict] | ||
Line 198: | Line 202: | ||
||We have a single block with 20 cells only in the x-direction. | ||We have a single block with 20 cells only in the x-direction. | ||
− | |- | + | |- |
|| [gedit blockMeshDict] | || [gedit blockMeshDict] | ||
'''Point to boundary''' | '''Point to boundary''' | ||
|| The four boundaries '''top, bottom, left''' and '''right''' are defined as type wall. | || The four boundaries '''top, bottom, left''' and '''right''' are defined as type wall. | ||
+ | |||
The boundary''' frontAndBack''' is kept empty as we are doing a '''1D simulation'''. | The boundary''' frontAndBack''' is kept empty as we are doing a '''1D simulation'''. | ||
− | |- | + | |- |
|| [gedit blockMeshDict] | || [gedit blockMeshDict] | ||
Click on Close to close the gedit file | Click on Close to close the gedit file | ||
|| Close the blockMeshDict file. | || Close the blockMeshDict file. | ||
− | |- | + | |- |
|| Slide: '''Boundary Conditions''' | || Slide: '''Boundary Conditions''' | ||
|| The '''boundary conditions '''used in the '''simulation''' are as shown in the table. | || The '''boundary conditions '''used in the '''simulation''' are as shown in the table. | ||
− | * The '''left face''' is maintained at '''373 | + | * The '''left face''' is maintained at '''373 K''', |
− | * The '''right face''' is maintained at '''273 | + | * The '''right face''' is maintained at '''273 K''', and |
− | * The '''top''' and '''bottom faces''' are '''adiabatic'''. | + | * The '''top''' and '''bottom faces''' are '''adiabatic'''. |
Therefore, they have '''zero gradient temperature boundary conditions'''. | Therefore, they have '''zero gradient temperature boundary conditions'''. | ||
Line 222: | Line 227: | ||
* The '''front''' and''' back '''faces are of type empty, as we are running a '''1D''' simulation. | * The '''front''' and''' back '''faces are of type empty, as we are running a '''1D''' simulation. | ||
− | |- | + | |
+ | |- | ||
|| Only Narration | || Only Narration | ||
− | || Let’s see how the '''boundary conditions''' are defined in '''OpenFOAM'''. | + | || Let’s see how the '''boundary conditions''' are defined in '''OpenFOAM'''. |
− | |- | + | |- |
|| [Terminal] Type: | || [Terminal] Type: | ||
Line 232: | Line 238: | ||
Let’s view its contents. | Let’s view its contents. | ||
− | |- | + | |- |
|| [Terminal] Highlight: | || [Terminal] Highlight: | ||
'''T''' | '''T''' | ||
|| You’ll see a '''temperature''' '''file'''. | || You’ll see a '''temperature''' '''file'''. | ||
− | |- | + | |- |
|| [Terminal] Type: '''gedit 0/T''' | || [Terminal] Type: '''gedit 0/T''' | ||
|| Let’s open the '''temperature file''', '''T'''. | || Let’s open the '''temperature file''', '''T'''. | ||
− | |- | + | |- |
|| [gedit - '''T'''] Highlight: | || [gedit - '''T'''] Highlight: | ||
'''internalField uniform 273 ''' | '''internalField uniform 273 ''' | ||
− | || The '''domain''' is '''initialized''' with a temperature of '''273 | + | || The '''domain''' is '''initialized''' with a temperature of '''273 K'''. |
− | |- | + | |- |
− | || [gedit - '''T'''] Highlight: | + | || [gedit - '''T'''] Highlight: |
'''bottom '''boundary condition | '''bottom '''boundary condition | ||
− | || The '''left face''' is maintained at a '''constant temperature''' of '''373 | + | || The '''left face''' is maintained at a '''constant temperature''' of '''373 K'''. |
− | |- | + | |- |
− | || [gedit - '''T'''] Highlight: | + | || [gedit - '''T'''] Highlight: |
'''top '''boundary condition | '''top '''boundary condition | ||
− | || The '''right face''' is maintained at a '''temperature''' of '''273 | + | || The '''right face''' is maintained at a '''temperature''' of '''273 K'''. |
− | |- | + | |- |
− | || [gedit - '''T'''] Highlight: | + | || [gedit - '''T'''] Highlight: |
'''left '''&''' right '''boundary condition | '''left '''&''' right '''boundary condition | ||
|| The '''top''' & '''bottom''' have '''zero gradient temperature boundary condition'''. | || The '''top''' & '''bottom''' have '''zero gradient temperature boundary condition'''. | ||
− | |- | + | |- |
− | || [gedit - '''T'''] Highlight: | + | || [gedit - '''T'''] Highlight: |
'''“faces” “frontAndBack”''' | '''“faces” “frontAndBack”''' | ||
|| Since we are simulating a '''1D '''problem, '''frontAndBack '''is set to empty. | || Since we are simulating a '''1D '''problem, '''frontAndBack '''is set to empty. | ||
− | |- | + | |- |
|| [gedit - '''T'''] Close the window | || [gedit - '''T'''] Close the window | ||
|| Close the '''T file'''. | || Close the '''T file'''. | ||
− | |- | + | |- |
|| [Terminal] Type: | || [Terminal] Type: | ||
'''ls constant''' | '''ls constant''' | ||
|| Let’s now see the contents of the '''constant''' folder using the '''ls command'''. | || Let’s now see the contents of the '''constant''' folder using the '''ls command'''. | ||
− | |- | + | |- |
|| [Terminal] Highlight: | || [Terminal] Highlight: | ||
'''transportProperties''' | '''transportProperties''' | ||
|| We can see the '''transportProperties '''file in the '''constant''' folder. | || We can see the '''transportProperties '''file in the '''constant''' folder. | ||
− | |- | + | |- |
|| [Terminal] Type: '''gedit constant/transportProperties''' | || [Terminal] Type: '''gedit constant/transportProperties''' | ||
|| Let’s open the '''transportProperties '''file. | || Let’s open the '''transportProperties '''file. | ||
− | |- | + | |- |
− | || [gedit - '''transportProperties'''] Highlight: | + | || [gedit - '''transportProperties'''] Highlight: |
'''“DT”''' | '''“DT”''' | ||
− | || In the '''transportProperties '''file, we can see a property, '''DT'''. | + | || In the '''transportProperties '''file, we can see a property, '''DT'''. |
− | '''DT''' stands for '''thermal diffusivity'''. | + | '''DT''' stands for '''thermal diffusivity'''. |
− | |- | + | |- |
|| [gedit - '''transportProperties'''] Close the window | || [gedit - '''transportProperties'''] Close the window | ||
|| Close the file. | || Close the file. | ||
− | |- | + | |- |
|| [terminal]: type '''clear''' | || [terminal]: type '''clear''' | ||
|| Clear the screen with the '''clear''' command. | || Clear the screen with the '''clear''' command. | ||
− | |- | + | |- |
|| Only narration | || Only narration | ||
|| Let’s simulate the problem in '''OpenFOAM'''. | || Let’s simulate the problem in '''OpenFOAM'''. | ||
− | |- | + | |- |
|| [Terminal] Type: '''blockMesh''' | || [Terminal] Type: '''blockMesh''' | ||
|| First, let’s '''mesh''' the geometry using the '''blockMesh''' '''command'''. | || First, let’s '''mesh''' the geometry using the '''blockMesh''' '''command'''. | ||
− | |- | + | |- |
|| [Terminal] Type: '''laplacianFoam''' | || [Terminal] Type: '''laplacianFoam''' | ||
|| Let’s start the '''simulation''' using the following '''command'''. | || Let’s start the '''simulation''' using the following '''command'''. | ||
− | |- | + | |
+ | |- | ||
|| [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'''. | ||
− | |- | + | |- |
|| [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 '''T ''' | Click on '''vtkBlockColors''' >> Click on '''T ''' | ||
+ | |||
|| Let’s view the '''temperature contours''' for the simulation. | || Let’s view the '''temperature contours''' for the simulation. | ||
+ | |||
Click on the '''vtkBlockColors''' dropdown in the '''Active Variable Controls''' and select '''T'''. | Click on the '''vtkBlockColors''' dropdown in the '''Active Variable Controls''' and select '''T'''. | ||
+ | |||
Ensure that you click on the '''T''' option with a '''point icon''' and not the '''box icon''', in the dropdown. | Ensure that you click on the '''T''' option with a '''point icon''' and not the '''box icon''', in the dropdown. | ||
− | |- | + | |- |
|| [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'''. | ||
− | |- | + | |- |
|| [ParaView] '''Layout Window''' | || [ParaView] '''Layout Window''' | ||
+ | |||
Point to Circulation | Point to Circulation | ||
|| We can see the dissipation of heat from the hot end of the bar to the cold end. | || We can see the dissipation of heat from the hot end of the bar to the cold end. | ||
+ | |||
The temperature changes linearly as we move from left to the right of the bar. | The temperature changes linearly as we move from left to the right of the bar. | ||
+ | |||
This is indicated as the color gradually changes from red to blue from left to right. | This is indicated as the color gradually changes from red to blue from left to right. | ||
|- | |- | ||
− | || [ParaView] | + | || [ParaView] |
'''Data Analysis =>''' Click on '''plot over line filter''' | '''Data Analysis =>''' Click on '''plot over line filter''' | ||
+ | |||
||Now, let us plot the temperature''' '''along the length of the rod. | ||Now, let us plot the temperature''' '''along the length of the rod. | ||
+ | |||
Click on the''' plot over line''' icon located on top of the screen as shown. | Click on the''' plot over line''' icon located on top of the screen as shown. | ||
|- | |- | ||
− | || [ParaView] | + | || [ParaView] |
+ | |||
'''Properties''' '''Tab =>''' Click on '''x-axis''' | '''Properties''' '''Tab =>''' Click on '''x-axis''' | ||
+ | |||
'''&&''' | '''&&''' | ||
+ | |||
'''Properties''' '''Tab =>''' Click on '''Apply ''' | '''Properties''' '''Tab =>''' Click on '''Apply ''' | ||
||Click on the x-axis and then click on the Apply''' button.''' | ||Click on the x-axis and then click on the Apply''' button.''' | ||
+ | |||
As we can see from the graph, the temperature variation is linear. | As we can see from the graph, the temperature variation is linear. | ||
− | |- | + | |- |
|| 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''': | + | || '''Slide''': |
'''Summary''' | '''Summary''' | ||
Line 379: | Line 404: | ||
* Post-process results in paraview. | * Post-process results in paraview. | ||
− | |- | + | |- |
− | || '''Slide''': | + | || '''Slide''': |
'''Assignment''' | '''Assignment''' | ||
Line 389: | Line 414: | ||
* Keep all the other parameters unaltered in your '''simulation''' | * Keep all the other parameters unaltered in your '''simulation''' | ||
− | |- | + | |- |
− | || '''Slide''': | + | || '''Slide''': |
'''Assignment''' | '''Assignment''' | ||
[next slide of assignment] | [next slide of assignment] | ||
− | || | + | || |
* Simulate the heat transfer through this bar | * Simulate the heat transfer through this bar | ||
* View the temperature contours | * View the temperature contours | ||
Line 401: | Line 426: | ||
|- | |- | ||
− | ||'''Slide''': | + | ||'''Slide''': |
'''About the Spoken Tutorial Project''' | '''About the Spoken Tutorial Project''' | ||
Line 408: | Line 433: | ||
Please download and watch it. | Please download and watch it. | ||
|- | |- | ||
− | ||'''Slide''': | + | ||'''Slide''': |
'''Spoken Tutorial Workshops''' | '''Spoken Tutorial Workshops''' | ||
Line 415: | Line 440: | ||
Please contact us. | Please contact us. | ||
|- | |- | ||
− | ||'''Slide''': | + | ||'''Slide''': |
'''Spoken Tutorial Forum''' | '''Spoken Tutorial Forum''' | ||
||Please post your timed queries in this forum. | ||Please post your timed queries in this forum. | ||
|- | |- | ||
− | ||'''Slide''': | + | ||'''Slide''': |
'''FOSSEE Forum''' | '''FOSSEE Forum''' | ||
Line 428: | Line 453: | ||
|- | |- | ||
− | ||'''Slide''': | + | ||'''Slide''': |
'''FOSSEE Case Study Project''' | '''FOSSEE Case Study Project''' |
Revision as of 15:33, 16 October 2023
Title of the script: Simulating 1-D Conduction through a Bar
Author: Mano Prithvi Raj
Keywords: OpenFOAM, ParaView, CFD, computational fluid dynamics, blockMesh, heat transfer, conduction, laplacianFoam, transport properties, FOSSEE, spoken tutorial, video tutorial
Visual Cue | Narration |
Slide:
Opening Slide |
Welcome to the spoken tutorial on Simulating 1D Conduction through a Bar. |
Slide:
Learning Objective |
In this tutorial, we will learn to:
|
Slide: System Specifications | To record this tutorial, I am using,
However, you may use any other editor of your choice. |
Slide:
Prerequisites
|
As a prerequisite:
|
Slide: Code Files |
|
Slide:
Geometry |
We will be solving a 1D Conduction Problem.
|
Slide: Geometry |
|
Only Narration | Let’s look at the structure of laplacianFoam and how its equations are modeled. |
Slide: laplacianFoam |
|
Slide:
laplacianFoam Highlight: Laplacian Equation |
This is the equation implemented in laplacianFoam:
where,
|
Point to the equation. | Let’s see how this equation is implemented in OpenFOAM |
CTRL + ALT + T | Open the terminal by pressing Ctrl, Alt & T keys. |
[Terminal] Type:
cd $FOAM_SOLVERS |
Type the following command and press Enter to move into the solvers directory. |
[Terminal] Type:
cd basic/laplacianFoam |
Type this command and press Enter to move into the directory of laplacianFoam. |
[Terminal] Type: ls | Type ls to view the files present in the laplacianFoam directory. |
[Terminal] Type:
gedit laplacianFoam.C |
Type the following command to open the source code for laplacianFoam. |
[gedit laplacianFoam.C] Highlight:
Line no. 62 to 67 |
This is the code for solving the laplace equation in every timestep. |
[gedit laplacianFoam.C] Highlight:
fvm::ddt(T) |
The first term represents the time derivative for temperature field T. |
[gedit laplacianFoam.C] Highlight:
fvm::laplacian(DT,T) |
The second term represents the laplacian of temperature field T.
DT stands for thermal diffusivity. |
[gedit laplacianFoam.C] Highlight:
fvModels.source(T) |
The last term is on the right hand side of the equation.
It is used to add source terms to the equation. |
Click on Close to close the gedit file. | Let’s move on to the simulation.
You can now close gedit. |
[Terminal] Type:
cd $FOAM_RUN |
Type the following command and press Enter to move into the run directory. |
[Terminal]: Ctrl + L | Press Ctrl and L keys together to clear the screen |
Only Narration | Please remember to press Enter key after typing each command in the terminal. |
[Terminal] Type: cp -r ~/Downloads/conductionBar . | Copy the case folder that you had downloaded and extracted, into the run directory. |
[Terminal] Highlight:
|
In my system, the case folder named conductionBar is located in the Downloads folder.
The location of the case folder may be different for you. Please use the appropriate command while copying the folder. |
[Terminal] Type:
cd conductionBar |
Let’s move into the case folder using the cd command. |
Slide: Boundaries | The computational domain has 4 boundaries, namely top, bottom, left, and right.
All 4 boundaries are fixed. |
[Terminal Type]:
gedit system/blockMeshDict |
The details of the mesh can be found in the blockMeshDict file in the system folder.
|
[gedit blockMeshDict]
Point to vertices |
These are the vertices used to make a rectangular domain. |
[gedit blockMeshDict]
Point to blocks |
We have a single block with 20 cells only in the x-direction. |
[gedit blockMeshDict]
Point to boundary |
The four boundaries top, bottom, left and right are defined as type wall.
|
[gedit blockMeshDict]
Click on Close to close the gedit file |
Close the blockMeshDict file. |
Slide: Boundary Conditions | The boundary conditions used in the simulation are as shown in the table.
Therefore, they have zero gradient temperature boundary conditions.
|
Only Narration | Let’s see how the boundary conditions are defined in OpenFOAM. |
[Terminal] Type:
ls 0 |
The boundary conditions are defined in 0 folder.
Let’s view its contents. |
[Terminal] Highlight:
T |
You’ll see a temperature file. |
[Terminal] Type: gedit 0/T | Let’s open the temperature file, T. |
[gedit - T] Highlight:
internalField uniform 273 |
The domain is initialized with a temperature of 273 K. |
[gedit - T] Highlight:
bottom boundary condition |
The left face is maintained at a constant temperature of 373 K. |
[gedit - T] Highlight:
top boundary condition |
The right face is maintained at a temperature of 273 K. |
[gedit - T] Highlight:
left & right boundary condition |
The top & bottom have zero gradient temperature boundary condition. |
[gedit - T] Highlight:
“faces” “frontAndBack” |
Since we are simulating a 1D problem, frontAndBack is set to empty. |
[gedit - T] Close the window | Close the T file. |
[Terminal] Type:
ls constant |
Let’s now see the contents of the constant folder using the ls command. |
[Terminal] Highlight:
transportProperties |
We can see the transportProperties file in the constant folder. |
[Terminal] Type: gedit constant/transportProperties | Let’s open the transportProperties file. |
[gedit - transportProperties] Highlight:
“DT” |
In the transportProperties file, we can see a property, DT.
DT stands for thermal diffusivity. |
[gedit - transportProperties] Close the window | Close the file. |
[terminal]: type clear | Clear the screen with the clear command. |
Only narration | Let’s simulate the problem in OpenFOAM. |
[Terminal] Type: blockMesh | First, let’s mesh the geometry using the blockMesh command. |
[Terminal] Type: laplacianFoam | Let’s start the simulation using the following command.
|
[Terminal] Highlight: End | The simulation is now complete. |
[Terminal] Type: paraFoam | Let’s view the simulated results in ParaView. |
[ParaView] Properties Tab
Click on Apply |
Click on the Apply button to view the geometry. |
[ParaView] Active Variable Controls
|
Let’s view the temperature contours for the simulation.
|
[ParaView] VCR Controls
|
Let’s view the contours at the end of the simulation.
|
[ParaView] Layout Window
|
We can see the dissipation of heat from the hot end of the bar to the cold end.
|
[ParaView]
Data Analysis => Click on plot over line filter
|
Now, let us plot the temperature along the length of the rod.
|
[ParaView]
|
Click on the x-axis and then click on the Apply button.
|
Only Narration | With this we have come to the end of the tutorial.
|
Slide:
Summary |
In this tutorial, we have learnt to:
|
Slide:
Assignment |
As an assignment:
|
Slide:
Assignment [next slide of assignment] |
|
Slide:
About the Spoken Tutorial Project |
The video at the following link summarizes 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 |
|
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 Mano Prithvi Raj, Aabhushan Regmi and Payel Mukherjee from IIT Bombay. Thank you for joining. |