View
235
Download
4
Category
Preview:
Citation preview
© 2015 ANSYS, Inc. 1
ANSYS定制开发技术
王昱皓/高级实施工程师
© 2015 ANSYS, Inc. 2
仿真应用发展
通用产品
仿真计算 +
定制开发
专业产品包
仿真体系
© 2015 ANSYS, Inc. 3
ANSYS产品家族
© 2015 ANSYS, Inc. 4
基于WorkBench框架的应用整合
Geometry Meshing Setup Solve Results
Meshing Results Geometry
Setup Solve
Setup Solve
应用集成
Framework Toolkit Data and Process Management
Scripting Parameterization
结构
电磁
Meshing Setup Solve Results
Component applications, covering various phases of the simulation process, sitting on top of a common framework
© 2015 ANSYS, Inc. 5
WorkBench的应用层次
集成应用框架
− WB2 框架
− 集成化的仿真组件
− 分析过程及数据关联,设计探索优化,工程数据
− 完全脚本化
− 脚本语言: Python
集成的应用程序 • 在Workbench中共享数据和参数
• 独立的UI及应用窗口
如., Mechanical, Mechanical APDL, CFX, FLUENT, DM
• 脚本语言: JScript, Scheme, APDL …
© 2015 ANSYS, Inc. 6
应用框架
Application
HTML XML JavaScript
Core C++ Application Logic
GUI
Workbench Design Modeler and Mechanical application share same architecture
© 2015 ANSYS, Inc. 7
ANSYS ACS
A new offering at R14.5,R15.0,R16.0
Application Customization Toolkit (ACT) Toolkit for application-level
customization Specific to ANSYS Mechanical at R14.5 Specific to DM,DX at R15.0 ANSYS Mechanical GUI Specialist programmer skills are NOT
required
ANSYS Customization Suite = Workbench Software Development Kit (SDK) Toolkit for Framework integration System appears in the Toolbox on the
WB project page Third-party application GUI Specialist programmer skills required
+
© 2015 ANSYS, Inc. 8
Workbench定制开发
© 2015 ANSYS, Inc. 9
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
Solver interaction:UPF,APDLMath Loads,BC:APDL、UPF、External Data、ACT Results:APDL、ACT、UPF、Excel Other links:ACT、Excel、External Connector
© 2015 ANSYS, Inc. 10
Enable automatic recording − Tools -> Options… -> Journals and Logs
Automatically Record Journals
© 2015 ANSYS, Inc. 11
Manually Record Journal
1 2
3
Do the operations
4
© 2015 ANSYS, Inc. 12
Edit Journal
© 2015 ANSYS, Inc. 13
Replay Journal/Run Script
1 2
3
4
Recorded operation is replayed
© 2015 ANSYS, Inc. 14
A journal can also be replayed from the command line − Add –R <filename.wbjn>
− Add –I for interactive mode or –B for batch
Replay Journal/Run Script (2)
© 2015 ANSYS, Inc. 15
Online Help includes:
− “Overview” and “How-to”
−Complete command reference
−Many examples
Documentation
© 2015 ANSYS, Inc. 16
Examples (1) : WB 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
© 2015 ANSYS, Inc. 17
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
© 2015 ANSYS, Inc. 18
Examples (2): External Connection 利用External Connection组件进行第三方软件集成
编写少量Python脚本,具有很强的开放性
可实现参数关联与自动传递,一次设置,多次自动分析优化
特色:多学科仿真过程集成与自动化优化;与ANSYS软件无缝集成
© 2015 ANSYS, Inc. 19
− 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
© 2015 ANSYS, Inc. 20
Workbench Command Line Options
Argument Operation -B Run Workbench in batch mode. The user interface is not
displayed and a console window is opened. The functionality of the console window is the same as the Workbench Command Window.
-R <ANSYS Workbench script file>
Replay the specified Workbench script file on start-up. If specified in conjunction with –B, Workbench will start in batch mode, execute the specified script, and shut down at the completion of script execution.
-I Run Workbench in interactive mode. This is typically the default, but if specified in conjunction with –B, both the user interface and console window are opened.
-X Run Workbench interactively and then exit upon completion of script execution. Typically used in conjunction with –R.
-F <ANSYS Workbench project file>
Load the specified Workbench project file on start-up.
-E <command> Execute the specified Workbench scripting command on start-up. You can issue multiple commands, separated with semicolons (;), or specify this argument multiple times and the commands will be executed in order.
© 2015 ANSYS, Inc. 21
Examples (4): Custom GUI on WB
Windows Linux
© 2015 ANSYS, Inc. 22
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
© 2015 ANSYS, Inc. 23
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
© 2015 ANSYS, Inc. 24
Examples (7): ACT
Specific Loads/BCs
Specific results
© 2015 ANSYS, Inc. 25
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
© 2015 ANSYS, Inc. 26
经典ANSYS定制开发
© 2015 ANSYS, Inc. 27
经典ANSYS定制开发技术
开发工具 说明
APDL (ANSYS Parametric Design
Language)
通常的命令流
UPFs (User Programmable Features)
操作途径是对ANSYS核心Fortran代码进行修改,对开发者有限元知识
水平要求较高
UIDL (User Interface Design Language)
用户界面设计语言
Tcl/Tk 独立的工具命令语言,与ANSYS接口良好
© 2015 ANSYS, Inc. 28
Tcl/Tk与ANSYS接口API
通过Tcl调用ANSYS的接口函数,与ANSYS进行交互操作和数据传递,主要使用两条命令:
− ans_sendcommand:向ANSYS传递APDL命令
− ans_getvalue:从ANSYS数据库中获取变量值
上面两条命令足以满足90%的开发需求
使用举例:
− ans_sendcommand ) cm,center,line # 创建名为center的线组件
− set maxindex [ans_getvalue kp,0,num,maxd] #从ANSYS数据库中获取节点的最大编号赋值给maxindex
© 2015 ANSYS, Inc. 29
经典ANSYS定制开发:TCL/TK+APDL
© 2015 ANSYS, Inc. 30
CFD软件定制开发
© 2015 ANSYS, Inc. 31
Fluent中使用Scheme Fluent主窗口 工具栏菜单 menu
工具栏下拉菜menu 触发窗口panel
© 2015 ANSYS, Inc. 32
CFX 中使用CCL
• 在CFX模型树中,右键单击一个模块,点击Edit in Command Editor,可对模块进行编
辑,或复制CCL脚本
© 2015 ANSYS, Inc. 33
Workbench 发送SendCommand
• 在Workbench项目页通过Python发送SendCommand(Command=“””“””)调
用Fluent Scheme和CFX ccl
调用CFX CCL脚本
调用FLUENT Scheme脚本
© 2015 ANSYS, Inc. 34
面向工程应用的定制开发
© 2015 ANSYS, Inc. 35
定制开发的目的
在通用软件的基础上,通过客户化定制开发,固
化仿真流程、规范仿真应用过程、构建向导化的
仿真分析模板、封装企业仿真分析指南及规范、
定制仿真分析报告,最终形成面向特定行业、工
业品及专业方向的仿真应用专业系统。 仿真知识和经验显性化、软件化,使得客户的仿真应用更快、更准
。
密切结合客户需求和过程需求,持续扩展与丰富。
© 2015 ANSYS, Inc. 36
仿真分析定制开发方向
仿真任务:单学科、多学科、优化计算、疲劳计算、…
Solving Postprocessing CAD Preprocessing
几何
模型预处理
分网
材料
边界条件
求解设置
单学科求解
后处理
优化
多学科求解
CAD工具
前处理工具
求解器
后处理工具
Catia Pro/E UG DM …
ANSYS ICEM CFD Patran Hypermesh …
结构 流体 电磁 耦合 优化
ANSYS CFX Fluent
DX Feko
FE-Safe
ABAQUS Nastran
ANSYS ICEM CFD Patran Hypermesh …
模型 … 载荷库
… 计算 工况
分网规则
材料库
数据存储
… 报告模板
评价 规范
…
© 2015 ANSYS, Inc. 37
仿真分析定制开发方向
仿真任务:单学科、多学科、优化计算、疲劳计算、…
Solving Postprocessing CAD Preprocessing
几何
模型预处理
分网
材料
边界条件
求解设置
单学科求解
后处理
优化
多学科求解
CAD工具
前处理工具
求解器
后处理工具
Catia Pro/E UG DM …
ANSYS ICEM CFD Patran Hypermesh …
结构 流体 电磁 耦合 优化
ANSYS CFX Fluent
DX Feko
FE-Safe
ABAQUS Nastran
ANSYS ICEM CFD Patran Hypermesh …
模型 … 载荷库
… 计算 工况
分网规则
材料库
数据存储
… 报告模板
评价 规范
… 仿真分析资源库(模型、材料、载荷、…):统一管理,提高效率
工具集成:软件集成,统一界面
分析流程-模板化
专业化应用-工程化
© 2015 ANSYS, Inc. 38
仿真分析定制开发方向
仿真任务:单学科、多学科、优化计算、疲劳计算、…
Solving Postprocessing CAD Preprocessing
几何
模型预处理
分网
材料
边界条件
求解设置
单学科求解
后处理
优化
多学科求解
CAD工具
前处理工具
求解器
后处理工具
Catia Pro/E UG DM …
ANSYS ICEM CFD Patran Hypermesh …
结构 流体 电磁 耦合 优化
ANSYS CFX Fluent
DX Feko
FE-Safe
ABAQUS Nastran
ANSYS ICEM CFD Patran Hypermesh …
模型 … 载荷库
… 计算 工况
分网规则
材料库
数据存储
… 报告模板
评价 规范
… 仿真分析资源库(模型库、材料库、截面库、载荷库、…):统一管理,提高效率
工具集成:软件集成,统一界面
分析流程-模板化
专业化应用-工程化
面向工程应用的专业系统
© 2015 ANSYS, Inc. 39
仿真分析定制开发方向
客户化定制与实施 仿真计算环境
资源库集成
仿真流程定制
多学科工具集成
自研算法封装 ………
© 2015 ANSYS, Inc. 40
仿真分析定制开发方向
工程化 1——多学科工具集成 – WorBench采用模块化设计,通过插
件的形式集成各类软件工具,从而
实现功能扩充。
集成第三方组件
ANSYS SDK与VS集成 仿真流程搭建
© 2015 ANSYS, Inc. 41
仿真分析定制开发方向
工程化 2——复杂仿真流程定制 – 通过配置面板的方式,自动化搭建仿真流程。
© 2015 ANSYS, Inc. 42
仿真分析定制开发方向 工程化 3——专业模板开发
– 在各功能模块基础上开发专业模板,建立各种专业系统。
流体仿真模板
© 2015 ANSYS, Inc. 43
仿真分析定制开发方向 工程化 4——工程数据资源集成
– 材料库、模型库、工况库等。
飞机翼型库 载荷工况库
材料库
© 2015 ANSYS, Inc. 44
仿真分析定制开发方向 工程化5—— 规范、标准、算法封装及可视化
© 2015 ANSYS, Inc. 45
Thank you
Recommended