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

Interpreted UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2004, 16:40
Default Interpreted UDF
  #1
Bikash
Guest
 
Posts: n/a
hi

i am trying to use UDF for two different temperature boundary conditons varying with time. one is at the inlet and other one is for ambient air. i have two different equations guiding the temperature. when i compile the udf i get only one udf while defining the boundary conditions. the last one compiled overlaps the previous one, so i cannot define two different boundary condition using the UDF. i used different name while defining the macros, but it didnt work.

i would appreciate any help and suggestions

thank you bikash
  Reply With Quote

Old   August 29, 2004, 02:57
Default Re: Interpreted UDF
  #2
Abraham
Guest
 
Posts: n/a
Yo have to use a multiple UDF. Take the two codes and put in the same file, after compiled.

When you compiled the file, you will have two UDF for your case.
  Reply With Quote

Old   August 30, 2004, 04:12
Default Re: Interpreted UDF
  #3
Bikash
Guest
 
Posts: n/a
hi abraham,

well thanks for your help. can you give me more details about how to put two codes in the same file? i really dont know how to put two codes in the same file and compile. i really appreciate your help

thank you bikash
  Reply With Quote

Old   August 30, 2004, 14:08
Default Re: Interpreted UDF
  #4
Mahesh Masurkar
Guest
 
Posts: n/a
#include "udf.h"

define_profile(temp1...) { } define_profile(temp2...) { }

Then save the file and compile the UDF. ( interrupted).

Mahesh
  Reply With Quote

Old   August 30, 2004, 14:43
Default Re: Interpreted UDF
  #5
Abraham
Guest
 
Posts: n/a
The following code is of the fluent userīs manual

Example 2 In the following example, DEFINE PROFILE is used to generate pro les for the x velocity, turbulent kinetic energy, and dissipation rate, respectively, for a 2D fully-developed duct flow. Three separate UDFs named x velocity, k profile, and dissip profile are de ned. These functions are concatenated in a single C source le which can be executed as interpreted or compiled in FLUENT. The 1/7th power law is used to specify the x velocity component: vx = vx;free y  1=7 A fully-developed pro le occurs when  is one-half the duct height. In this example, the mean x velocity is prescribed and the peak (free-stream) velocity is determined by averaging across the channel. The turbulent kinetic energy is assumed to vary linearly from a near-wall value of knw = u2  qC to a free-stream value of kinf = 0:002u2 free The dissipation rate is given by  = C3=4  (k3=2) ` where the mixing length ` is the minimum of y and 0.085. ( is the von Karman constant = 0.41.) The friction velocity and wall shear take the forms u = qw= w = fu2 free 2 The friction factor is estimated from the Blasius equation: f = 0:045 ufree  !?1=4 4-28 c Fluent Inc. December 3, 2001 4.3 Model-Speci c DEFINE Macros /************************************************** ********************/ /* Concatenated UDFs for fully-developed turbulent inlet profiles */ /************************************************** ********************/ #include "udf.h" #define YMIN 0.0 /* constants */ #define YMAX 0.4064 #define UMEAN 1.0 #define B 1./7. #define DELOVRH 0.5 #define VISC 1.7894e-05 #define CMU 0.09 #define VKC 0.41 /* profile for x-velocity */ DEFINE_PROFILE(x_velocity, t, i) { real y, del, h, x[ND_ND], ufree; /* variable declarations */ face_t f; h = YMAX - YMIN; del = DELOVRH*h; ufree = UMEAN*(B+1.); begin_f_loop(f, t) { F_CENTROID(x,f,t); y = x[1]; if (y <= del) F_PROFILE(f,t,i) = ufree*pow(y/del,B); else F_PROFILE(f,t,i) = ufree*pow((h-y)/del,B); } end_f_loop(f, t) } /* profile for kinetic energy */ c Fluent Inc. December 3, 2001 4-29 DEFINE Macros DEFINE_PROFILE(k_profile, t, i) { real y, del, h, ufree, x[ND_ND]; real ff, utau, knw, kinf; face_t f; h = YMAX - YMIN; del = DELOVRH*h; ufree = UMEAN*(B+1.); ff = 0.045/pow(ufree*del/VISC,0.25); utau=sqrt(ff*pow(ufree,2.)/2.0); knw=pow(utau,2.)/sqrt(CMU); kinf=0.002*pow(ufree,2.); begin_f_loop(f, t) { F_CENTROID(x,f,t); y=x[1]; if (y <= del) F_PROFILE(f,t,i)=knw+y/del*(kinf-knw); else F_PROFILE(f,t,i)=knw+(h-y)/del*(kinf-knw); } end_f_loop(f, t) } /* profile for dissipation rate */ DEFINE_PROFILE(dissip_profile, t, i) { real y, x[ND_ND], del, h, ufree; real ff, utau, knw, kinf; real mix, kay; face_t f; h = YMAX - YMIN; del = DELOVRH*h; ufree = UMEAN*(B+1.); ff = 0.045/pow(ufree*del/VISC,0.25); utau=sqrt(ff*pow(ufree,2.)/2.0); knw=pow(utau,2.)/sqrt(CMU); 4-30 c Fluent Inc. December 3, 2001 4.3 Model-Speci c DEFINE Macros kinf=0.002*pow(ufree,2.); begin_f_loop(f, t) { F_CENTROID(x,f,t); y=x[1]; if (y <= del) kay=knw+y/del*(kinf-knw); else kay=knw+(h-y)/del*(kinf-knw); if (VKC*y < 0.085*del) mix = VKC*y; else mix = 0.085*del; F_PROFILE(f,t,i)=pow(CMU,0.75)*pow(kay,1.5)/mix; } end_f_loop(f,t) } c Fluent Inc. December 3, 2001 4-31
  Reply With Quote

Old   August 30, 2004, 14:49
Default Re: Interpreted UDF better
  #6
Abraham
Guest
 
Posts: n/a
Example 2

/**************************************************/

/* Concatenated UDFs for fully-developed turbulent inlet profiles */ /********************************************/

#include "udf.h"

#define YMIN 0.0 /* constants */

#define YMAX 0.4064

#define UMEAN 1.0

#define B 1./7.

#define DELOVRH 0.5

#define VISC 1.7894e-05

#define CMU 0.09

#define VKC 0.41

/* profile for x-velocity */

DEFINE_PROFILE(x_velocity, t, i)

{

real y, del, h, x[ND_ND], ufree; /* variable declarations */

face_t f;

h = YMAX - YMIN;

del = DELOVRH*h;

ufree = UMEAN*(B+1.);

begin_f_loop(f, t)

{

F_CENTROID(x,f,t);

y = x[1];

if (y <= del)

F_PROFILE(f,t,i) = ufree*pow(y/del,B);

else

F_PROFILE(f,t,i) = ufree*pow((h-y)/del,B);

}

end_f_loop(f, t)

}

/* profile for kinetic energy */

DEFINE_PROFILE(k_profile, t, i)

{

real y, del, h, ufree, x[ND_ND];

real ff, utau, knw, kinf;

face_t f;

h = YMAX - YMIN;

del = DELOVRH*h;

ufree = UMEAN*(B+1.);

ff = 0.045/pow(ufree*del/VISC,0.25);

utau=sqrt(ff*pow(ufree,2.)/2.0);

knw=pow(utau,2.)/sqrt(CMU);

kinf=0.002*pow(ufree,2.);

begin_f_loop(f, t)

{

F_CENTROID(x,f,t);

y=x[1];

if (y <= del)

F_PROFILE(f,t,i)=knw+y/del*(kinf-knw);

else

F_PROFILE(f,t,i)=knw+(h-y)/del*(kinf-knw);

}

end_f_loop(f, t)

}

/* profile for dissipation rate */

DEFINE_PROFILE(dissip_profile, t, i)

{

real y, x[ND_ND], del, h, ufree;

real ff, utau, knw, kinf;

real mix, kay;

face_t f;

h = YMAX - YMIN;

del = DELOVRH*h;

ufree = UMEAN*(B+1.);

ff = 0.045/pow(ufree*del/VISC,0.25);

utau=sqrt(ff*pow(ufree,2.)/2.0);

knw=pow(utau,2.)/sqrt(CMU);

kinf=0.002*pow(ufree,2.);

begin_f_loop(f, t)

{

F_CENTROID(x,f,t);

y=x[1];

if (y <= del)

kay=knw+y/del*(kinf-knw);

else

kay=knw+(h-y)/del*(kinf-knw);

if (VKC*y < 0.085*del)

mix = VKC*y;

else

mix = 0.085*del;

F_PROFILE(f,t,i)=pow(CMU,0.75)*pow(kay,1.5)/mix;

}

end_f_loop(f,t)

}
  Reply With Quote

Old   August 30, 2004, 21:21
Default Re: Interpreted UDF better
  #7
Bikash
Guest
 
Posts: n/a
hi

thanks a lot for your help. i will try to use the ideas. i'll get back to you guys if i get any trouble.

i really appreciate your help abraham.

  Reply With Quote

Old   August 31, 2004, 13:29
Default Re: Interpreted UDF better
  #8
Bikash
Guest
 
Posts: n/a
hi abraham,

i followed the example that you gave me for concatenated udfs.

i get syntax error on the line when i add the second udf in the same code file.

i checked everything but its not working, it works if i take the second udf out and just compile single udf.

may be you can suggest me something.

i respect your time and greatly appreciate your help

thankyou

bikash

-------------------------------------------------------------------------------------------------------------------------------------- #include "udf.h"

DEFINE_PROFILE(unsteady_velocity1, thread, position) { face_t f;

begin_f_loop(f, thread)

{

real t = RP_Get_Real("flow-time");

F_PROFILE(f, thread, position) = 20. + 5.0*sin(10.*t);

} end_f_loop(f, thread) }*****************

DEFINE_PROFILE(unsteady_velocity2, thread, position) { face_t f;

begin_f_loop(f, thread)

{

real t = RP_Get_Real("flow-time");

F_PROFILE(f, thread, position) = 20. + 5.0*sin(10.*t);

} end_f_loop(f, thread) }

My udf is pretty much similar to this, i followed the above syntax. i couldnt get access to my program now, cause im in the library. i get error on that line *********************

  Reply With Quote

Old   September 1, 2004, 03:30
Default Re: Interpreted UDF better
  #9
bikash
Guest
 
Posts: n/a
hi abraham

it worked the way you told me.

thanks a lot

bikash
  Reply With Quote

Old   April 19, 2016, 09:53
Default Delovrh meaning
  #10
New Member
 
Join Date: Jun 2013
Posts: 8
Rep Power: 13
msbhatti123 is on a distinguished road
Hi all,

Could you please let me know, what does DELOVRH means. and how they are doing del= DELOVRH*h. in this profile generation, can i use log law instead of power law? is it makes any difference.thanks
msbhatti123 is offline   Reply With Quote

Old   December 3, 2019, 01:52
Default Its urgent
  #11
New Member
 
BINAY BHUSHAN BORA
Join Date: Nov 2019
Posts: 1
Rep Power: 0
BINAY BHUSHAN BORA is on a distinguished road
hi can you please elaborate the meaning of YMIN,YMAX,UMEAN,B,DELOVRH,CMU,VKC.PLEASE HELP ME ANYBODY.
BINAY BHUSHAN BORA 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
UDF - Interpreted works and compiled doesn't AlwaysLearning FLUENT 9 October 30, 2018 01:52
A Problem of Fluent Interpreted UDF: parse error knight Fluent UDF and Scheme Programming 25 August 16, 2018 11:26
Interpreted UDF in parallel David Chabot Fluent UDF and Scheme Programming 8 May 30, 2012 04:18
compiled or interpreted udf Aireen FLUENT 11 August 25, 2005 01:54
error of Interpreted udf Zhang Junmei FLUENT 6 December 12, 2001 09:03


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