OpenFOAM-version-7/C2/Basic-Post-Processing-using-ParaView/English

From Script | Spoken-Tutorial
Revision as of 10:25, 23 July 2020 by Divyesh7 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Title of the script: Basic Post Processing using ParaView

Author: Divyesh Variya

Keywords: OpenFOAM, Hagen Poiseuille, Paraview, Clip, Streamline, Glyph, Plot-over-line, Parabolic profile, Video-Tutorial


Visual Cue Narration
Slide: Opening Slide Hello and welcome to this tutorial on Basic Post Processing using ParaView.
Slide: Learning Objective In this tutorial, we will learn,
  • Some basic visualization techniques in ParaView
  • Export the field data to .csv file
  • Plot a graph in LibreOffice Suite Calc and
  • Save a screenshot of a view
Slide: System Specifications To record this tutorial, I am using,
  • Ubuntu Linux OS version 18.04
  • OpenFOAM version 7
  • ParaView version 5.6.0 and
  • LibreOffice Suite 6.4
Slide: Prerequisites* Please go through these two tutorials on https://spoken-tutorial.org As a prerequisite learner should practise,
  • On Simulating Hagen Poiseuille Flow through a Pipe from the OpenFOAM tutorials and
  • Tutorial on Using Charts and Graphs from LibreOffice Suite Calc
  • Please go through these two tutorials on this website.
Press Ctrl + Alt + T keys Open the terminal by pressing the Ctrl, Alt and T keys together.
Only Narration From now onwards please remember to press the Enter key after typing each command.
[Terminal] Type:

cd $FOAM_RUN

At the prompt, type the following command to go to the run directory.
[Terminal] Type:

cd pipe

Navigate to the pipe case folder.

We have created this in the “Simulating Hagen Poiseuille Flow through Pipe” tutorial.

[Terminal] Type: paraFoam Type paraFoam in the terminal to open the case file in paraView.
[ParaView]

Uncheck >> inlet and outlet

Go to the properties panel.

Scroll down and locate the mesh parts section.

Uncheck all patches other than internalMesh.

[ParaView] Click on Apply Click on the Apply button in the Properties panel.
[ParaView]

Click on Solid Color >> Click on U

Click on Solid Color available in the Active Variable Controls.

From here, we can change the fields that we want to visualize.

Select the U field with the dot, not the one with the box.

[ParaView]

Click on Last Frame

From VCR Controls, we can change the time steps and run animation using the Play button.

Currently we are on 0 time, which is for the initial field.

To go to the last time step, click on the Last Frame button.

Show Picture of ICONS As you can see, some filter icons are shown here.
[ParaView]

Click on Stream Tracer filter

To visualize streamline, click on the Stream tracer icon from Common and Data Analysis Filters.
[ParaView]

Change seed type to point source

From the Properties panel we can change the seed type.

The two seed types available are:

  • High resolution line source and
  • Point Source

High resolution Line Source gives streamlines passing through a line.

Point Source gives streamlines passing through a sphere.

We will select Point Source.

[ParaView]

Set number of points to 1000 >>

Uncheck Show Sphere checkbox

Set the number of points to 1000 and uncheck the Show Sphere option to hide the sphere.
[ParaView]

Click on Apply

Click on the Apply button in the Properties panel.

We can see 1000 streamlines passing through 1000 random points within the sphere.

[ParaView]

Click on Delete button

This way we can visualize the streamline.

Now Delete the Stream Tracer filter by clicking on the Delete button on the Properties panel.

[ParaView] Click on Glyph filter Click on the Glyph icon from Common and Data Analysis Filters.
[ParaView]

Change Orientation U

Change Orientation Array to U from the Properties panel.
[ParaView] Scale array U Change Scale array to U in the Properties panel.
[ParaView] Click on Apply Click on the Apply button in the Properties panel.
[ParaView]

Hide pipe.OpenFOAM

Hide pipe.OpenFOAM from the pipeline browser by clicking on the eye icon.
[ParaView]

Zoom in render layout with left mouse click and drag

We can see Arrows in the direction of the flow.
[ParaView] Delete Glyph filter Delete the Glyph filter from the Properties panel.
[ParaView] Click on Clip filter Click on the clip icon from Common and Data Analysis Filters to clip the mesh.
[ParaView]

Uncheck Show plane and invert

Uncheck “Show Plane” and “invert” boxes from the Properties panel.
[ParaView] Click on Apply Click on the Apply button in the Properties panel.
Only Narration This way we can clip any mesh and visualize internal flow.
[ParaView] Delete Clip filter Delete the Clip filter from the Properties panel.
[ParaView]

Click on Plot Over Line Filter

Click on the “Plot Over Line” filter from Common and Data Analysis Filters.
[ParaView]

Click on Y Axis

Click on Y Axis on the Properties panel and click Apply.
[ParaView]Highlight

Line Chart view window

A new line chart window opens automatically with P and U_Magnitude graphs.
[ParaView]

Scroll properties panel and uncheck p from series parameter

In the Properties panel, scroll down and locate the series parameters section.

Uncheck P from that.

[ParaView] Highlight

Line Chart view window

We will get a parabolic profile for velocity in the graph.
[ParaView] Click on Line chart view window

Press CTRL+S

Click on the Line Chart View window

And press Ctrl+S keys to save data.

[Save File:]

Select file type as .csv

give name - Y-Axis

Select Files of type as .csv and give the file name Y(hyphen)Axis.
[Save File:]

Click >> OK

Click on OK.

Again click on OK with default settings.

Only Narration The data is saved in a .csv file.

We can open this file in LibreOffice Calc and compare with an analytical solution.

[ParaView]

Click on File >> Save Screenshot...

Now go to the File menu in the menu bar and select Save Screenshot.
[ParaView]

File name - velocity

File type - .png

Give a File Name and select file type.

Here I am saving the screenshot as velocity with the .png file type.

[ParaView] Click >> OK Click on the OK button.
[ParaView]

Click >> OK

The Save Screenshot option window pops up.

We can change the size, scaling, coloring and other image options here.

With the default values in the settings, click on the OK button.

Only Narration Screenshot of Parabolic curve profile is saved in our case directory.
[ParaView]

Click on Z Axis

Go to the Properties panel.

Click on Z Axis and then click on the Apply button.

[ParaView]

Uncheck U_Magnitude and check p

Then go to the series parameter section in the Properties panel.

Uncheck U_Magnitude field and check p field.

[ParaView]

Press CTRL+S

Select .csv file type

Give a name - Z-Axis

Press OK

Press OK

Save this data to Z-Axis.csv file as explained earlier.
[ParaView] Close ParaView Close the ParaView window.
Open File explorer Open the File explorer from the taskbar.
[File explorer]

Open >> OpenFOAM

Open the OpenFOAM directory.

Here we can see the username directory of our computer.

[File explorer]

Open >> “username directory”

Now open your current user directory.

In the user directory we can see the “run” directory.

[File explorer]

Open >> run

Open the “run” directory.

Our saved work is available here in the pipe directory.

[File explorer] Open >> pipe Now open the pipe directory.
Only Narration Here we can see all files including screenshot image and .csv files that we have saved.
[File explorer]

Right click on >> Z-Axis.csv

Right click on Z-Axis.csv file.
[File explorer]

Click on >> Open With Other Application

From the list, click on the “Open With Other Application” option.
[File explorer]

Click on >> View All Application

Now click on the “View All Application” button.
[File explorer]

Double click on >> LibreOffice Calc

A list of all the applications available in your computer will appear.

From this list find “LibreOffice Calc” and double click on it.

[File explorer]

Click on >> OK

A “Text Import” window will open on your screen.

At the bottom right corner click on the OK button.

Highlight LibreOffice suite calc Our file is now open in LibreOffice Calc.
[LibreOffice suite calc]

Highlight cells

We have

velocity U:0 at Point:0

Velocity U:1 at Point:1 and

Velocity U:2 at Point:2.

[LibreOffice suite calc]

Highlight cells

We have kinematic pressure p, vtkValidPointMask and arc_length also.
[LibreOffice suite calc]

Highlight cells

Necessary data to plot the graph is U:2, Point:2 and p.
[LibreOffice suite calc]

Show Graphs

For this demonstration I have created a graph on z-axis versus kinematic pressure.

And another graph for z-axis versus velocity.

[LibreOffice suite calc]

Show Graphs

In the same way I have created a y-axis versus velocity graph with a y-axis.csv file.
Only Narration Here you can also compare analytical solutions with OpenFoam solutions.
Only Narration With this we have come to the end of the tutorial.

Let us summarize.

Slide: Summary In this tutorial, we have learnt,
  • Some basic visualization techniques in ParaView
  • Export field data to .csv file
  • Plot graph in LibreOffice suite calc and
  • Save screenshot of a view
Slide: Assignment As an assignment:
  • Simulate the Hagen Poiseuille flow for the pipe of 0.5 cm diameter with
  • Inlet velocity 0.05 m/s and outlet pressure 0 Pascal and,
  • Plot graphs of velocity and pressure in ParaView and LibreOffice Calc.
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 on this website
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: Spoken Tutorial The Spoken Tutorial project is supported by MHRD, Govt. of India.

The script for this tutorial is contributed by Divyesh Variya.

And this is Swetha Sridhar from IIT Bombay signing off. Thank you for joining.

Contributors and Content Editors

Divyesh7