码迷,mamicode.com
首页 > 其他好文 > 详细

fluent批量处理——模型参数的设置

时间:2016-12-30 20:29:35      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:记录   影响   读写   复制   mode   识别   今后   mda   grid   

对于常见的工程应用来说,计算的工况很多,尤其优化工作,少则几百,多则上千,面对如此之多的case文件要写,假如按照一个一个的读写的话,相信你一定会为这么机械的工作烦躁,甚至影响今后好几天的心情,那么有什么简便一些的方法呢?答案是肯定的。那就是采用fluent的journal文件。
首先打开fluent软件,在file/write/start journal,见下图:

技术分享

选择保存文件名*.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文件还是很省事的,你到时就可以在一边听着音乐,一边看着它自动编写!

fluent批量处理——模型参数的设置

标签:记录   影响   读写   复制   mode   识别   今后   mda   grid   

原文地址:http://www.cnblogs.com/54Leo/p/6238156.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!