CalculateForce With Paraview

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

I have done the simulation of a sphere floating in a free surface water.

But unfortunately I didn’t include


a force calculation function in my simulation and you don’t want to run this time consuming simulation
again.

Instead I use Paraview calculate pressure force on the sphere. This tutorial will show you how I do that.

First let turn off all other fields and values we don’t need in this process to make it goes faster

Total pressure force is actually the summation of all pressure multiply by area and normal vector of each
cell so here I only keep pressure value.

𝐹⃗ = ∑ 𝑝𝑖 ⃗⃗⃗⃗
𝑛𝑖 𝑆𝑖

𝐹⃗ − 𝑡𝑜𝑡𝑎𝑙 𝑝𝑟𝑒𝑠𝑠𝑢𝑟𝑒 𝑓𝑜𝑟𝑐𝑒


𝑝𝑖 − 𝑝𝑟𝑒𝑠𝑠𝑢𝑟𝑒 𝑎𝑡 𝑓𝑎𝑐𝑒 𝑖
𝑛𝑖 − 𝑛𝑜𝑟𝑚𝑎𝑙 𝑣𝑒𝑐𝑡𝑜𝑟 𝑜𝑓 𝑓𝑎𝑐𝑒 𝑖
⃗⃗⃗⃗
𝑆𝑖 − 𝑎𝑟𝑒𝑎 𝑜𝑓 𝑓𝑎𝑐𝑒 𝑖

𝑝𝑖 is variable from data

𝑛𝑖 is generated using Filters/Alphabetical/Generate Surfae Normal


⃗⃗⃗⃗

𝑋⃗ = 𝑝𝑖 ⃗⃗⃗⃗
𝑛𝑖 is calculated using Filters/Data Analysis/Calculator or Filters/Alphabetical/Calculator

𝐹⃗ = ∑ 𝑋⃗ 𝑆𝑖 is calculated using Filters/Data Analysis/Intergrate Variables or


Filters/Alphabetical/Intergrate Variables

Because the normal vector data is not ready yet, so we have to generate it. Here we use filter called
Generate Normal Vector which can be found in Filters → Alphabetical → Generate Normal Vector. Apply
this filter will create a new vector field name Normals.

To view the vector we can use Glyph function, which also can be found in Alphabetical list. But we can
simply click to the Glyph in the toolbar.

Choose glyph type as arrow for vector and scale it with vector Normals which is generated from previous
step.

After click Apply you can see the vector field which pointed inside of the sphere. Just go back to Generate
Normal Vector and choose Flip normal to change the vector direction.

Now we multiply pressure with normal vector to create new field which can be later multiply by cell area
to get force. To do so we use Calculator function on Generate Normal Vector data. Remember to select
Generate Normal Vector data in Pipeline Browser before using Calculator function. This function can be
found in toolbar and also Data analysis filter and off course Alphabetical list as well.

Name the new field as PressureForce or whatever you want.


Select p in scalar list, select multiply sign in the calculator tool and select the Normals in the vector list
then click apply.

This is later create a new vector field in the variable list. This can be shown in the RenderView window.
Change if to X Y or Z component you can see how the pressure force distribute on the surface.

To multiply pressure with area and sum it up, we use Integrate Variable filter. This can be found in Filters
→Data Analysis→Integrate Variable or Filters→Alphabetical→ Integrate Variable.

This filter simply multiply any variable with face area and sum up. Let say, you have three faces here only
then it multiply all value in that face with face areas then you get new three values than sum up all three
values.

After click apply, then a new SpreadsheetView window pop up shows the surface integration of all-
variable in the data.

Because Sphere moves in z direction only, so the pressure force in Z direction is higher compare to the
other direction which are nearly zero.

The pressure force in z direction is equal to the gravitational force when Sphere reach the balance position.

If you want to plot this force over time, just select the data in the SpreadSheetView window and apply
filter Plot Selection Over Time in Alphabetical list or Data Analysis list.

If there is an error massage pop up, it is because at the 0- time step there no pressure data. Therefore,
no variable integrated at timestep 0.

To correct this error, go back to original data and select Skip Zero Time.

Plot Selection Over Time will plot data in a new window called QuartileChartView. However, it is not easy
to control the chart in ParaView. It is difficult to change font, inset legends, insert title and so on. So you
may need to export data to file.

To do so, select the Plot Selection Over Time data in the Pipeline Browser, and choose File→Save Data.

This will export data in .CSV format which can be then import to Excel or Libreoffice Cal.

If the file contains many statistic data, just go back and select Only Report Selection Statistic for the data
of Plot Selection Over Time.

Another way to export data is use SpreadSheetView window. Fisrt select SpreadSheetView window, Then,
turn on Plot Selection Over Time data in this window by click to the eye icon in the Pipeline Browser

Click the export SpreadSheet button and save file. Now you get the same data as Save Data function but
maybe in different order.

Before turning of ParaView, remember to save state so that you don’t need to do the whole process
againt next time when you need it.

Choose File→Save state and assign it a name.

Next time when you load the state using File→Load State, data you need is ready.

Cheers,

You might also like