|
[Sponsors] |
Added one UDF for finding particle concentration. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 30, 2024, 08:28 |
Added one UDF for finding particle concentration.
|
#1 |
New Member
Ankit
Join Date: Jul 2024
Posts: 1
Rep Power: 0 |
I added one UDF for finding the particle concentration inside the office room. But after initializing some for 9-10 steps, the fluent is crashing down. Could anyone please help me what is wrong with my UDF. I'm posting my UDF here:
#include "udf.h" /* Define the region boundaries */ #define X_MIN -3.75 #define X_MAX 3.75 #define Y_MIN 0.0 #define Y_MAX 3.5 #define Z_MIN 0.0 #define Z_MAX 5.5 DEFINE_EXECUTE_AT_END(particle_concentration) { Domain *domain; Thread *ct; cell_t c; real volume = 0.0; int particle_count = 0; real pc; // Change pc to real type for proper division /* Get the domain pointer */ domain = Get_Domain(1); if (domain == NULL) { printf("Error: Domain is NULL\n"); return; } /* Loop over all cell threads in the domain */ thread_loop_c(ct, domain) { /* Loop over all cells in the thread */ begin_c_loop(c, ct) { /* Get the cell centroid coordinates */ real xc[ND_ND]; C_CENTROID(xc, c, ct); /* Check if the cell is within the specified region */ if (xc[0] >= X_MIN && xc[0] <= X_MAX && xc[1] >= Y_MIN && xc[1] <= Y_MAX && xc[2] >= Z_MIN && xc[2] <= Z_MAX) { /* Update the volume of the region */ volume += C_VOLUME(c, ct); } } end_c_loop(c, ct) } /* Calculate the particle concentration */ if (volume > 0) { pc = (real)particle_count / volume; } else { printf("Warning: Volume is zero\n"); pc = 0.0; } /* Output the result to the console */ printf("Particle concentration in the defined volume: %g particles per unit volume\n", pc); } |
|
Tags |
fluent - udf, particle concentration, udf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Relations between lagrangian particle concentration and mesh size | Jasper Z | OpenFOAM Running, Solving & CFD | 1 | June 10, 2022 05:06 |
Udf for species concentration (interfacial area udf) | marijam | Fluent UDF and Scheme Programming | 4 | December 10, 2021 17:42 |
UDF for DPM particle deposition modelingpa | haghshenasfard | Fluent UDF and Scheme Programming | 10 | September 15, 2019 03:03 |
Particle concentration | jhlee9622 | STAR-CCM+ | 3 | May 23, 2016 09:14 |
udf about particle concentration--who can help me? | zhaoh | FLUENT | 1 | January 17, 2007 12:46 |