I wrote an UDF with which to define effective diffusion coefficients in porous zone. In my UDF, molecular mass diffusion coefficients for all species are calculated according to their L-J parameters. Because I have 16 species in the system. The code has nearly 1000 lines. The UDF can be compiled and loaded without any errors.
However, it causes divergence after some iterations. Since the code is so long, I don't know where to start to check error. I think firstly there should be no syntax error because it can be compiled and loaded without error.
I think the logic of the code is wrong. Maybe it gives unreasonable mass diffusion coefficients or the loop inside the UDF becomes infinity at some points. In order to find out why, I want ask a question about this macro: DEFINE_DIFFUSIVITY
what is the sequence for this macro to assign mass diffusion coefficients to every species? does it assign diffusion coefficient for every species in a cell and then go to another cell? Or it just gives diffusion coefficients for a species in the whole domain and then goes to next species?