introduction to workbench scripting & customization · cfx ccl yes yes cfd post ccl yes yes...

21
© 2011 ANSYS, Inc. November 29, 2012 1 Introduction to Workbench Scripting & Customization

Upload: vankien

Post on 08-Apr-2018

237 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

1

Introduction to Workbench Scripting & Customization

Page 2: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

2

Outline

Understanding the Workbench framework

WB Journaling and Scripting

Different Customization Methods

Conclusion

Page 3: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

3

Geometry Meshing Setup Solve Results

Meshing Results

Geometry

Setup Solve

Setup Solve

Application Integration

Workbench Framework Application Integration

Framework Toolkit Data and Process Management

Scripting Parameterization

Component applications, covering various phases of the simulation process, sitting on top of a common framework

Meshing Setup Solve Results

Page 4: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

4

Native and Data-Integrated Applications

Native applications• Built entirely on WB2 Framework• Embedded within the “Workbench” window• Project Schematic, Design Exploration, Engineering

Data• Fully supported by Workbench scripting• Scripting Language: Python

Data-integrated applications• Share data and parameters with Workbench, native

applications, and other data-integrated applications

• Independent UI, window

– E.g., Mechanical, Mechanical APDL, CFX, FLUENT, DM

• Scripting Language: JScript, Scheme, APDL …

Page 5: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

5

Workbench

IronPython

Scripting Languages

Mechanical

JavaScript

MAPDL

APDL

Page 6: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

6

Workbench

IronPython

Scripting Languages

FLUENT

SchemeJournal Commands (TUI, GUI)

Page 7: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

7

Journaling

Workbench operations are recorded in a journal file • Only operations which modify data model

• Actions taken in some data-integrated applications is not recorded

Each session creates a new journal file

Playing back journal recreates session

Two types of Workbench journals• Automatically recorded session journals

– Restore work from a complete session

• Operations in some applications are not recorded, playing journal file will notrestore the complete session

• Manually recorded journals

– Starting points for creating custom Workbench scripts

• It is possible to include scripts for the applications [not recorded in Journal] in the WB Python script to automate all the operations

Page 8: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

8

Documentation Reference:// Scripting Guide // Scripting Overview // Journaling and Scripting Capability Overview // Scripting and Data-Integrated Applications

Support for Data-Integrated Application Scripting Languages

Data Integrated Applications

Native Scripting Language

Support Journalingwith

SendCommand

Support Scriptingwith

SendCommand

Mechanical APDL

APDL Yes

Mechanical Jscript Yes

DesignModeler Jscript Yes

Meshing Jscript Yes

FE Molder Jscript Yes

AQWA Jscript Yes

ICEM CFD TCL Yes

CFX CCL Yes Yes

CFD Post CCL Yes Yes

FLUENT Scheme Yes Yes

PolyFlow N/A

IcePak N/A

AUTODYN N/A

Recording WB journal will record the actions applied during the set up in theses integrated apps.

You can insert the ‘SendCommand’ call into your ANSYS Workbench scripts to drive these data-integrated applications.

*JScript has limited support within the noted applications. For example, the Jscript interface is not fully documented.

Page 9: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

9

WB Journal with native applications

Operations involved Project level operations only

All the commands are captured in the Journal

Playing this journal file will reproduce the complete project

Page 10: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

10

WB Journal with FLUENT

WB Journal captured operations performed in FLUENT via SendCommand

Playing this journal file will reproduce the complete project

Page 11: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

11

WB Journal with Mechanical

WB Journal did not capture operations performed in Mechanical

• Playing this journal file will not reproduce the complete project

Using SendCommand operations in Mechanical can be automated

• This will reproduce the complete project

Page 12: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

12

Different Customization Methods

JScript (for DM, Meshing, Mechanical etc.)• Automation scripts

• JScript add-in to add functionality

Wizards (for DM, Meshing, Mechanical etc.)• Creating a customized workflow

ACT (for Mechanical)• Creating custom objects in tree for advanced customization

Python Journaling• For task automation at WB level

– Creating Project, Performing Parameters simulations etc.

• Can use Jscript macros for DM, Meshing, Mechanical etc.

External Connection Add-in• Making external applications (not integrated with WB) to participate in workflow through parameters

• Python scripting can be integrated to add functionality to WB

C# Add-in using Software Development Kit (SDK)• Integrate external applications in workflow through custom systems

• WB GUI customization (addition of buttons, menu etc.)

• SDK offers much more access compared to External Connection

Page 13: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

13

Examples (1) : Scripting

Example:

• A Python Journal file to automate simulation with changing input parameters

Typical Usage:

• Running WB from other software

– MATLAB, Excel etc.

• Read/Write external data in WB

Page 14: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

14

Examples (2): External Connection

Example:• Using External Connection, HFSS parameters and

properties are available within Workbench (Prior to ANSYS Release 13)

– System acts as proxy for Ansoft HFSS application

Typical Usage:• Integration of in-house/third-party code based on

parametric input/output

Page 15: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

15

• WB simulations can be performed with user inputs in Excel

Examples (3): WB simulations from MS Excel

DP1 simulation is done.

DP2 Updating…

WB simulation is started in the background.DP1 simulation is Updating…

Provide the Parameters for the Design Point study

Both the DPs are solved, Project is saved.

Pressure drop values from those analysis are updated in Excel

• WB Python journal is used for getting inputs from MS Excel, performing the simulation and publishing results back to MS Excel• Similarly other simulations (Mechanical, HFSS etc.) can be done

Page 16: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

16

Examples (4): Custom GUI on WB

A custom GUI opens that allows a Pipe Flow CFD Simulation

Provide the dimensions of the pipe

Provide the inputs

Provide the inputsValidate the flow condition

Provide the inputsGenerate Mesh

A suitable mesh with appropriate Y+ is generated

View Mesh

Provide solver controls

Provide some inputs for extracting results (radial profiles)

Iterate

The residuals are displayed as the simulation is progressing

Some standard results are displayed for a quick check

Plots generated are available for display

Open a standard report(with plots, contours, vectors etc.)

Open CFD Post for an interactive post-processing

Page 17: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

17

Examples (5): Wizards

Example:

• A Customized Wizard in Mechanical to manage the workflow

Typical Usage:

• Create a workflow in DM, Meshing, Mechanical etc.

• Interface to take interactive inputs

• Task automation

Page 18: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

18

Examples (6): JScript add-in

Example:

• Using JScript add-in, Wizard functionality is added in DM

Typical Usage:

• Add high level functionality in DM, Meshing, Mechanical etc.

• Add Button/Menu for extra features

– Enable/disable dynamically

Page 19: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

19

Examples (7): ACT

Specific Loads/BCs

Specific results

Page 20: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

20

Examples (8): SDK

Example:

• nCode is integrated in Workbench Project Schematic using C# add-in

Typical Usage:

• Integrate in-house/third-party codes deep in WB workflow

• Create Customized GUI on WB

Page 21: Introduction to Workbench Scripting & Customization · CFX CCL Yes Yes CFD Post CCL Yes Yes FLUENT Scheme Yes Yes PolyFlow N/A IcePak N/A AUTODYN N/A Recording WB journal will record

© 2011 ANSYS, Inc. November 29, 2012

21

Conclusion

• ANSYS provides multiple methods to extend and customize Workbench

• Different Data Integrated Applications allow different types of customization

• Power and complexity can range from basic scripting to full programming

• Choose method that best fits your needs