0% found this document useful (0 votes)
23 views45 pages

Ansys ACT

The document discusses the automation and customization of structural simulation workflows using Ansys tools, highlighting the benefits of saving time and improving robustness. It introduces various scripting approaches, including product and Python scripting, and emphasizes the use of the Ansys Customization Toolkit (ACT) and Data Processing Framework (DPF) for creating efficient postprocessing workflows. The session concludes with resources for further learning and support options.

Uploaded by

4t6cbrrxke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views45 pages

Ansys ACT

The document discusses the automation and customization of structural simulation workflows using Ansys tools, highlighting the benefits of saving time and improving robustness. It introduces various scripting approaches, including product and Python scripting, and emphasizes the use of the Ansys Customization Toolkit (ACT) and Data Processing Framework (DPF) for creating efficient postprocessing workflows. The session concludes with resources for further learning and support options.

Uploaded by

4t6cbrrxke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Hands-On:

Automation and Customization of


Your Structural Simulation
Workflows

1 Jun 2023

Start of Recording
© Copyright 2023 ANSYS, Inc. / Confidential
Key Take-Aways of Today’s Session

Save time and improve robustness by automating your


workflows

Automate and customize either from within Ansys tools or from


within your external tools

Create efficient custom postprocessing workflows

2 ©2023 ANSYS, Inc. / Confidential


Ansys Learning Hub & Siemens Private Learning Room

https://www.ansys.com/alhactivation_en

3 ©2023 ANSYS, Inc. / Confidential


Introduction of Presenters & Account Team

Pernelle Marone Hitz, Michael Hortmann, Alexander Stubenrauch, André Braune,


Lead Application Engineer Enterprise Account Director Strategic Account Manager Sr. Technical Account Manager
[email protected] [email protected] alexander.stubenrauch@ [email protected]
ansys.com

Questions ? – Please use Chat function or use Q&A slot at the end

4 ©2023 ANSYS, Inc. / Confidential


• DECEMBER 2019

Hands-On:
Automation and Customization of
Your Structural Simulation
Workflows

© Copyright 2023 ANSYS, Inc. / Confidential


Two possible approaches to scripting

Product 1
Product 1

Product 2 Ansys Ecosystem Ansys Product 2


Ecosystem
Technology 3
Product 4
Product 3

Product scripting PyAnsys scripting

6 ©2023 ANSYS, Inc. / Confidential


Scripting from within the products

Geometry scripting (SpaceClaim or Discovery)

MAPDL scripting

Mechanical scripting
WB scripting

7 ©2023 ANSYS, Inc. / Confidential


Scripting from within the customer tools
Products
Any tool from which you can write Python (UI is yours to choose)
Ansys
API
Product A
PyAnsys
technology Ansys
API
Product B

Ansys
API
MAPDL

Technology components
Possibility to use other
useful Python tools Meshing

Data
Processing
Framework

Customer Ansys
tools Technology

8 ©2023 ANSYS, Inc. / Confidential


Product scripting
Product scripting

10 ©2023 ANSYS, Inc. / Confidential


Geometry scripting
• Prepare geometry
• Modify parameters
• Replay script
• Recording capabilities
• In SpaceClaim or in Discovery

11 ©2023 ANSYS, Inc. / Confidential


Project page scripting
• Create component systems
• Link them together
• Update them
• Recording capabilities

Example: Sequentially solve blocks with internal names “SYS” and “SYS 2”.

Update result cell of analysis block “SYS”

Update result cell of analysis block “SYS 2”

12 ©2023 ANSYS, Inc. / Confidential


Mechanical scripting: automation

13 ©2023 ANSYS, Inc. / Confidential


Mechanical scripting: complete model setup and postprocessing

14 ©2023 ANSYS, Inc. / Confidential


Mechanical code objects
Run scripts automatically at the “proper time”

Python Code Object Python Result Object


Automate changes and non-graphical operations Create custom plots

• Execute Python code in response to events occurring • Create custom postprocessing workflow
in Mechanical
• Plot result as if it was a standard Mechanical item
• Use Python code to inject MAPDL commands into the
solver input • Add properties in the details view as needed (inputs,
outputs, parameters)
• Define custom properties
• Based on DPF technology

15 ©2023 ANSYS, Inc. / Confidential


Python Code example: Create new parameters for design
variations
def before_solve(this, analysis):# Do not edit this line
"""
Called before solving the parent analysis.
Keyword Arguments :
this -- this python object
analysis -- Static Structural
"""
preload =
this.PropertyProvider.GetPropertyByName("Parameters/Preload
(N)").Value

all_prets = DataModel.GetObjectsByName('Bolt Pretension')

for prets in all_prets:


times = range(1,prets.Parent.AnalysisSettings.NumberOfSteps+1)
preload_vals=[]
time_vals=[]
Preload value available as parameter for time in times:
time_vals.append(Quantity(float(time), "sec"))
• Update can be applied to one or more preload_vals.append(Quantity(float(preload), "N"))
pretension objects
prets.Preload.Inputs[0].DiscreteValues = time_vals
• Called before solving to update value sent to prets.Preload.Output.DiscreteValues=preload_vals
the solver

16 ©2023 ANSYS, Inc. / Confidential


Python Result example: stress threshold
Standard result: plot stress on complete model

Python result: plot stress above a specified value

17 17 ©2023 ANSYS, Inc. / Confidential


Mechanical scripting ease of use

Automation scripts can


be saved to a button

Both Python Code and


Python Code object can be Use DPF to create Python Result objects allow
Automate result search used to send MAPDL custom results for user inputs and outputs,
and label creation commands to the solver (Mechanical) and parametric definition

18 ©2023 ANSYS, Inc. / Confidential


Ansys Customization
Toolkit (ACT)
Customization tools (ACT)
• Encapsulate and distribute scripts and ‘know-how’ in an intuitive way
• Create your own loads, boundary conditions, or results
• Guide and automate simulation workflows using ACT Wizards
• Hide source code from end users

Custom loads, custom results, … Embed MAPDL macros Guided workflows

20 ©2023 ANSYS, Inc. / Confidential


ACT personas and file types

❑ End-user side ❑ Creator’s side


▪ Install binary .wbex file ▪ .xml file to configure the UI (buttons, actions, etc)
▪ IronPython (.py) script file to implement the
extension’s functionalities
▪ For wizards, .html files can be added to guide
user through the different steps

21 ©2023 ANSYS, Inc. / Confidential


Data Processing
Framework (DPF)
technology
DPF: a powerful way to post-process and create custom results

.RST
.RTH

Manipulate/ Visualize/
Access Transform/
Simulation
Export/
Map Transfer
Data
Simulation Data Field Data

.csv
.vtk
.hdf5 Physics Agnostic
Performance
Remote/Distributed Access Create custom plots
Pythonic Facilitate data transfer in multi-tool simulations
Customizable
Open Source
Dedicated Libraries (eg: numpy, matplotlib)
Plug & Play

23 ©2023 ANSYS, Inc. / Confidential


DPF data model – Operator
• Each process is divided into several unitary operations carried out by operators

• Operators can be chained to realize simple or complex operations

24 ©2023 ANSYS, Inc. / Confidential


Where can DPF be used ?

In Mechanical: Mechanical DPF


• Scripting console
• Python Code object
• Python Result object

In PyAnsys: PyDPF
• Several packages to address different needs:
• PyDPF-Core: standard implementation of DPF
• PyDPF-Post: simplified functions for standard post-processing
• PyDPF-Composites: for postprocessing of composite models

25 ©2023 ANSYS, Inc. / Confidential


Example #1: Pressure profile

Pressure variation for nodes in contact with upper plate


Ansys internal model along with deformation profile

26 ©2023 ANSYS, Inc. / Confidential


Example #2: Expanding generalized Axisymmetric results

Standard results Expanded results thanks to


Mechanical DPF

27 27 ©2023 ANSYS, Inc. / Confidential


PyAnsys scripting
PyAnsys scripting

29 ©2023 ANSYS, Inc. / Confidential


What is PyAnsys?
Not a product! Set of technologies that allow the user to interface with Ansys products pythonically

Python Ansys PyAnsys

The PyAnsys project is Ansys’s commitment to open-source where we provide


Python libraries that expose Ansys technologies in the Python ecosystem
through APIs and interfaces that are clear, concise, and maintainable. This
allows Ansys customers to do:
• Flexible Automation: Democratize powerful capabilities offered by Ansys through scripting
• Flexible Distribution : Connect Ansys and Open-Source technologies in a seamless manner
• Broader Technology Integration: Integrate Ansys physics capabilities easily with AI/ML

30 ©2023 ANSYS, Inc. / Confidential


What is open source in PyAnsys?

That’s the open This remains proprietary


source part and consumes product
licenses

31 ©2023 ANSYS, Inc. / Confidential


What’s the UI like?
No specific UI. User’s choice.
• PyAnsys is a set of tools to interact with Ansys products from a Python interface
• Any Python interface can be used (even the Windows Command Prompt !)
• Using an IDE (Integrated Development Environment) is recommended to write and maintain code.
Many IDEs are available: Spyder, PyCharm, VS Code, Visual Studio, ….

User can also develop apps by coding both


Code can be written from a web-page thanks An IDE can be used (PyCharm, Spyder, …) the front end and the back end
to Jupyterlab

32 ©2023 ANSYS, Inc. / Confidential


Available PyAnsys packages

Simulation librairies Utility librairies Postprocessing librairies

33 ©2023 ANSYS, Inc. / Confidential


PyAnsys Source Code and Documentation
PyAnsys is an open-source project. The source code and documentation are provided on Github.

https://github.com/ansys

Source Code and Documentation

Introduction videos
available on ansys.com:
• 3 min video
• 15 min video

Each package has documentation


and many examples

34 ©2023 ANSYS, Inc. / Confidential


Example: Web app to perform FE simulation

• Standalone App

• UI is created through Python


too (in this case, Plotly Dash)

• Simulation is done in the


back through FE analysis in
PyAnsys

35 ©2023 ANSYS, Inc. / Confidential


In any case
Choosing between various technologies – running scripts
Actively developing Run script from console

Source code can be


exposed
Development is
User button
Manually by clicking on “frozen”
a button

Need a deployable
solution that protects
ACT Custom Button
source code and is
easily distributable

Deploying a Mechanical To create a custom


Python Result
script result
Source code exposed;
no need to distribute
For other reasons than
Python Code
creating a result plot

Automatically at the
right time and/or with
user inputs To create a custom load ACT Custom Load
or boundary condition

Need a deployable
solution that protects To create a custom
ACT Custom Result
source code and is result plot
easily distributable

For other reasons ACT Custom object

37 ©2023 ANSYS, Inc. / Confidential


Choosing between various technologies – guided workflows

In-product solution
ACT Wizard
with low-code UI

Guided workflow
External solution with
greater deployment Web App
and UI flexibility

38 ©2023 ANSYS, Inc. / Confidential


Ansys Developer Forum

https://discuss.ansys.com/

39 ©2023 ANSYS, Inc. / Confidential


Getting support, asking for enhancement, report a bug
Bug Open an issue in Github

Related to PyAnsys Feature request Open an issue in Github

Help with a command


Use the Dev Forum
or a script
I need help

Help with command or


Use the Dev Forum
script
Related to Product
Scripting
Contact Ansys TECS
Customer Support
Any issue
(open a Service
Request)

They will put you in


Want to discuss a
Contact AM and or TAM contact with an
project
application engineer

40 ©2023 ANSYS, Inc. / Confidential


Documentation and training material

Documentation Training material Support

SpaceClaim/Discovery scripting Ansys Help: SCDM scripting Ansys Learning Hub: Scripting in Ansys Developer Forum,
SpaceClaim Ansys Customer Portal,
Ansys Innovation Courses: Scripting in [email protected]
Ansys Discovery, Advanced scripting in
Ansys Discovery
Mechanical scripting Ansys Help: Scripting in Mechanical Ansys Learning Hub: Ansys Mechanical Developer Forum,
Scripting Ansys Customer Portal,
[email protected]

DPF scripting • For Mechanical DPF: Ansys Help: Ansys Learning Hub: Introduction to Data Developer Forum,
Python Result Processing Framework Ansys Customer Portal,
• For PyDPF: Github Documentation: DPF [email protected]
docs
ACT scripting Ansys Help: Customization suite Ansys Learning Hub: Introduction to Ansys Developer Forum,
ACT in Mechanical, Introduction to Ansys Ansys Customer Portal,
ACT Wizards [email protected]

PyAnsys Github Documentation: PyAnsys project Ansys Innovation Courses: Intro to Using PyAnsys: Ansys Developer Forum
Python, Getting Started with PyMAPDL, Report issues (bug, enhancement need):
Developing WebApps for Modeling and open an issue on Github (in the repo of
Simulation Using PyAnsys each package)

41 ©2023 ANSYS, Inc. / Confidential


Key Take-Aways of Today’s Session

Save time and improve robustness by automating your


workflows

Automate and customize either from within Ansys tools or from


within your external tools

Create efficient custom postprocessing workflows

42 ©2023 ANSYS, Inc. / Confidential


End of Recording

Q&A

What questions do you


have?
Please use Chat function or unmute yourself
The Siemens Private Tour – Next Events

44 ©2023 ANSYS, Inc. / Confidential

You might also like