


{"id":362939,"date":"2024-04-18T12:37:56","date_gmt":"2024-04-18T12:37:56","guid":{"rendered":"\/forum\/forums\/topic\/udf-for-mass-transfer-pars-error\/"},"modified":"2024-04-18T12:47:33","modified_gmt":"2024-04-18T12:47:33","slug":"udf-for-mass-transfer-pars-error","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-mass-transfer-pars-error\/","title":{"rendered":"UDF for mass transfer parse error"},"content":{"rendered":"<p>Hallo,<br \/>&nbsp;I&#8217;m trying to write a udf to model the mass transfer equation indicated in the image below for condensation model&nbsp;<br \/>the porblem is when i press interpret in fluent it gives me an error&nbsp;<br \/>&#8220;line 13 parse error<br \/>line 14: parse error<br \/>line.15: parse error.<br \/>line 18: liq: undeclared variable&#8221;<\/p>\n<p>here is my UDF code&nbsp;<\/p>\n<div>\n<div>\/* UDF to define a simple mass transfer based on Saturation<\/div>\n<div>&nbsp; &nbsp;Temperature. The &#8220;from&#8221; phase is the gas and the &#8220;to&#8221; phase is the<\/div>\n<div>&nbsp; &nbsp;liquid phase &nbsp;*\/<\/div>\n<p><\/p>\n<div>#include &#8220;udf.h&#8221;<\/div>\n<div>DEFINE_MASS_TRANSFER(Th_conds, cell, thread, from_index,from_species_index, to_index, to_species_index)<\/div>\n<div>{<\/div>\n<div>&nbsp; &nbsp;real m_lg;<\/div>\n<div>&nbsp; &nbsp;real time_step;<\/div>\n<div>&nbsp; &nbsp;time_step=5e-5;<\/div>\n<div>&nbsp; &nbsp;real T_SAT = 309.15;<\/div>\n<div>&nbsp; &nbsp;Thread *gas = THREAD_SUB_THREAD(thread, from_index);<\/div>\n<div>&nbsp; &nbsp;Thread *liq = THREAD_SUB_THREAD(thread, to_index);<\/div>\n<p><\/p>\n<div>&nbsp; &nbsp;m_lg = 0;<\/div>\n<div>&nbsp; &nbsp;if (C_T(cell, liq) &gt;= T_SAT)<\/div>\n<div>&nbsp; &nbsp; &nbsp;{<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp;m_lg = &#8211; (C_R(cell,liq)*C_CP(cell,liq)*(C_T(cell,liq)-T_SAT))\/(time_step*C_H(cell,liq)); &nbsp; &nbsp;<\/div>\n<div>&nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/div>\n<div>&nbsp; &nbsp;if ((m_lg == 0 ) &amp;&amp; (C_T(cell, gas) &lt;= T_SAT))<\/div>\n<div>&nbsp; &nbsp; &nbsp;{<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp;m_lg = &nbsp;(C_R(cell,gas)*C_CP(cell,gas)*(C_T(cell,liq)-T_SAT))\/(time_step*C_H(cell,gas)); &nbsp;<\/div>\n<div>&nbsp; &nbsp; &nbsp;}<\/div>\n<p><\/p>\n<div>&nbsp; &nbsp;return (m_lg);<\/div>\n<div>}<\/div>\n<\/div>\n<p>here is the mass transfer equation <a class=\"wp-colorbox-image cboxElement\" href=\"\/forum\/wp-content\/uploads\/sites\/2\/2024\/04\/18-04-2024-1713443854-Capture.PNG\"><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2024\/04\/18-04-2024-1713443854-Capture.PNG\" alt=\"\"><\/a><\/p>\n","protected":false},"template":"","class_list":["post-362939","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["337903","199"],"_bbp_author_ip":["168.143.243.24"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["346"],"_bbp_topic_status":["unanswered"],"_edit_lock":["1713444421:285887"],"_bbp_topic_id":["362939"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","337903"],"_bbp_voice_count":["2"],"_bbp_reply_count":["8"],"_bbp_last_reply_id":["363428"],"_bbp_last_active_id":["363428"],"_bbp_last_active_time":["2024-04-22 08:38:15"]},"test":"ibrahimallam087gmail-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/362939","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":2,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/362939\/revisions"}],"predecessor-version":[{"id":362946,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/362939\/revisions\/362946"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=362939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}