CHAPTER 3: SOLUTION PROCEDUR
3.5 User Define Functions (UDFs)
User Defined Functions (UDFs) allow the user to customize ANSYS Fluent and can significantly enhance its capabilities. A UDF is a routine (programmed by the user)
67
written in C which can be dynamically linked with the solver. It is a combination of Standard C functions such as: trigonometric, exponential, control blocks, do-loops, files inputs and outputs, etc; And Pre-Defined Macros which Allow access to field variable, material property, and cell geometry data. The standard interface of ANSYS Fluent cannot be programmed to anticipate all needs such as: customization of boundary conditions, source terms, reaction rates, material properties, adjust functions (once per iteration), Execute on Demand functions, solution initialization etc [151].
Since the presented numerical solution of heat pipes involves variables and parameters from both system level and standard level as well as from different computational domains, it is impossible without UDFs to perform such a numerical simulation. All the UDFs used in this study are listed in Table 3.3 with their type and names. In this section, these UDFs and their roles are explained briefly.
3.5.1 Initial UDFs
“DEFINE_INIT” type UDFs are the first UDF called before the solver is started, before any other UDFs however, after “Declarations” is loaded. Two “DEFINE_INIT” type UDFs are used in this study which are mentioned in this section along with what they do.
INITIAL_SETTINGS
All the parameters used in the simulation are set in this UDF such as: heat flux, heat transfer coefficient, reference temperature and pressure, latent heat, porosity, effective conductivity, under relaxation factor, operation pressure etc. Also, the UDS and interface variables are initialize in this UDF. Moreover, the volume of wick and vapor domains, the mass of wick and vapor domains are set and initialize in this UDF.
68
SHADOW_READING
As mentioned earlier, the domains are made separately and do not have any connection. Now imagine the pointer is on a cell on a boundary of a domain (boundary#1, Figure 3.6) and information from the neighbor cell from the other domain (boundary#2, Figure 3.6) is needed. ANSYS Fluent does not have any predefined macro to access the neighbor cell in neighbor domains, therefore, one has to loop through all the cells within the neighboring boundary (boundary#2, Figure 3.6) and compare a geometry parameter (x
in this case) to find the neighboring cell on the main boundary (boundary#1, Figure 3.6). This procedure has to be repeated for all the cells on the boundary from the first domain (loop in loop) and for all other interface boundaries in all the domains. This would take a lot processing time if repeated for each iteration and each time step. In this UDF, at the initial stage before the solution is started, for once this process of finding neighbor cells is done and the faces and threats of neighbor cells are saved in arrays that can be called and used later in the rest of solver without any loop which saves CPU time.
3.5.2 Define Adjust UDFs
“DEFINE_ADJUST” type UDFs are called at the beginning of each iteration. Two “DEFINE_ADJUST” type UDFs are used in this study which are mentioned in this section along with what they do.
PARAMETERS_UPDATE
Pressure operation (Eq. (3.4)) is updated every iteration in this UDF based on information from the vapor domain and liquid-wick interface. Also, based on the mass transfer balance (Eq. (2.28)) at the liquid-vapor interface, the mass of vapor (Eq. (2.29)) and mas of wick (Eq. (2.30)) domain is updated every iteration.
69
WICK_VAPOR_INTERFACE
In this UDF, the interface temperature (Eq. (3.17)), interface mass transfer (Eq. (3.2)), and as well as the interface velocities at the wick (Eq. (2.18)) and interface velocities at the vapor (Eq. (2.19)) domains. Note, the interface temperature and velocities are only calculated here in this UDF and they are applied in other UDFs.
3.5.3 Define Profile UDS
“DEFINE_PROFILE” type UDFs could be used at any part of the solver such: defining a boundray condition, definting a properties or any other customized profiles not provided by ANSYS Fluent. All the “DEFINE_PROFILE” type UDFs are used in this study which are mentioned in this section along with what they do
VELOCITY_VAPOR_WICK
This UDF assigns the velocity boundary values, already calculated in “DEFINE_ADJUST, WICK_VAPOR_INTERFACE,” to the vapor-wick interface boundary but at the vapor side.
VELOCITY_WICK_VAPOR
This UDF assigns the velocity boundary values, already calculated in “DEFINE_ADJUST (WICK_VAPOR_INTERFACE),” to the vapor-wick interface boundary but at the wick side.
TEMPERATURE_VAPOR_WICK
This UDF assigns the temperature boundary values, already calculated in “DEFINE_ADJUST, WICK_VAPOR_INTERFACE,” to the vapor-wick interface boundary but at the vapor side.
70
This UDF assigns the temperature boundary values, already calculated in “DEFINE_ADJUST, WICK_VAPOR_INTERFACE,” to the vapor-wick interface boundary but at the wick side.
TEMPERATURE_WICK_WALL
This UDF calculates and assigns the temperature boundary values based on Eq. (2.16) to the wick-wall interface boundary but at the wick side
TEMPERATURE_WALL_WICK
This UDF calculates and assigns the temperature boundary values based on Eq. (2.16) to the wick-wall interface boundary but at the wall side
TEMPERATURE_COOLING
This UDF calculates and assigns the temperature boundary values based on Eq. (2.14) to the boundary of condensation s.
WALL_HEAT_FLUX
This UDF assigns the temperature boundary values based on Eq. (2.12) to the boundary of condensation section.
VAPOR_DENSITY
This UDF calculates and assigns the local density of vapor based on Eq. (2.34).
LIQUID_DENSITY
This UDF calculates and assigns the density of wick based on Eq. (2.35).
WICK_CONDUCTIVITY
This UDF assigns the effective thermal conductivity of the wick domain based on the location of pointer, whether it is in groove or screen mesh area.
71
This UDF assigns the porosity of the wick domain based on the location of pointer, whether it is in groove or screen mesh area.
VISCOUS_RESISTANCE
This UDF assigns the porous media viscous resistance of the wick domain based on the location of pointer, whether it is in groove or screen mesh area.
INERTIAL_RESISTANCE
This UDF assigns the porous media inertial resistance of the wick domain based on the location of pointer, whether it is in groove or screen mesh area.
3.5.6 Other UDFs
There are other types of UDFs used in this study as listed and explained in this section. Declarations
This part is used to declare all the public variables and once declared in this part, would be accessible in all other UDFs. Despite local variables, any variable defined in this section is global. All the faces, threads, domains, integer variable, real variables and arrays are defined in this section. When ANSYS Fluent loads the C file, declares all the variables in this section. This section of the UDFs is the only section called before “DEFINE_INIT” type UDFs.
DEFINE_UDS_UNSTEADY: UDS_UNSTEADY_REVISION
As explained earlier, the transient term normally calculated by ANSYS Fluent for the UDS transport equation has to be modified in the wick region because of the porous media. This UDF calculates and assigns the unsteady terms based on Eq. (3.20), Eq. (3.21) and Eq. (3.19).
72
This UDF assigns the diffusivity of the wick domain based on the location of pointer, whether it is in groove or screen mesh area.
DEFINE_DELTAT: TIME_STEP
This UDF is in charge of dynamic time step. Each time step value is calculated and assign in this section.