### Post

2 followers Follow # Working with Python: Query of through-plane flow of multiple clips in one plot

Hello everyone.

I am working with 3D velocity data. Since I need to evaluate parameters such as through-plane flow, wall shear stress etc. in several clips (n>10) I am looking for (semi-)automatic evaluation of the flow data. For that reason I am working on a python script. In doing so, I have two major questions regarding python and the implementation of a python script in Ensight. At the moment I am using Ensight 10.02(h).

1. Question:
I would like to plot the through-plane flow in several (previously calulated) 2D-clips (perpendicular to the aorta) as a time vs. flow curve. The final goal is the plot of several curves in one graph by pushing only one button.
I calculated the through-plane flow in this python script:

[quote]#Calculate the plane normals of the clip
ensight.variables.evaluate("N_plane=Normal(plist)")

#Calculate the through-plane velocity (VEL= 3D velocity field)
ensight.variables.evaluate("vel_plane=DOT(VEL,N_plane)")

#Through-plane flow = surface integral of through-plane velocity values
ensight.variables.evaluate("flow_plane=IntegralSurface(plist,vel_plane)")
[/quote]

After calculating flow_plane I plot the through-plane flow as a function of time by using the query function.
I would like to achieve this for several clips (n>10) in the most time-efficient way and I would like to have the data in one large *csv file so I can import all data at once into Excel, Matlab etc.

However, I couldn't find any useful solution to achieve this since Ensight seems to only allow queries of one clip at a time. My first idea was to achieve such a plot in a for loop over the clips. Unfortunately, since the variable flow_plane is updated with each clip and the query of the last clip is always overwritten with the values of the next clip, this solution does not work. So my question is: How can I achieve that Ensight keeps different queries of the same variable (flow_plane), even when the variable is updated with each clip.

2. Question:
For further evaluations I also need to determine the plane normals and the coordinates of the center of the clip. At the moment I am using the plane tool (right click -> edit) and copy and paste the coordinates into a python script. However, since the goal is to have a (semi-) automatic evaluation of the flow data, this solution is not optimal. So my second questions is: What are the python commands to get the important coordinates of a clip (i.e., plane normals, plane center coordinates)?

I am thanking everyone who has a useful solution for my problem or has at least some advices for me.

### 1 comment Hi Patrick,

1. There are a couple of notes here on how you're doing the analysis. First, you are calculating the flow by first getting the normal, then the normal component of the velocity, and finally integrating over the clip. All of these steps can be done by using the Flow() calculator function. If you use this function, indeed, it will do exactly the steps you are now doing manually. Give a looks at the User Manual, ch. 7.3 for a description of Flow()

Now, about your question on how to not-overwrite the variables. This is possible in 10.1.6 (and prior), but it is easier to do with the latest version, 10.2.

If you're using EnSight 10.2, you will see that it contains a new kind of variable: Constant per part. This is a variable that return a single value for each part it is calculated on. So, if you select all your clips, calculate Flow() on them and set the output to be Constant per part, you now have the Flow() variable that, for each clip, returns a single value the flow of that clip.

You can right-click on the Flow variable on the variable list (bottom-left) -> Plot vs. Time. This will create the plot with all the queries of Flow vs. time, for all the clip parts.

Now, you want to export the queries as single .csv file. Simply right-click on Flow in the variable list -> Export constant to csv

2. If you need to get the values of the plane tool used to create a plane clip, use the following commands:

from ensight.objs import core

core.PARTS[i].CLIPPLANEPT1

core.PARTS[i].CLIPPLANEPT2

core.PARTS[i].CLIPPLANEPT3

core.PARTS[i] will be the part corresponding to the clip plane part - set "i" to be the correct index. This will return the three points that are used to define the plane tool. From these points, you should be able to extract origin and normal of the plane tool.

Let us know if you have questions or need more help.
Bests,

Marina
{"ft_lang_label":"__label__en","ft_lang_prob":0.87615985,"math_prob":0.8640804,"size":1868,"snap":"2019-26-2019-30","text_gpt3_token_len":460,"char_repetition_ratio":0.11802575,"word_repetition_ratio":0.0,"special_character_ratio":0.2366167,"punctuation_ratio":0.14111923,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97875684,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-07-19T04:29:43Z\",\"WARC-Record-ID\":\"<urn:uuid:9c7a31d4-db33-4057-adec-31fbe6b1584a>\",\"Content-Length\":\"29111\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b27c5b9e-7e10-47d9-ab6d-b0ef97bdabe6>\",\"WARC-Concurrent-To\":\"<urn:uuid:a37c25e3-6905-4a7b-8d27-1ea210735e3e>\",\"WARC-IP-Address\":\"104.16.54.111\",\"WARC-Target-URI\":\"https://support.ceisoftware.com/hc/en-us/community/posts/115000015792-Working-with-Python-Query-of-through-plane-flow-of-multiple-clips-in-one-plot\",\"WARC-Payload-Digest\":\"sha1:SKS7JNNJRCVOQKLTWAEV2FH2S4MHJ2O5\",\"WARC-Block-Digest\":\"sha1:T7BA5JBXMEWJD6TDIRHEQ5YUFS4HXXND\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-30/CC-MAIN-2019-30_segments_1563195525974.74_warc_CC-MAIN-20190719032721-20190719054721-00212.warc.gz\"}"}