声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2245|回复: 0

[Fluent应用] 应用System Coupling进行Fluent与Mechanical的双向流固耦合

[复制链接]
发表于 2016-6-8 13:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
  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文件例子,可以参考一下:

  1.   ; Author: huys

  2.   ; Description: Batch setup for segment one

  3.   ; Date: 2008/06/03

  4.   ; Revision:

  5.   ; 1.1 Add materials from user-defined material database

  6.   ; Please make sure material's name is right defiend

  7.   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  8.   ;Read in the mesh file.

  9.   file read-case seg1_m.msh

  10.   ;Scale it. mm -> m.

  11.   grid/scale

  12.   ;x scale factor [1]

  13.   0.001

  14.   ;y scale factor [1]

  15.   0.001

  16.   ;z scale factor [1]

  17.   0.001

  18.   ;Turn on the energy equation

  19.   define/models energy?

  20.   ;Enable energy model? [no]

  21.   yes

  22.   ;Compute viscous energy dissipation? [no]

  23.   no

  24.   ;include pressure work in energy equation? [no]

  25.   no

  26.   ;include kinetic energy in energy equation? [no]

  27.   no

  28.   ;Include diffusion at inlets? [yes]

  29.   yes

  30.   ;Specify turbulence model.

  31.   define/models/viscous/ke-standard

  32.   ;Enable the standard k-epsilon turbulence model? [no]

  33.   yes

  34.   ;Select equations to solve.

  35.   solve/set/equations flow

  36.   ;Solve Flow equation(s)? [yes]

  37.   yes

  38.   solve/set/equations temperature

  39.   ;Solve Energy equation(s)? [yes]

  40.   yes

  41.   solve/set/equations ke

  42.   ;Solve Turbulence equation(s)? [yes]

  43.   yes

  44.   ;Select material database

  45.   define/materials/data-base/database-type

  46.   ;Available Types: (fluent-database user-defined)

  47.   ;Database Type [fluent-database]

  48.   user-defined

  49.   ;Database File [""]

  50.   custom.scm

  51.   ;Copy your materials

  52.   define/materials/copy

  53.   ;Material of type []>

  54.   fluid

  55.   ;database-material-name>

  56.   water_var

  57.   ;

  58.   define/materials/copy

  59.   ;Material of type []>

  60.   solid

  61.   ;database-material-name>

  62.   stainless_cnt

  63.   ;Define boundary conditions

  64.   ; Wall

  65.   define/boundary-conditions/wall

  66.   ; ...

  67.   inner_wall_b

  68.   ;Wall Thickness (m) [0]

  69.   0

  70.   ;Use Profile for Heat Generation Rate? [no]

  71.   no

  72.   ;Heat Generation Rate (w/m3) [0]

  73.   0

  74.   ;material-name [aluminum]: Change current value? [no]

  75.   no

  76.   ;Thermal BC Type [heat-flux]: Change current value? [no]

  77.   yes

  78.   ;Thermal BC Type [heat-flux]

  79.   ;; convection

  80.   ;; coupled

  81.   ;; heat-flux

  82.   ;; mixed

  83.   ;; network

  84.   ;; radiation

  85.   ;; temperature

  86.   temperature

  87.   ;Use Profile for Temperature? [no]

  88.   no

  89.   ;Temperature (k) [300]

  90.   1000

  91.   ;Enable shell conduction? [no]

  92.   no

  93.   ; Inlet

  94.   define/boundary-conditions/velocity-inlet

  95.   ;

  96.   inlet_channel_b

  97.   ;Velocity Specification Method: Magnitude and Direction [no]

  98.   no

  99.   ;Velocity Specification Method: Components [no]

  100.   no

  101.   ;Velocity Specification Method: Magnitude, Normal to Boundary [yes]

  102.   yes

  103.   ;Reference Frame: Absolute [yes]

  104.   yes

  105.   ;Use Profile for Velocity Magnitude? [no]

  106.   no

  107.   ;Velocity Magnitude (m/s) [0]

  108.   10

  109.   ;Coordinate System: Cartesian (X, Y, Z) [yes]

  110.   yes

  111.   ;Use Profile for Temperature? [no]

  112.   no

  113.   ;Temperature (k) [300]

  114.   300

  115.   ;Turbulent Specification Method: K and Epsilon [yes]

  116.   no

  117.   ;Turbulent Specification Method: Intensity and Length Scale [no]

  118.   no

  119.   ;Turbulent Specification Method: Intensity and Viscosity Ratio [no]

  120.   yes

  121.   ;Turbulent Intensity (%) [10]

  122.   10

  123.   ;Turbulent Viscosity Ratio [10]

  124.   10

  125.   ; channel

  126.   define/boundary-conditions/fluid

  127.   ;(channel)

  128.   ;zone id/name [channel]

  129.   channel

  130.   ;material-name [air]: Change current value? [no]

  131.   yes

  132.   ;material-name [air]>

  133.   water_var

  134.   ;Specify source terms? [no]

  135.   no

  136.   ;Specify fixed values? [no]

  137.   no

  138.   ;Motion Type: Stationary [yes]

  139.   yes

  140.   ;X-Origin of Rotation-Axis (m) [0]

  141.   0

  142.   ;Y-Origin of Rotation-Axis (m) [0]

  143.   0

  144.   ;Z-Origin of Rotation-Axis (m) [0]

  145.   0

  146.   ;X-Component of Rotation-Axis [0]

  147.   0

  148.   ;Y-Component of Rotation-Axis [0]

  149.   0

  150.   ;Z-Component of Rotation-Axis [1]

  151.   1

  152.   ;Deactivated Thread [no]

  153.   no

  154.   ;Laminar zone? [no]

  155.   no

  156.   ;Porous zone? [no]

  157.   no

  158.   ; soild(wall)

  159.   define/boundary-conditions/solid

  160.   ;(wall)

  161.   ;zone id/name [wall]

  162.   wall

  163.   ;material-name [aluminum]: Change current value? [no]

  164.   yes

  165.   ;material-name [aluminum]>

  166.   stainless_cnt

  167.   ;Specify source terms? [no]

  168.   no

  169.   ;Specify fixed values? [no]

  170.   no

  171.   ;Motion Type: Stationary [yes]

  172.   yes

  173.   ;X-Origin of Rotation-Axis (m) [0]

  174.   0

  175.   ;Y-Origin of Rotation-Axis (m) [0]

  176.   0

  177.   ;Z-Origin of Rotation-Axis (m) [0]

  178.   0

  179.   ;X-Component of Rotation-Axis [0]

  180.   0

  181.   ;Y-Component of Rotation-Axis [0]

  182.   0

  183.   ;Z-Component of Rotation-Axis [1]

  184.   1

  185.   ;Deactivated Thread [no]

  186.   no

  187.   ;Set Pressure Velocity Coupling Scheme to SIMPLEC

  188.   solve/set/p-v-coupling

  189.   ;Pressure Velocity Coupling Scheme [20] ?

  190.   ;; 20 for SIMPLE

  191.   ;; 21 for SIMPLEC

  192.   ;; 22 for PISO

  193.   ;; 24 for Coupled

  194.   21

  195.   ;Set the discretization schemes.\

  196.   solve/set/discretization-scheme pressure

  197.   ;Convective discretization scheme for Pressure [10]

  198.   ;; 10 for Standard

  199.   ;; 14 for PRESTO!

  200.   ;; 11 for Linear

  201.   ;; 12 for Second Order

  202.   ;; 13 for Body Force Weighted

  203.   10

  204.   solve/set/discretization-scheme mom

  205.   ;Convective discretization scheme for Momentum [0]

  206.   ;; 0 for First Order Upwind

  207.   ;; 1 for Second Order Upwind

  208.   ;; 2 for Power Law

  209.   ;; 4 for QUICK

  210.   ;; 6 for Third-Order MUSCL

  211.   1

  212.   solve/set/discretization-scheme temperature

  213.   ;Convective discretization scheme for Energy [0]

  214.   ;; 0 for First Order Upwind

  215.   ;; 1 for Second Order Upwind

  216.   ;; 2 for Power Law

  217.   ;; 4 for QUICK

  218.   ;; 6 for Third-Order MUSCL

  219.   1

  220.   solve/set/discretization-scheme k

  221.   ;Convective discretization scheme for Turbulence Kinetic Energy [0]

  222.   ;; 0 for First Order Upwind

  223.   ;; 1 for Second Order Upwind

  224.   ;; 2 for Power Law

  225.   ;; 4 for QUICK

  226.   ;; 6 for Third-Order MUSCL

  227.   1

  228.   solve/set/discretization-scheme epsilon

  229.   ;Convective discretization scheme for Turbulence Dissipation Rate [0]

  230.   ;; 0 for First Order Upwind

  231.   ;; 1 for Second Order Upwind

  232.   ;; 2 for Power Law

  233.   ;; 4 for QUICK

  234.   ;; 6 for Third-Order MUSCL

  235.   1

  236.   ;Set underrelaxation factors.

  237.   solve/set/under-relaxation pressure

  238.   ;Underrelaxation factor for Pressure [0.3]

  239.   0.9

  240.   solve/set/under-relaxation mom

  241.   ;Underrelaxation factor for Momentum [0.7]

  242.   0.9

  243.   solve/set/under-relaxation temperature

  244.   ;Underrelaxation factor for Energy [1]

  245.   0.9

  246.   solve/set/under-relaxation k

  247.   ;Underrelaxation factor for Turbulence Kinetic Energy [0.8]

  248.   0.9

  249.   solve/set/under-relaxation epsilon

  250.   ;Underrelaxation factor for Turbulence Dissipation Rate [0.8]

  251.   0.9

  252.   solve/set/under-relaxation turb-viscosity

  253.   ;Underrelaxation factor for Viscosity [1]

  254.   0.9

  255.   solve/set/under-relaxation density

  256.   ;Underrelaxation factor for Density [1]

  257.   0.9

  258.   solve/set/under-relaxation body-force

  259.   ;Underrelaxation factor for Body Forces [1]

  260.   0.9

  261.   ;Set multigrid.

  262.   solve/set/multi-grid-controls pressure

  263.   ;Multigrid cycle type for Pressure [1]

  264.   1

  265.   ;Termination criterion [0.1]

  266.   1e-30

  267.   ;Multigrid method for Pressure [0]

  268.   0

  269.   ;Multigrid stabilization for Pressure [0]

  270.   0

  271.   solve/set/multi-grid-controls x-mom

  272.   ;Multigrid cycle type for X-Momentum [0]

  273.   0

  274.   ;Termination criterion [0.1]

  275.   1e-30

  276.   ;Residual reduction tolerance for [0.7]

  277.   0.999

  278.   ;Multigrid method for X-Momentum [0]

  279.   0

  280.   solve/set/multi-grid-controls y-mom

  281.   ;Multigrid cycle type for X-Momentum [0]

  282.   0

  283.   ;Termination criterion [0.1]

  284.   1e-30

  285.   ;Residual reduction tolerance for [0.7]

  286.   0.999

  287.   ;Multigrid method for X-Momentum [0]

  288.   0

  289.   solve/set/multi-grid-controls z-mom

  290.   ;Multigrid cycle type for X-Momentum [0]

  291.   0

  292.   ;Termination criterion [0.1]

  293.   1e-30

  294.   ;Residual reduction tolerance for [0.7]

  295.   0.999

  296.   ;Multigrid method for X-Momentum [0]

  297.   0

  298.   solve/set/multi-grid-controls k

  299.   ;Multigrid cycle type for Turbulent Kinetic Energy [0]

  300.   0

  301.   ;Termination criterion [0.1]

  302.   1e-30

  303.   ;Residual reduction tolerance for [0.7]

  304.   0.999

  305.   ;Multigrid method for Turbulent Kinetic Energy [0]

  306.   0

  307.   solve/set/multi-grid-controls epsilon

  308.   ;Multigrid cycle type for Turbulent Dissipation Rate [0]

  309.   0

  310.   ;Termination criterion [0.1]

  311.   1e-30

  312.   ;Residual reduction tolerance for [0.7]

  313.   0.999

  314.   ;Multigrid method for Turbulent Dissipation Rate [0]

  315.   0

  316.   solve/set/multi-grid-controls temperature

  317.   ;Multigrid cycle type for Energy [0]

  318.   0

  319.   ;Termination criterion [0.1]

  320.   1e-30

  321.   ;Residual reduction tolerance for [0.7]

  322.   0.999

  323.   ;Multigrid method for Energy [0]

  324.   0

  325.   ;Set the convergence criteria.

  326.   solve/monitors/residual convergence-criteria

  327.   ;continuity residual convergence criterion [0.001]

  328.   1e-16

  329.   ;x-velocity residual convergence criterion [0.001]

  330.   1e-16

  331.   ;y-velocity residual convergence criterion [0.001]

  332.   1e-16

  333.   ;z-velocity residual convergence criterion [0.001]

  334.   1e-16

  335.   ;energy residual convergence criterion [1e-06]

  336.   1e-16

  337.   ;k residual convergence criterion [0.001]

  338.   1e-16

  339.   ;epsilon residual convergence criterion [0.001]

  340.   1e-16

  341.   ;Write settings to a case file.

  342.   file/write-case

  343.   ;case file name [""]

  344.   "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,计算,保存计算结果。

  内容如下:

  1.   (cx-gui-do cx-activate-item "MenuBar*ReadSubMenu*Case & Data...")

  2.   (cx-gui-do cx-set-text-entry "Select File*Text" "lzzmn.cas")

  3.   (cx-gui-do cx-activate-item "Select File*OK")

  4.   (cx-gui-do cx-activate-item "MenuBar*SolveMenu*Iterate...")

  5.   (cx-gui-do cx-set-integer-entry

  6.   "Iterate*Table1*Frame2(Iteration)*Table2(Iteration)*IntegerEntry1(Number of

  7.   Iterations)" 2000)

  8.   (cx-gui-do cx-activate-item "MenuBar*SolveMenu*Iterate...")

  9.   (cx-gui-do cx-activate-item "Iterate*PanelButtons*PushButton1(OK)")

  10.   (cx-gui-do cx-activate-item "MenuBar*WriteSubMenu*Case & Data...")

  11.   (cx-gui-do cx-set-text-entry "Select File*Text" "lzzmn.cas ")

  12.   (cx-gui-do cx-activate-item "Select File*OK")

  13.   (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


本帖被以下淘专辑推荐:

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-13 09:56 , Processed in 0.069477 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表