CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Syntax Error in UDF using DEFINE-DPM-OUTPUT

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 17, 2008, 08:34
Default Syntax Error in UDF using DEFINE-DPM-OUTPUT
  #1
Julian K.
Guest
 
Posts: n/a
Hallo,

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*/

DEFINE-DPM-OUTPUT(discrete_phase_counter,header,fp,p,t,plane)

{

if(header)

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*/

p->stream_index=-1;

#endif

}

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

I am very thankful for any suggestions.

Merci,

Julian
  Reply With Quote

Old   November 18, 2008, 09:59
Default Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
  #2
KJ Larsen
Guest
 
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, 11:55
Default Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
  #3
Julian K.
Guest
 
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:

http://www.cfd-online.com/Forum/fluent.cgi?read=62160

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,

Julian
  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax Error Virag CFX 4 February 3, 2019 07:59
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 12:40.