Very helpful - if you are a novice, you really need such kinds of examples with detailed explanations. I wanted just to learn how one can use Paraview with Python. I got a very good idea now how it could function. Thank you for that beautifule video, Cyprien!
Thank you so much! I was ready to give up on trying this. I'm of the opinion that this should be the method in the documentation. This was so much easier and it actually worked!
This is brilliant actually. You explain v nicely. Plz make another video to show how for loop can be used to get multiple planes and plot the data. Thanks
Incredibly Helpful, thank you so much! You just saved me so much time trying to figure out how to get the Paraview module working on my current python distribution!
Thanks a lot for this well descriptive video. It will push beginners like me to use Python shell inside Paraview. If possible, can you please make some videos for 3D vector field visualization where the same field lines are tracked continuously with time? Or some aspects of wavelet analysis? It would be really helpful then.
Top shelf content. Great video. I'm really happy to see this video. I "knew" paraview could be controlled by Python, but so much easier/nicer to learn it via a video.
Hi, great video! Thanks to you I know how to utilize Python. Maybe you can help me with that: I am trying to load a state with a specific file (selectinbg choose file name during load), but with the command LoadState(saved_state_path, LoadStateDataFileOptions='Choose File Names', filenames='D:\Simulations\out_97.xmf') I dont get the respective picture, but the initial one, as if I only load the state without specifying the file.
Cyprien, this is a great introductory video on the topic. I have got one question. How can we enable the AutoMPI in pvpython or is there any way to run the .py file in parallel?
Thanks a lot just one thing when I click on the start trace I get the error ""vtkSMTrace (0x561097d29a70): Failed to import paraview.smtrace module. Generic Warning: In /build/paraview-vlxewD/paraview-5.7.0/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx, line 162 Trace not started since required Python modules are missing."" I tried to install other packages of the Python module it doesn't solve how can I solve this error?
Hello Cyprien. Excellent tutorials. My question is regarding to Wrap Svale filter. Could you advice me about how to applied? I have had problems applying this kind of filter. Some times seems that just it doesn't work (I don't see it active). Thanks for your time and help.
Thanks for the video I want to apply a Macro to a lot of different files which have the same structure but different names, so when I save a Macro and I try to use it with other files it won't work well because the names of the variables changes. Do yo know how can I modify the Macro in order to work among other files, given that they have the same structure?
Sure, you have some ways in python to look for files in a folder or with a certain name, that way it will automatically use the right file. Try to os.walk() function for example
Thanks a lot for your work! What is a correct way to execute some external python script from disk? I use line "execfile(‘full_path/script.py’) " in the "script" window , but see ‘execfile is not found’. Where is a mistake?
For a normal python installation you can just run « python full_path/script.py » in the terminal. I don’t know what is « execfile ». For paraview python script you will have to use the special python executable pvpython like I show in the video
@@Feaforall Dear Cyprien! Thank you for your answer. but I use pvpython and write python script in window "script" using copy-paste procedure. It works, At that moment paraview prompts to use "execfile(‘full_path/script.py’) "! Thatis the problem.....
Hello Cyprien Rusu, Thank you for letting us learn more and more stuff from you..... I have a question...... Can we collect data of velocity at each mesh point in Paraview / OpenFoam! and if yes how! Thank you, Will wait for your reply
@@Feaforall Hello Cyprien Rusu, Thank you so much, I got the results..... Just one more doubt i have done Plot over time and imported to csv format, I am getting Temperature and Velocity as Avg, Max and min.... Is ti possible to get normal original value at each time step..... Thank you in advance.
thank you very much for making this tutorial, actually, I would like to ask if you have used python code to make calculation between the values, for example, calculating the principal stresses with the stress tensor, and shown eventually as a function of each node and time.
I haven’t done any video about that (yet) but it’s totally doable. You can also have a look at a python module called pyvista. It’s easy to couple that with Jupyter notebook to do some calculations of the tensor values. Good luck
Can we perform mathematical operation like root mean square of field variable over the entire domain and visualize in paraFoam ? Can Python script help in any manner ?
Sure, you just have to use the right filter (the calculator filter can do that, watch my video about paraview filters to see how it works). Then you can record the python macro and do it within a python script.
Hi Cyprien, thank you for the tutorial ! I added the path for pvpython as you said, but then when I want to import all from paraview.simple in spyder (installed with anaconda) it doesn't work, can you help me please ?
Probably because spyder is not using pvpython but it’s own python version. I am sure spyder has its own environment variable to set the python distribution used, but I am not familiar enough with it to tell you which one. Check the documentation, there is surely the answer somewhere.
Sorry, since I'm new to this. May I ask one more question? When I use paraFoam, there will be an existent built-in (openFoam case) (which using paraview is not). Hence, if I want to execute code through pvpython then will I have to import that built-in or the trace-back can also trace that existent built-in?
You mean it works in the Python console of paraview, but not powershell? That’s probably because of the environment. If you use the pvpython executable of paraview, it should work in powershell, but if you use another python distribution, then it will not recognize paraview if you don’t import the correct modules.
@@Feaforall No, python can be worked on different interfaces - e.g. on powershell / on IDLE (just the interfaces for python, NOT for paraview). After linking up paraview to python, you work on powershell while I work on IDLE, both are working by calling in paraview with "from paraview.simple import *". But, I don't know why I can only work on IDLE, but no powershell.
@@engineeringarts4509 have you checked if your IDLE and the python distribution you are calling from powershell are the same python distribution? For me using “from paraview.simple import *” directly with python often does not work because some distributions are not compatible with the modules paraview is calling. That’s why I talk in the video about using the pvpython distribution provided with paraview to read the paraview/python code (this one has been tested and it is sure to work)
@@Feaforall i see your point. But, can you get me a pointer how to ensure the same distribution of paraview as to the python? I'm out of context on this point from the video, sorry about that.
@@Feaforall Yep i did... you ran pvpython and the 'from paraview.simple import *' line (which is the first line of the script). but i later figured that pvpython can is essentially the same as python. so i can run 'pvpython script.py' where script.py is the py macro generated in paraview
Great help.. please keep up making more advanced topic. I WAS LOOKING FOR MAKING AN ANIMATED 3D MESH TO EXPORT FROM PARAVIEW TO RUN INSIDE A GAME ENGINE. If you can please teach us a way to do so will be a great help. I WAS LOOKING FOR EXPORTING any type of result data as mesh or point cloud volume to game engine. I need 3D animated mesh not a static mesh. Is it possible? Also is I tried to export fluid simulation stream line result into. csv format. Which i tried to reopen in 3ds max in cfd data import option. But the result does not look same as the paraview. If you could show a pipeline to import the animated result into game engine would be a great help.. Thanks a bunch in advanced..
Hey Jukka, paraview is a software for scientifics and engineers. If you are looking to create game graphics and animations, you should look into Maya or Blender (open source). Paraview is not for for that purpose.
thanks, man I watched all the tutorials of ParaView along with practice in one sitting. Huge thanks, Bro.
Very helpful - if you are a novice, you really need such kinds of examples with detailed explanations. I wanted just to learn how one can use Paraview with Python. I got a very good idea now how it could function. Thank you for that beautifule video, Cyprien!
Glad it helped Jordan!
Thank you. One of the best video tutorials on paraview.
The tutorial is very useful. I am using the scripting outside of GUI to automate the export of scenes for animation purpose. Thank you!
Thank you Cyprien for this tutorial, very nice. I watched it all
Thank you, the best ParaView tutorial series that I found :)
Thank you so much! I was ready to give up on trying this. I'm of the opinion that this should be the method in the documentation. This was so much easier and it actually worked!
This is brilliant actually. You explain v nicely. Plz make another video to show how for loop can be used to get multiple planes and plot the data.
Thanks
Incredibly Helpful, thank you so much! You just saved me so much time trying to figure out how to get the Paraview module working on my current python distribution!
Thanks a lot! I think this just revolutionized my Paraview workflow!
This is great. Can you perhaps also show some tricks for saving memory when dealing with large data?
Really good video to start using Paraview with Python. thanks.
Thank you Cyprien! This really helped me get my feet wet in Paraview!!
Thanks a lot for this well descriptive video. It will push beginners like me to use Python shell inside Paraview. If possible, can you please make some videos for 3D vector field visualization where the same field lines are tracked continuously with time? Or some aspects of wavelet analysis? It would be really helpful then.
Top shelf content. Great video.
I'm really happy to see this video. I "knew" paraview could be controlled by Python, but so much easier/nicer to learn it via a video.
Amazing videos! It really helped a lot
Thanks a lot! As a beginner, it's really helpful to me.
Great video series, easy to follow explanations. Thanks for your hard work.
Great work! Thanks very much.
Thank you, this was a really useful tutorial!
Thanks man. Great video!
Great video! This process u showed is useful if u are using freecad also
Thanks for this video.
I did not know we can record Marcos.
This is really helpful since I usually apply similar kinds of filters to view my results.
Great video! Thank you very much 🙂
Python
Thanks a lot for your huge effort
Hi, great video! Thanks to you I know how to utilize Python. Maybe you can help me with that: I am trying to load a state with a specific file (selectinbg choose file name during load), but with the command LoadState(saved_state_path, LoadStateDataFileOptions='Choose File Names', filenames='D:\Simulations\out_97.xmf') I dont get the respective picture, but the initial one, as if I only load the state without specifying the file.
Cyprien, this is a great introductory video on the topic. I have got one question. How can we enable the AutoMPI in pvpython or is there any way to run the .py file in parallel?
You have another executable special just to run the bigger parallel scripts... pvbatch? (From memory)
@@Feaforall thanks.
Great video! Very clear explanation and super useful stuff! Thank you very much for this material. Cheers!
Thanks a lot just one thing when I click on the start trace I get the error
""vtkSMTrace (0x561097d29a70): Failed to import paraview.smtrace module.
Generic Warning: In /build/paraview-vlxewD/paraview-5.7.0/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx, line 162
Trace not started since required Python modules are missing.""
I tried to install other packages of the Python module it doesn't solve
how can I solve this error?
Hello Cyprien. Excellent tutorials. My question is regarding to Wrap Svale filter. Could you advice me about how to applied? I have had problems applying this kind of filter. Some times seems that just it doesn't work (I don't see it active). Thanks for your time and help.
Great tutorial! I learnt a lot. thankssss
Incredible!!!!! Thank you
thank you for the tutorial. How would you run the python script file from pvpython, assume that is possible?
Go in terminal and enter “pvpython script.py” (pvpython has to be in your path and you must be located in the directory where your script is)
@@Feaforall thank you!
Very helpful. Thanks
Thanks for the video
I want to apply a Macro to a lot of different files which have the same structure but different names, so when I save a Macro and I try to use it with other files it won't work well because the names of the variables changes. Do yo know how can I modify the Macro in order to work among other files, given that they have the same structure?
Sure, you have some ways in python to look for files in a folder or with a certain name, that way it will automatically use the right file. Try to os.walk() function for example
Thanks a lot for your work! What is a correct way to execute some external python script from disk? I use line "execfile(‘full_path/script.py’) " in the "script" window , but see ‘execfile is not found’. Where is a mistake?
For a normal python installation you can just run « python full_path/script.py » in the terminal. I don’t know what is « execfile ».
For paraview python script you will have to use the special python executable pvpython like I show in the video
@@Feaforall Dear Cyprien! Thank you for your answer. but I use pvpython and write python script in window "script" using copy-paste procedure. It works, At that moment paraview prompts to use
"execfile(‘full_path/script.py’) "! Thatis the
problem.....
very helpful, thanks :)
Hello Cyprien Rusu, Thank you for letting us learn more and more stuff from you.....
I have a question...... Can we collect data of velocity at each mesh point in Paraview / OpenFoam! and if yes how!
Thank you, Will wait for your reply
Hi Hemanth, yes, you can. I think you need to watch this video: [Paraview Tutorial 4] How to display node and elements data in Paraview
@@Feaforall Hello Cyprien Rusu, Thank you so much, I got the results..... Just one more doubt i have done Plot over time and imported to csv format, I am getting Temperature and Velocity as Avg, Max and min.... Is ti possible to get normal original value at each time step..... Thank you in advance.
thank you very much for making this tutorial, actually, I would like to ask if you have used python code to make calculation between the values, for example, calculating the principal stresses with the stress tensor, and shown eventually as a function of each node and time.
I haven’t done any video about that (yet) but it’s totally doable. You can also have a look at a python module called pyvista. It’s easy to couple that with Jupyter notebook to do some calculations of the tensor values. Good luck
Thank you so much!
thank you for your video!
Thank you! Great videos
Can we perform mathematical operation like root mean square of field variable over the entire domain and visualize in paraFoam ? Can Python script help in any manner ?
Sure, you just have to use the right filter (the calculator filter can do that, watch my video about paraview filters to see how it works). Then you can record the python macro and do it within a python script.
Hi Cyprien, thank you for the tutorial ! I added the path for pvpython as you said, but then when I want to import all from paraview.simple in spyder (installed with anaconda) it doesn't work, can you help me please ?
Probably because spyder is not using pvpython but it’s own python version. I am sure spyder has its own environment variable to set the python distribution used, but I am not familiar enough with it to tell you which one. Check the documentation, there is surely the answer somewhere.
@@Feaforall finaly I used subprocess.run to execute my python script with pvpython.exe from spyder. Thank you for your answer :)
Hi sir, is it possible to execute python script with paraFoam (paraview but with openfoam case) directly?
Yes, of course. ParaFoam is just paraview with some added functions
Sorry, since I'm new to this. May I ask one more question?
When I use paraFoam, there will be an existent built-in (openFoam case) (which using paraview is not). Hence, if I want to execute code through pvpython then will I have to import that built-in or the trace-back can also trace that existent built-in?
Sure, just double check that your parafoam has been compiled with python (if you have the python console in it, it should be)
I did the same procedures as you mentioned, but dont know why it doesn't work in powershell, while works well in the python IDLE interface.
You mean it works in the Python console of paraview, but not powershell? That’s probably because of the environment. If you use the pvpython executable of paraview, it should work in powershell, but if you use another python distribution, then it will not recognize paraview if you don’t import the correct modules.
@@Feaforall No, python can be worked on different interfaces - e.g. on powershell / on IDLE (just the interfaces for python, NOT for paraview). After linking up paraview to python, you work on powershell while I work on IDLE, both are working by calling in paraview with "from paraview.simple import *". But, I don't know why I can only work on IDLE, but no powershell.
@@Feaforall By the way, thanks for your movie, very useful!!!
@@engineeringarts4509 have you checked if your IDLE and the python distribution you are calling from powershell are the same python distribution?
For me using “from paraview.simple import *” directly with python often does not work because some distributions are not compatible with the modules paraview is calling. That’s why I talk in the video about using the pvpython distribution provided with paraview to read the paraview/python code (this one has been tested and it is sure to work)
@@Feaforall i see your point. But, can you get me a pointer how to ensure the same distribution of paraview as to the python? I'm out of context on this point from the video, sorry about that.
is it possible to run the python macro in the terminal without opening the GUI?
Yes, I am sure I talk about that in the video... did you watched all of it?
@@Feaforall Yep i did... you ran pvpython and the 'from paraview.simple import *' line (which is the first line of the script).
but i later figured that pvpython can is essentially the same as python. so i can run 'pvpython script.py' where script.py is the py macro generated in paraview
You are awesome!
Great help.. please keep up making more advanced topic. I WAS LOOKING FOR MAKING AN ANIMATED 3D MESH TO EXPORT FROM PARAVIEW TO RUN INSIDE A GAME ENGINE. If you can please teach us a way to do so will be a great help. I WAS LOOKING FOR EXPORTING any type of result data as mesh or point cloud volume to game engine. I need 3D animated mesh not a static mesh. Is it possible?
Also is I tried to export fluid simulation stream line result into. csv format. Which i tried to reopen in 3ds max in cfd data import option. But the result does not look same as the paraview. If you could show a pipeline to import the animated result into game engine would be a great help.. Thanks a bunch in advanced..
Hey Jukka, paraview is a software for scientifics and engineers. If you are looking to create game graphics and animations, you should look into Maya or Blender (open source). Paraview is not for for that purpose.
Thank you man!
Great!
Thanks a lot ! Really helpful