distance between every two faces
i want to calculate below formula too.how can i write udf?
please help me. s[i][j]=(exp(k*s)*(A[i].r)*(A[j].r))/(4*s) k=constant s=NV_MAG(r) A[i] , A[j] = Area r= distance between face A[i] and A[j] how can i calculate this formula for all faces in domain? 
It may not be possible. What is the meaning of previous face? You should modify the algorithm.

i want to write exchange factor for radiation by zone method and i have to compute the surface to surface exchange factor between every two surfaces, surface to gas exchange factor between every face and gas cell , and gas to gas exchange factor between every two gas cell.
formula for surface to surface exchange factor between surfaces i and surface j is: ss[i][j]=(exp(k*s)*(A[i].r)*(A[j].r))/(4*s) k=constant A[i] =surface i area A[j] = surface j area r=distance vector between face A[i] and face A[j] s= magnitude of distance between face A[i] and A[j] 
All times are GMT 4. The time now is 10:10. 