CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Parse error in DEFINE_SOURCE (https://www.cfd-online.com/Forums/fluent-udf/106421-parse-error-define_source.html)

fevi84 August 28, 2012 14:31

Parse error in DEFINE_SOURCE
 
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!!!

antonk67 August 30, 2012 01:16

You have the syntax error in the line just above highlighted in red.

fevi84 August 30, 2012 14:58

Thank you very much for your reply.

Quote:

Originally Posted by antonk67 (Post 379426)
You have the syntax error in the line just above highlighted in red.



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