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

Help! Why C_T_G does not work in my DEFINE_ADJUST udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2013, 23:14
Default Help! Why C_T_G does not work in my DEFINE_ADJUST udf
  #1
New Member
 
CZ
Join Date: Jun 2013
Posts: 9
Rep Power: 13
titanchao is on a distinguished road
Hello,

Can some Fluent experts here please help me find out why C_T_G does not work in this DEFINE_ADJUST function?

I have enabled the "Keep temporary memory from being freed" option.

The code compiles fine, but the computation iteration would collapse.

I know it is the problem with C_T_G because I have tested by replacing C_T_G by another term, and everything works out fine.

I would highly appreciate your help!

CZ

#include "udf.h"
#include "mem.h"
#include "math.h"

DEFINE_ADJUST(Disperions_before_Del,d)
{
real vel, Re, cosalfa,sinalfa, Pr,kXX, kYY,Tgrad_x,Tgrad_r;
real poros=0.93;
real fila_d=0.0006;
Thread *t;
cell_t c;

if (!Data_Valid_P())
return;

thread_loop_c(t,d)
{if (FLUID_THREAD_P(t))
{
begin_c_loop_int(c,t)
{ vel=sqrt(C_U(c,t)*C_U(c,t)+C_V(c,t)*C_V(c,t));

if (vel==0)
{
cosalfa=1;
sinalfa=0;
}
else
{
cosalfa=C_U(c,t)/vel;
sinalfa=C_V(c,t)/vel;
}

Re=C_R(c,t)*vel*fila_d/C_MU_L(c,t);
Pr=C_CP(c,t)*C_MU_L(c,t)/C_K_L(c,t);

if (Re*Pr<10)
{
kXX=C_K_L(c,t)*0.022*Re*Pr*Re*Pr/(1-poros);
kYY=C_K_L(c,t)*0.022*pow(Re*Pr,1.7)/pow((1-poros),0.25);
}

else
{
kXX=C_K_L(c,t)*2.7*Re*Pr/sqrt(poros);
kYY=C_K_L(c,t)*0.052*sqrt(1-poros)*Re*Pr;
}

if (!Data_Valid_P())
return;
Tgrad_x=C_T_G(c,t)[0];
Tgrad_r=C_T_G(c,t)[1];


C_UDSI(c,t,1)=kXX*cosalfa*Tgrad_x + kXX*sinalfa*Tgrad_r;
C_UDSI(c,t,2)=-kYY*sinalfa*Tgrad_x + kYY*cosalfa*Tgrad_r;
/* just for testing purpose, which shows the problem is with C_T_G
C_UDSI(c,t,1)=kXX*cosalfa + kXX*sinalfa;
C_UDSI(c,t,2)=-kYY*sinalfa + kYY*cosalfa;*/
}
end_c_loop_int(c,t)
}
}
}
titanchao is offline   Reply With Quote

Old   July 1, 2013, 00:33
Default
  #2
New Member
 
CZ
Join Date: Jun 2013
Posts: 9
Rep Power: 13
titanchao is on a distinguished road
looks like I just found a solution:

http://www.cfd-online.com/Forums/flu...oblem-udf.html
titanchao 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
my udf dos not work amir_14 Fluent UDF and Scheme Programming 11 January 7, 2013 15:46
parse error while interpreting udf Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43
udf doesn't work blaid FLUENT 0 March 6, 2012 13:29
udf - c++ compiler does not work Matthias FLUENT 1 January 9, 2009 01:44
I need UDF help. S.Whitney FLUENT 0 October 15, 2007 12:29


All times are GMT -4. The time now is 19:44.