|
[Sponsors] |
[OpenFOAM] Annotate velocity of specific cell or point |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 20, 2016, 12:37 |
Annotate velocity of specific cell or point
|
#1 |
New Member
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 12 |
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. |
|
July 21, 2016, 06:27 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Perhaps these links help:
https://paraview.uservoice.com/forum...om-annotations http://stackoverflow.com/questions/2...python-scripts |
|
July 21, 2016, 12:30 |
|
#3 | |
New Member
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 12 |
Quote:
|
||
July 31, 2016, 19:27 |
|
#4 |
New Member
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 12 |
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. |
|
August 5, 2016, 06:50 |
|
#5 |
New Member
Jaap Stolk
Join Date: Nov 2014
Posts: 11
Rep Power: 12 |
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" |
|
Tags |
annotate |
|
|
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 |