CEI.2015.model-swirling-flow-11-25-15b

Using EnSight to Visualize Swirling Flow

CEI.2015.model-swirling-flow-11-25-15b

Frequently, CEI employees come across interesting and potentially useful information while developing and testing EnSight that we think could be helpful to a subset of our users. We’ll present these mini tutorials here on our blog. If you are looking for basic tutorials or answers to specific questions please visit our support center. 

As part of our testing for EnSight 10.6.1(b), I put on my combustion engineering hat and had some fun with a Converge dataset, exploring how to use EnSight to explore Swirling flow.

Suppose I have some sort of an engine with an inlet and a piston that moves up and down:

unnamed

My Inlet #2 sucks in some flow.

I want to have a metric to see the swirl of the flow coming into Inlet #2.

The swirl of the flow is the component that is moving in the theta direction in an RTZ cylindrical coordinate system with the axis perpendicular to Inlet #2, essential “swirling” around the centerline of the inlet. The problem is, the axes of Inlet #2 doesn’t align with the global axes.

In the past, calculating the swirl about an arbitrary axis would require a handful of intermediate variables and a lot of arduous vector math. But now, I can easily calculate this swirl by creating a new Frame, Frame 1, which has frame z axis of the frame defined to be the centerline of inlet #2.

Then, I can calculate the swirl using the new VectorCyclProjection function which can calculate one of three vectors: R, Theta or Z. I choose Theta, and I request it to use Frame 1.

Then I can create an RTZ clip and tell it to make an R clip about Frame 1’s Z and make vector arrows from the swirl and zoom in to see the swirling flow:

unnamed (1)

Now, I can look at the swirl at any given radius. Further, I can calculate the SpatialMean of the swirl on the R clip and then, using the Part Constant Query Tool, plot average swirl in the Inlet Frame coordinate system over a range of radii. Basically, it sweeps the R clip from a min to a max and collects up the average swirl value, then it plots it. I checked the box on this tool to update with timechange so I can look at other timesteps, for this example:

unnamed (2)

Then I wrote a python script to step through time, rescale the plot y axis to a constant value, and save an image. Why not just click the record button (save animation)? The scripting technique allows for clearer images with very little static, all with two lines of pyton using ens_utils enve modules:

import ens_utils as eu
flist = eu.get_file_list(“/Users/wndunn/testdir/file_*” , sort_flag=eu.AN_SORT)
eu.images_to_mov(flist,”/Users/wndunn/testdir/final.mp4″)

 

CFD Post-processing of Multiple Reference Frame (MRF) and Rigid-Body Motion

Multiple Reference Frame (MRF) models simplify the modeling of turbomachinery, allowing you to simulate with a steady-state model what would normally look to require a transient CFD simulation.

Those doing CFD post-processing from simulations of fans, pumps, stir tanks, HVAC, and other rotating machinery often want the parts to rotate.  We have developed a specific tool to provide part rotation using the python scripting language.  This tool provides rigid body motion according to several options you can provide. Combining rigid-body motion with pathlines provides a nice looking and logical recreation of the moving parts in your Multiple Reference Frame (MRF) CFD simulation.

A couple of frequent questions from users of EnSight are answered in this screencast such as:

– Can I make parts rotate or appear to rotate in EnSight

– I solved my CFD simulation using Multiple Reference Frame (MRF) – how do I use that in EnSight

– what is the difference between streamlines and pathlines

– how do I make pathlines

– what are some useful specialized tools that come with EnSight

 

Related Information

Find other useful Python tools that are not included in EnSight in Resources.

Do you want to know a little about writing your own Python tool, see this screencast.

Want to loop over a list of parts in your Python script, see this screencast.

 

 

Measure Distance and Size a new tool at Python Exchange

EnSight has no really handy capability to measure the size of a selected part or the distance between two points although all necessary information is existig. I was asked several times for a simple click solution. Well, here it comes. Attached are two Python codes zipped to a complete directory. Both scripts include a dynamical GUI which enables a very handy usage.

The size measurement tool:

Start the routine and just select one ore more parts from the part list or directly from the graphical area – that’s all. The GUI of the code will update immediately so you will get the desired information without more steps.

The distance measurement tool:

Start the routine and choose the measurement mode. Now just click on the first surface point. The GUI will update at once and asks you to select the second surface point. Once again the GUI will update and tell you the distance betwee the two points. Both points are connected with the line tool now. You can continue picking surface points as long as the GUI is active. If you are finished, just quit the GUI and the line tool will disappear.

Both routines are included in a complete user defined tool directory. Download the file, unzip it and copy the whole directory to this path (If the path does not exist you’ll have to create it):

$HOMEDRIVE/$HOMEPATH/.ensight100/extensions/user_defined

Please contact me at david@ceisoftware.com if you have any problems.

Download the tool here:  CEI_GMBH_TOOLS