Ansys workbench如何与isight联合优化分析?

2016-08-22  by:CAE仿真在线  来源:互联网

ANSYS Workbench 组件

Ansys组件容许Isight与ANSYS Workbench软件交互。

关于ANSYS Workbench组件

ANSYSWorkbench组件运行Isight与ANSYS Workbench软件进行数据交换,并且可以驱动ANSYS Workbench仿真模拟。ANSYS Workbench组件是一个应用程序组件,创建了Isight与ANSYS Workbench软件的链接。该组件可以读取一个ANSYS Workbench项目文件并生成一个输入和输出参数列表,在ANSYS Workbench组件编辑器可以修改输入参数的值。该组件允许执行各种类型的分析(如流体流动、静态的结构分析等等),以及与其他解算器结构在一起(如Fluent等)。该组件还允许提供定制Python脚本检索和更新参数。可以使用Isight流程组件(如DOE和Optimization)探索设计空间,并优化模型。

下图显示了ANSYS Workbench组件编辑页面:

图1. ANSYS Workbench组件编辑页面

开始ANSYS Workbench组件编辑器,双击ANSYS Workbench组件图标,当完成ANSYS Workbench组件编辑器配置后,点击OK关闭编辑器。

ANSYS Workbench支持的版本

该组件支持ANSYS Workbench软件的12.1和13.0版本。

前提条件

必须满足前提条件才能运行ANSYS Workbench组件。在使用ANSYS Workbench组件之前,必须执行以下操作:1.必须在计算机上安装了ANSYSWorkbench12.1和13.0版本软件;2.必须有一个ANSYSWorkbench可执行文件的环境变量,Name为:ANSYS_WB_EXE_PATH;值为:ANSYS Workbench执行路径。例如:D:\ANSYSInc\v121\Framework\bin\Win32\RunWB2.exe。3.当首次使用该组件,运行install.bat文件,该文件在<Isightinstallation directory>\intel_a\reffiles\SMAFIPcomponent\AnsysWorkbench目录中。

配置ANSYS Workbench组件

接下来详述如何配置ANSYS Workbench组件执行ANSYS Workbench模拟。在这里可以选择将被用于Isight模型的输入和输出参数,设置设计选项和执行选项,并查看相关组件的信息。

选择ANSYS Workbench Project和Parameters

可以选择一个ANSYS Workbench项目文件,组件对该文件进行扫描,并显示可用的参数。然后,可以选择想要在Isight模型中使用的参数。

1.双击ANSYS Workbench组件图标,将弹出ANSYS Workbench Component Editor页面。

2.从ANSYS Workbench Component Editor页面,单击选择Parameters标签。

3.单击Browse。

4.导航到你想要使用的ANSYS Workbench项目文件(.wbpj格式),并单击打开。如果你想要使用自定义Python脚本,在选择项目文件之前,从Advanced选项卡选择Use Custom Script。

一个ANSYS Workbench项目的存档文件(.zwp格式)及其支持的文件将被创建在之前选择的项目文件(.wbpj格式)所在目录中。如果双击.zwp格式文件,将创建一个临时目录zwpContents,在其中提取.zwp文件内容。选中的ANSYS Workbench项目将被启动。

注:如果使用的是几何进口,该几何进口文件的副本将被添加到子目录ImportedFilesByAnsys,子目录将被创建在与项目文件(.wbpj)相同的目录中。

ANSYS Workbench项目中的参数将被显示在Available Parameters区域。为了保证Isight模型能够使用这些参数,需要将它们添加到Isight Parameters区域。

5.如果参数很多,在Isight中可以通过下列方式对参数进行分类和筛选。

a)通过点击相应的列标题类的参数。

第一次单击列数据按升序排列,第二次单击列数据按降序排序,第三次单击列数据恢复初始排列顺序,列标题右边的小箭头图标显示当前排序选项。

b)通过Mode或者Type模式。

c)在筛选框中输入参数名称,可查看参数的某些信息。

6.通过下列方式选择你想要在Isight模型中使用的参数。

选项

描述

单击check box

选择一个单独的参数

单击

选择所有参数

单击

清除所有被选参数

7.向Isight Parameter区域添加选中的参数

a)单击"+",向Isight Parameter区域中添加选中的参数;

b)单击"-",从Isight Parameter区域中移除选中的参数

8.单击OK保存设置,并返回Design Gateway界面。

配置Design和Execution选项

可以使用Advanced标签来设置设计和执行选项

1.双击ANSYS Workbench组件图标,将弹出ANSYS Workbench Component Editor页面。

2.从ANSYS Workbench Component Editor页面,单击选择Advanced标签。

3.设置Design Options项:

选项

描述

Create in model file paremeters

在Isight模型(.zmf)中保存输入文件

Use Custom Script

通过组件使用自定义Python脚本定制组件的输入和输出,这些Python脚本文件应该放置在工作目录下,与.wbpj文件同一个目录中。在选择输入项目文件之前必须要选择该选项。

4.设置Execution Options:

选项

描述

Show ANSYS Workbench during execution

启动ANSYS Workbench作为前台进程,可以查看在ANSYS Workbench模型执行期间发生的变换

Time Out

输入一个值(以秒为单位)来指定等待执行的时间,超出该时间则确定执行失败,默认为300秒

5.单击OK保存设置,并返回Design Gataway。

关于使用脚本

组件允许你提供定制的Python脚本检索和更新组件参数。如果你选择Use Custom Script标签,则ANSYS Workbench组件执行两个特定用户提供Python模块。这些模块的名称必须是userscript_dt.py(设计界面脚本)和userscript_rt.py(运行脚本)。可以使用这些脚本执行ANSYS Workbench组件不支持,但是必须的参数类型的操作。

可以定义一个或两个这种模块,也可以两个都不定义。组件执行完designtime模块(userscript_dt.py)之后打开ANSYS Workbench项目文件,在runtime模块(userscript_rt.py)特定功能运行之前和之后,执行更新ANSYS Workbench项目。

Designtime脚本(userscript_dt.py)示例

import os

def runUserScript(projPath):

"""

Before this function is called, the ANSYS Workbench project is already

open and the user should not reopen or close it.

This function gets called after fetching the PIDO parameters.

This function will accept a single parameter containing the path of the

user's work directory where the .wbpj file is located.

This function is required to create two text files, user_input_params.txt

&

user_output_params.txt, in the user's work directory. As the name suggests,

these two files must contain custom input & output parameter name-value

pairs

separated by "::". Each pair should be written on a separate line.

In the following code we are creating two dummy parameters - inputParam1 &

outputParam1.

Note: The decimal point character should be ".", irrespective of the locale.

"""

with open(projPath + os.path.sep + "user_input_params.txt", "w") as

inputFile:

inputFile.write("inputParam1::1.2")

with open(projPath + os.path.sep + "user_output_params.txt", "w") as

outputFile:

outputFile.write("outputParam1::2.3")

Runtime脚本(userscript_rt.py)示例:

import os

def runSetUserValues(projPath, custInputParamsDict):

"""

Before this function is called, the ANSYS Workbench project is already

open and the user should not reopen or close it.

This function accepts two parameters.

1. projPath -> It contains the runtime directory path where the .wbpj

file gets copied.

2. custInputParamsDict -> It is a Python dictionary object, and it

contains the updated custom input param name-value pairs.

273

In this function, the user needs to update the values for the custom

input parameters of the ANSYS Workbench project, located at the provided

projPath to get the updated values of the custom output parameters.

Below is an example of how to get the custom input parameters created

by the user.

"""

if (custInputParamsDict.__len__() > 0):

for k, v in custInputParamsDict.iteritems():

# You should write code here to update value of parameter

# 'k' in ANSYS Workbench model with a new value 'v'

def runUserScript(projPath):

"""

This function gets called after solving the ANSYS Workbench project.

It accepts a single parameter containing the user's runtime directory

path where the .wbpj file gets copied.

From this function, the user should fetch the custom output parameters

from the ANSYS Workbench project, and they should be written in a text

file (user_output_params.txt) with name and value separated by "::".

Each parameter is written on a separate line, as shown in the following

code.

Note: The decimal point character should be ".", irrespective of the

locale.

"""

with open(projPath + os.path.sep + "user_output_params.txt", "w") as

outputFile:

outputFile.write("outputParam1::2.4")

查看关于ANSYS Workbench组件的信息

1.双击ANSYS Workbench组件图标,将弹出ANSYS Workbench Component Editor页面。

2.从ANSYS Workbench Component Editor页面,单击选择About标签。About标签提供关于组件的信息,如版本和描述等。

3.单击More查看诊断信息。


开放分享:优质有限元技术文章,助你自学成才

相关标签搜索:Ansys workbench如何与isight联合优化分析? Ansys与isight联合优化分析 ansys isight Ansys有限元培训 Ansys workbench培训 ansys视频教程 ansys workbench教程 ansys APDL经典教程 ansys资料下载 ansys技术咨询 ansys基础知识 ansys代做 Fluent、CFX流体分析 

编辑
在线报名:
  • 客服在线请直接联系我们的客服,您也可以通过下面的方式进行在线报名,我们会及时给您回复电话,谢谢!
验证码

全国服务热线

1358-032-9919

广州公司:
广州市环市中路306号金鹰大厦3800
电话:13580329919
          135-8032-9919
培训QQ咨询:点击咨询 点击咨询
项目QQ咨询:点击咨询
email:kf@1cae.com