golang做網(wǎng)站怎么樣微信群免費(fèi)推廣平臺(tái)
0.什么是PyFluent?
官方介紹如下:
PyFluent 是?PyAnsys?生態(tài)系統(tǒng)的一部分, 允許您在所選的 Python 環(huán)境中結(jié)合使用 Fluent 與其他 PyAnsys 庫和外部 Python 庫一起使用。
PyFluent 實(shí)現(xiàn)了客戶端-服務(wù)器體系結(jié)構(gòu)。它使用谷歌遙控器 過程調(diào)用或 gRPC 接口,用于啟動(dòng)或連接正在運(yùn)行的 Fluent 進(jìn)程作為服務(wù)器。但是,您只需要與 Python 交互接口。
可以使用 PyFluent 以編程方式創(chuàng)建、交互和控制 Fluent 會(huì)話,用于創(chuàng)建您自己的自定義工作區(qū)。此外,您可以使用 PyFluent 通過高度可配置的定制功能提高您的生產(chǎn)力腳本。
PyFluent 文檔 0.19.2 — PyFluent (pyansys.com)
可以使用Python控制ANSYS軟件的調(diào)用,包括網(wǎng)格生成、計(jì)算、后處理、數(shù)據(jù)提取和設(shè)計(jì)優(yōu)化,簡(jiǎn)而言之,很牛。
1.如何使用pip安裝庫及更換鏡像源
使用python的pip安裝前先配置合適的源,推薦使用鏡像源例如清華、阿里,網(wǎng)速會(huì)快一些。
使用以下代碼安裝nump庫,-i后表示選擇的源地址。
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
也可以使用阿里源,替換代碼就可以。
-i https:// mirrors.aliyun.com/pypi/simple
使用 -i 方式是臨時(shí)換源,也可以修改配置文件永久換源:
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
查看是否配置成功:
pip config list
若提示下圖則說明成功配置:
附國內(nèi)常用的鏡像源:
清華大學(xué):
https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣:
https://pypi.douban.com/simple/
阿里云:
https://mirrors.aliyun.com/pypi/simple/
中國科學(xué)技術(shù)大學(xué):
https://pypi.mirrors.ustc.edu.cn/simple
2.安裝PyFluent所需庫文件
所需核心庫有以下三個(gè):
- 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.
https://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.
https://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.
https://github.com/ansys/pyfluent-visualization
?可在開源網(wǎng)格GitHub中下載,也可以使用ANSYS官方的 Ansys Python Manager 程序進(jìn)行輔助配置,比較方便。庫版本需要與Python版本和ANSYS版本進(jìn)行匹配。
- PyAnsys文檔:https://docs.pyansys.com/
https://docs.pyansys.com/version/dev/
- 下載Ansys Python Manager:https://github.com/pyansys/python-installer-qt-gui/releases/
https://github.com/pyansys/python-installer-qt-gui/releases/
- 下載 Python:?Download Python | Python.orgThe official home of the Python Programming Language
https://www.python.org/downloads/
官方安裝鏈接視頻如下,本文是對(duì)其內(nèi)容進(jìn)行簡(jiǎn)化:
PyFluent 安裝 |Ansys創(chuàng)新課程
https://courses.ansys.com/index.php/courses/getting-started-with-pyfluent/lessons/lesson-2-installation/
Ansys-Python-Manager安裝后啟動(dòng)界面如下:
2.1安裝Phthon
如果電腦中未安裝Python,可以在此界面中安裝,如已安裝可以跳過此界面。Python版本推薦最新版本的前一個(gè)版本,穩(wěn)定而不落后。
Python安裝地址:
Download Python | Python.orghttps://www.python.org/downloads/
2.2 安裝配置虛擬環(huán)境
可選則是否創(chuàng)建虛擬環(huán)境,此后運(yùn)行代碼可在此環(huán)境中進(jìn)行,無需到Python默認(rèn)路徑。若無需求可跳過此界面。
2.3 安裝PyFluent所需庫文件
在該窗口下依次安裝Core、parametric和visualizetion庫文件。
2.4 啟動(dòng)Jupyter Notebook
在目錄中輸入cmd,當(dāng)前路徑下啟動(dòng)命令行窗口。
?輸入“jupyter notebook”啟動(dòng)Jupyter Notebook。
?Jupyter Notebook啟動(dòng)界面。
?可以新建或者打開文檔,這里打開ANSYS官方提供的實(shí)例“Launching Fluent.ipynb”:
" Launching Fluent.ipynb"文件內(nèi)容:
?選中一行代碼后可“SHIFT+Enter”運(yùn)行,或者點(diǎn)擊 “單箭頭” 標(biāo)志運(yùn)行該行代碼。
這里代碼的主要效果是啟動(dòng)FLUENT,運(yùn)行后效果如下,PyFluent就成功安裝了,也可以使用PyCharm或者VS等其他軟件啟動(dòng)。