CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Error in compiling UDF for computation of space charge density (http://www.cfd-online.com/Forums/fluent/65572-error-compiling-udf-computation-space-charge-density.html)

greensociety June 18, 2009 21:32

Error in compiling UDF for computation of space charge density
 
1 Attachment(s)
Greetings all,

I am implementing the Poisson equation for electric field computations, thus there is a need to compute the space charge density in each cell. This charge density is due to steady-state simulation of charged particles using DPM. The code for the UDF is as such:

__________________________________________________ _____________
#include "udf.h"
#include "dpm.h"

DEFINE_SOURCE(space_charge_source,c,t,dS,eqn)
{
real q_m_0 = 5;
real number_of_particle_streams = 30000;
real mass_flow_rate_0 = 0.000000883 / number_of_particle_streams;
real cell_volume = C_VOLUME(c,t);
real charge_flow_rate = q_m_0 * mass_flow_rate_0;
real summation = 0;
Particle *zz;
real residence_time = 0;
real space_charge_density = 0;
begin_particle_cell_loop(zz,c,t)
{
residence_time = P_TIME(zz) - P_TIME0(zz);
space_charge_density = charge_flow_rate * residence_time / cell_volume;
summation = summation + space_charge_density;
}
end_particle_cell_loop(zz,c,t)
real total_space_charge_density = summation;
dS[eqn] = 0;
return total_space_charge_density;
}

__________________________________________________ _____________

Upon compilation in Linux Fluent 6.3, I got the error message (attached screenshot). Please advice me on how to resolve this problem.

Many Thanks
(PS: I am suspecting that calculation of residence time is the problem)

greensociety July 21, 2009 02:29

Bump
 
I would appreciate all help and comments. Thanks


All times are GMT -4. The time now is 12:07.