当前位置: 首页 > news >正文

如何安装PyFluent

0.什么是PyFluent?

官方介绍如下:

PyFluent 是 PyAnsys 生态系统的一部分, 允许您在所选的 Python 环境中结合使用 Fluent 与其他 PyAnsys 库和外部 Python 库一起使用。

PyFluent 实现了客户端-服务器体系结构。它使用谷歌遥控器 过程调用或 gRPC 接口,用于启动或连接正在运行的 Fluent 进程作为服务器。但是,您只需要与 Python 交互接口。

可以使用 PyFluent 以编程方式创建、交互和控制 Fluent 会话,用于创建您自己的自定义工作区。此外,您可以使用 PyFluent 通过高度可配置的定制功能提高您的生产力脚本。

PyFluent 文档 0.19.2 — PyFluent (pyansys.com)

可以使用Python控制ANSYS软件的调用,包括网格生成、计算、后处理、数据提取和设计优化,简而言之,很牛。


1.如何使用pip安装库及更换镜像源

使用python的pip安装前先配置合适的源,推荐使用镜像源例如清华、阿里,网速会快一些。

使用以下代码安装nump库,-i后表示选择的源地址。

pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple

也可以使用阿里源,替换代码就可以。

-i https:// mirrors.aliyun.com/pypi/simple

使用 -i 方式是临时换源,也可以修改配置文件永久换源

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

查看是否配置成功:

pip config list

若提示下图则说明成功配置:


附国内常用的镜像源:

清华大学:

https://pypi.tuna.tsinghua.edu.cn/simple

豆瓣:

https://pypi.douban.com/simple/

阿里云:

https://mirrors.aliyun.com/pypi/simple/

中国科学技术大学:

https://pypi.mirrors.ustc.edu.cn/simple

2.安装PyFluent所需库文件

所需核心库有以下三个:

  • PyFluent-Core:GitHub - ansys/pyfluent: Pythonic interface to Ansys FluentPythonic interface to Ansys Fluent. Contribute to ansys/pyfluent development by creating an account on GitHub.icon-default.png?t=N7T8https://github.com/ansys/pyfluent
  • PyFluent-parametric:GitHub - ansys/pyfluent-parametric: Pythonic interface to Ansys Fluent parametricPythonic interface to Ansys Fluent parametric. Contribute to ansys/pyfluent-parametric development by creating an account on GitHub.icon-default.png?t=N7T8https://github.com/ansys/pyfluent-parametric
  • PyFluent-visualizetion:GitHub - ansys/pyfluent-visualization: Visualize Ansys Fluent simulations using PythonVisualize Ansys Fluent simulations using Python. Contribute to ansys/pyfluent-visualization development by creating an account on GitHub.icon-default.png?t=N7T8https://github.com/ansys/pyfluent-visualization

 可在开源网格GitHub中下载,也可以使用ANSYS官方的 Ansys Python Manager 程序进行辅助配置,比较方便。库版本需要与Python版本和ANSYS版本进行匹配。

  • PyAnsys文档:https://docs.pyansys.com/icon-default.png?t=N7T8https://docs.pyansys.com/version/dev/
  • 下载Ansys Python Manager:https://github.com/pyansys/python-installer-qt-gui/releases/icon-default.png?t=N7T8https://github.com/pyansys/python-installer-qt-gui/releases/
  • 下载 Python: Download Python | Python.orgThe official home of the Python Programming Languageicon-default.png?t=N7T8https://www.python.org/downloads/

官方安装链接视频如下,本文是对其内容进行简化:

PyFluent 安装 |Ansys创新课程icon-default.png?t=N7T8https://courses.ansys.com/index.php/courses/getting-started-with-pyfluent/lessons/lesson-2-installation/

Ansys-Python-Manager安装后启动界面如下:

2.1安装Phthon

如果电脑中未安装Python,可以在此界面中安装,如已安装可以跳过此界面。Python版本推荐最新版本的前一个版本,稳定而不落后。

Python安装地址:

Download Python | Python.orgicon-default.png?t=N7T8https://www.python.org/downloads/

2.2 安装配置虚拟环境

可选则是否创建虚拟环境,此后运行代码可在此环境中进行,无需到Python默认路径。若无需求可跳过此界面。

2.3 安装PyFluent所需库文件

在该窗口下依次安装Core、parametric和visualizetion库文件。

2.4 启动Jupyter Notebook

在目录中输入cmd,当前路径下启动命令行窗口。

 输入“jupyter notebook”启动Jupyter Notebook。

 Jupyter Notebook启动界面。

 可以新建或者打开文档,这里打开ANSYS官方提供的实例“Launching Fluent.ipynb”:

" Launching Fluent.ipynb"文件内容:

 选中一行代码后可“SHIFT+Enter”运行,或者点击 “单箭头” 标志运行该行代码。

这里代码的主要效果是启动FLUENT,运行后效果如下,PyFluent就成功安装了,也可以使用PyCharm或者VS等其他软件启动。

http://www.lryc.cn/news/340788.html

相关文章:

  • Qt 2 QMapQHashQVector类实例
  • 使用Git将文件夹上传到Github以及使用Git LFS上传大文件
  • 1.SCI各模块
  • 记录shell编程中$1,$@等符号的含义
  • 单链表的应用
  • 手机副业赚钱秘籍:让你的手机变成赚钱利器
  • (二十七)Flask之数据库连接池DBUtils库
  • FewShotPromptTemplate和SemanticSimilarityExampleSelector的学习
  • 【保姆级】2024年OnlyFans订阅指南
  • 深入理解JVM中的G1垃圾收集器原理、过程和参数配置
  • VUE3 + Elementui-Plus 之 树形组件el-tree 一键展开(收起);一键全选(不全选)
  • 【Godot4自学手册】第三十七节钥匙控制开门
  • GitHub repository - Pulse - Contributors - Network
  • RocketMQ 10 面试题FAQ
  • 【Spring进阶系列丨第十篇】基于注解的面向切面编程(AOP)详解
  • Leetcode 152. 乘积最大子数组和Leetcode 162. 寻找峰值
  • 项目实战之网络电话本之发送邮件名片和导出word版个人信息
  • 前端面试问题汇总 - HTTP篇
  • Java的IO流
  • Node.js 中的 RSA 加密、解密、签名与验证详解
  • vue+element作用域插槽
  • MUSA模型
  • avicat连接异常,错误编号2059-authentication plugin…
  • 阿里云云效CI/CD配置
  • 个人开发者,Spring Boot 项目如何部署
  • 【Spring进阶系列丨第九篇】基于XML的面向切面编程(AOP)详解
  • 学习记录:转发和重定向
  • 实现(图像、视频等)数据上云存储
  • LeetCode 454.四数相加II
  • GoogleNet网络训练集和测试集搭建