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/)
-   -   Problem ND_SET (https://www.cfd-online.com/Forums/fluent-udf/105927-problem-nd_set.html)

fevi84 August 13, 2012 09:28

Problem ND_SET
 
Hi

I need help!!!

I need create a vector in 2D from to the cordenates x and y. I have the x component, tx_l, and the y component, ty_l. I tried with the follow UDF:

real tx_l, ty_l;
real t_l [ND_ND]

tx_l = mu_l*C_DUDX(cell,thread_l)*C_UDSI_G(cell,thread_l, 0)[0] + 0.5*mu_l*C_UDSI_G(cell,thread_l,0)[1]*(C_DUDY(cell,thread_l) + C_DVDX(cell,thread_l));

ty_l = mu_l*C_DVDY(cell,thread_l)*C_UDSI_G(cell,thread_l, 0)[1] + 0.5*mu_l*C_UDSI_G(cell,thread_l,0)[0]*(C_DUDY(cell,thread_l) + C_DVDX(cell,thread_l));

ND_SET(t_l[0], t_l[1], tx_l, ty_l)

But this not works. The error is:

error: macro "ND_SET" requires 6 arguments, but only 4 given

Also I tried with:

t_l[0] = tx_l;
t_l[1] = ty_l;

In this case gave no error, but I'm not sure if well.

Anyone knows, how create a vector using the ND_SET macro in this case, which I have the components?

Thanks!!!

blackmask August 15, 2012 23:03

ND_SET requires 6 arguments no matter what the value of ND_ND is. you have to write something like
ND_SET(t_l[0], t_l[1], NULL, tx_l, ty_l, NULL)
because the 3rd and 6th arguments must appear but are not used if ND_ND is 2.
It is ok you assign the value for t_I array directly, which is almost the same as what the macro ND_SET does.

fevi84 August 16, 2012 17:44

Thank you very much for your reply.

Quote:

Originally Posted by blackmask (Post 377291)
ND_SET requires 6 arguments no matter what the value of ND_ND is. you have to write something like
ND_SET(t_l[0], t_l[1], NULL, tx_l, ty_l, NULL)
because the 3rd and 6th arguments must appear but are not used if ND_ND is 2.
It is ok you assign the value for t_I array directly, which is almost the same as what the macro ND_SET does.


danieldmgy May 16, 2014 18:45

Quote:

Originally Posted by blackmask (Post 377291)
ND_SET requires 6 arguments no matter what the value of ND_ND is. you have to write something like
ND_SET(t_l[0], t_l[1], NULL, tx_l, ty_l, NULL)
because the 3rd and 6th arguments must appear but are not used if ND_ND is 2.
It is ok you assign the value for t_I array directly, which is almost the same as what the macro ND_SET does.

Thank you so much for help! It works like a charm!


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