Fluids

Fluids

Find the coordinates of the center of a face

    • admin
      Ansys Employee

      How can I 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) }

Viewing 1 reply thread
  • You must be logged in to reply to this topic.