应用System Coupling进行Fluent与Mechanical的双向流固耦合
journal 文件的作用就像windows下的批处理文件一样,文件中包含了一连串的操作命令(command)。Fluent读入journal文件后,它就会按找顺序执行一系列的命令。当你的工作中包含有一些重复性的操作时,journal文件就很有用了。
因为FLUENT的journal相对比较难编写,所以一个简单的方法就是,设置的过程中把设置过程保存成journal,下次直接用。具体方法:
(1)FLUENT—File—write—start journal—输入文件名,
(2)读入mesh—设置相关参数—stop journal。 这样journal就生成了,下次使用,直接读入就行了,FLUENT—File—read—journal文件。
下面是一个journal文件例子,可以参考一下:
; Author: huys
; Description: Batch setup for segment one
; Date: 2008/06/03
; Revision:
; 1.1 Add materials from user-defined material database
; Please make sure material's name is right defiend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Read in the mesh file.
file read-case seg1_m.msh
;Scale it. mm -> m.
grid/scale
;x scale factor
0.001
;y scale factor
0.001
;z scale factor
0.001
;Turn on the energy equation
define/models energy?
;Enable energy model?
yes
;Compute viscous energy dissipation?
no
;include pressure work in energy equation?
no
;include kinetic energy in energy equation?
no
;Include diffusion at inlets?
yes
;Specify turbulence model.
define/models/viscous/ke-standard
;Enable the standard k-epsilon turbulence model?
yes
;Select equations to solve.
solve/set/equations flow
;Solve Flow equation(s)?
yes
solve/set/equations temperature
;Solve Energy equation(s)?
yes
solve/set/equations ke
;Solve Turbulence equation(s)?
yes
;Select material database
define/materials/data-base/database-type
;Available Types: (fluent-database user-defined)
;Database Type
user-defined
;Database File [""]
custom.scm
;Copy your materials
define/materials/copy
;Material of type []>
fluid
;database-material-name>
water_var
;
define/materials/copy
;Material of type []>
solid
;database-material-name>
stainless_cnt
;Define boundary conditions
; Wall
define/boundary-conditions/wall
; ...
inner_wall_b
;Wall Thickness (m)
0
;Use Profile for Heat Generation Rate?
no
;Heat Generation Rate (w/m3)
0
;material-name : Change current value?
no
;Thermal BC Type : Change current value?
yes
;Thermal BC Type
;; convection
;; coupled
;; heat-flux
;; mixed
;; network
;; radiation
;; temperature
temperature
;Use Profile for Temperature?
no
;Temperature (k)
1000
;Enable shell conduction?
no
; Inlet
define/boundary-conditions/velocity-inlet
;
inlet_channel_b
;Velocity Specification Method: Magnitude and Direction
no
;Velocity Specification Method: Components
no
;Velocity Specification Method: Magnitude, Normal to Boundary
yes
;Reference Frame: Absolute
yes
;Use Profile for Velocity Magnitude?
no
;Velocity Magnitude (m/s)
10
;Coordinate System: Cartesian (X, Y, Z)
yes
;Use Profile for Temperature?
no
;Temperature (k)
300
;Turbulent Specification Method: K and Epsilon
no
;Turbulent Specification Method: Intensity and Length Scale
no
;Turbulent Specification Method: Intensity and Viscosity Ratio
yes
;Turbulent Intensity (%)
10
;Turbulent Viscosity Ratio
10
; channel
define/boundary-conditions/fluid
;(channel)
;zone id/name
channel
;material-name : Change current value?
yes
;material-name >
water_var
;Specify source terms?
no
;Specify fixed values?
no
;Motion Type: Stationary
yes
;X-Origin of Rotation-Axis (m)
0
;Y-Origin of Rotation-Axis (m)
0
;Z-Origin of Rotation-Axis (m)
0
;X-Component of Rotation-Axis
0
;Y-Component of Rotation-Axis
0
;Z-Component of Rotation-Axis
1
;Deactivated Thread
no
;Laminar zone?
no
;Porous zone?
no
; soild(wall)
define/boundary-conditions/solid
;(wall)
;zone id/name
wall
;material-name : Change current value?
yes
;material-name >
stainless_cnt
;Specify source terms?
no
;Specify fixed values?
no
;Motion Type: Stationary
yes
;X-Origin of Rotation-Axis (m)
0
;Y-Origin of Rotation-Axis (m)
0
;Z-Origin of Rotation-Axis (m)
0
;X-Component of Rotation-Axis
0
;Y-Component of Rotation-Axis
0
;Z-Component of Rotation-Axis
1
;Deactivated Thread
no
;Set Pressure Velocity Coupling Scheme to SIMPLEC
solve/set/p-v-coupling
;Pressure Velocity Coupling Scheme ?
;; 20 for SIMPLE
;; 21 for SIMPLEC
;; 22 for PISO
;; 24 for Coupled
21
;Set the discretization schemes.\
solve/set/discretization-scheme pressure
;Convective discretization scheme for Pressure
;; 10 for Standard
;; 14 for PRESTO!
;; 11 for Linear
;; 12 for Second Order
;; 13 for Body Force Weighted
10
solve/set/discretization-scheme mom
;Convective discretization scheme for Momentum
;; 0 for First Order Upwind
;; 1 for Second Order Upwind
;; 2 for Power Law
;; 4 for QUICK
;; 6 for Third-Order MUSCL
1
solve/set/discretization-scheme temperature
;Convective discretization scheme for Energy
;; 0 for First Order Upwind
;; 1 for Second Order Upwind
;; 2 for Power Law
;; 4 for QUICK
;; 6 for Third-Order MUSCL
1
solve/set/discretization-scheme k
;Convective discretization scheme for Turbulence Kinetic Energy
;; 0 for First Order Upwind
;; 1 for Second Order Upwind
;; 2 for Power Law
;; 4 for QUICK
;; 6 for Third-Order MUSCL
1
solve/set/discretization-scheme epsilon
;Convective discretization scheme for Turbulence Dissipation Rate
;; 0 for First Order Upwind
;; 1 for Second Order Upwind
;; 2 for Power Law
;; 4 for QUICK
;; 6 for Third-Order MUSCL
1
;Set underrelaxation factors.
solve/set/under-relaxation pressure
;Underrelaxation factor for Pressure
0.9
solve/set/under-relaxation mom
;Underrelaxation factor for Momentum
0.9
solve/set/under-relaxation temperature
;Underrelaxation factor for Energy
0.9
solve/set/under-relaxation k
;Underrelaxation factor for Turbulence Kinetic Energy
0.9
solve/set/under-relaxation epsilon
;Underrelaxation factor for Turbulence Dissipation Rate
0.9
solve/set/under-relaxation turb-viscosity
;Underrelaxation factor for Viscosity
0.9
solve/set/under-relaxation density
;Underrelaxation factor for Density
0.9
solve/set/under-relaxation body-force
;Underrelaxation factor for Body Forces
0.9
;Set multigrid.
solve/set/multi-grid-controls pressure
;Multigrid cycle type for Pressure
1
;Termination criterion
1e-30
;Multigrid method for Pressure
0
;Multigrid stabilization for Pressure
0
solve/set/multi-grid-controls x-mom
;Multigrid cycle type for X-Momentum
0
;Termination criterion
1e-30
;Residual reduction tolerance for
0.999
;Multigrid method for X-Momentum
0
solve/set/multi-grid-controls y-mom
;Multigrid cycle type for X-Momentum
0
;Termination criterion
1e-30
;Residual reduction tolerance for
0.999
;Multigrid method for X-Momentum
0
solve/set/multi-grid-controls z-mom
;Multigrid cycle type for X-Momentum
0
;Termination criterion
1e-30
;Residual reduction tolerance for
0.999
;Multigrid method for X-Momentum
0
solve/set/multi-grid-controls k
;Multigrid cycle type for Turbulent Kinetic Energy
0
;Termination criterion
1e-30
;Residual reduction tolerance for
0.999
;Multigrid method for Turbulent Kinetic Energy
0
solve/set/multi-grid-controls epsilon
;Multigrid cycle type for Turbulent Dissipation Rate
0
;Termination criterion
1e-30
;Residual reduction tolerance for
0.999
;Multigrid method for Turbulent Dissipation Rate
0
solve/set/multi-grid-controls temperature
;Multigrid cycle type for Energy
0
;Termination criterion
1e-30
;Residual reduction tolerance for
0.999
;Multigrid method for Energy
0
;Set the convergence criteria.
solve/monitors/residual convergence-criteria
;continuity residual convergence criterion
1e-16
;x-velocity residual convergence criterion
1e-16
;y-velocity residual convergence criterion
1e-16
;z-velocity residual convergence criterion
1e-16
;energy residual convergence criterion
1e-16
;k residual convergence criterion
1e-16
;epsilon residual convergence criterion
1e-16
;Write settings to a case file.
file/write-case
;case file name [""]
"seg1_xx.cas"
Fluent批量计算
对于工程应用来说,计算精度要求不高,但是计算的case比较多,尤其模型优化工作,你可能有几十个case要算。一个case只需要计算个把钟头,对于周末的大好时光来说,两天时间只能算一个,实在是浪费时间。经过一番研究,找到了解决方法。基本原理是使用fluent的journal文件,你要写一个journal文件,命名为1.journal在fluent 的file/write/start journal,选择文件名1.journal后,fluent就还是记录你的操作到1.jouranl中,你操作完成后,file/write/stop journal,用记事本打开看看就知道了。
来一个我写好的journal文件,其作用是读取已有的case and data,计算,保存计算结果。
内容如下:
(cx-gui-do cx-activate-item "MenuBar*ReadSubMenu*Case & Data...")
(cx-gui-do cx-set-text-entry "Select File*Text" "lzzmn.cas")
(cx-gui-do cx-activate-item "Select File*OK")
(cx-gui-do cx-activate-item "MenuBar*SolveMenu*Iterate...")
(cx-gui-do cx-set-integer-entry
"Iterate*Table1*Frame2(Iteration)*Table2(Iteration)*IntegerEntry1(Number of
Iterations)" 2000)
(cx-gui-do cx-activate-item "MenuBar*SolveMenu*Iterate...")
(cx-gui-do cx-activate-item "Iterate*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-activate-item "MenuBar*WriteSubMenu*Case & Data...")
(cx-gui-do cx-set-text-entry "Select File*Text" "lzzmn.cas ")
(cx-gui-do cx-activate-item "Select File*OK")
(cx-gui-do cx-activate-item "Warning*OK")
为方便使用,注释集中写在下面:
打开 read case and data对话框;
选择文件“lzzmn.cas”,这个文件改成你的文件;
点击选择文件对话框的确定;
打开iterate 对话框;
设置number of iterations 为2000,在你的case中没有对iterate apply过,这里默认的是
1,因此在这个文件中我又设置了一次计算步数;
激活iterate 对话框;
点击iterate,开始运算,这就开始工作啦,直到运算结束(满足你设置的残差要求或者达
到了2000步);
打开保存case and data对话框;
选择保存的文件名“lzzmn.cas”,换成你自己的;
点击确定;
由于前后两次使用的文件名一致,会跳出一个对话框警告是否覆盖,点击ok;如果你两次的对话框选择的文件名不一致,就不会警告你要不要覆盖,那么这一行就没有了;至此完成了一个case的读取,计算,保存;把上述过程再重复一次,其中读取、保存的文件换成你的第二个case,那么就进行第二个case的读取计算保存了。你有n个,那么copy n次以上内容,更改读取、保存的文件名字在同一个journal文件中,比如文件名为1.journal。
简单方法:
如果你case都是2维的,或者都是3维的,那就简单了。首先,你把所有的case都设置好,并进行简单的计算,以确保你的case是收敛的。注意在iterate对话框中 number of iterations中输入合理的数值后记得Apply一下,否则这个数值不能记录到case中,那么以后你读入的case文件只计算一步,保存好case and data文件。
打开对应版本的fluent,可以是单机的,可以是联网的;
File/read/journal,选择你journal文件即可。
命令行:
如果你的case会有维数的变化,那么你写一个bat文件即可。
用记事本写如下内容,命名为1.bat, linux可以写shell脚本,对后缀没有要求:
fluent 2d -g -i g -i 11.journal
fluent 3d -g -i g -i 12.journal
fluent 2ddp -g -i g -i 13.journal
fluent 3ddp -g -i g -i 14.journal
上述是打开了四个不同的fluent,2d 2ddp 3d 3ddp,而journal文件11 12 13 14分别对应读取二维 三维的case data文件。
只要你的case 收敛,你的case文件足够多,你就可以让你的电脑周末两天一点也没的休息了。
转自:http://blog.sina.com.cn/s/blog_6817db3a0100k6nu.html
页:
[1]