


{"id":346749,"date":"2024-01-26T10:46:56","date_gmt":"2024-01-26T10:46:56","guid":{"rendered":"\/forum\/forums\/topic\/variable-density-for-solid-object\/"},"modified":"2024-01-26T10:46:56","modified_gmt":"2024-01-26T10:46:56","slug":"variable-density-for-solid-object","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/variable-density-for-solid-object\/","title":{"rendered":"Variable density for solid object"},"content":{"rendered":"<p>Hi community, I would ask a question about density distribution with UDF file.<\/p>\n<p>I&#8217;m trying to simulate the falling descent of a solid body in air with overset mesh and 6-dof solver.&nbsp;Everithing is well setted up and if i use a constant value for the solid density in fluent no problems occurs.<\/p>\n<p>&nbsp;I would like to consider a body with different density distribution, for example rho = 40 if the cell thickness is below a threshold and rho =430 if it is above. I&#8217;ve write the following UDF and fluent allow to compile and assign to the material density, but when i look at the density contours in CFD post the value on the solid body is uniform and equal to 1.225 (air density). How can I check the real density of the solid ?&nbsp;<\/p>\n<p>UDF:<\/p>\n<p>#include &#8220;udf.h&#8221;<\/p>\n<p>DEFINE_PROPERTY(density, c, t)<br \/>{<br \/>&nbsp; &nbsp; real ro;<br \/>&nbsp; &nbsp; real x[ND_ND];<br \/>&nbsp; &nbsp; real thickness;<br \/>&nbsp; &nbsp; int isWallObject;<br \/>&nbsp; &nbsp; Domain* domain;<\/p>\n<p>&nbsp; &nbsp; \/* Ottieni il dominio *\/<br \/>&nbsp; &nbsp; domain = Get_Domain(1);<\/p>\n<p>&nbsp; &nbsp; \/* Verifica se la faccia &egrave; associata alla name selection &#8220;wall-object&#8221; *\/<br \/>&nbsp; &nbsp; isWallObject = (C_FACE_THREAD(c, t) == Lookup_Thread(domain, &#8220;wall-object&#8221;)) ? 1 : 0;<\/p>\n<p>&nbsp; &nbsp; if (isWallObject)<br \/>&nbsp; &nbsp; {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; C_CENTROID(x, c, t);<br \/>&nbsp; &nbsp; &nbsp; &nbsp; thickness = C_VOLUME(c, t) \/ C_FACE_AREA(c, t);<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; if (thickness &lt; 0.000353)<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ro = 40;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; else<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ro = 430;<br \/>&nbsp; &nbsp; }<br \/>&nbsp; &nbsp; else<br \/>&nbsp; &nbsp; {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; ro = 1.225;<br \/>&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; return ro;<br \/>}<\/p>\n<p>&nbsp;<\/p>\n<p>Many thanks<\/p>\n","protected":false},"template":"","class_list":["post-346749","topic","type-topic","status-closed","hentry","topic-tag-fluent-cfd-ansys-1","topic-tag-overset-mesh","topic-tag-user-defined-functions"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["275015","199"],"_bbp_author_ip":["23.52.43.16"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["679"],"_bbp_topic_status":["unanswered"],"_bbp_topic_id":["346749"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","275015"],"_bbp_voice_count":["2"],"_bbp_reply_count":["12"],"_bbp_last_reply_id":["347265"],"_bbp_last_active_id":["347265"],"_bbp_last_active_time":["2024-01-30 11:41:07"]},"test":"alberto-lollisantannapisa-it"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/346749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/346749\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=346749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}