EnSight Python scripting with a debugger

Customers using EnSight with Python want to use a debugger to help develop their scripts and tools.

Below is and attachment describing how to do this with a debugger (winpdb) that has a graphical user interface.
In attachment, there are the instructions on how to install and setup this graphical debugger. It works on all platforms (Win / Linux / Mac). In attachment, also a screenshot movie of what you should see once everything is set up correctly.

pythdebug0002 from EnSight by CEI Software on Vimeo.

Basically, you’ll need to add 2 lines at the top of the python script you want to debug:

import rpdb2
rpdb2.start_embedded_debugger(“mytest”)

Then, launch the script in EnSight. EnSight will freeze while it waits for the connection to the debugger. Outside from EnSight, launch the debugger winpdb. From its graphical interface, look for the process with the password “mytest” and attach it. Now you can run your script in debug mode from this graphical interface, and EnSight will do the calculations for you.
Here a tutorial on the debugger winpdb:
http://winpdb.org/tutorial/WinpdbTutorial.html

Although it is a little tricky to set up (requires installation of a bunch of libraries outside of EnSight). We hope this is clear and useful for some of you. Let EnSight Support know if you have questions.

 

Setting Up a Python Debugger with EnSight

Also see how to use Visual Studio 2013 as a python debugger for EnSight.

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