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 in DEFINE_SOURCE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2012, 14:31
Default Parse error in DEFINE_SOURCE
  #1
Member
 
Fer Villa
Join Date: Apr 2012
Posts: 35
Rep Power: 13
fevi84 is on a distinguished road
Hi

I need help!!!

I'm trying to implement the follow UDF:

DEFINE_ADJUST(adjust_vof_rho_water, domain)
{
Thread *thread_l;
cell_t cell;
face_t face;
domain = Get_Domain(2);
/*Fill UDS whit the variable*/
thread_loop_c(thread_l,domain)
{
begin_c_loop(cell,thread_l)
{
C_UDSI(cell,thread_l,0) = C_VOF(cell,thread_l);
C_UDSI(cell,thread_l,4) = C_R(cell,thread_l);
}
end_c_loop(cell,thread_l)
}
}


DEFINE_ADJUST(adjust_vof_rho_air, domain)
{
Thread *thread_g;
cell_t cell;
face_t face;
domain = Get_Domain(3);
/*Fill UDS whit the variable*/
thread_loop_c(thread_g,domain)
{
begin_c_loop(cell,thread_g)
{
C_UDSI(cell,thread_g,1) = C_VOF(cell,thread_g);
C_UDSI(cell,thread_g,5) = C_R(cell,thread_g);
}
end_c_loop(cell,thread_g)
}
}

DEFINE_ADJUST(adjust_versor_gradient, domain)
{
Thread *thread_l;
cell_t cell;
real n[ND_ND];
domain = Get_Domain(2);
/*Fill UDS whit the variable*/
thread_loop_c(thread_l,domain)
{
begin_c_loop(cell,thread_l)
{
/*C_UDSI(cell,thread_l,0) = C_VOF(cell,thread_l);*/
n[0] = C_UDSI_G(cell,thread_l,0)[0]/NV_MAG(C_UDSI_G(cell,thread_l,0));
n[1] = C_UDSI_G(cell,thread_l,0)[1]/NV_MAG(C_UDSI_G(cell,thread_l,0));
C_UDSI(cell,thread_l,2) = n[0];
C_UDSI(cell,thread_l,3) = n[1];
}
end_c_loop(cell,thread_l)
}
}


DEFINE_SOURCE(x_airdisp_mom_src, cell, thread, dS, eqn)
{
real kappax, rho_lg;
real sigma = 0.073;
real source

kappax = C_UDSI_G(cell,thread,2)[0] + C_UDSI_G(cell,thread,3)[1];

rho_lg = C_UDSI(cell,thread,0)*C_UDSI(cell,thread,4) + C_UDSI(cell,thread,1)*C_UDSI(cell,thread,5);

source = (2*sigma*rho_lg*kappax*C_UDSI_G(cell,thread,0)[0])/(C_UDSI(cell,thread,4) + C_UDSI(cell,thread,5));

dS[eqn] = 0.0;

return source;

}

The PARSE ERROR is in the red line.

I tried defining n[ND_ND] as a global variable, so to difine:

kappax = n[0] + n[1];

but also gave the same error in the expression of kappax.

I also tried adding other UDS in DEFINE_ADJUST(adjust_versor_gradient, domain):

C_UDSI(cell,thread_l,6) = C_UDSI_G(cell,thread_l,2)[0];
C_UDSI(cell,thread_l,7) = C_UDSI_G(cell,thread_l,3)[1];

then,

kappax = C_UDSI(cell,thread,6) + C_UDSI(cell,thread,7);

and also gave the same error in the expression of kappax.

Anyone know what could be the problem????

Thanks!!!
fevi84 is offline   Reply With Quote

Old   August 30, 2012, 01:16
Default
  #2
New Member
 
Anton Khokhlov
Join Date: Aug 2012
Location: Moscow
Posts: 4
Rep Power: 13
antonk67 is on a distinguished road
You have the syntax error in the line just above highlighted in red.
antonk67 is offline   Reply With Quote

Old   August 30, 2012, 14:58
Default
  #3
Member
 
Fer Villa
Join Date: Apr 2012
Posts: 35
Rep Power: 13
fevi84 is on a distinguished road
Thank you very much for your reply.

Quote:
Originally Posted by antonk67 View Post
You have the syntax error in the line just above highlighted in red.
fevi84 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 in transient udf spring FLUENT 1 July 6, 2010 06:26
Parse Error Message While interpreting UDF in FLUENT dhimans Fluent UDF and Scheme Programming 1 July 10, 2009 06:29
PARSE ERROR Message when interpreting UDF in FLUENT dhimans FLUENT 0 May 24, 2009 11:40
Parse Error Vamsee FLUENT 0 March 16, 2009 15:03
Parse error Fernando FLUENT 2 January 21, 2006 12:55


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