CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   udf problem (https://www.cfd-online.com/Forums/fluent/93231-udf-problem.html)

 rubis October 9, 2011 05:02

udf problem

hi,
please can you help me .
i have a big problem , i have a udf function and i want to display it but i cab't .
i do'not know how?

best regards

 Amir October 9, 2011 09:00

Quote:
 Originally Posted by rubis (Post 327192) hi, please can you help me . i have a big problem , i have a udf function and i want to display it but i cab't . i do'not know how? please help me ? best regards
Dear Rose,

To display your function, you can store desired function in a UDM and then you can simply display that. But before that, ensure whether you need UDF or not, maybe you can achieve your purpose via custom field function.

Bests,

 rubis October 9, 2011 10:13

udf display

thank you amir,
i need udf and want to display it

best regards

 m2montazari October 9, 2011 15:21

hi,
if you want to write a udf to define a new variable for postprocessing, more than 90 percent you can do it with custom field function as Amir said. but if you can't use this, perhaps UDM is a good idea. can you send the udf you've written?
yours,

 rubis October 10, 2011 04:51

my big problem

hi all,
thank you mohamed also amir for your help .
this is my udfs and i want to display it
#include <udf.h>
{
real dst;
real t=CURRENT_TIME;
dst=141121*pow(t,5) - 38978*pow(t,4) + 3817.5*pow(t,3) - 148.84*pow(t,2) +
1.3033*pow(t,1) + 0.071;
return dst;
}

and the second is
#include "udf.h"
#define GC 8.3145 /*gas constant*/
#define Ta 293 /*Temperature K*/
#define MW 288.38 /*SDS Molecular weight*/
#define phase_2_ID 2
#define CV 3.4676 /*convert concentration from kg/m^3 to mmol/l*/
#define CST 0.001 /*convert dyn/cm to N/m*/
#define rho 370 /*SDS density kg/m^3*/
#define cmcst -0.25 /*change in surface tension w/ SDS conc. above critical
micelle concentration (dyn/cm)*/
DEFINE_PROPERTY(surften,cell,ti)
{
Domain *d = Get_Domain(phase_2_ID); /*domain pointer*/
real yi; /*mass fraction*/
/*rho = C_R(cell,tp);*/ /*concentration is yi*rho (kg/m^3) */
yi = C_YI(cell,tp,0);
if (yi <= 0.0055)
{ C_UDMI(cell,tp,0) = (68.49-
log(exp(yi*rho*1000/MW))*(6.516+3.353*log(exp(yi*rho*1000/MW))
))*CST;
C_UDMI(cell,tp,1) = (6.516+6.706*log(exp(yi*rho*1000/MW)))/(GC*MW);

return (68.49-
log(exp(yi*rho*1000/MW))*(6.516+3.353*log(exp(yi*rho*1000/MW))))*CST;
/*Experimental results from Mysels*/
mol*10^-10cm^2*/
} else
{ C_UDMI(cell,tp,0) = (cmcst*yi*rho*1000/MW+39)*0.001;
return (cmcst*yi*rho*1000/MW+39)*0.001;
/*return 0;*/
}
}

in the both i can not display it
and my second problem :how i canactivate a conncentartion?

thank you

 Amir October 10, 2011 05:09

Quote:
 Originally Posted by rubis (Post 327278) in the both i can not display it and my second problem :how i canactivate a conncentartion?
Hi,

1) You're using a DEFINE_PROPERTY to update a variable each time step; so I'm not sure but you may have this variable in display->contour list!

2) You set 2 UDMs and stored desired data in them; so you can easily display them in contour list. (main prodcedure: first activate UDMs in FLUENT; then it's better to initialize them before use (with patching))

3) To activate a general concentration equation, you can use UDS template. (refer to manual)

Bests,

 rubis October 10, 2011 06:03

hi Amir,
i use Define_Property but i have not this variable in display----contour list
prehaps i know not interpert udf ?
best regards

 Amir October 10, 2011 06:13

Quote:
 Originally Posted by rubis (Post 327295) hi Amir, yhank you for your réponse i use Define_Property but i have not this variable in display----contour list prehaps i know not interpert udf ? best regards
Dear Rose,

I think you can find your variables in contour list if you check it carefully but if there isn't, it's not a problem; it's not depend on your method of implementation of UDF; interpret or compile !!! As I said before, use UDM for that.

Bests,

 rubis October 10, 2011 07:33

another probmel

thank you Amir
i have used a UDM but i have a other problem is:
when i rau the iteration i have this message
chip-exec: dyn_surf_tension: wrong return type: void udf function expectedchip-exec: dyn_surf_tension: wrong return type: void udf function expectedchip-exec: dyn_surf_tension: wrong return type: void udf function expectedDone

best regards

 Amir October 10, 2011 08:59

Quote:
 Originally Posted by rubis (Post 327301) thank you Amir i have used a UDM but i have a other problem is: when i rau the iteration i have this message chip-exec: dyn_surf_tension: wrong return type: void udf function expectedchip-exec: dyn_surf_tension: wrong return type: void udf function expectedchip-exec: dyn_surf_tension: wrong return type: void udf function expectedDone best regards
Dear Rose,

I checked your first UDF and It didn't have any problem during iteration! (I compiled that)
I guess this issue may origin from finding binary files after implementation of UDF; in other words; you may change cas file path and libudf file is not in the appropriate folder. Try to compile/interpret it again in your new folder. (if you interpreted it; change UDF file path and do it again)

Bests,

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