【仿真技巧】fluent TUI使用技巧及燃燒室自動(dòng)化仿真案例
【仿真技巧】fluent TUI使用技巧及燃燒室自動(dòng)化仿真案例
Fluid-CFD
流體機(jī)械相關(guān)資料共享,解決流體機(jī)械相關(guān)工程問(wèn)題,解決流體機(jī)械數(shù)值模擬(CFD)相關(guān)問(wèn)題,這是一個(gè)學(xué)習(xí)與共享的平臺(tái)
以下文章來(lái)源于Ansys 流體大本營(yíng) ,作者Ansys中國(guó) 井文明
Ansys 中國(guó)流體官方公眾號(hào),用于流體類產(chǎn)品的新版本更新、使用技巧、教程等資料分享。
點(diǎn)擊藍(lán)字 | 關(guān)注我們
01
需求說(shuō)明
Fluent非常強(qiáng)大的日志腳本功能,可以自動(dòng)化任何仿真設(shè)置和操作。
Fluent提供文本用戶命令(TUI命令)和界面用戶命令(GUI命令),兩者都是基于Scheme語(yǔ)言編寫。對(duì)于大多數(shù)Fluent的GUI操作,都有一個(gè)相關(guān)的TUI命令對(duì)應(yīng),而有很多其他的操作只能通過(guò)TUI命令完成,本文只介紹TUI相關(guān)命令。
02
與UDF,expression,scheme區(qū)別
?UDF
‐基于C/C++的二次開(kāi)發(fā)程序
‐可用于修改物理模型、初始化、增強(qiáng)后處理、增加物理模型等
‐有豐富的文檔和案例
‐需要有一定的C/C++基礎(chǔ) ‐ANSYS不提供常規(guī)的技術(shù)支持
典型UDF代碼如下
#
include
"udf.h"
DEFINE_PROFILE(pressure_profile,t,i)
{
real x[ND_ND];
/* this will hold the position vector */
real y;
face_t
f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[
1
];
F_PROFILE(f,t,i) =
1.1e5
- y*y/(
.0745
*
.0745
)*
0.1e5
;
}
end_f_loop(f,t)
}
?Scheme
‐本身是一種腳本化的編程語(yǔ)言
‐Fluent的GUI(Cortex)基于/內(nèi)置了Scheme解釋器
‐可用于控制Fluent運(yùn)行的過(guò)程
‐可用于開(kāi)發(fā)用戶界面
‐可用于與求解器/UDF通訊
‐可以集成Journal命令
‐只有很少的幫助文檔
‐需要有較強(qiáng)的Scheme基礎(chǔ)
‐ANSYS不提供常規(guī)的技術(shù)支持
典型scheme語(yǔ)言如下
(define my-iterate
(lambda (mark-temp)
(
if
(< (pick-a-real
"/re/vi/max solid () temperature no"
1
) mark-temp)
(begin
(ti-menu-load-
string
"/so/dti 1 20"
)
(my-iterate mark-temp)))))
?Expression
‐可以取代部分UDF、Scheme、Journal的功能,但不能完全取代
‐更加易用、易學(xué)
‐是一種基于Python的解釋型的聲明式語(yǔ)言 ‐功能 ‐指定與時(shí)間、迭代步、位置、求解變量相關(guān)的復(fù)雜的邊界條件和源項(xiàng)
‐基于時(shí)間和迭代步指定不同的模型和求解器設(shè)置
典型expression語(yǔ)句如下
Vmax*(
5.0
*
exp
(t
-0.3
[s]/
2.8
[s]))
?Custom Field Function
‐用戶定義的一個(gè)計(jì)算公式
‐基于三維網(wǎng)格上的信息進(jìn)行計(jì)算?。?!
‐可用于后處理和初始化
‐幫助文檔中有豐富的說(shuō)明 ‐非常易于學(xué)習(xí)
用戶自定義函數(shù)界面如下
?Journal/TUI
‐是包含一系列Fluent命令流的文本
‐包含GUI和TUI兩種類型,但GUI使用受限較大,本文不講
‐可用于控制/自動(dòng)化Fluent的過(guò)程
‐可以嵌套使用
‐缺乏一些復(fù)雜的控制功能,例如:?循環(huán) ?判斷…
‐可與Scheme結(jié)合使用
‐非常易于學(xué)習(xí)
‐有豐富的文檔資料
‐甚至無(wú)需文檔,用戶只需在Fluent的TUI中簡(jiǎn)單嘗試即可理解掌握
典型的TUI命令如下
/file/read-
case
-data test.
case
/solve/
set
/under-relaxation/mom
0.2
/solve/
set
/under-relaxation/pressure
0.4
/solve/iterate
200
/file/write-
case
-dat result.cas
03
TUI使用介紹
04
燃燒室自動(dòng)化案例演示
;; This journal is writen by wenming jing of Ansys China, plz contact
for
help
;; read
case
/mesh
/file/read-
case
combustor.msh.h5
;; confirm overwrite
/file/confirm-overwrite? yes
;;choose steady
define/models/steady?
;;activate energy equation
define/models/energy? yes yes yes
;;choose rke turbulence model
define/models/viscous/ke-realizable? yes
;;define operating conditions
define/operating-conditions/operating-pressure
101325
gravity yes
0
-9.8
0
q
;; combustion model setting
define/models/species/partially-premixed-combustion? yes yes no yes
101325
no no
0.1
315
500
yes
"jet-a<g>"
1
0
"n2"
0
0.767
"o2"
0
0.233
, , , yes
15
200
0.25
0.25
20
298
no
"combustor.pdf"
yes
;;DPM model setting
define/models/dpm/interaction/coupled-calculations? yes
define/models/dpm/interaction/dpm-iteration-interval
30
define/models/dpm/interaction/update-dpm-sources-every-flow-iteration? no
define/models/dpm/unsteady-tracking no
/define/models/dpm/numerics/tracking-parameters
50000
no
5
;;DPM injection setting
define/models/dpm/injections/create-injection , yes droplet yes surface diesel-
liquid
fuelinlet
()
no no no no no no jet-a<g> no 0 0 10 0.0001 315 0.01
;;read injection file
;;/file/read-injections injection-file
;; inletair1 setting
define/boundary-conditions/velocity-inlet inletair1 , , , , ,
40
, , ,
500
, , , , , , , , , , , ,
;;another way inletair1 setting
;;define/boundary-conditions/
set
/velocity-
inlet
inletair1
()
vmag no 31 temperature no 319 fmean no 0 premixc no 0 fvar no 0 q
;; inletair2 setting
define/boundary-conditions/velocity-inlet inletair2 , , , , ,
30
, , ,
500
, , , , , , , , , , , ,
;; fuelinlet setting
define/boundary-conditions/velocity-inlet fuelinlet , , , , ,
15
, , ,
300
, , , , , , , ,
1
, , ,
;; outlet setting
define/boundary-conditions/pressure-outlet outlet , ,
0
,
800
, , , , ,
5
10
,
0
, , , , , , , , ,
;; wall setting
define/boundary-conditions/wall mainbody:
1
, , , , , ,
0
, , , , , , , , , , , , , , , ,
;;hybrid initialization
solve/initialize/hyb-initialization
;;report definition
solve/report-definitions/add max-temp volume-max zone-names mainbody , field temperature report-type volume-max q
;;add report to plot
and
file
solve/report-plot/add max-temp plot-instantaneous-values? yes report-defs max-temp () q
solve/report-files/add max-temp report-defs max-temp () write-instantaneous-values? yes file-name max-temp.out q
;;define a surface plane
display/surface/plane-surface midplane zx-plane
0
;;setting up midplane velocity contour
display/objects/create contour midplane-velocity field velocity-magnitude surfaces-
list
midplane , q
;;setting up midplane velocity
vector
display/objects/create
vector
midplane-v-
vector
field velocity-magnitude surfaces-
list
midplane , q
;;setting up
auto
save
/file/
auto
-save/
case
-frequency
if
-
case
-is-modified data-frequency
1000
retain-most-recent-files yes root-name combustor
;;freeze specify equation
/solve/
set
/equations/premixed no
;;activate permixed equation
/solve/
set
/equations/premixed no
;; solve
for
200
iteration
solve/iterate
100
;;activate specify equation
/solve/
set
/equations/premixed yes
;;patch temperature
solve/
patch
mainbody
()
temperature 3000
;;patch progress variable
solve/
patch
mainbody
()
premixc 1
;; solve
for
1000
iteration
solve/iterate
1000
以往相關(guān)文章
Ansys Fluent Expression功能匯總
上述案例所用網(wǎng)格鏈接如下:https://pan.baidu.com/s/1i_o2017vMjajq2cmaMO88g
提取碼:q5ns
求分享
求點(diǎn)贊
求賞
-
2023年各省最新電價(jià)一覽!8省中午執(zhí)行谷段電價(jià)! 2023-01-03
-
PPT導(dǎo)出高分辨率圖片的四種方法 2022-09-22
-
全國(guó)消防救援總隊(duì)主官及簡(jiǎn)歷(2023.2) 2023-02-10
-
我們的前輩!歷屆全國(guó)工程勘察設(shè)計(jì)大師完整名單! 2022-11-18
-
關(guān)于某送變電公司“4·22”人身死亡事故的快報(bào) 2022-04-26
