UDF wrong as you are not getting first the right mixture thread just as hint. More information in the UDF manual: thread_sub_thread accepts the phase domain index as second argument which zero for primary phase.
By the way what you want to do in the UDF can be easily done via Report Definition and Volume Averaging or Sum Functions.
Please Login to Report Topic
Please Login to Share Feed
New Post - Reply To: Calculate a bubble average speed