《CFX用户手册-User Fortran.docx》由会员分享,可在线阅读,更多相关《CFX用户手册-User Fortran.docx(25页珍藏版)》请在第一文库网上搜索。
1、UserFortranIntroductionThechapterdiscusses: I:SeTCE1FUnC1iO1SandRc)U1ineS USerJ1mCtionBOXRoUtineS Shared1ibrarieS USCrParamoterS Iti1i1yROU1inCSforUSCrFUnC1iOnS ANSYSCFXMe1norYManaEC【nonISys1cm(MMS) USerCE1EXamP1eS USer血nctionBOXEXan1PIeS USingCFX-4RoUtineSinANSYSCFXToa11owyoutoaddadditiona1features
2、andphysica1mode1stoANSYSCFX,youcanwriteyourownsubroutinesinFortranandhavetheANSYSCFX-So1verca11theseroutinesthroughasourcecodeinterface.Youmaya1sowishtoimp1ementcustomizedphysica1mode1swhichwou1dneverbeavai1ab1einANSYSCFXduetoconfidentia1ityconsiderations.ANSYSCFXsupportsusersubroutineswritteninFort
3、ran77orFortran90.A1istofsupportedcompi1ersforeachp1atformisavai1ab1e.UsingFortran77wheneverpossib1eisrecommended.Twodifferentkindsofuserroutinesareavai1ab1einANSYSCFX:CFX可以利用两种不同的方式应用用户子程序 UserdefinedCE1(CFXExpression1anguage)functionscanbeusedwithinaCE1expression,fo11owingthestandardCE1ru1es.Fordet
4、ai1s,SeeUSerCE1FUnCtionSandRoutines.用户定义CE1(UserdefinedCE1)函数可以在CE1表达式中使用 Junctionboxroutinescanbeusedatsevera1p1acesintheANSYSCFX-So1vertoexecuteusercode.ForCIetaiIs,SeeUSorJUCCtiOnBOXRoutines.Junctionboxroutines可以在ANSYSCFX-So1ver中执行用户代码Thefo11owingtaskscanbeaccomp1ishedwithusersubroutinesinANSYSCF
5、X:通过用户程序可以在CFX中完成以下内容: Inputofuserdata(e.g.,datarequiredforprofi1eboundaryconditionsorexterna11ygeneratedsources). User-specifiedboundaryconditions(e.g.,profi1eboundaryconditions). User-specifiedinitia1conditions(e.g.,externa11ygeneratedf1owfie1ds,randomdistributionordisturbanceofexistingso1utions).
6、 User-specifiedsourceterms(e.g.,externa11ygeneratedbodyforcesorgenera1additiona1sourcetermsusedtoimp1ementnewphysica1mode1s). Junctionboxroutinesca11edeverytimestepwhichactsasagenera1interfacebetweentheANSYSCFX-So1verandothersoftware(e.g.,structuremechaniccodes).Junctionboxesa1soofferaninterfacefora
7、dvancedmonitoringandso1utionoutput. Userpartic1eroutinesareusedtospecifysourcesofmomentum,heatandmasstransfer,andcana1sobeusedtospecifyinjectionregionsforpartic1es.Thestructureofpartic1euserroutinesisthesame.Anexamp1eofthisfunctiona1ityisavai1ab1e.FOrdetai1s,SeeStrUCtUreOfIJSerCE1FUnCtiOns.Fordetai1
8、s,SeePartiCIeUSerSources.Fordetai1s,seeUserDefined.NotethatANSYSCFXinc1udesfeaturessuchasadvancedmonitoringofso1utionvariab1esorg1oba1va1uesandextendedCE1functiona1ity,whichmayreduceyourneedforusersubroutines.Tousejunctionboxroutines,youwi11needtobefami1iarwiththeANSYSCFXMMS(MemoryManagementSystem)t
9、osetupandpassarounduserdataforaccessinanysubroutine.Foid。Iai1s,SCCANSYSCFXMenK)IyVanag。IncnISyStem(MMS).Shared1ibrariesa11owsubroutinestobere-usedwithoutrecompi1ationforsuccessiveANSYSCFX-So1verrunsorevenfordifferentapp1ications.The1ocationofashared1ibraryisspecifiedinANSYSCFX-Pre.Duringexecutionoft
10、heANSYSCFX-So1ver,theusersubroutinesare1oadedfromthespecifiedshared1ibraries.Fordetai1s,seeShared1ibraries.UserCE1FunctionsandRoutinesUserCE1functionsa1IowyoutocreateyourownfunctionsinadditiontothepredefinedCE1functions(e.g.,sin,cos,step,etc.).YoucanthenusethesefunctionsinanyexpressionwhereaCE1funct
11、ioncanbeused.AuserCE1functionpassesanargument1isttoasubroutinethatyouhavewritten,andthenusesthereturnedva1uesfromthesubroutinetosetva1uesforthequantityofinterest.Thefigurebe1owdemonstratestheconcept.UserCE1FuuctiousH11dRoutinesUserCE1fimctnsa11owyoucreateyourownfunebonsvadd-ontotherede6nedCE1funcfao
12、ns(eg,an.co.ftcp.CtC)YoucmIbCnuetbeefuactocuaanyeqcffiCwhereaCE1fuctotCAabeusedAuserCE1func1ionpassesanargumentbetoaubroudnthatyouhavesvntten.andthenusestheEtUmedva1uesfromIherurotjhnetoetveforr斗IafmryOftntwnTnPfigurebe1owdwonff1tP?theconceptA11variab1esthatareavai1ab1eforuseinstandardCE1expressions
13、area1soavai1ab1eforuseinUserCE1Expressions.A1istofthesevariab1esisavai1ab1e.Fordetai1s,SeeVariabieSAVaiiabieforUSeinCE1Expressions.Detai1soncreatinguserCE1functionsinANSYSCFX-Preanddefiningquantitiesviaanexpressionwithanargument1istareavai1ab1e. Fordetai1s,SeeUSerROUtineDetaiISView. FOrdetai1s,SeeUS
14、erFUnCtiOnS.Detai1soncreatingshared1ibrariesandcompi1ingsubroutinesareavai1ab1e.FOrdetai1s,SeeShared1ibraries.Examp1esofusinguserCE1functionsareavai1ab1e.Forde1ai1s,SeeUSerCE1Examp1es.StructureofUserCE1FunctionsAUserFortranfiIemaycontainsevera1userroutinesthatcanbeca11edfromtheANSYSCFX-So1ver,aswe11
15、asanysecondaryroutinesthatareca11edon1yfromotherroutinesinthisfi1e.Inadditiontoanycommentsanddec1arationsthatyoumaywishtoadd,thebasicstructureofauserCE1functionis:ftinc1ude,zcfx5ext.hd11export()SUBROUTINE(&N1OC,NRET,NARG,RET,ARGS,CRES1T,CZ,DZ,IZ,1Z,RZ)CINTEGERN1OC,NARG,NRETCHARACTERCRES1T*(*)REA1RGS(N1OC,NARG),RET(N1OC,NRET)CINTEGERIZ(*)CHARACTERCZ(*)*(1)DOUB1EPRECISIONDZ(*)1OGICA11Z(*)REA1RZ(*)C.executab1estatementsENDThed11export()macroisusedtoensurethataca11ingnameisknownexterna11yonthosep1atformsthatrequireitforsuccessfu1runtime1inking.Themacroisdefinedinaninc1udefi1esoItinc1udecfx5