writing Udf for thermal conductivity correlation

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

June 24, 2014, 20:51
writing Udf for thermal conductivity correlation
#1
Member

sarah
Join Date: Aug 2010
Posts: 41
Rep Power: 9
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????
Attached Files
 Figure 1.docx (12.9 KB, 20 views)

 June 25, 2014, 08:40 #2 Senior Member   François Grégoire Join Date: Jan 2010 Location: Laval University, Canada Posts: 389 Rep Power: 10 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, 09:06 #3 Member   sarah Join Date: Aug 2010 Posts: 41 Rep Power: 9 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 13:45.

 June 25, 2014, 15:06 #4 Member   sarah Join Date: Aug 2010 Posts: 41 Rep Power: 9 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"

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post mvf Fluent UDF and Scheme Programming 1 February 10, 2017 20:05 Kwiaci Fluent UDF and Scheme Programming 2 January 20, 2017 09:42 Rashmi FLUENT 1 November 6, 2007 21:08 KKLAU FLUENT 1 April 6, 2004 23:58 umesh FLUENT 1 June 13, 2003 04:20

All times are GMT -4. The time now is 06:08.