CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Syntax Error in UDF using DEFINE-DPM-OUTPUT (

Julian K. November 17, 2008 09:34

Syntax Error in UDF using DEFINE-DPM-OUTPUT

I would like to let planes in my domain sample particles and trap them afterwards. For doing so, I wrote an UDF using the function: DEFINE-DPM-OUTPUT.

When I compiled the .c file there was said to be a syntax error.

Here is my .c file:

#include "udf.h"

/************************************************** ****************/

/* UDF which counts particles that passed through a sampler and */

/* removes them afterwards. */

/************************************************** ****************/

extern int part_no; /*This defines a external integer variable which should indicate how many particles have been trapped yet*/

#define REMOVE_PARTICLES TRUE /*This defines the function, which will remove the particles from the domain, after they have been sampled*/




fprintf_head(fp," Particles Trapped Particle ID\n"); /*Writes the string to the head of the file*/

part_no = part_no + 1;

fprintf(fp," %d %d \n", part_no, p->part_id);

#if REMOVE_PARTICLES /*This if loop removes the particles*/




I am an absolute greenhorn with UDFs and in C, thus bear with me.

I am very thankful for any suggestions.



KJ Larsen November 18, 2008 10:59

Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
Hello Julian

Does it say on which line the syntax error is?

I have not come accross the use of extern in initialisation before. Normally for global variables you don't need an extra word, the position before the main code sets it as global.

Otherwise the function par_fprintf(); may need to be used for writing to a file, (without the par_ only for writing to console).

Hopefully simple things to check. Kris

Also if you're using a windows system, you have to launch Fluent from a command window.

Julian K. November 18, 2008 12:55

Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
Hi Kris,

thank you for your help. Actually, I modified my UDF-file and now it works. You can see the new code here:

Unfortunately, I have a new problem. But now it's Fluent. Maybe you have as well some hints how to solve it.

Thanks for your help,


All times are GMT -4. The time now is 03:25.