I am trying to use an UDF to define mass diffusion coefficients for all species in the system. However, it causes divergence after some iterations.
In order to debug the code, I wrote a line "C_UDMI(c,t,i)=deffective[i]" to store mass diffusion coefficient of i specie in i UDM. Then I run the model and tried to display mass diffusion coefficient contour of some species before divergence happened. I found that all mass diffusion coefficients UDF returned were zero. This is definitely not reasonable. Therefore, I guess the following reasons:
1. Might it be some numerical reasons that all number below some threshold value is treated as zero in fluent? Because the magnitude of mass diffusion coefficient is normally e^-6 to e^-5.
2. I used the species index "i" in the macro DEFINE_DIFFUSIVITY(name,c,t,i) to loop every species in the system. I also defined an array to store mass diffusion coefficients the UDF returns which is deffective. In every loop i, a coefficient deffective[i] is returned to species i. The reason I don't just define a real number deffective to store mass diffusion coefficient returned is because I think the value returned now will cover and erase the value returned previously for the last specie. Am I thinking right?
Any suggestions will be very appreciated?