


{"id":377594,"date":"2024-08-07T16:27:59","date_gmt":"2024-08-07T16:27:59","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/ansys-fluent-udf-define_dpm_bc\/"},"modified":"2024-08-07T16:27:59","modified_gmt":"2024-08-07T16:27:59","slug":"ansys-fluent-udf-define_dpm_bc","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/ansys-fluent-udf-define_dpm_bc\/","title":{"rendered":"Ansys Fluent UDF: DEFINE_DPM_BC"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I&#8217;m trying to compile a UDF to impose a criteria for particle adhesion.&nbsp;<br \/>This is my first attempt at writing a UDF, I ran into a few errors when I tried to build it and then when I load the UDF I see the following error, I will attach the UDF after the error message, I need some advise on this matter.<\/p>\n<p>Thanks,<br \/>Kiran<\/p>\n<p>&nbsp;<\/p>\n<p><strong>error:<\/strong><\/p>\n<p>Files udf_names.c and user_nt.udf in 3ddp_host are up-to-date.<\/p>\n<p>&nbsp;<\/p>\n<p>Copyright 1987-2024 ANSYS, Inc. All Rights Reserved.<\/p>\n<p>Compiler and linker: Microsoft Visual C++<\/p>\n<p># Linking libudf.dll because of makefile user_nt.udf udf_names.obj test-UDF-four.obj<\/p>\n<p>LINK : fatal error LNK1104: cannot open file &#8216;kernel32.lib&#8217;<\/p>\n<p>NMAKE : U1077: &#8216;link -nologo \/Libpath:&#8221;C:\\PROGRA~1\\ANSYSI~1\\v241\\fluent&#8221;\\fluent24.1.0\\win64\\3ddp_host \/Libpath:&#8221;C:\\PROGRA~1\\ANSYSI~1\\v241\\fluent&#8221;\\fluent24.1.0\\multiport\\win64\\net\\shared \/dll \/out:libudf.dll udf_names.obj test-UDF-four.obj mport.lib fl2410.lib &#8216; : return code &#8216;0x450&#8217;<\/p>\n<p>Stop.<\/p>\n<p>Files udf_names.c and user_nt.udf in 3ddp_node are up-to-date.<\/p>\n<p>&nbsp;<\/p>\n<p>Copyright 1987-2024 ANSYS, Inc. All Rights Reserved.<\/p>\n<p>Compiler and linker: Microsoft Visual C++<\/p>\n<p># Linking libudf.dll because of makefile user_nt.udf udf_names.obj test-UDF-four.obj<\/p>\n<p>LINK : fatal error LNK1104: cannot open file &#8216;kernel32.lib&#8217;<\/p>\n<p>NMAKE : U1077: &#8216;link -nologo \/Libpath:&#8221;C:\\PROGRA~1\\ANSYSI~1\\v241\\fluent&#8221;\\fluent24.1.0\\win64\\3ddp_node \/Libpath:&#8221;C:\\PROGRA~1\\ANSYSI~1\\v241\\fluent&#8221;\\fluent24.1.0\\multiport\\win64\\mpi\\shared \/dll \/out:libudf.dll udf_names.obj test-UDF-four.obj mport.lib fl_mpi2410.lib &#8216; : return code &#8216;0x450&#8217;<\/p>\n<p>Stop.<\/p>\n<p>&nbsp;<\/p>\n<p>Done.<\/p>\n<p>&nbsp;<\/p>\n<p>kiran: Opening library &#8220;C:\\Users\\usr\\OneDrive\\Desktop\\Me\\UDF_compiled\\test_files\\dp0\\FFF-1\\Fluent\\one_way_transient-1&#8243;&#8230;<\/p>\n<p>ERROR: The UDF library you are trying to load (one_way_transient-1) is not compiled for parallel use on the current platform (win64).<\/p>\n<p>The system cannot find the file specified.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>C:\\\\Users\\\\usr\\\\OneDrive\\\\Desktop\\\\Me\\\\UDF_compiled\\\\test_files\\\\dp0\\\\FFF-1\\\\Fluent\\\\one_way_transient-1\\\\win64\\\\3ddp_host\\\\libudf.dll<\/p>\n<p>&nbsp;<\/p>\n<p>Done.<\/p>\n<p>&nbsp;<\/p>\n<p>kiran: Opening library &#8220;C:\\Users\\usr\\OneDrive\\Desktop\\Me\\UDF_compiled\\test_files\\dp0\\FFF-1\\Fluent\\one_way_transient-1&#8243;&#8230;<\/p>\n<p>ERROR: The UDF library you are trying to load (one_way_transient-1) is not compiled for parallel use on the current platform (win64).<\/p>\n<p>The system cannot find the file specified.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>C:\\\\Users\\\\usr\\\\OneDrive\\\\Desktop\\\\Me\\\\UDF_compiled\\\\test_files\\\\dp0\\\\FFF-1\\\\Fluent\\\\one_way_transient-1\\\\win64\\\\3ddp_node\\\\libudf.dll<\/p>\n<p>&nbsp;<\/p>\n<p>Error: An error occurred in the previous operation.<\/p>\n<p>The details can be found in the text output.<\/p>\n<p>Error Object: #f<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>UDF:<\/strong><\/p>\n<div>\n<div>#include &#8220;udf.h&#8221;<\/div>\n<div>#include &#8220;dpm.h&#8221;<\/div>\n<p><\/p>\n<div>\/* Define constants *\/<\/div>\n<div>#define Rho_air 1.225 &nbsp;\/* Density of air in kg\/m^3 *\/<\/div>\n<div>#define Cd 0.44 &nbsp; &nbsp; &nbsp; &nbsp;\/* Drag coefficient *\/<\/div>\n<div>#define mu 0.196 &nbsp; &nbsp; &nbsp; \/* Friction coefficient *\/<\/div>\n<\/div>\n<div>\n<div>DEFINE_DPM_BC(particle_bc, p, t, f, normal, dim)<\/div>\n<div>{<\/div>\n<div>&nbsp; &nbsp; \/\/ Particle *p;<\/div>\n<div>&nbsp; &nbsp; \/\/ real A = P_AREA(P_DIAM(p)); &nbsp;\/* Assuming a method to calculate the projected area of the particle *\/<\/div>\n<div>&nbsp; &nbsp; real V = sqrt(P_VEL(p)[0] * P_VEL(p)[0] + P_VEL(p)[1] * P_VEL(p)[1] + P_VEL(p)[2] * P_VEL(p)[2]); &nbsp;\/* Velocity magnitude in m\/s *\/<\/div>\n<div>&nbsp; &nbsp; real radius = P_DIAM(p) \/ 2.0;<\/div>\n<div>&nbsp; &nbsp; real A = M_PI * radius * radius; &nbsp;\/* M_PI is a constant for &pi; *\/<\/div>\n<p><\/p>\n<div>&nbsp; &nbsp;<\/div>\n<div>&nbsp; &nbsp; \/* Get the thread and cell pointers *\/<\/div>\n<div>&nbsp; &nbsp; Thread *t0 = P_CELL_THREAD(p);<\/div>\n<div>&nbsp; &nbsp; cell_t c0 = P_CELL(p);<\/div>\n<div>&nbsp; &nbsp;<\/div>\n<div>&nbsp; &nbsp; \/* Get local pressure at the particle&#8217;s location *\/<\/div>\n<div>&nbsp; &nbsp; real P_local = C_P(c0, t0);<\/div>\n<p><\/p>\n<div>&nbsp; &nbsp; \/* Calculate aerodynamic force Fa *\/<\/div>\n<div>&nbsp; &nbsp; real Fa = 0.5 * Rho_air * A * Cd * V * V;<\/div>\n<p><\/p>\n<div>&nbsp; &nbsp; \/* Calculate normal force Fn *\/<\/div>\n<div>&nbsp; &nbsp; real Fn = P_local * A;<\/div>\n<p><\/p>\n<div>&nbsp; &nbsp; \/* Calculate frictional force Ff *\/<\/div>\n<div>&nbsp; &nbsp; real Ff = mu * Fn;<\/div>\n<p><\/p>\n<div>&nbsp; &nbsp; \/* Check the removal condition *\/<\/div>\n<div>&nbsp; &nbsp; if (Fa &gt; Ff)<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; \/* Particle needs to be removed from the surface *\/<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; return PATH_ACTIVE; \/*No adhesion*\/<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp; else<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; \/* Particle sticks to the boundary *\/<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; P_USER_REAL(p, 0) = 1.;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; return PATH_ABORT; \/*Adhesion*\/<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>}<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"template":"","class_list":["post-377594","topic","type-topic","status-publish","hentry","topic-tag-adhesion-1","topic-tag-interior-bc","topic-tag-udf"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["288381","199"],"_bbp_author_ip":["2607:fea8:7a61:4800:3128:8fa2:bb8d:e9dd"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["759"],"_bbp_topic_status":["unanswered"],"_bbp_topic_id":["377594"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","288381"],"_bbp_voice_count":["2"],"_bbp_reply_count":["13"],"_bbp_last_reply_id":["379972"],"_bbp_last_active_id":["379972"],"_bbp_last_active_time":["2024-08-23 09:25:51"]},"test":"kiran-purushothamakeshavanontariotechu-net"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/377594","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\/377594\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=377594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}