|
[Sponsors] |
Segmentation error in UDF for DPM model particle-wall interactions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 22, 2020, 14:27 |
Segmentation error in UDF for DPM model particle-wall interactions
|
#1 |
Member
L.A.Isanka
Join Date: Jul 2020
Posts: 55
Rep Power: 5 |
Hello!
I wrote the below-mentioned code to model particle wall interactions. the force exerted by the wall only acts on particles injected by one injection(injection 0). i have set a loop to loop over the injections and for each particle, force exerted by the wall is calculted via a loop over the boundary cells. when I run the code I get a warning and few errors. warning C4700: uninitialized local variable 'd' used and, Error: received a fatal signal (Segmentation fault). Error Object: #f Error: Error Occured during handling message in WorkBench: An error occurred in FLUENT during execution of an internal command An error occurred in FLUENT during execution of an internal command Error Object: #f Can someone check the code and help me with this? Thank you! #include "udf.h" #include "dpm.h" #include "dpm_mem.h" #define K 0.00003 DEFINE_DPM_BODY_FORCE(particle_body_force,p,i) /* Fluent macro to define particle body force*/ { double bf,dw,x1,y1,z1,x0,y0,z0,fmag,m,acc; real bforce[ND_ND]; real xw[ND_ND]; real Force[ND_ND]; real n[ND_ND]; real a[ND_ND]; Domain *d; /* Particle *p;*/ cell_t c; Thread *t; face_t f; DEFINE_DPM_INJECTION_INIT ( injection0,I); /* Fluent macro to create a loop over the injections*/ { Injection *Ilist = Get_dpm_injections(); /* to get a list of injections */ Injection *I; /* injection pointer */ Particle *p; /* particle pointer*/ loop(I, Ilist) /* looping over all injections */ loop(p,I->p) /* Standard Fluent Looping Macro to get particle streams in an Injection */ { c = P_CELL(p); /* Get the cell and thread that the particle is currently in */ t = P_CELL_THREAD(p); m=P_MASS(p); if (I=0) { x0 = P_POS(p)[0]; y0 = P_POS(p)[1]; z0 = P_POS(p)[2]; t = Lookup_Thread(d,5); /*create a thread pointing to the wall*/ begin_f_loop(f, t) { F_CENTROID(xw,f,t); x1 = xw[0]; y1 = xw[1]; z1 = xw[2]; dw = sqrt(SQR(x1-x0) + SQR(y1-y0) + SQR(z1-z0)); /* wall to particle distance calculation*/ bf = K/(dw*dw*dw*dw*dw*dw*dw); /* calculation of the resulting force */ Force[0] = x1-x0; /* vector in the direction of the force */ Force[1] = y1-y0; Force[2] = z1-z0; fmag = NV_MAG(Force); /* Magnitude of the vector in the direction of the force*/ n[0]=Force[0]/fmag; /* unit vector in the diretion of the force*/ n[1]=Force[1]/fmag; n[2]=Force[2]/fmag; NV_V_VS(bforce, =, bforce, +, bforce, *, bf); /* calculates the sum of all interaction forces*/ } end_f_loop(f, t) } else { bforce[0] = 0; bforce[1] = 0; bforce[2] = 0; } } /*return;*/ /* Not sure whether this return functions needs to be added*/ } a[0] = bforce[0]/m; a[1] = bforce[1]/m; a[2] = bforce[2]/m; acc = sqrt( a[0]* a[0] + a[1]* a[1] + a[2]* a[2] ); return acc; } |
|
Tags |
boundary cell, dpm bodyforce, dpm boundary condition |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 07:30 |
Wrong multiphase flow at rotating interface | Sanyo | CFX | 14 | February 7, 2017 17:19 |
Multiphase flow - incorrect velocity on inlet | Mike_Tom | CFX | 6 | September 29, 2016 01:27 |
Wrong flow in ratating domain problem | Sanyo | CFX | 17 | August 15, 2015 06:20 |
Check particle impaction with User Fortran | Julian K. | CFX | 3 | January 12, 2012 09:46 |