Fluent6: UDF: How to access mole fraction of species
To access the mass fraction of a species, the macro C_YI(c,t,i) can be used. How could the mole fraction be accessed?
The mole fraction of a species in a mixture can be calculated by
- first summing up [mass fraction / molecular weight] of all species and
- then dividing the same quotient for the individual species by the calculated sum.
This is done automatically by the following function call (including variables and preparation):
Material *mix_mat = mixture_material(Get_Domain(1));
Material *spe_mat = NULL;
int i = -1;
mixture_species_loop(mix_mat, spe_mat, i)
all_mass_fracts[i] = C_YI(c,t,i);
Mole_Fraction(mix_mat, all_mass_fracts, all_mole_fracts)
After this, the mole fractions of all species can be found in the array "all_mole_fracts".