你可以定制自己的Fluent界面!
Fluent可以實現(xiàn)界面定制
使用scheme語言可以之間對Fluent界面進行修改定制,同時這種語言還可以鏈接到UDF中,和UDF進行交互
使用方法:
1. 新建txt文檔,寫好scheme語言的腳本,將后綴名更改為.scm格式
2. 打開Fluent,點擊左上角file-read-Scheme
3. 讀取Scheme文件,然后會在界面顯示代碼定制的內(nèi)容。
比如y+計算器就可以直接在Fluent界面顯示
和之前文章四十五、壁面函數(shù)理論及y+的確定小程序結果對比,基本相同
下面是這個Y+計算器的代碼:
代碼經(jīng)過復制粘貼之后格式好像就變了,我試了一下,復制到txt文檔,不能正常使用,這里還是貼出來給大家參考。
代碼源文件我會放在文章末尾的鏈接中,也會放在群文件,供大家使用
(define apply-cb #t)
(define update-cb #f)
;事件函數(shù)
(define (apply-cb . args)
? ?(display "")
)
(define (update-cb . args)
? (cx-set-real-entry real1 1.0);默認主流速度
? (cx-set-real-entry real2 1.215);密度
? (cx-set-real-entry real3 1.8e-5);粘度
? (cx-set-real-entry real4 0.5);特征長度
? (cx-set-real-entry real5 1.0);y+
)
(define (click . args)
? ?(define density (cx-show-real-entry real2))
? ?(define velocity (cx-show-real-entry real1))
? ?(define mu (cx-show-real-entry real3))
? ?(define length (cx-show-real-entry real4))
? ?(define ypl (cx-show-real-entry real5))
? ?(define re ( / ( * length ( * density velocity)) mu))
? ?(define cf (/ 0.026 (expt re (/ 1 7))))
? ?(define iwall (* 0.5 (* velocity (* velocity (* cf density)))))
? ?(define ufric (sqrt (/ iwall density)))
? ?(define DeltaS (* 2 (/ (/ (* ypl mu) ufric ) density )))
? ?(cx-set-real-entry real6 DeltaS)
? ?(cx-set-real-entry real7 re)
)
;界面布局
(define yplus (cx-create-panel "y+計算器" apply-cb update-cb))
(define table1 (cx-create-table yplus "Data Inputs"))
(define real1 (cx-create-real-entry table1 "Velocity(m/s):" 'row 0))
(define real2 (cx-create-real-entry table1 "Density(kg/m3):" 'row 1))
(define real3 (cx-create-real-entry table1 "Viscosity(Pa*s):" 'row 2))
(define real4 (cx-create-real-entry table1 "Length(m):" 'row 3))
(define real5 (cx-create-real-entry table1 "YPlus:" 'row 4))
(define button1 (cx-create-button yplus "Calculate" 'activate-callback click 'row 1))
(define table2 (cx-create-table yplus "Data Outputs") 'row 2)
(define real6 (cx-create-real-entry table2 "DeltaS(m):" 'row 1))
(define real7 (cx-create-real-entry table2 "Re:" 'row 2))
(cx-show-panel yplus)
https://pan.baidu.com/s/19LUcQJSPzGvuFWCbV4Q5Eg?pwd=b3s3?
提取碼:b3s3
公眾號:Fluent學習筆記。為了方便大家學習交流,我創(chuàng)建了QQ群:863690217,大家可以在其中討論相關的問題,同時我會將所有文章的源文件都放到QQ群中,還會放一些其它的學習文件。歡迎大家加入。