Using Python scripting to plot integration of a variable over a line versus time in ParaView

社会主义新天地 提交于 2019-12-14 04:04:48

问题


I have some OpenFOAM simulation results (you may use the official can.ex2 model which can be downloaded from here). What I want to do is:

  1. open a file, load the original data as decomposed case (which can't be applied to the case above)
  2. apply a Calculator filter one a specific variable (e.g. DISP*3.14*coordsX, I used 3.14 because for the love of god I can't find Pi!)
  3. apply filter plot over line [x1,y1,z1] to [x2,y2,z2]
  4. integrate the output of 2 over the line defined in 3 in each time step
  5. plot the result of 4 over time

I would appreciate if you could help me know how I can write a Python script to do this.


回答1:


The easiest way to write a Python script to do this is to use ParaView's Python Trace capabilities. Basically, you start a trace and then run through the actions you've listed in the Paraview user interface. ParaView translates your actions into a Python script that you can save and modify after stopping the trace. See Section 1.6.2 of the ParaView Guide for more information. It is probably the single best way to learn about Python scripting for ParaView.



来源:https://stackoverflow.com/questions/52206088/using-python-scripting-to-plot-integration-of-a-variable-over-a-line-versus-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!