CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [OpenFOAM] Display center of mass with mesh (https://www.cfd-online.com/Forums/paraview/151482-display-center-mass-mesh.html)

13msmemusman May 3, 2015 12:04

Thank you sir it has already been successful. Thanks a lot for this kind help.
Sincerely
Usman

Hale_812 June 12, 2018 20:43

Quote:

Originally Posted by wyldckat (Post 543810)
...The following took me some considerable time to program. Steps to use:
In ParaView (I tested this in ParaView 4.1.0), select from the menu "Sources" the "Programmable Source".

It now shows at least 3 options, which should be populated as follows:

Output Data Set Type: vtkPolyData

Script:

My test file "test.csv" contains this:


Dear wyldckat.


I have similar goal of loading datalogger-style time-voltage readings .csv table as time-varying data source.


Surprisingly, ParaView still does not have this fundamental featureж I mean, interpreting time data. Upon searching with Google, I found your post from 2015.


Unfortunately, I am not a programmer, and have little Idea about Paraview Python API, so I can not make your script working on my system.
And my system is ParavView 5.5.0 x64 for Win64, official build.


First, using manuals, I tried tweaking it for time-voltage 2-column data file. But I could create just 2 timesteps, "0" and "1", with wrong values not present in the table.
Then I just tried executing your example with your test-file without change. And got this error message:


Traceback (most recent call last): File "<string>", line 19, in <module>
File "<string>", line 44, in RequestData
NameError: global name 'arrayX' is not defined



Can you please help solving this problem?

Hale_812 June 12, 2018 21:14

Oh, Increadible! I just got an idea why didn't it work with your example.
ParaView 5 can execute Python programmable Source ONLY ONCE! After that, it should be closed and restarted. So weird.


Anyway, I see, your code can load only 2 timesteps "0", and "1" from the whole table.


I tried my table with 770 values from 0 to 7.714910349e-009 s.
And it loaded the final value only. I guess, because it did not find 1s timestep, and obeyed directive "elif arrayT[-1] <= req_time:"


When calling SetOutputTimesteps(self, (0, 7.6147167081e-009)) with 7.6147167081e-009s timestep as an argument, it reads the value for time=0 instead. But the added time is 7.61472e-009.


So, is there a way to import all the timesteps with float-format time data?
And a way of resetting the numpy environment before the script is executed, so I don't have to restart ParaView every time?


All times are GMT -4. The time now is 12:05.