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

parse error while interpreting udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2007, 08:20
Default parse error while interpreting udf
  #1
Kristin
Guest
 
Posts: n/a
Hello,

I need some help. I've been trying to interpret my udf calculating drag force. I'm running an Euler-Euler simulation of elongated granular bodies.

This is my first udf and I'm not entirely familiar with the language. I'm getting several parse error when interpreting, which I have noted in the udf as comments.

I've also tried compiling the udf but i only get error:Open_udf_library: The system cannot find the file specified. I have the udf in the same folder as the casefile and when creating the library the udf is copied into the src-folder in the library.

Can someone please try to interpret or compile my udf and help me.

This is my udf:

# include "udf.h" # include "mem.h"

# define DCYL 0.0002; # define L 0.010; # define N 10;

# define DREF 78e-6;

# define PI 3.141592653589; DEFINE_EXCHANGE_PROPERTY(drag_45, cell, mix_thread, s_col, f_col) {

Thread *thread_v, *thread_f;

real uxf;

real uyf;

real uzf;

real uxv;

real uyv;

real uzv;

real slip_v;

real rho_v;

real rho_f;

real mu_v;

double cos_alpha;

double sin_alpha;

double alfa;

double redn;

double redp;

double cdn;

double cf;

double cdfiber;

real k;

real void_v;

real void_f;

real fn;

real fp;

real fd;

alfa=45;

/* find the threads for the gas (primary) */

/* and solids (secondary phases) */

thread_v = THREAD_SUB_THREAD(mix_thread, f_col); /* liquid phase */

thread_f = THREAD_SUB_THREAD(mix_thread, s_col); /* fiber phase*/

/* find phase velocities and properties*/

uxf = C_U(cell, thread_f);

uyf = C_V(cell, thread_f);

uzf = C_W(cell, thread_f);

uxv = C_U(cell, thread_v);

uyv = C_V(cell, thread_v);

uzv = C_W(cell, thread_v);

slip_v = SQR((uxv-uxf)*(uxv-uxf) +(uyv-uyf)*(uyv-uyf)+(uzv-uzf)*(uzv-uzf));

if (slip_v < 1e-12)

{

slip_v = 1e-12;

}

else

{

}

rho_v = C_R(cell, thread_v);

rho_f = C_R(cell, thread_f);

mu_v = C_MU_L(cell, thread_v)

void_v = C_VOF(cell, thread_v); /* Vol frac water*//*parse error*/

void_f = 1-void_v;

cos_alpha= cos ( alfa);

sin_alpha= sin (alfa);

/*compute reynoldsnumber*/

redn=rho_v*slip_v*sin_alpha*DCYL/mu_v; /*normal to fiber*/ /*parse error*/

redp=rho_v*slip_v*cos_alpha*DCYL/mu_v; /*parallell to fiber*/ /*parse error*/

if (redn<1e-12)

{

redn=1e-12;

}

if (redp<1e-12)

{

redp=1e-12;

}

/* compute dragforce coeff in normal direction*/

cdn=6.96*(1/( pow ( redn, 0.440))* pow ( DCYL/DREF, 0.404)); /*parse error*/

cf=0.78*1/(pow (redp,0.61));

cdfiber=(8/3)*(cf*cos_alpha*cos_alpha*cos_alpha+(cdn/PI)sin_alpha*sin_alpha*sin_alpha); /*parse error*/

if (void_f<1e-12)

{

void_f=1e-12;

}

fn=1/2*rho_v*slip_v*slip_v*sin_alpha*sin_alpha*DCYL*L*c dn; /*parse error*/

fp=1/2*rho_v*slip_v*slip_v*cos_alpha*cos_alpha*PI*DCYL* L*cf;

fd=fp*cos_alpha+fn*sin_alpha;

np=4*void_f/(PI*DCYL*L);

K=fd*np/slip_v;

return K; }

Sincerely, Kristin
  Reply With Quote

Old   December 11, 2007, 09:27
Default Re: parse error while interpreting udf
  #2
szz
Guest
 
Posts: n/a
Hi,

your code contained several minor syntax errors which I corrected and commented below. Now it compiles just fine. Online-tutorials on the language C can help you with the basics.

Greetings szz

# include "udf.h" # include "mem.h"

# define DCYL 0.0002 /* no semicolon in preprocessor declaration*/

# define L 0.010 # define N 10

# define DREF 78e-6

# define PI 3.141592653589

DEFINE_EXCHANGE_PROPERTY(drag_45, cell, mix_thread, s_col, f_col) {

Thread *thread_v, *thread_f;

real uxf;

real uyf;

real uzf;

real uxv;

real uyv;

real uzv;

real slip_v;

real rho_v;

real rho_f;

real mu_v;

real np; // added

real K; // added

double cos_alpha;

double sin_alpha;

double alfa;

double redn;

double redp;

double cdn;

double cf;

double cdfiber;

real k;

real void_v;

real void_f;

real fn;

real fp;

real fd;

alfa=45;

/* find the threads for the gas (primary) */

/* and solids (secondary phases) */

thread_v = THREAD_SUB_THREAD(mix_thread, f_col); /* liquid phase */

thread_f = THREAD_SUB_THREAD(mix_thread, s_col); /* fiber phase*/

/* find phase velocities and properties*/

uxf = C_U(cell, thread_f);

uyf = C_V(cell, thread_f);

uzf = C_W(cell, thread_f);

uxv = C_U(cell, thread_v);

uyv = C_V(cell, thread_v);

uzv = C_W(cell, thread_v);

slip_v = SQR((uxv-uxf)*(uxv-uxf) +(uyv-uyf)*(uyv-uyf)+(uzv-uzf)*(uzv-uzf));

if (slip_v < 1e-12)

{

slip_v = 1e-12;

}

else

{

}

rho_v = C_R(cell, thread_v);

rho_f = C_R(cell, thread_f);

mu_v = C_MU_L(cell, thread_v); // semicolon added

void_v = C_VOF(cell, thread_v); /* Vol frac water*//*parse error*/

void_f = 1-void_v;

cos_alpha= cos ( alfa);

sin_alpha= sin (alfa);

/*compute reynoldsnumber*/

redn=rho_v*slip_v*sin_alpha*DCYL/mu_v; /*normal to fiber*/ /*parse error*/

redp=rho_v*slip_v*cos_alpha*DCYL/mu_v; /*parallell to fiber*/ /*parse error*/

if (redn<1e-12)

{

redn=1e-12;

}

if (redp<1e-12)

{

redp=1e-12;

}

/* compute dragforce coeff in normal direction*/

cdn=6.96*(1/( pow ( redn, 0.440))* pow ( DCYL/DREF, 0.404)); /*parse error*/

cf=0.78*1/(pow (redp,0.61));

cdfiber=(8/3)*(cf*cos_alpha*cos_alpha*cos_alpha+(cdn/PI)*sin_alpha*sin_alpha*sin_alpha); /* times (*) added before sin */

if (void_f<1e-12)

{

void_f=1e-12;

}

fn=1/2*rho_v*slip_v*slip_v*sin_alpha*sin_alpha*DCYL*L*c dn; /*parse error*/

fp=1/2*rho_v*slip_v*slip_v*cos_alpha*cos_alpha*PI*DCYL* L*cf;

fd=fp*cos_alpha+fn*sin_alpha;

np=4*void_f/(PI*DCYL*L);

K=fd*np/slip_v;

return K; }

  Reply With Quote

Old   December 11, 2007, 10:49
Default Re: parse error while interpreting udf
  #3
Kristin
Guest
 
Posts: n/a
Thanks a million
  Reply With Quote

Old   March 15, 2012, 07:43
Default
  #4
New Member
 
karthik
Join Date: Oct 2010
Posts: 14
Rep Power: 16
kitrax is on a distinguished road
Dear all, I am getting the same parse error when I try to interpret. The code is quite simple, and I keep getting it on the bottom line of code. I cant understand why, can someone please help.

Thanks, have attached the code below

/*UDF for adding sink term for H2 consumption based on current density */

#include "udf.h"

DEFINE_SOURCE(sink,c,t,dS,eqn)
{
real i = 0.4; /* Amps/m2 */
real F = 96485.0; /* Faradays constant (C/mol) */
real M_H2 = 2.0; /* Molecular weight of Hydrogen */
real sink;
real area = 0.001*0.001;
real volume = C_VOLUME(c,t);
/*Thread *t;
cell_t c;*/

//sink = -(((i/area)/volume)/(2.0*F))*M_H2;
sink = 0.0;
return sink
}
kitrax is offline   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
Parse Error:- Interpreting UDF on remote terminal moataz.che FLUENT 1 March 7, 2017 15:13
parse error in transient udf spring FLUENT 1 July 6, 2010 07:26
parse error with interpreting UDF ivanbuz Fluent UDF and Scheme Programming 2 August 13, 2009 19:29
Parse Error Message While interpreting UDF in FLUENT dhimans Fluent UDF and Scheme Programming 1 July 10, 2009 07:29
PARSE ERROR Message when interpreting UDF in FLUENT dhimans FLUENT 0 May 24, 2009 12:40


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