程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> fluent批量處理——模型參數的設置,fluent模型參數

fluent批量處理——模型參數的設置,fluent模型參數

編輯:C++入門知識

fluent批量處理——模型參數的設置,fluent模型參數


對於常見的工程應用來說,計算的工況很多,尤其優化工作,少則幾百,多則上千,面對如此之多的case文件要寫,假如按照一個一個的讀寫的話,相信你一定會為這麼機械的工作煩躁,甚至影響今後好幾天的心情,那麼有什麼簡便一些的方法呢?答案是肯定的。那就是采用fluent的journal文件。
首先打開fluent軟件,在file/write/start journal,見下圖:

1.png

選擇保存文件名*.journal後(看你自己怎麼設置文件名),我一般按照這一組的類型來命名;
這樣, journal文件就開始記錄你以後的每一步操作。
按照原先設置模型參數一樣,一步步來就是了。
等你操作完成後,原先的”start journal“現在已經是”stop journal“,所以你只需要選擇”stop journal“就可以了。
此時,用寫字板打開看看就可以看到如下的一些記錄命令。
(cx-gui-do cx-activate-item "MenuBar*ReadSubMenu*Case...")
(cx-gui-do cx-activate-item "Warning*OK")
(cx-gui-do cx-set-text-entry "Select File*Text" "fluent.msh")
(cx-gui-do cx-activate-item "Select File*OK")
(cx-gui-do cx-activate-item "MenuBar*GridMenu*Check")
(cx-gui-do cx-activate-item "MenuBar*GridMenu*Smooth/Swap...")
(cx-gui-do cx-activate-item "Smooth/Swap Grid*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-activate-item "Smooth/Swap Grid*PanelButtons*PushButton1(Swap)")
(cx-gui-do cx-activate-item "Smooth/Swap Grid*PanelButtons*PushButton2(Cancel)")
(cx-gui-do cx-activate-item "MenuBar*ModelsSubMenu*Solver...")
(cx-gui-do cx-activate-item "Solver*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-activate-item "MenuBar*ModelsSubMenu*Viscous...")
(cx-gui-do cx-activate-item "Viscous Model*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-activate-item "MenuBar*DefineMenu*Boundary Conditions...")
(cx-gui-do cx-activate-item "Boundary Conditions*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-set-real-entry-list "velocity-inlet-10-1*Frame4*Frame3(Momentum)*Table1*Table4*RealEntry2(Velocity Magnitude)" '( 10))
(cx-gui-do cx-activate-item "velocity-inlet-10-1*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-activate-item "Boundary Conditions*PanelButtons*PushButton2(Cancel)")
(cx-gui-do cx-activate-item "MenuBar*ControlsSubMenu*Solution...")
(cx-gui-do cx-set-list-selections "Solution Controls*Table1*Frame2(Pressure-Velocity Coupling)*Table2(Pressure-Velocity Coupling)*DropDownList1" '( 1))
(cx-gui-do cx-activate-item "Solution Controls*Table1*Frame2(Pressure-Velocity Coupling)*Table2(Pressure-Velocity Coupling)*DropDownList1")
(cx-gui-do cx-set-list-selections "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList1(Pressure)" '( 3))
(cx-gui-do cx-activate-item "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList1(Pressure)")
(cx-gui-do cx-set-list-selections "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList2(Momentum)" '( 1))
(cx-gui-do cx-activate-item "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList2(Momentum)")
(cx-gui-do cx-set-list-selections "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList3(Turbulent Kinetic Energy)" '( 1))
(cx-gui-do cx-activate-item "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList3(Turbulent Kinetic Energy)")
(cx-gui-do cx-set-list-selections "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList4(Turbulent Dissipation Rate)" '( 1))
(cx-gui-do cx-activate-item "Solution Controls*Table2*Frame1(Discretization)*Table1(Discretization)*DropDownList4(Turbulent Dissipation Rate)")
(cx-gui-do cx-activate-item "Solution Controls*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-activate-item "MenuBar*MonitorsSubMenu*Residual...")
(cx-gui-do cx-set-real-entry-list "Residual Monitors*Table2*RealEntry11" '( 1e-005))
(cx-gui-do cx-set-toggle-button "Residual Monitors*Table1*Frame1(Options)*ToggleBox1(Options)*CheckButton2(Plot)" #f)
(cx-gui-do cx-activate-item "Residual Monitors*Table1*Frame1(Options)*ToggleBox1(Options)*CheckButton2(Plot)")
(cx-gui-do cx-set-real-entry-list "Residual Monitors*Table2*RealEntry17" '( 1e-005))
(cx-gui-do cx-set-real-entry-list "Residual Monitors*Table2*RealEntry23" '( 1e-005))
(cx-gui-do cx-set-real-entry-list "Residual Monitors*Table2*RealEntry29" '( 1e-005))
(cx-gui-do cx-set-real-entry-list "Residual Monitors*Table2*RealEntry35" '( 1e-005))
(cx-gui-do cx-set-real-entry-list "Residual Monitors*Table2*RealEntry41" '( 1e-005))
(cx-gui-do cx-activate-item "Residual Monitors*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-activate-item "MenuBar*WriteSubMenu*Case...")
(cx-gui-do cx-set-text-entry "Select File*Text" "fluent.cas")
(cx-gui-do cx-activate-item "Select File*OK")
(cx-gui-do cx-activate-item "Warning*OK")
這樣一個case文件就寫完了,你後面需要做的就是替換"fluent.msh"與"fluent.cas“為你自己的文件名就行。復制粘貼寫好的一個case的journal文件,替換成下一個mesh文件名;值得注意的是,模型文件中的邊界數量要一致,否則會出現錯誤,因為GUI語言是按照fluent裡邊界的ID號來識別的。
基本上,這樣寫case文件還是很省事的,你到時就可以在一邊聽著音樂,一邊看著它自動編寫!

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved