CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] Annotate velocity of specific cell or point

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By jherb
  • 1 Post By jwstolk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 20, 2016, 12:37
Default Annotate velocity of specific cell or point
  #1
New Member
 
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 11
jwstolk is on a distinguished road
I'm generating animations, based on the interDyMFoam DTCHull example.
I wrote a tool and additional scripts to automatically stop openfoam, increase the velocity of the "tank" and then re-start openfoam for another N seconds, etc. I have the time annotation in my parafoam view, and in the generated animations.

I would like to anotate the velocity of a single point (deep in the tank, away from the ship) or the velocity anywhere in the inlet mesh, so I have the velocity listed in the animation, just like the time.
(i.e: render a single number, updated for each frame, not generate a plot)

The velocity change factor and time between changes vary a bit, so it is very difficult to track and remember the velocity of each time for every run. The velocity can't be calculated from the time.

I can't find any example on google or this forum, other than annotating the time. Is there a way to annotate the velocity at a specific point?

If necessary, I can add extra data-sets to all the time folders, with the "expected" velocity. If I could somehow annotate that value in the animation, that would be a good alternative solution.
jwstolk is offline   Reply With Quote

Old   July 21, 2016, 06:27
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Perhaps these links help:
https://paraview.uservoice.com/forum...om-annotations
http://stackoverflow.com/questions/2...python-scripts
jwstolk likes this.
jherb is offline   Reply With Quote

Old   July 21, 2016, 12:30
Default
  #3
New Member
 
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 11
jwstolk is on a distinguished road
Thank you! Especially the last two examples in the first link look very promising. I will try it out and post what worked.
jwstolk is offline   Reply With Quote

Old   July 31, 2016, 19:27
Default
  #4
New Member
 
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 11
jwstolk is on a distinguished road
Quote:
Originally Posted by jwstolk View Post
I will try it out and post what worked.
I finally had some time to test this. It looks like the PythonAnnotation filter should do the trick.
I have installed numpy, and now I don't get errors about missing numpy any more.

I have:
Array Association: Cell data
Expression: "u=%f knots" % (max(input.CellData['U'][1,0])*0.51444*10000)

I added the 10000 factor because the results are very (too) small, but they do change with each frame in the animation.

But the actual values seem random, and I don't know how to properly select a specific cell.

I also can't find the correct way to extract the X value from a specific cell in the VTKCompositeDataArray. max() does not generate an error, but no useful value.
Does anyone know how to extract the velocity along the X-axes of a specific cell?

(or from a specific coordinate in the FieldData, that would be even better)
I only have a little python experience, but never used numpy and most examples and documentation I can find do some computation on the VTKCompositeDataArray, not extracting a single value.
jwstolk is offline   Reply With Quote

Old   August 5, 2016, 06:50
Default
  #5
New Member
 
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 11
jwstolk is on a distinguished road
Quote:
Originally Posted by jwstolk View Post
I will try it out and post what worked.
I replaced the %f with %s to show the whole VTKarray so I could see what data was there. In the end I found correct values in the inlet-patch

This works very well:

in the dataset:
enable: "interpolate volFields" and "Patch Names", then select "inlet_patch" and "U"

in the Python annotation filter:
Array Association: "Point Data"
Expression: "t=%.3f sec. v=%.3f m/s = %.1f kn" % (t_value, -max(input.PointData['U'][1,0]), max(input.PointData['U'][1,0])*-1.94384)

result: "t=45.000 sec. v=5.144 m/s = 10.0 kn"
BlnPhoenix likes this.
jwstolk is offline   Reply With Quote

Reply

Tags
annotate

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
Compression stoke is giving higher pressure than calculated nickjuana CFX 62 May 19, 2015 14:32
How to get cell labels for all the points within specific distance from a given point gxy200992243 OpenFOAM Programming & Development 7 October 11, 2014 16:17
Constant velocity of the material Sas CFX 15 July 13, 2010 09:56
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58


All times are GMT -4. The time now is 07:20.