CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   HELP! how inject the same number of particles that exits the domain? (http://www.cfd-online.com/Forums/fluent-udf/121620-help-how-inject-same-number-particles-exits-domain.html)

 matiashess August 1, 2013 10:04

HELP! how inject the same number of particles that exits the domain?

Hi all, I'm making use of DPM to model a recirculating batch reactor with liquid-solid heterogeneous flow. I need help with a UDF that works on boundary conditions by injecting the same number of particles that left the domain to maintain constant mass.
My boundary conditions were on output "pressure outlet" and "velocity inlet" at the inlet.
Really I would greatly appreciate if you help me with the UDF.

Greetings my dear!

 matiashess August 5, 2013 12:45

pleasee someone who can help me? any contribution will help me to advance my project

 macfly August 7, 2013 13:32

Hi,

The following example is not about particles, but it shows how you can do some calculations on a boundary at each time step and apply the results somewhere else.

- Area averaged temperature is calculated at the outlet.
- The calculated average temperature is augmented by 1 K and will be applied as the inlet temperature at next time step.

Code:

```#include "udf.h" real T_mean = 300.0;  /* defined outside because will be used in multiple DEFINE macros */ DEFINE_EXECUTE_AT_END(execute_at_end) { Domain *domain; Thread *thread; face_t face; real area[ND_ND]; real total_area = 0.0; real total_area_ave_temp = 0.0; int ID = 18; /* outlet ID displayed in Fluent boundary conditions panel */ domain = Get_Domain(1); thread = Lookup_Thread(domain, ID); /*change "12" to the actual id of your b.c. */         begin_f_loop(face, thread)                 F_AREA(area, face, thread);                 total_area += NV_MAG(area);                 total_area_ave_temp += NV_MAG(area)*F_T(face, thread);         end_f_loop(face, thread) T_mean = total_area_ave_temp/total_area; printf("Area averaged T on boundary %d = %f K\n", ID, T_mean); } DEFINE_PROFILE(T_profile, thread, position) { face_t face; real T_prof = T_mean + 1;          begin_f_loop(face, thread)                 F_PROFILE(face, thread, position) = T_prof;         end_f_loop(face, thread) }```
I guess it's not a big deal to modify the code for your case, but I don't have time for that. Hope it helps.

 matiashess October 10, 2013 11:09

Thanks for your reply François, i'm working on that udf.

 All times are GMT -4. The time now is 19:47.