欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    Scheme Language in Fluent.ppt

    • 资源ID:17599648       资源大小:937KB        全文页数:34页
    • 资源格式: PPT        下载积分:9金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要9金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Scheme Language in Fluent.ppt

    PERA Global, ShanghailA dialect of LISP, a very old programming language.lIts grammar is very simple and its commands have a general form like: (Command Name, argument1,argument2.).lThe Scheme Command in FLUENT:1) Run simulation processes automatically(Journal file) 2) Extend the Interface of Fluent. 1.Arithmetic Functions+ - * / , entspricht UPN, mehr als 2 Argumente mglich: (+ 2 4 5) 11 (/ 6 3) 2 (/ 2) ; similar to (/ 1 2) 0.5 (abs x), (sqrt x), (expt x y) = x y, (exp x) = e x, (log x) = ln x, (sin x), (cos x), (atan x), (atan x y) = arctan(x/y), Integer(!)-Functions: (remainder 45 6) 3 (modulo 5 2) 1 (truncate x), (round x), (ceiling x), (floor x), . (max x y .), (min x y .) (apply max (1 5 8 3 4) ; find the maximum in a list 8 2.Global and Local VariablesGlobal variable defintion: (define x 3) (+ x 1) 4 No difference in variable types(integer,real,string).Changing variable values is not possible in functions, which only local varialbes are valid:(set! x 1) to change variable values (display x) or (write x) to output variable values Integer (2), Float (2.5), Boolean (#t fr true, #f false) Strings (this is a text string) and Symbols: symbol, for example.: (define x this-is-a-symbol) Global variables and self-defined functions are valid until the end of Fluent. Lokale Scheme-Variablen Local varable definition:(let (var1 value1) (var2 value2) .) ;variables are valid only in this scope)3.“Format“ command (format #f format var1 and var like printf in C, . var1 var2 . ) l Tilde () is used instead of %: a general format (Strings without ) d Integer 04d always 4 digits with enough 0 before (5 wird zu 0005) f floating number4.2f 1.2 -1.20 s String with (format #f string: s ! text) becomes string: text ! There are a few of ways to call scheme in FLUENT.1. Input the command in the text interface There are a few of ways to call scheme in FLUENT.The scheme command can be also input in menu “Solve/Execute-Commands”, which will be executed by each iteration or time step. There are a few of ways to call scheme in FLUENT.Call in FLUENT menu using “File/Read/Scheme” to read a .scm file.If the scheme file is saved as .fluent and in the same directory as the case file, then it can be automatically loaded when the case file is read.FLUENT commands can be called in Scheme in two ways: Command in text interface(ti-menu-load-string “display/contour temperature 30 100”)It will return “#t” if success, “#f” if failureThis is the normal and fast way to use fluent commands GUI command(not a common way)These commands are used in journal file, for example:(cx-gui-do cx-activate-item “Velocity Vectors*PanelButtons*PushButton1(OK)”) Call UDF in Scheme:(%udf-on-demand udf-eod-name) How to use Scheme funtions in UDF is moment not known. C funtion CX_Interpret_String(scheme-command-string), which is declared in Fluent.Inc/fluentX.Y/cort, can interprete scheme-command-string, but can not access the environmental variables. RP variables (used in text interface commands)For example, the following command gets the simulation time (rpgetvar flow-time) 0.1Then comes the command to set the simulation time: (rpsetvar flow-time 0)All RP variables are defined in case file. CX variables (only used in GUI commands)The following examples are about the settings of the color map: (cxgetvar cmap-list)0.1 (cxsetvar def-cmap “rgb”) (rp-var-define name default-and-init-value type #f) For example: (rp-var-define udf/var1 0 real #f) The way to get the info about the variable: (rp-var-object udf/var1) (udf/var1 0 real #f 0) (rp-var-object udf/var2)#f real RP_Get_Real(char *s) long RP_Get_Integer(char *s) char *RP_Get_String(char *s) boolean RP_Get_Boolean(char *s) void RP_Set_Real(char *s, real v) void RP_Set_Integer(char *s, real v) void RP_Set_Boolean(char * s, boolean v) void RP_Set_String(char *s, char *v) void RP_Set_Symbol(char *s, char *v)for example:var1=RP_Get_Real(“udf/var1”)RP_Set_Real(“udf/var1”,3.2) PaintSim is written in Scheme to run simulation processes automatically and conveniently in a flow-line way. It can also be used for post-processing of simulation results.u Display the content of the main window after being enableduDisplay the buttons in the bottom of the main windowuStart Gui uStart to define the window layoutuDefine the button events uCreate the frames and other componentsuShow the panel after all components are defined:uAdd one menu item to Fluent (rpsetvar paintsim/target_id 2) (%rpgetvar paintsim/target_id) (rpsetvar paintsim/nrtrack 30) (%rpgetvar paintsim/nrtrack) (rpsetvar paintsim/fthick_name fthick_test.txt) (%rpgetvar paintsim/fthick_name) Radius_Needle=RP_Get_Real(lacksim/radius_needle); Roughness_Needle=RP_Get_Real(lacksim/roughness_needle); PaintSim must be loaded first. Once it is loaded, all the variables have their own default values. However, if the case-data files are saved after these variables are modified, the modified values will also be saved in case-data files. Then, next time when the case-data files are re-loaded, these variables will have the values saved in case-data files, but not the default values. In batch-file mode, the FLUENT GUI can not be used. This is already considered in the code of PaintSim. At this time, the menu will not be loaded, but all the variables can be changed by the command input into the text-command interface of FLUENT. In batch file, the scheme file can be loaded with the similar form like “load paintsim.scm”. Actually, you can also use the scheme command directly in batch files. For example, “(rpsetvar paintsim/target_id)” It is used to set the ID number of the target wall.

    注意事项

    本文(Scheme Language in Fluent.ppt)为本站会员(知****量)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开