首页/文章/ 详情

PyFluent文档|07 General设置

精品
作者优秀平台推荐
详细信息
文章亮点
作者优秀
优秀教师/意见领袖/博士学历/特邀专家
平台推荐
内容稀缺
6天前浏览1468

本文示例展示了使用PyFluent设置Fluent General参数。

1 检查网格

此示例展示了使用TUI命令与Python代码执行网格一致性检查及在控制台中显示报告的对比。报告包含了区域范围、体积统计信息、网格面面积统计、所有警告以及关于失败的详细信息。所展示信息的详略程度取决于为verbosity(0到3级)设置的参数。

TUI命令

/mesh/check
/mesh/check-verbosity 1

Python代码

import ansys.fluent.core as pyfluent
solver = pyfluent.launch_fluent(precision='double', processor_count=2, mode="solver")
solver.tui.file.read_case('file.cas.h5')
solver.tui.mesh.check()

2 报告网格质量

此示例展示了通过TUI命令与Python代码在控制台中展示网格质量信息的对比,其中包括最小正交质量和最大长宽比。

TUI命令

/mesh/quality

Python代码

solver.tui.mesh.quality()

3 缩放网格

此示例比较了使用TUI命令和Python代码在各个活跃的笛卡尔坐标方向上对网格进行缩放的方法。

TUI命令

/mesh/scale 1 1 1

Python代码

solver.tui.mesh.scale(1,1,1)

4 定义单位

此示例比较了使用TUI命令和Python代码在各个活跃的笛卡尔坐标方向上对网格进行缩放的方法。

TUI命令

/define/units length 'in'

Python代码

solver.tui.define.units("length", "in")

5 设置稳态或瞬态求解模型

此示例对比了通过TUI命令与Python代码启用和禁用稳态及非稳态(瞬态)求解模型的方式。

TUI 命令

/define/models/steady yes
/define/models/unsteady_1st_order yes

Python 代码

import ansys.fluent.core as pyfluent
solver = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver")
solver.tui.file.read_case("file.cas.h5")
solver.tui.define.models.steady("yes")
solver.tui.define.models.unsteady_1st_order("yes")

6 设置压力基及密度基

该示例显示了 TUI 命令与 Python 代码在启用和禁用压力基和密度基求解器模型方面的比较。

TUI 命令

/define/models/solver/density-based-explicit yes
/define/models/solver/density-based-implicit yes
/define/models/solver/pressure-based yes

Python 代码

solver.tui.define.models.solver.density_based_explicit("yes")
solver.tui.define.models.solver.density_based_implicit("yes")
solver.tui.define.models.solver.pressure_based("yes")

7 设置重力加速度

本例显示了 TUI 命令与 Python 代码在设置重力加速度方面的比较。

TUI 命令

/define/operating-conditions/gravity yes 0 -9.81 0

Python 代码

solver.tui.define.operating_conditions.gravity("yes","0","-9.81","0")
来源:CFD之道
Fluentpython控制ANSYS
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2024-06-23
最近编辑:6天前
CFD之道
博士 | 教师 探讨CFD职场生活,闲谈CFD里外
获赞 2484粉丝 10637文章 683课程 27
点赞
收藏
未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈