Display center of mass with mesh
Hye please help me i solved center of mass in (x,y,z) format now i want to watch it in paraFoam. anyone knows something about it????
|
Quick answer: Please provide more details, as explained here: http://www.cfd-online.com/Forums/ope...-get-help.html
Because the simplest answer is this - In ParaView, you should:
|
But sir problem is that value of center of mass is changing contonously with runtime. Thats why i want to make some change in solver to see center of mass. please help me if you can.......
|
Quote:
At the very least, provide an example file of the data you want to plot and see in ParaView! |
Actually sir, just think about damBreak case..... In interFoam case i added
CoM = sum(rho*mesh.V()*mesh.C().dimensionedInternalField ())/sum(rho*mesh.V()); and defined CoM as a vector dimensionedVector CoM("CoM", dimLength, vector::zero); now it gives me center of mass of fluid suppose in dambreak case. But it gives me in log file. in form of Vector (a,b,c). Value of center of mass of fluid changes with movement of fluid in paraFoam. I want to watch position of center of mass at every time step. so i want position of center of mass in mesh. |
Quick answer:
Good luck! |
Thank you sir. these things are quite informative. i like that. thanks you again
|
sir you forget to write after (and here). The link needed
|
Quote:
|
1 Attachment(s)
Sir i tried to do as you said. but the problem is that it shows all sphares at a time. i want to watch center of mass moving at runtime. but the method you specified gives all locations of center of mass at a time.
i am attaching the image with this thread. |
Hi 13msmemusman,
The following took me some considerable time to program. Steps to use:
My test file "test.csv" contains this: Code:
Time, X, Y, Z Bruno PS: I wrote this code based on the examples given here: |
thank you sir you did so much for me. but there is an error.
Code:
Traceback (most recent call last): |
Hi Muhammad,
Looks like "numpy" isn't installed. A few questions:
Bruno |
Sir now i have installed numpy and now error is
Code:
not defined This is ubuntu 14 and openfoam 2.3.1 and paraFoam 4.1.0 i followed instructions by openfoam.org |
there was problem in file format. i have corrected. but still i have a problem. i doesn't give me error but it don't show me center of mass
|
2 Attachment(s)
Attached are two images, tested with the tutorial case "incompressible/icoFoam/cavity":
|
Sir i am using it in interFoam.... let me try again....
|
p, li { white-space: pre-wrap; } not defined
Traceback (most recent call last): File "<string>", line 20, in <module> File "<string>", line 28, in RequestData ValueError: field named Time not found Error sir.... please save the state in paraFoam and send me at 13msmemusman@smme.edu.pk |
Thank you boss..... i have also done it successfully
|
2 Attachment(s)
Attached is a complete example case, which is the "cavity" I mentioned before case.
Unpack it and then run: Code:
./Allrun When you open it, it will show a window similar to the attached image. You'll need to change the path to the folder given in the second command. |
Thank you sir it has already been successful. Thanks a lot for this kind help.
Sincerely Usman |
Quote:
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? |
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 07:49. |