


{"id":55111,"date":"2017-10-17T06:21:38","date_gmt":"2017-10-17T06:21:38","guid":{"rendered":"\/forum\/forums\/reply\/55111\/"},"modified":"2017-10-17T06:21:38","modified_gmt":"2017-10-17T06:21:38","slug":"55111","status":"publish","type":"reply","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/55111\/","title":{"rendered":"Reply To: Find the coordinates of the center of a face"},"content":{"rendered":"<p><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">The coordinates of center of a face can be obtained by using the F<\/span><em style=\"box-sizing: border-box; font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">CENTROID macro. The following udf is an example of accessing the coordinates of the face center using DEFINE<\/em><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">ON<\/span><em style=\"box-sizing: border-box; font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">DEMAND. Note: When define on demand is executed, the coordinates and the ID of the face center are printed in the Fluent console. #include &#8220;udf.h&#8221; DEFINE<\/em><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">ON<\/span><em style=\"box-sizing: border-box; font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">DEMAND(on<\/em><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">demand) { Domain *d = Get<\/span><em style=\"box-sizing: border-box; font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">Domain(1); int ID = 2; Thread *t =Lookup<\/em><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">Thread(d, ID); face<\/span><em style=\"box-sizing: border-box; font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">t f; real x[ND<\/em><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">ND],x1,y1,z1; begin<\/span><em style=\"box-sizing: border-box; font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">f<\/em><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">loop(f,t) { F<\/span><em style=\"box-sizing: border-box; font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">CENTROID(x,f,t); x1 = x [0]; y1 = x [1]; z1 = x [2]; Message(&#8220;face : %d,%f,%f,%f,%dn&#8221;,f,x1,y1,z1,ID); } end<\/em><span style=\"font-family: 'Open Sans', Arial, Helvetica, sans-serif; font-size: 15px;\">f_loop(f,t) }<\/span><\/p>\n","protected":false},"template":"","class_list":["post-55111","reply","type-reply","status-publish","hentry"],"aioseo_notices":[],"acf":[],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/55111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/reply"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/55111\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=55111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}