


{"id":319002,"date":"2023-11-22T10:23:50","date_gmt":"2023-11-22T10:23:50","guid":{"rendered":"\/forum\/forums\/topic\/udf-crash\/"},"modified":"2023-11-22T10:23:50","modified_gmt":"2023-11-22T10:23:50","slug":"udf-crash","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-crash\/","title":{"rendered":"UDF crash"},"content":{"rendered":"<p>I tried to calculate the stockes number for a specific group of particles. here is the code.<\/p>\n<p>This udf has been hooked up in DPM model and the number of scalar is set to 1.<\/p>\n<p><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/22-11-2023-1700648269-mceclip2.png\"><\/p>\n<p><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/22-11-2023-1700648316-mceclip3.png\"><\/p>\n<p>the code has no compiling issue in this LES case. the case runs on HPC with 128 cores. memory info is listed below.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/22-11-2023-1700648586-mceclip4.png\"><\/p>\n<p>but when the calculation started, then it crashed.<\/p>\n<p>&nbsp;<\/p>\n<div>#include &#8220;udf.h&#8221;<\/div>\n<div>#include &#8220;dpm.h&#8221;<\/div>\n<div>&nbsp;<\/div>\n<div>DEFINE_DPM_SCALAR_UPDATE(StokesNumber,c,t,init,p)<\/div>\n<div>{<\/div>\n<div>&nbsp; &nbsp; cphase_state_t *cp;<\/div>\n<div>&nbsp; &nbsp; cp = p-&gt;cphase;<\/div>\n<div>&nbsp; &nbsp; \/* cphase_state_t *c = &amp;(p-&gt;cphase); *\/<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; real tau_p = 0;<\/div>\n<div>&nbsp; &nbsp; real drag_factor;<\/div>\n<div>&nbsp; &nbsp; real tau_f = 1e-16;<\/div>\n<div>&nbsp; &nbsp; real C_mu = 0.09;<\/div>\n<div>&nbsp; &nbsp; real l_int, u_f;&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/* Compute particle relaxation time *\/<\/div>\n<div>&nbsp; &nbsp; if (P_DIAM(p) != 0.0)<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>tau_p = P_RHO(p)*pow(P_DIAM(p), 2.0)\/C_MU_L(TP_CELL(p), TP_CELL_THREAD(p));<\/div>\n<div>drag_factor = DragCoeff(p); \/* returns 18*Cd*Rep\/24 ? Please check *\/<\/div>\n<div>tau_p \/= drag_factor;<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp; else<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>tau_p = 0.;<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/* Compute the fluid time scale<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp;(based on integral length scale) *\/<\/div>\n<div>&nbsp; &nbsp; if (C_D(TP_CELL(p), TP_CELL_THREAD(p)) &gt; 0)<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; l_int = C_mu*pow(C_K(TP_CELL(p), TP_CELL_THREAD(p)), 1.5)\/C_D(TP_CELL(p), TP_CELL_THREAD(p));<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp; else<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>l_int = 1.;<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp;&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/* Velocity magnitude*\/<\/div>\n<div>&nbsp; &nbsp; u_f = sqrt(pow(cp-&gt;V[0], 2.0) + pow(cp-&gt;V[1], 2.0) + pow(cp-&gt;V[2], 2.0));<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; if (u_f &gt; 1e-12)<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>tau_f = l_int\/u_f;<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp; &nbsp;else<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>tau_f = 1.;<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/* Stokes Number *\/<\/div>\n<div>&nbsp; &nbsp; P_USER_REAL(p,0) = tau_p \/ tau_f;<\/div>\n<div>&nbsp;<\/div>\n<div>}<\/div>\n<p><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/22-11-2023-1700640023-mceclip0.png\"><\/p>\n","protected":false},"template":"","class_list":["post-319002","topic","type-topic","status-closed","hentry","topic-tag-dpm","topic-tag-les","topic-tag-particle-tracking","topic-tag-udf"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["27819","199"],"_bbp_author_ip":["23.206.193.154"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["415"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["319002"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","27819"],"_bbp_voice_count":["2"],"_bbp_reply_count":["9"],"_bbp_last_reply_id":["319877"],"_bbp_last_active_id":["319877"],"_bbp_last_active_time":["2023-11-28 23:15:53"]},"test":"ll00023mix-wvu-edu"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/319002","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\/319002\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=319002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}