您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > 其它办公文档 > Fluent-UDF-14.5-L06-Multiphase
©2012ANSYS,Inc.June17,20131Release14.514.5ReleaseChapter6UDFsforMultiphaseFlowsUserDefinedFunctionsinANSYSFluent©2012ANSYS,Inc.June17,20132Release14.5AdditionalDataStructureforMulti-phase•Inmultiphasemodelstherearemultipledomainsinvolved:–Mixture(Super)Domain:Thisisthetop-leveldomaincontainsallphase-independentandmixturedata:geometry,connectivity,property–Sub-domains(phasedomains):Eachphasehasasub-domainthatinheritsthemixture-specificdataandmaintainsthephase-specificdata–InteractionDomain:ToactivatethephaseinteractionmechanismsSub-DomainsThreadsInletFluid-2Fluid-1Solid-1OutletPorousMediumSolid-2WallThreadsInletFluid-2Fluid-1Solid-1OutletPorousMediumSolid-2WallThreadsInletFluid-2Fluid-1Solid-1OutletPorousMediumSolid-2WallInteractionDomainInletFluid-2Fluid-1Solid-1OutletPorousMediumSolid-2WallThreadsPrimaryPhaseDomainSecondaryPhaseDomainsSub-ThreadsmixtureDomain©2012ANSYS,Inc.June17,20133Release14.5DomainPointersandPhaseDomainIDs•Formultiphasemodels,thedomainsneedtobeidentifiedbyuniquedomainIDs(includingtheinteractiondomain)•Domain_IDofthemixturedomainisalways1,butvaluesforphasedomains(primaryandsecondary)canbeanyintegergreaterthan1.ThevaluescanbefoundintheFLUENTGUIpanelunderdefinephases•ThemacroGET_Domain(domain_id)returnseitherthemixture,aphaseoraninteractiondomainpointer.(ButthemixturedomainpointerisalwaysobtainablebyusingGet_Domain(1)!)•Incomparison,onlyonedomain(ID=1)existsforsinglephaseflows©2012ANSYS,Inc.June17,20134Release14.5PhaseDomainIndex•PhaseDomainIndex(PDI)isanintegerindexforagivensubdomain(nottobeconfusedwiththedomainID,seeanexamplebelow):phase_domain_index=0fortheprimaryphase1forthefirstsecondaryphase,…,N-1forthelastsecondaryphase•Phasedomainindexisprimarilyusedtoretrievephasedomainpointers(andsubthreadpointersviadifferentmacros)Especiallywhenyouwanttoaccessdataforaparticularphase:Domain*subdomain=DOMAIN_SUB_DOMAIN(mixture_domain,phase_domain_index);Thecellthreadpointerinthesubdomaingivesthephasedata(e.g.,thread_loop_c(t,subdomain)loopsoverallcellthreadsofthephase)TheinversemacrotogetPDIis:intphase_domain_index=PHASE_DOMAIN_INDEX(subdomain);•Forexample,aproblemusingtheVOFmodelwith2phases:ThemixturedomainIDisalways1PrimaryPhase:thephasedomainIDis2;thephasedomainindex=0SecondaryPhase:thephasedomainIDis3;thephasedomainindexis1©2012ANSYS,Inc.June17,20135Release14.5AccessingaSpecificPhaseDomain•Severalmacrosareavailableforaccessingaspecificphasedomain(orsub-domain)pointer:Domain*d=Get_Domain(domain_id);Forexample,domain_id=1forthemixturedomain,2fortheprimaryphase,3forasecondaryphase,andsoonDomain*subdomain=DOMAIN_SUB_DOMAIN(mixture_domain,phase_domain_index);Forexample,phase_domain_index=0fortheprimaryphase,1forthesecondaryphase,etc.Oncethedomainpointerisavailable,loopovercellthreads,andoverallcellswithineachcellthreadasfollows:thread_loop_c(cellthread_ptr,subdomain){begin_c_loop(c,cellthread_ptr){}end_c_loop(c,cellthread_ptr)}©2012ANSYS,Inc.June17,20136Release14.5MixtureThreadsandPhaseSubthreads•Threadspossessasimilarhierarchythatmatchesthatofthedomains•The“mixturethreads”arewherethe“mixture”ofthephasesisstoredandsoareoftencalledthe“superthreads”•Phase-independentdatasuchasthecell’sgeometrydataarestoredinthemixturethread•EachPhasehasitsownsetofthreadsknownasa“subthreads”or“phasethreads”MixturethreadsP1threadsP0threadsP2threadsInteractionssubthreadsPhasesubthreads©2012ANSYS,Inc.June17,20137Release14.5RetrievetheMixtureThread•Mixturethreadpointerisretrievableifaparticularphase-levelpointer(subthread)isavailable:Thread*subthread;Thread*mixture_thread=THREAD_SUPER_THREAD(subthread);•Mixture(super)domainpointerisretrieved,thenLookup_Threadmacroisusedtogetthemixture_threadpointer(theparticularcellzoneIDmustbesupplied):Domain*mix_domain=Get_Domain(1);subthread=Lookup_Thread(mix_domain,ID)•Usingthread_loop_c(mixture_thread,mix_domain)isalsoanoption©2012ANSYS,Inc.June17,20138Release14.5AccessingaSpecificSubthread•Wecanalsoaccessphasethreads(subthreads)byanumberofmacros:–thread_loop_c(mixture_thread,mixture_domain)Onceasubthreadpointerisavailable,wecanretrieveinformationthroughmacroslikebegin_c_looporbegin_f_loop–THREAD_SUB_THREADintp_d_index=0;/*primaryphasedomainindexis0*/Thread*mix_thread;/*mixture-levelthreadpointer*/Thread*subthread=THREAD_SUB_THREAD(mix_thread,p_d_index);Givenaph_d_index,THREAD_SU_THREADreturnsthecorrespondingphase-levelsub-threadpointer–THREAD_SUB_THREADSThread*mixture_thread;Thread**pt=THREAD_SUB_THREADS(mixture_thread);Givenapointertothemixturethread,returnsaphasethreadpointerarray:pt[j]isthesubthreadpointertothej-thphase(i.e.,phase_domain_index=j)•Notethatthemixture_threadpointer(s)areassumedtobeavailable.Ifnot,useoneofthemethodsdiscussedinthepreviousslide©2012ANSYS,Inc.June17,20139Release14.5LoopoverPhaseDomainsinaMixture•Loopmacroforvisitingallsub-domains(primaryandsecondaryphases)inthemixture:sub_domain_loop(sub_domain,mixture_domain,phase_domain_index)•Example:Givenamixture_domainpointer,thefollowingmacroloopsoverallphasesinthemixture.sub_domainandphase_domain_i
本文标题:Fluent-UDF-14.5-L06-Multiphase
链接地址:https://www.777doc.com/doc-4084257 .html