资源描述:
《scheme language in fluent》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、PERAGlobal,ShanghaiProgramminginFLUENTwithSchemeLanguageAboutSchemeAdialectofLISP,averyoldprogramminglanguage.Itsgrammarisverysimpleanditscommandshaveageneralformlike:(CommandName,argument1,argument2….).TheSchemeCommandinFLUENT:1)Runsimulationprocessesa
2、utomatically(Journalfile)2)ExtendtheInterfaceofFluent.BasicGrammarofScheme1.ArithmeticFunctions+-*/,entsprichtUPN,mehrals2Argumentemöglich:>(+245)11>(/63)2>(/2);;similarto(/12)0.5(absx),(sqrtx),(exptxy)[=xy],(expx)[=ex],(logx)[=lnx],(sinx),(cosx),(atan
3、x),(atanxy)[=arctan(x/y)],…Integer(!)-Functions:>(remainder456)3>(modulo52)1(truncatex),(roundx),(ceilingx),(floorx),...(maxxy...),(minxy...)>(applymax'(15834));;findthemaximuminalist8BasicGrammarofScheme2.GlobalandLocalVariablesGlobalvariabledefintion:
4、>(definex3)>(+x1)4Nodifferenceinvariabletypes(integer,real,string)..Changingvariablevaluesisnotpossibleinfunctions,whichonlylocalvarialbesarevalid:(set!x1)tochangevariablevalues(displayx)or(writex)tooutputvariablevaluesInteger(2),Float(2.5),Boolean(#tfü
5、rtrue,#ffalse)Strings("thisisatextstring")andSymbols:'symbol,forexample.:(definex'this-is-a-symbol)Globalvariablesandself-definedfunctionsarevaliduntiltheendofFluent.LokaleScheme-VariablenLocalvarabledefinition:(let((var1value1)(var2value2)...);;variabl
6、esarevalidonlyinthisscope)BasicGrammarofScheme3.“Format“command>(format#f"formatvar1andvarlikeprintfinC,..."var1var2...)Tilde(~)isusedinsteadof%:~ageneralformat(Stringswithout"")~dInteger~04dalways4digitswithenough0before(5wirdzu0005)~ffloatingnumber~4
7、.2f1.2->1.20~sStringwith""(format#f"string:~s!""text")becomesstring:"text"!UsingSchemeinFLUENTThereareafewofwaystocallschemeinFLUENT.1.InputthecommandinthetextinterfaceUsingSchemeinFLUENTThereareafewofwaystocallschemeinFLUENT.Theschemecommandcanbealsoin
8、putinmenu“Solve/Execute-Commands”,whichwillbeexecutedbyeachiterationortimestep.UsingSchemeinFLUENTThereareafewofwaystocallschemeinFLUENT.CallinFLUENTmenuusing“File/Read/Scheme”toreada.scmfile.Iftheschemefileissavedas.fluentandint