|
[Sponsors] |
writing Udf for thermal conductivity correlation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 24, 2014, 21:51 |
writing Udf for thermal conductivity correlation
|
#1 |
Member
sarah
Join Date: Aug 2010
Posts: 42
Rep Power: 16 |
Hi,
i want to define thermal conductivity according to Zehner and Schluender correlation; I wrote the following Udf but it doesn't work! #include "udf.h" DEFINE_PROPERTY(ksolid,c,t) { real ktc; real temp= C_T(c,t); real por; real e_r; real k_g; real a; real b_z; real sigma; por=0.36; e_r=0.8; sigma=0.0000000567; b_z=1.25*pow(((1.-por)/por),1.11); k_g=156.97-0.0988*temp+2.083e-05*pow(temp,3); a=k_g/0.24*sigma*pow(temp,3.); ktc=0.24*sigma*pow(temp,3.)*((1.-pow((1-por),0.5)+(((pow((1-por),0.5)/(2.*pow(e_r,-1.)-1.))*((b_z+1.)/b_z)*pow((1+(1/((2.*pow(e_r,-1.)-1)*a))),-1.), return ktc; } is there any one to help me???? |
|
June 25, 2014, 09:40 |
|
#2 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
There should be a semi-colon at the end of the ktc = ... line, not a comma.
Parenthese overdose in the same line, this line works: ktc = 0.24*sigma*pow(tempe,3)*( (1-pow(1-por,0.5)) * (1-por) + pow(1-por,0.5)/(2*pow(e_r,-1)-1) * (b_z+1)/b_z * pow(1 + 1/((2*pow(e_r,-1)-1)*a),-1) ); I renamed temp for tempe because temp shadows a previous definition... |
|
June 25, 2014, 10:06 |
|
#3 |
Member
sarah
Join Date: Aug 2010
Posts: 42
Rep Power: 16 |
Thanks macfly !
I did a silly mistake to write a comma instead of semi- colon!! now i fix it and it works! i wrote some udfs for porous zone and when i run udf i always see this message that says "c definition shadows previous definition" c is referred to cell. how can i fix it? Thanks Last edited by sarah l; June 25, 2014 at 14:45. |
|
June 25, 2014, 16:06 |
|
#4 |
Member
sarah
Join Date: Aug 2010
Posts: 42
Rep Power: 16 |
I wrote a udf for energy source when i eliminate this udf i don't see this message again.
here this UDF: #include "udf.h" #include "math.h" DEFINE_SOURCE(energy_source,c,t,dS,eqn) { real x[ND_ND]; real source; real t_c = CURRENT_TIME ; real t_0; cell_t c; t_0=35424000; if((t_c>0.1) && (t_c<10)) { source = (4958000*sin(0.285*x[0])+ 1866900)*0.0603*(pow(t_c,-0.0639)-pow(t_c+t_0, -0.0639)) ; dS[eqn] = (1416001.489*cos(0.285*x[0]))*0.0603*(pow(t_c,-0.0639)-pow(t_c+t_0, -0.0639)) ; } if((t_c>10) && (t_c<150)) { source = (4958000*sin(0.285*x[0])+ 1866900)*0.0766*(pow(t_c,-0.181)-pow(t_c+t_0, -0.181)) ; dS[eqn] = 1416001.489*cos(0.285*x[0])* 0.0766*(pow(t_c,-0.181)-pow(t_c+t_0, -0.181)) ; } if((t_c>150) && (t_c<4000000)) { source = (4958000*sin(0.285*x[0])+ 1866900)*0.13*(pow(t_c,-0.283)-pow(t_c+t_0, -0.283)) ; dS[eqn] = 1416001.489*cos(0.285*x[0])*0.13*(pow(t_c,-0.283)-pow(t_c+t_0, -0.283)); } if((t_c>4000000) && (t_c<200000000)) { source = (4958000*sin(0.285*x[0])+ 1866900)*0.266*(pow(t_c,-0.335)-pow(t_c+t_0, -0.335)) ; dS[eqn] = 1416001.489*cos(0.285*x[0])*0.266*(pow(t_c,-0.335)-pow(t_c+t_0, -0.335)); } if((t_c==0)) { source = (4958000*sin(0.285*x[0])+ 1866900); dS[eqn] = 1416001.489*cos(0.285*x[0]); } return source; } I think there is a problem with it because when i interpret it to fluent , I see this message that says "c definition shadows previous definition" |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
I need one simple udf code for effective thermal conductivity of nanofluid | mvf | Fluent UDF and Scheme Programming | 1 | February 10, 2017 20:05 |
Anisotropic thermal conductivity UDF | Kwiaci | Fluent UDF and Scheme Programming | 2 | January 20, 2017 09:42 |
UDF for effective thermal conductivity | Rashmi | FLUENT | 1 | November 6, 2007 21:08 |
Writing UDF for Robbins Bounday Condition | KKLAU | FLUENT | 1 | April 7, 2004 00:58 |
Macros for writing UDF for porosity | umesh | FLUENT | 1 | June 13, 2003 05:20 |