SpinOffs

A blog on what's new, notable, and next in turbomachinery

Extending the Capabilities of the Agile Engineering Design System with Python

By Dr. Peter Weitzman, President of Software Sales & Business Development
Jan 3, 2024


Share
  • Facebook
  • Twitter
  • LinkedIn

One of the most interesting things I heard from a customer this year was “I never want to see your UI”.

This customer had a goal to embed our software into an optimization loop and run it through the Python API. This really got us thinking about the API, Python, and what our customers want to accomplish with those tools and how we can make their jobs easier. The reasons that our users want to use the Python API fall into three main categories as follows:

    1. Automate repetitive UI tasks. If you always do the same things over and over in the UI, it really saves time to automate those things.

    2. Embed the CN software into a larger system. The customer with the optimization tool is a good example, others that we have seen is to use our preliminary design tool as a performance estimator inside of a sales tool and to use our streamline curvature solver as a starting condition for CFD

    3. Incorporate company proprietary data or models into the CN tools. Some examples of this are using a proprietary blade cross section shape in AxCent or using a proprietary loss model in one of our meanline codes.

Let us take a look at an example that falls into the first category. The impeller design below is one of the example centrifugal compressors included with AxCent

The shroud inlet blade angle is -60 degrees, the exit blade angle is -50 degrees and the distribution is defined by a Beizer curve with 9 control points. Let’s say that this is a high performing impeller and we have a new operating point and structural requirement that moves the inlet and exit blade angles to -55/-45 degrees. Instead of manually moving all 9 control points let’s create some python code which takes as inputs the current Bezier curve and the desired new endpoints and creates a new Bezier curve with all 9 points adjusted appropriately. The Python code for this function is shown below.

To run this code in AxCent, press Ctrl+Alt+Space to open the Python window and enter the two commands shown below to import and run the script. The result of the script is shown in the window below using the overlay feature of AxCent.

Next let’s take a look at an example from COMPAL. Below is some sample code which corrects mass flow to equivalent flow on a standard day at a temperature of 288K and pressure of 101,325pa and puts this corrected values into the “User1” Variable in COMPAL.

Next let’s instruct COMPAL to run this calculation every time the solver is run. To do this, first open a COMPAL design case and then select Agile->Macro->Macros. In this dialog box you will see a list of all of the Python scripts located in the macros folder under the COMPAL install. Under each script is a list of available functions. Select the CustomPostProcessing() function under the postprocessing script and click the “Run At” button.

This will bring up the dialog box to select when to run the script.

Choose Post-Solve and click OK.

This has instructed COMPAL to run the post processing script after the solver. Now run the COMPAL solver and open a new results table. Scroll down to the user variable section and you will see that User1 now contains the reduced mass flow and User2 contains the reduced speed which is also contained in the same script.

So we have seen how to extend both AxCent and COMPAL with python scripts. This barely scratches the surface of what is possible. In addition, there are 137,000 Python libraries available to choose from to combine with our tools to create the ideal turbomachinery design suite for your organization. Here is a list to get you started https://www.mygreatlearning.com/blog/open-source-python-libraries/ . Remember that the Agile Engineering Design System was developed by engineers for engineers, so which Python libraries are we using to extend our applications? Stay tuned…

We welcome your questions and comments here or contact us at info@conceptsnrec.com.

Tags: Agile Engineering Design System, Software

Subscribe to SpinOffs