Creating a UDWSPF C function library is reasonably straightforward:
The code must contain the udf.h file inclusion directive at the beginning of the source code. This
allows the definitions for DEFINE macros
and other ANSYS Fluent functions to be accessible during the compilation
process.
The code must include at least one in the UDF’s DEFINE functions (that is DEFINE_ON_DEMAND) to be able to use the compiled UDFs utility.
Any values that are passed to the solver by the UDWSPF or returned by the solver to the UDWSPF are assumed to be in SI units.
You must use the principle set of user-defined wet steam property functions in your UDWSPF library, as described in the list that follows. These functions are the mechanism by which your thermodynamic property data is transferred to the ANSYS Fluent solver.
The following lists the user-defined wet steam property function
names and arguments, as well as a short description of their functions.
Function inputs from the ANSYS Fluent solver consist of one or more
of the following variables: T = temperature (), P = pressure (
), and
= vapor-phase density
(
).
void wetst_init(Domain *domain)
This will be called when you load the UDWSPF. You use it to initialize wet steam model constants or your own model constants. It returns nothing.
real wetst_satP(real T)
This is the saturated pressure function, which takes on temperature in K and returns saturation pressure in Pa.
real wetst_satT(real P, real T)
This is the saturated temperature function, which takes on pressure in Pa and a starting guess temperature in K and returns saturation temperature in K.
real wetst_eosP(real rho, real T)
This is the equation of state, which takes on vapor density in kg/m3 and Temperature in K and returns pressure in Pa.
real wetst_eosRHO(real P, real T)
This is the equation of state, which takes on pressure in Pa and temperature in K and returns vapor density in kg/m3.
real wetst_cpv(real T, real rho)
This is the vapor specific heat at constant pressure, which takes on temperature in K and vapor density in kg/m3 and returns specific heat at constant pressure in J/kg/K.
real wetst_cvv(real T, real rho)
This is the vapor specific heat at constant volume, which takes on temperature in K and vapor density in kg/m3 and returns specific heat at constant volume in J/kg/K.
real wetst_hv(real T,real rho)
This is the vapor specific enthalpy, which takes on temperature in K and vapor density in kg/m3 and returns specific enthalpy in J/Kg.
real wetst_sv(real T, real rho)
This is the vapor specific entropy, which takes on temperature in K and vapor density in kg/m3 and returns specific entropy in J/Kg/K.
real wetst_muv(real T, real rho)
This is the vapor dynamic viscosity, which takes on temperature in K and vapor density in kg/m3 and returns viscosity in kg/m/s.
real wetst_ktv(real T, real rho)
This is the vapor thermal conductivity, which takes on temperature in K and vapor density in kg/m3 and returns thermal conductivity in W/m/K.
real wetst_rhol(real T)
This is the saturated liquid density, which takes on temperature in K and returns liquid density in kg/m3.
real wetst_cpl(real T)
This is the saturated liquid specific heat at constant pressure, which takes on temperature in K and returns liquid specific heat in J/kg/K.
real wetst_mul(real T)
This is the liquid dynamic viscosity, which takes on Temperature in K and returns dynamic viscosity in kg/m/s.
real wetst_ktl(real T)
This is the liquid thermal conductivity, which takes on temperature in K and returns thermal conductivity in W/m/K.
real wetst_surft(real T)
This is the liquid surface tension, which takes on Temperature in K and returns surface tension N/m.
At the end of the code you must define a structure of type WS_Functions whose members are pointers to the principle
functions listed previously. The structure is of type WS_Functions and its name is WetSteamFunctionList.
UDF_EXPORT WS_Functions WetSteamFunctionList =
{
wetst_init, /*initialization function*/
wetst_satP, /*Saturation pressure*/
wetst_satT, /*Saturation temperature*/
wetst_eosP, /*equation of state*/
wetst_eosRHO, /*equation of state*/
wetst_hv, /*vapor enthalpy*/
wetst_sv, /*vapor entropy*/
wetst_cpv, /*vapor isobaric specific heat*/
wetst_cvv, /*vapor isochoric specific heat*/
wetst_muv, /*vapor dynamic viscosity*/
wetst_ktv, /*vapor thermal conductivity*/
wetst_rhol, /*sat. liquid density*/
wetst_cpl, /*sat. liquid specific heat*/
wetst_mul, /*sat. liquid viscosity*/
wetst_ktl, /*sat. liquid thermal conductivity*/
wetst_surft /*liquid surface tension*/
};