CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF to increase the number of injected particles (http://www.cfd-online.com/Forums/fluent-udf/78091-udf-increase-number-injected-particles.html)

sfotovati July 12, 2010 18:35

UDF to increase the number of injected particles
 
Dear users,
I know that the maximum number of injected particles from any surface is equal to the total number of mesh points over that surface. I wrote a UDF to increase that which is as followings:


#include "udf.h"
DEFINE_DPM_INJECTION_INIT(init_inject,I)
{
real x;
real ymax;
Particle *p;
ymax=20e-3;
x=rand()* ymax / RAND_MAX ;
P_POS(p)[0]=0;
P_POS(p)[1]=x; 
}

but I recieve a SEGMENTATION VIOLATION error. Please help me to fix it.


All times are GMT -4. The time now is 23:05.