Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.

Ansys Learning Forum Forums Discuss Simulation Fluids Find the coordinates of the center of a face Reply To: Find the coordinates of the center of a face

admin
Ansys Employee

The coordinates of center of a face can be obtained by using the FCENTROID macro. The following udf is an example of accessing the coordinates of the face center using DEFINEONDEMAND. Note: When define on demand is executed, the coordinates and the ID of the face center are printed in the Fluent console. #include "udf.h" DEFINEONDEMAND(ondemand) { Domain *d = GetDomain(1); int ID = 2; Thread *t =LookupThread(d, ID); facet f; real x[NDND],x1,y1,z1; beginfloop(f,t) { FCENTROID(x,f,t); x1 = x [0]; y1 = x [1]; z1 = x [2]; Message("face : %d,%f,%f,%f,%dn",f,x1,y1,z1,ID); } endf_loop(f,t) }

[bingo_chatbox]