


{"id":36085,"date":"2019-06-20T14:38:49","date_gmt":"2019-06-20T14:38:49","guid":{"rendered":"\/forum\/forums\/topic\/udf-compilation-and-interpretation-error\/"},"modified":"2019-06-20T14:38:49","modified_gmt":"2019-06-20T14:38:49","slug":"udf-compilation-and-interpretation-error","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-compilation-and-interpretation-error\/","title":{"rendered":"UDF Compilation and Interpretation Error"},"content":{"rendered":"<p>Hi,<\/p>\n<p><\/p>\n<p>I am facing errors while trying to do interpretation or compilation for a&nbsp;UDF in fluent.<\/p>\n<p><\/p>\n<p>I am simulating a 2D rectangular cavity with the following boundary conditions: adiabatic top layer, periodic side walls and rigid bottom with thermal heat flux and small random perturbations following this equation: dT\/dy= -exp(-h)+ epsilon*[rand(x)-0.5] , where rand is a one dimensional array of random numbers uniformly distributed in the range of [0,1].<\/p>\n<p><\/p>\n<p>I used a UDF to assign the heat flux and perturbation to the bottom layer. When I used interpretation of UDF, I get an error notifying that:&nbsp;<em>srand: undeclared variable.<\/em><\/p>\n<p><\/p>\n<p>When trying to compile it, I get an error notifying that:&nbsp;<em>The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64<\/em><em>)<span style=\"color: #111111; font-family: Roboto, Arial, sans-serif;\">.nnThe system cannot find the file specified.<\/span><\/em><span style=\"color: #111111; font-family: Roboto, Arial, sans-serif;\">&nbsp;however, the<\/span><span style=\"color: #111111; font-family: Roboto, Arial, sans-serif;\">&nbsp;UDF source files are in the directory t<\/span><span style=\"color: #111111; font-family: Roboto, Arial, sans-serif;\">hat contains my case and data files.<\/span><\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p><span style=\"color: #111111; font-family: Roboto, Arial, sans-serif;\">Following the UDF I am using to set up the boundary condition at the bottom layer:<\/span><\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>#include &#8220;udf.h&#8221;<\/p>\n<p><\/p>\n<p>#include &#8220;stdlib.h&#8221;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;\/* srand and rand *\/<\/p>\n<p><\/p>\n<p>#include &#8220;time.h&#8221;<\/p>\n<p><\/p>\n<p>#include &#8220;random.h&#8221;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>#define RAND_MAX 32767<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>DEFINE_PROFILE(Temp_rand_pertubation_bottom,thread,index)<\/p>\n<p><\/p>\n<p>{<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>real x[ND_ND]; \/* this will hold the position vector *\/<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>face_t f;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>real time= CURRENT_TIME;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>float h,E,r;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>srand((unsigned)time(NULL));&nbsp; &nbsp; &nbsp; &nbsp; \/*&nbsp; this to specify a different random number at each cell *\/<\/p>\n<p><\/p>\n<p>k=0.6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/* thermal conductivity *\/<\/p>\n<p><\/p>\n<p>T=300&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/* Temp in Kelvin *\/<\/p>\n<p><\/p>\n<p>h = 0.5; \/* cavity height&nbsp; *\/<\/p>\n<p><\/p>\n<p>E= 0.01; \/* epsilon constant value *\/<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>&nbsp; begin_f_loop_all(f,thread)<\/p>\n<p><\/p>\n<p>{<\/p>\n<p><\/p>\n<p>r= rand()\/float(RAND_MAX);&nbsp; &nbsp; &nbsp; &nbsp;\/* r is a 1D array of random numbers uniformly distributed in the range of [0,1] *\/<\/p>\n<p><\/p>\n<p>&nbsp;&nbsp;<\/p>\n<p><\/p>\n<p>F_CENTROID (x,f,thread);<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>F_PROFILE(f,thread,index) = k*T*(- exp(-h)+E*(r-0.5))\/h;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/* apply random perturbation *\/<\/p>\n<p><\/p>\n<p>}<\/p>\n<p><\/p>\n<p>&nbsp; end_f_loop_all(f,thread);<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>void srand(unsighned int seed);<\/p>\n<p><\/p>\n<p>}<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>To avoid these errors, please advice me whether my UDF need to be corrected or modified, or its something to do with fluent itself.<\/p>\n<p><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n<p>Many thanks<\/p>\n<p><\/p>\n<p>Esra&#8217;a<\/p>\n","protected":false},"template":"","class_list":["post-36085","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_old_topic_id":["8257"],"_bbp_old_topic_author_name_id":["Anonymous"],"_bbp_old_is_topic_anonymous_id":["false"],"_bbp_old_closed_status_id":["publish"],"_bbp_author_ip":[null],"_bbp_old_sticky_status_id":["normal"],"_bbp_likes_count":["0","0"],"_btv_view_count":["2307"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["36085"],"_bbp_forum_id":["27796"],"_bbp_engagement":["199","22555","157480","163991"],"_bbp_voice_count":["4"],"_bbp_reply_count":["18"],"_bbp_last_reply_id":["89743"],"_bbp_last_active_id":["89743"],"_bbp_last_active_time":["2019-07-16 17:56:36"]},"test":"ehkh"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/36085","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\/36085\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=36085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}