|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
angelo
Join Date: Apr 2022
Posts: 8
Rep Power: 5 ![]() |
hello guys, i'm running this udf and i want to find the minimum distance of the particle respect to the wall. but when i print the value in the console are printed nall the values and not the minimum. someone can help me?
/* UDF adding an external body force to the particles */ #include "udf.h" #include "dpm.h" #include "dpm_mem.h" #include "surf.h" DEFINE_DPM_BODY_FORCE(particle_body_force, p, i) { /* declaration of variables */ double w, Dh, Ufx, Ufy, Ufz, Gx, rho, a, F_L, c_height, c_length, c_volume, side, H, W, f_height_total, Renx, Reny, Renz, crDh, mu, aUfx, aUfy, aUfz, C1, C2, C3, C4, C_Ly, C_Lz, z, y, distancewall; int ID=9; real xw[ND_ND]; real vec[ND_ND]; Domain* d; cell_t c; Thread* t; face_t f; //f is the face index that is inside the face thread t(our wall). You will extract the face area vector from f index d = Get_Domain(1); c = P_CELL(p); //cell in witch the particle is currently in t = Lookup_Thread(d,ID); //9 is the ID number of the upper wall. t is the thread index(pointer) of the wall boundary surface 9 distancewall=100; //i'm setting an generic initial value begin_f_loop(f,t) { F_CENTROID(xw,f,t); //center of each face NV_VV(vec,=,xw,-,P_POS(p)); //vector connecting the particle to the face center that is placed at the wall. The NV_VV do the operation between 2 vectors ![]() //now you want to calculate the minimum distance between particle and wall, and so you want to find the minimum of the vector vec doing the loop over all the boundary face if(distancewall>=NV_MAG(vec)) { distancewall=NV_MAG(vec); } } end_f_loop(f, t) Message0("the wall distance is: %g\n", distancewall); return 0; } |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,933
Rep Power: 145 ![]() ![]() ![]() ![]() |
Wrong forum - try the Fluent UDF forum.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commercial meshers] Fluent3DMeshToFoam | simvun | OpenFOAM Meshing & Mesh Conversion | 50 | January 19, 2020 15:33 |
Particles are not hitting the wall | CedricVH | OpenFOAM Bugs | 23 | May 19, 2016 20:29 |
Wall Distance in CFX | davidwilcox | CFX | 1 | September 22, 2014 21:01 |
DPM particles cross wall & pressure inlet | blackstyle | FLUENT | 0 | August 14, 2014 09:10 |
UDF for wall slipping | HFLUENT | Fluent UDF and Scheme Programming | 0 | April 27, 2011 12:03 |