|
[Sponsors] |
August 28, 2004, 16:40 |
Interpreted UDF
|
#1 |
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 |
|
August 29, 2004, 02:57 |
Re: Interpreted UDF
|
#2 |
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. |
|
August 30, 2004, 04:12 |
Re: Interpreted UDF
|
#3 |
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 |
|
August 30, 2004, 14:08 |
Re: Interpreted UDF
|
#4 |
Guest
Posts: n/a
|
#include "udf.h"
define_profile(temp1...) { } define_profile(temp2...) { } Then save the file and compile the UDF. ( interrupted). Mahesh |
|
August 30, 2004, 14:43 |
Re: Interpreted UDF
|
#5 |
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 |
|
August 30, 2004, 14:49 |
Re: Interpreted UDF better
|
#6 |
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) } |
|
August 30, 2004, 21:21 |
Re: Interpreted UDF better
|
#7 |
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. |
|
August 31, 2004, 13:29 |
Re: Interpreted UDF better
|
#8 |
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 ********************* |
|
September 1, 2004, 03:30 |
Re: Interpreted UDF better
|
#9 |
Guest
Posts: n/a
|
hi abraham
it worked the way you told me. thanks a lot bikash |
|
April 19, 2016, 09:53 |
Delovrh meaning
|
#10 |
New Member
Join Date: Jun 2013
Posts: 8
Rep Power: 13 |
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 |
|
December 3, 2019, 01:52 |
Its urgent
|
#11 |
New Member
BINAY BHUSHAN BORA
Join Date: Nov 2019
Posts: 1
Rep Power: 0 |
hi can you please elaborate the meaning of YMIN,YMAX,UMEAN,B,DELOVRH,CMU,VKC.PLEASE HELP ME ANYBODY.
|
|
|
|
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 |