So I think I got it working now. Apparently TP_CELL_THREAD returns the mixture thread, not the particle thread. I don't understand why that is the case and in my opinion the UDF guide says otherwise (Table 3.29), but it doesn't crash and gives me plausible values.

My code is now (declarations as above):

mixthread = TP_CELL_THREAD(tp);
gthread = THREAD_SUB_THREAD(mixthread,0);

c = TP_CELL(tp);

urel = C_U(c,gthread);