|
[Sponsors] |
Help! Why C_T_G does not work in my DEFINE_ADJUST udf |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 30, 2013, 23:14 |
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 |
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) } } } |
|
July 1, 2013, 00:33 |
|
#2 |
New Member
CZ
Join Date: Jun 2013
Posts: 9
Rep Power: 13 |
||
|
|
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 |