CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

Syntax Error in UDF using DEFINE-DPM-OUTPUT

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   November 17, 2008, 09:34
Default Syntax Error in UDF using DEFINE-DPM-OUTPUT
Julian K.
Posts: n/a

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.


  Reply With Quote

Old   November 18, 2008, 10:59
Default Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
KJ Larsen
Posts: n/a
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.
  Reply With Quote

Old   November 18, 2008, 12:55
Default Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
Julian K.
Posts: n/a
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,

  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax Error Virag CFX 3 December 4, 2017 16:09
Syntax Error Mechstud CFX 3 June 29, 2007 07:22
Syntax error again Szabolcs Varga FLUENT 0 April 21, 2004 05:38
Syntax error Szabolcs Varga FLUENT 0 April 20, 2004 10:53
UDF syntax error Duc FLUENT 2 June 11, 2002 09:27

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