|
[Sponsors] |
August 2, 2021, 00:23 |
UDF for particle deposition in porous zone
|
#1 |
New Member
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 5 |
Hi,
I am very new in UDF and do not have much knowledge on C. I need urgent help in a UDF to: 1- specify the porous zone ID 2- read the particle concentration in each cell 3- reduce it as a percentage from the initial concentration 4- store the new reduced concentration I tried for many days but i am stuck, i really appreciate if anyone will help me. The code i tried is below (probably it is very bad): #include "udf.h" #include "sg_mem.h" # include "dpm.h" # define domain_ID 4 DEFINE_ADJUST(adjust_UDS,domain) { Thread *t; cell_t c; domain = Get_Domain(domain_ID); /*Fill UDS with the variable*/ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_DPMS_CONCENTRATION(c,t); } end_c_loop (c,t) } } DEFINE_SOURCE(conc_source,c,t,dS,equ) { real x[ND_ND],c_source; source= (C_UDSI(c,t,0) + C_UDSI(c,t,0)); return source; } |
|
August 3, 2021, 04:58 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
compile following code,
in fluent GUI: hook functions, allocate 1 user define memory Code:
#include "udf.h" #include "sg_mem.h" #include "dpm.h" int porous_ID = 4; DEFINE_INIT(my_init_func,d) { cell_t c; Thread *t; /* loop over all cell threads in the domain */ thread_loop_c(t,d) { /* loop over all cells */ begin_c_loop(c,t) { C_UDMI(c,t,0) = 0.0; } end_c_loop_all(c,t) } } DEFINE_ADJUST(my_adjust,domain) { Thread *t; cell_t c; t = Lookup_Thread(domain, porous_ID); /*Fill UDM with the variable*/ begin_c_loop(c,t) { C_UDMI(c,t,0) = C_DPMS_CONCENTRATION(c,t); } end_c_loop (c,t) } DEFINE_SOURCE(conc_source,c,t,dS,equ) { real x[ND_ND],c_source; source= (C_UDMI(c,t,0) + C_UDMI(c,t,0)); return source; }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 3, 2021, 05:24 |
|
#3 |
New Member
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 5 |
Hi Alexander,
Thank you so much for your help. I will try this UDF. Could you clarify what do you mean by hook function? (interpret or compile?) And how do i allocate 1 user memory? I am so sorry, i'm just beginner in this |
|
August 3, 2021, 05:41 |
|
#4 |
New Member
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 5 |
I have one more question, if i want to also capture the axial velocity at each cell in the porous domain, and include it in the source equation at the end, what should i add more? i am so sorry, i really appreciate your help. you are saving me
|
|
August 3, 2021, 08:14 |
|
#5 |
New Member
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 5 |
I tried compiling the UDF, i got this error:
/////// Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).\n\nThe system cannot find the file specified. \n\nD:\NUS\pollutant_study_Prof_Bala\chinese_garde ns_1m_thick_DM_geometry\udf_inlet_trying_depositio n_injecting_from_road_and_inlet\libudf\win64\3ddp_ host\libudf.dll Error Object: #f //////// When i interpret the udf, it doesnt generate errors but the solution of the case is the same, it didnt change any numbers. Could you please help me in this issue? Thank you |
|
August 3, 2021, 12:30 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Check my signature below.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
August 4, 2021, 00:13 |
|
#7 |
New Member
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 5 |
Hi Pakk,
Thanks for your response. So how can i solve this issue? Even when i try "Serial" not parrallel, it generates a similar error, but instead of "(libudf) is not compiled for parallel use on the current platform (win64)." it says not compiled for 3ddp |
|
August 4, 2021, 02:45 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
My suggestion is to look at the errors during compiling, and if you need help share them with us.
I can't see what went wrong during compiling from the word during loading. Show the errors that come after you click 'build'. (and can you suggest an improvement for my signature? Apparently it is not clear enough, but I can't see the problem...)
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
Tags |
dpm concentration, particle deposition |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how fluent calculate terms of momentum equation in porous zone? | Weiqiang Liu | FLUENT | 0 | December 4, 2020 03:23 |
Porous Media Zone Thickness | TheKitchenCleaner | FLUENT | 0 | October 5, 2020 01:42 |
UDF for Species Mass Fraction Gradient *IN SPECIFIC ZONE * -- e.g. along axis of sym. | ksiegs2 | Fluent UDF and Scheme Programming | 0 | February 27, 2011 13:55 |
Problem in IMPORT of ICEM input file in FLUENT | csvirume | FLUENT | 2 | September 9, 2009 02:08 |
Sliding mesh error | Karl Kevala | FLUENT | 4 | February 21, 2001 16:52 |