有一节叫Advanced Multiphase Macro,也许有帮助。
For most standard UDFs written for multiphase models (for example, source term, material property, profile functions), variables that your function needs (domain pointers, thread pointers, and so on) are passed directly to your UDF as arguments by the solver in the solution process. All you need to do is hook the UDF to your model and everything is taken care of. For example, if your multiphase UDF defines a custom profile for a particular boundary zone (using DEFINE_PROFILE) and is hooked to the appropriate phase or mixture in Ansys Fluent in the relevant boundary condition dialog box, then appropriate phase or mixture variables will be passed to your function by the solver at run time.
There may, however, be more complex functions you want to write that require a variable that is not directly passed through its arguments. DEFINE_ADJUST and DEFINE_INIT functions, for example, are passed mixture domain variables only. If a UDF requires a phase domain pointer, instead, then it will need to use macros presented in this section to retrieve it. ON_DEMAND UDFS are not directly passed any variables through their arguments. Consequently, any on demand function that requires access to phase or domain variables will also need to use macros presented in this section to retrieve them.