CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Slicing extracted part of a volume in Python script

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 26, 2016, 09:34
Default Slicing extracted part of a volume in Python script
  #1
New Member
 
Join Date: May 2009
Posts: 8
Rep Power: 12
wilmbas is on a distinguished road
[SOLVED]

Hi all.

I try to set up a python script by tracing from inside paraview. What I did until now is importing an openfoam case to get finally slices from which I want to save the data in csv to do some post processing analysis in python for my own.

The case contains tubes with returning bends thus there are two flows with opposite direction. Please see the picture. I just want to get informations on the tube segment downstream with the lower absolute pressure field (colored in blue).



To avoid the upstream tube segment I selected through all cells up to some point at the return bend outlet and this marked section was extracted all other became hidden.
So far so good. This worked as long as I just traced the steps and I did the extracting, slicing and exporting of the csv by hand.

But when I wanted to automate this for other analog cases the extraction process was the weak part of the script. It effectively did not export anything as long as extracting was part of the script. Some strange processing took place with no output at all. Only processor/CPU load with no effective outcome. When I deleted this part it worked good.

Thus I have two questions:
1. Is it possible in any form to do this automated selection and extraction process or
2. How can I ensure that the slicing is only done for the downstream tube segment. What is the syntax to limit the region of the overall geometry to this part only.

Thanks in advance for your help. Hope it was clearly defined.

Best regards
Thore

Last edited by wilmbas; April 28, 2016 at 18:14.
wilmbas is offline   Reply With Quote

Old   April 27, 2016, 16:57
Default
  #2
New Member
 
Join Date: May 2009
Posts: 8
Rep Power: 12
wilmbas is on a distinguished road
Hm, no reaction so far. Is there anything not understood by my description?
wilmbas is offline   Reply With Quote

Old   April 28, 2016, 12:03
Default
  #3
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 525
Rep Power: 18
tomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

I am not sure why you want to use the "extracting part". Can you use a clip filter with a plane as clipping tool instead? It works similar to a plane slice.

The export to CSV is something else, I am not sure if that can be scripted robustly, but maybe it can (since you said that you dit it if you did not use the extracting bit).

Regards,
Tom
tomf is offline   Reply With Quote

Old   April 28, 2016, 16:08
Default
  #4
New Member
 
Join Date: May 2009
Posts: 8
Rep Power: 12
wilmbas is on a distinguished road
Dear Tom.

Thanks for your time. But clipping will just allow to review some part inside the tube segment. I want to post-process data sets from within the slice which results into two-dimensional, cross-sectional areas of the tube. This is different from a clipping procedure. Of course I could do this twice from both sides which would result into the same two-dimensional set of data.

I don't think that's what I need.

I still assume that the method of slicing is not wrong to get these cross-sections. But my lack of knowledge if there is a method to limit the slice to only a single segment and the automation of this step in Python is the issue. Please find below two slices. The first without extraction but having both segments being sliced and the second slicing after extraction. But that's the point this latter procedure is buggy being scripted with the tracing. Does anyone have an idea to get this in Python automated?





Thanks in advance for your help. Every hint is appreciated!

Regards.
Thore
wilmbas is offline   Reply With Quote

Old   April 28, 2016, 18:14
Default [solved]
  #5
New Member
 
Join Date: May 2009
Posts: 8
Rep Power: 12
wilmbas is on a distinguished road
Hi all.

Got it solved by this description. Stupid simple but nice to share...
Just do a clipping with a box instead of the default plane after(!) the slicing.
Then no extraction is necessary!

Please look here: https://cmake.org/pipermail/paraview...il/033908.html

Best regards
Thore
wilmbas is offline   Reply With Quote

Reply

Tags
extract volume, python script, slices

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Get data from Calculator filter in python script taalf ParaView 17 February 15, 2018 05:53
multiphaseEulerFoam (OF2.3.0) : Courant number explodes when running in parallel Mehrez OpenFOAM Running, Solving & CFD 10 May 18, 2016 12:44
[General] How can I use python script to generate animation from 2000 frames of vtk datasets LieyuShi ParaView 3 March 10, 2016 14:37
[General] Transfer variables into python script from bash-shell cfdFreshman ParaView 0 December 3, 2015 04:33
How to run python script to plot sth WITHOUT reconstructPar ripperjack OpenFOAM Post-Processing 1 September 2, 2013 20:35


All times are GMT -4. The time now is 19:16.