CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   particle body force and scalar update. (https://www.cfd-online.com/Forums/fluent/40239-particle-body-force-scalar-update.html)

Kasper Skriver March 21, 2006 06:53

particle body force and scalar update.
 
Hi

I'm looking on particle transport between two plates subjected to a potential diff of 10kV.

The potential between the two plates has been defined as an user scalar, and calculated with boundary values 0 and 10kV. This is no problem.

The next step is modelling how the particles act in the potential field. First i define a charge of the particle as a scalar update(DEFINE_DPM_SCALAR_UPDATE). Then the body force as an additional acceleration DEFINE_DPM_BODY_FORCE. The code is at the bottom. Compiling works and loading does to.

When using these two UDF's in the discrete phase model I get the following error:
:>> Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () <<<

1. there is nothing but this event. 2. wont help. 3. same same. 4. they are a bit slow:) The error object is empty, why!!!!

I have an idea that it has something to do with the C_UDSI_G command, but I'm not sure.

Please help

-------------------------------------------- CODE:

#include "udf.h" #include "surf.h"

Particle *p;

DEFINE_DPM_SCALAR_UPDATE(charge,cell,thread,initia lize,p)

{

real P_charge_density;

if (initialize) /* only if init */

{

P_charge_density = - 1.e-3; /* [C/kg], if minus => negative charge */

p->user[0] = P_charge_density * P_MASS(p);

}

}

DEFINE_DPM_BODY_FORCE(elstat_force,p,i)

{

cell_t cell = P_CELL(p);

Thread *thread = P_CELL_THREAD(p);

real P_charge;

real NV_VEC(P_accelleration);

P_charge = -1.0 * P_USER_REAL(p,0); /* makes the gradient negativ */

NV_V(P_accelleration, =, C_UDSI_G(cell, thread, 0)); /*Coulomb force*/

NV_S(P_accelleration, *=, P_charge);

NV_S(P_accelleration, /=, P_MASS(p)); /* acceleration required */

return (P_accelleration[i]);

}

RoM March 21, 2006 09:55

Re: particle body force and scalar update.
 
There is nothing wrong with your code except the global "Particel *p;" which is not needed. It runs perfectly well on my machine. Maybe you did not allocate the particle scalar (define->models->discrete phase , in udf tab set number of scalars to 1)

RoM


All times are GMT -4. The time now is 20:09.