许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  Python与Fluent二次开发:TUI及Scheme代码笔记(Note 2)

Python与Fluent二次开发:TUI及Scheme代码笔记(Note 2)

阅读数 5
点赞 0
article_banner

前言

Python-Fluent coupled simulation:

Python equals to a client(客户端), and Fluent equals to a server( 服务器  ), combined as a CS model.


一、Fluent配置环境

Enviroment Configuration

First define the working directory of the fluent. *Note the working directory should include the *.msh and *.py file.
在这里插入图片描述

   Launch the Fluent as a server. FLUENT_AAS=1&OK
在这里插入图片描述

   Then, the three   .txt files are generated automatically in the working directory.
在这里插入图片描述

二、Python

1.import 库

ICoFluentUnit provide a set of functions: load and save case or data, set iterations, calculate and so on.

   ————————————————

Python

import time
import pathlib
import os
import sys
import io
from fluent_corba import CORBA
import AAS_CORBA #import the AAS_CORBA module compiled from CoFluentUnit.idl
import subprocess
from functools import partial

Matlab

orb=initialize_orb();
load_ansys_aas;
FluetnPath = 'Your own fluent work path';
aaS_Path = char(FluetnPath+"aaS_FluentId.txt");
 
ICoFluentUnit = actfluentserver(orb,aaS_Path);
iFluentTuiInterpreter = ICoFluentUnit.getSchemeControllerInstance();
 
ICoFluentUnit.loadCase('XX.cas');
iFluentTuiInterpreter.doMenuCommand('/display/mesh');
% 任务1、获取流体力
fileId = fopen(FluetnPath+"force.txt", 'r');
[force, count] = fscanf(fileId, '%f') ;
fclose(fileId);   
    
% 任务2、运动方程求解位移
[vel_n, dis_n] = calculate_y_motion(force(end), vel, dis);
dis_history = [dis_history,dis_n];
    
% 任务3、将位移传递到fluent中进行迭代求解
set_dis_commnd = strcat("(rpsetvar 'vel_n ", num2str(vel_n), ").");
iFluentTuiInterpreter.execScheme(set_dis_commnd)
————————————————
此代码为CSDN博主「小碗拉面不加香菜~」原文链接:https://blog.csdn.net/weixin_42130488/article/details/122920156



总结


免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删

相关文章
技术文档
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空