CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Problem with a simple UDF to calculate cell-averaged particle values (http://www.cfd-online.com/Forums/fluent/66358-problem-simple-udf-calculate-cell-averaged-particle-values.html)

kmayank July 13, 2009 10:16

Problem with a simple UDF to calculate cell-averaged particle values
 
Hi,

I want to write a UDF for recovering averaged particle properties within each cell throughout the domain.
For that I wrote a simple test UDF, mainly copying from Fluent manual, as follows:

#include "udf.h"
#include "dpm.h"

DEFINE_EXECUTE_AT_END(execute_at_end)
{

Domain *d;
Thread *t;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */
int count;
Particle *p;

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{

begin_particle_cell_loop(p,c,t){
count += 1;
}end_particle_cell_loop(p,c,t)

}end_c_loop(c,t)
}

printf("Total particles in domain %d \n", count);
}


This gives no error in compilation but on running gives Segmentation Violation and stack backtrace generation. The Segmentation Violation seems due to the presence of the particle loop only. When I remove the particle loop, the error message does not come.


------------------------------------------------------------------------
Stack backtrace generated for process id 301 on signal 1:
Please include this information with any bug report you file on this issue!
------------------------------------------------------------------------
/opt/ansys_inc/v120/fluent/fluent12.0.16/lnamd64/3ddp/fluent.12.0.16[0x128bc1d]
/opt/ansys_inc/v120/fluent/fluent12.0.16/lnamd64/3ddp/fluent.12.0.16[0x128c123]
/lib/libpthread.so.0[0x7fe71c5a90f0]
libudf/lnamd64/3ddp/libudf.so(execute_at_end+0x26)[0x7fe7187c43d2]


Could anyone please me help me on this.

My aim is to obtain cell avergaed values of x, y, z particle velocities throughout the domain. Fluent postprocessing does not provide these values, so I guess we have to write a UDF.

Thanks!!

Wikie January 18, 2011 02:40

Hi,

did you solve your problem? I also have to count the number of particles, but I wasn't able to do so yet.

Thanks,
Wikie


All times are GMT -4. The time now is 13:19.