You can use DEFINE_MASS_TRANSFER when
you want to model mass transfer in a multiphase problem. The mass
transfer rate specified using a DEFINE_MASS_TRANSFER UDF is used to compute mass, momentum, energy, and species sources
for the phases involved in the mass transfer. For problems in which
species transport is enabled, the mass transfer will be from one species
in one phase, to another species in another phase. If one of the phases
does not have a mixture material associated with it, then the mass
transfer will be with the bulk fluid of that phase.
Note: By default, Fluent will attempt to hook mass transfer
UDFs defined using DEFINE_LINEARIZED_MASS_TRANSFER. In order to hook a DEFINE_MASS_TRANSFER UDF to Fluent, you must first issue the TUI command solve/set/expert and enter no at the Linearized Mass Transfer UDF? prompt.
You may want to consider using the DEFINE_LINEARIZED_MASS_TRANSFER macro (
DEFINE_LINEARIZED_MASS_TRANSFER
) as it may provide a more robust solution, even though the results
may be the same when converged.
DEFINE_MASS_TRANSFER (name, c, mixture_thread, from_phase_index, from_species_index, to_phase_index, to_species_index)
Important: Note that all of the arguments to a DEFINE macro need to be placed on the same line in your source code. Splitting
the DEFINE statement onto several lines will
result in a compilation error.
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
Index of cell on the thread pointed
to by |
|
|
Pointer to mixture-level thread. |
|
|
Index of phase from which mass is transferred. |
|
|
ID of species from which mass is transferred (ID= -1 if phase does not have mixture material). |
|
|
Index of phase to which mass is transferred. |
|
|
ID of species to which mass is transferred (ID= -1 if phase does not have mixture material). |
Function returns
real
There are seven arguments to DEFINE_MASS_TRANSFER: name, c, mixture_thread, from_phase_index, from_species_index, to_phase_index, to_species_index. You supply name, the name of the UDF. The variables c, mixture_thread, from_phase_index, from_species_index, to_phase_index, and to_species_index are passed by the ANSYS Fluent solver to your UDF. Your UDF will need
to return the real value of the mass transfer to the solver in the
units of kg//s.
Important: The arguments from_species_index and to_species_index are relevant for multiphase species
transport problems only, and only if the respective phase has a mixture
material associated with it.
The following UDF, named liq_gas_source, specifies a simple mass transfer coefficient based on saturation
temperature:
Important: Note that in the example that follows, the DEFINE_MASS_TRANSFER statement is broken up into two lines for the sake of readability.
In your source file, you must make sure that the DEFINE statement is on one line only.
/* UDF to define a simple mass transfer based on Saturation Temperature.
The "from" phase is the gas phase and the "to" phase is the liquid phase */
#include "udf.h"
DEFINE_MASS_TRANSFER(liq_gas_source, cell, thread, from_index,
from_species_index, to_index, to_species_index)
{
real m_lg;
real T_SAT = 373.15;
Thread *gas, *liq;
gas = THREAD_SUB_THREAD(thread, from_index);
liq = THREAD_SUB_THREAD(thread, to_index);
m_lg = 0.0;
if (C_T(cell, liq) > T_SAT)
{ /* Evaporating */
m_lg = -0.1*C_VOF(cell,liq)*C_R(cell,liq)*
(C_T(cell,liq)-T_SAT)/T_SAT;
}
else if (C_T(cell, gas) < T_SAT)
{ /* Condensing */
m_lg = 0.1*C_VOF(cell,gas)*C_R(cell,gas)*
(T_SAT-C_T(cell,gas))/T_SAT;
}
return (m_lg);
}
In order to hook a DEFINE_MASS_TRANSFER UDF to Fluent, you must first issue the TUI command solve/set/expert and enter no at the Linearized Mass Transfer UDF? prompt.
After the UDF that you have defined using DEFINE_MASS_TRANSFER is interpreted (Interpreting UDFs)
or compiled (Compiling UDFs), the name
of the argument that you supplied as the first DEFINE macro argument (for example, liq_gas_source) will become visible and selectable under Mass Transfer when you select the Mass tab option in the
Phase Interaction dialog box and specify the
Number of Mass Transfer Functions. See Hooking DEFINE_MASS_TRANSFER UDFs for details.