|
[Sponsors] |
November 17, 2008, 08:34 |
Syntax Error in UDF using DEFINE-DPM-OUTPUT
|
#1 |
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 |
|
November 18, 2008, 09:59 |
Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
|
#2 |
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. |
|
November 18, 2008, 11:55 |
Re: Syntax Error in UDF using DEFINE-DPM-OUTPUT
|
#3 |
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 |
|
|
|
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 |