赞
踩
Fluent可以实现界面定制
使用scheme语言可以之间对Fluent界面进行修改定制,同时这种语言还可以链接到UDF中,和UDF进行交互
使用方法:
1. 新建txt文档,写好scheme语言的脚本,将后缀名更改为.scm格式
2. 打开Fluent,点击左上角file-read-Scheme
3. 读取Scheme文件,然后会在界面显示代码定制的内容。
比如y+计算器就可以直接在Fluent界面显示
和之前文章四十五、壁面函数理论及y+的确定小程序结果对比,基本相同
下面是这个Y+计算器的代码:
代码经过复制粘贴之后格式好像就变了,我试了一下,复制到txt文档,不能正常使用,这里还是贴出来给大家参考。
代码源文件我会放在文章末尾的链接中,也会放在群文件,供大家使用
- (define apply-cb #t)
-
- (define update-cb #f)
-
-
-
- ;事件函数
-
-
-
- (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)
-
-
-
原文链接:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。