CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

udf problem

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 9, 2011, 05:02
Default udf problem
  #1
Member
 
rose
Join Date: Dec 2010
Posts: 30
Rep Power: 6
rubis is on a distinguished road
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
rubis is offline   Reply With Quote

Old   October 9, 2011, 09:00
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by rubis View Post
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,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 9, 2011, 10:13
Default udf display
  #3
Member
 
rose
Join Date: Dec 2010
Posts: 30
Rep Power: 6
rubis is on a distinguished road
thank you amir,
i need udf and want to display it

best regards
rubis is offline   Reply With Quote

Old   October 9, 2011, 15:21
Default
  #4
Senior Member
 
Mohammad
Join Date: Feb 2010
Location: Shiraz, Iran
Posts: 108
Rep Power: 7
m2montazari is on a distinguished road
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,
mohammad
m2montazari is offline   Reply With Quote

Old   October 10, 2011, 04:51
Default my big problem
  #5
Member
 
rose
Join Date: Dec 2010
Posts: 30
Rep Power: 6
rubis is on a distinguished road
hi all,
thank you mohamed also amir for your help .
this is my udfs and i want to display it
#include <udf.h>
DEFINE_PROPERTY (dyn_surf_tension, cell, thread)
{
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 GAMMA 2.45e-10 /*adsorption mol/cm^2*/
#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*/
Thread *tp; /*thread from phase identified by phase_2_ID*/
real yi; /*mass fraction*/
tp = Lookup_Thread(d,THREAD_ID(ti));
/*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*/
return (6.516+6.706*log(exp(yi*rho*1000/MW)))/(Ta*GC/MW); /*adsorption
mol*10^-10cm^2*/
} else
{ C_UDMI(cell,tp,0) = (cmcst*yi*rho*1000/MW+39)*0.001;
C_UDMI(cell,tp,1) = 0.25; /*constant adsorption*/
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
rubis is offline   Reply With Quote

Old   October 10, 2011, 05:09
Default
  #6
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by rubis View Post
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,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 10, 2011, 06:03
Default
  #7
Member
 
rose
Join Date: Dec 2010
Posts: 30
Rep Power: 6
rubis is on a distinguished road
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
rubis is offline   Reply With Quote

Old   October 10, 2011, 06:13
Default
  #8
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by rubis View Post
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,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 10, 2011, 07:33
Default another probmel
  #9
Member
 
rose
Join Date: Dec 2010
Posts: 30
Rep Power: 6
rubis is on a distinguished road
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
rubis is offline   Reply With Quote

Old   October 10, 2011, 08:59
Default
  #10
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by rubis View Post
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,
__________________
Amir
Amir is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 32 May 8, 2015 06:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56
UDF problem mansha goraya FLUENT 0 October 29, 2007 01:31
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
UDF problem chiseung FLUENT 4 January 10, 2002 10:58


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