
[Sponsors] 
March 27, 2012, 05:39 
an error problem for a change of boundary condition

#1 
New Member
Join Date: Mar 2012
Posts: 26
Rep Power: 5 
HI every body,
it's my first time on this forum. I'm trying to change a boundary condition on a wall to put a velocity inlet but I have some problem when I want to use the adjacent cells of the face thread. Can Anyone help me, I don't understand what is the problem. I tried to find the problem, and I think it comes from the "F_C0" command. The error message that it's appear is : FLUENT received fatal signal (ACCESS_VIOLATION) Here is my UDF, //////////////////////////// #include "udf.h" #include "mem.h" double V_n[ND_ND], V_t[ND_ND], BC[ND_ND], VC[ND_ND]; real K, n, TAU0; /* consistency, power law parameter, limit yield stress for flowing */ real m, Cf, SL; /* regularization parameter, friction coefficient, limit yield stress for slipping */ double vmag, StrainRate, constante, TAUxx, TAUxy, TAUyy, VC_MAG; double dudx, dudy, dvdx, dvdy; /* derivatives */ face_t f; cell_t c0; DEFINE_PROFILE(wall_new_boundary, thread, position) { K=1; n=1; TAU0=1; m=100000; SL=0.6; begin_f_loop(f, thread) { F_AREA(V_n,f,thread); c0 = F_C0(f,thread); /* adjacent cell to f */ vmag=NV_MAG(V_n); /* magnitude and opposite of normal vector */ V_n[0]=V_n[0]/vmag; /* normed vector */ V_n[1]=V_n[1]/vmag; /* normed vector */ F_CENTROID(BC, f, thread); NV_D(V_t,=,V_n[1],V_n[0]); /* tangent vector */ StrainRate = C_STRAIN_RATE_MAG(c0, thread); constante = K*pow(StrainRate,(n1))+TAU0*(1exp(m*StrainRate))/StrainRate; dudx = C_U_G(c0,thread)[0]; dudy = C_U_G(c0,thread)[1]; dvdx = C_V_G(c0,thread)[0]; dvdy = C_V_G(c0,thread)[1]; TAUxx=2*constante*dudx; /* stress tensor's xx componant*/ TAUyy=2*constante*dvdy; /* stress tensor's yy componant*/ TAUxy=constante*(dudy+dvdx); /* stress tensor's xy componant*/ VC[0]=(TAUxx*V_n[0]+TAUxy*V_n[1])*(pow(V_t[0],2)); /* stress vector's x componant*/ VC[1]=(TAUxy*V_n[0]+TAUyy*V_n[1])*(pow(V_t[1],2)); /* stress vector's y componant*/ VC_MAG=NV_MAG(VC); /* stress vector's magnitude */ if ( VC_MAG < SL) { F_PROFILE(f, thread, position)=0; } else { F_PROFILE(f, thread, position)= VC[0]*(VC_MAGSL)/(VC_MAG*Cf); } } end_f_loop(f, thread) } //////////////////////////// Thanks for your help !! 

March 27, 2012, 12:10 
a simplified issue to solve my problem

#2  
New Member
Join Date: Mar 2012
Posts: 26
Rep Power: 5 
Here is a simplified UDF. It has no physical sense but it much more readable.
My problem is that I need to use the adjacent cell of face to chek the velocity there, but when I use "F_C0" command for it I have an error message which is : Quote:
Code:
#include "udf.h" #include "mem.h" double VC[ND_ND]; real SL; double VC_MAG; double dudx, dvdy; /* derivatives */ face_t f; cell_t c0; DEFINE_PROFILE(wall_velocity_x, thread, position) { SL=0.6; begin_f_loop(f, thread) { c0 = F_C0(f,thread); /* adjacent cell to f */ dudx = C_U_G(c0,thread)[0]; dvdy = C_V_G(c0,thread)[1]; VC[0]=dudx; VC[1]=dvdy; VC_MAG=NV_MAG(VC); if ( VC_MAG < SL) { F_PROFILE(f, thread, position)=0; } else { F_PROFILE(f, thread, position)= VC_MAGSL; } } end_f_loop(f, thread) } Thanks....... 

March 28, 2012, 11:21 
Can I call an adjacent cell with an other way ?

#3 
New Member
Join Date: Mar 2012
Posts: 26
Rep Power: 5 
I have no answer up to now.
So I change my question to be helped one day... Can I call an adjacent cell with an other way or must I use C_F0 ? 

March 28, 2012, 14:10 

#4 
Member
banty
Join Date: Mar 2012
Posts: 52
Rep Power: 5 
Hello,
In Micro (dudx = C_U_G(c0,thread)[0]) thread is the cell thread not face thread. The cells on either side of a face may or may not belong to the same cell thread. If a face is on the boundary of a domain, then only c0 exists. ( c1 is undefined for an external face). Alternatively, if the face is in the interior of the domain, then both c0 and c1 exist. There are two macros, THREAD_T0(t) and THREAD_T1(t), that can be used to identify cell threads that are adjacent to a given face f in a face thread t. This may be helpful to u. 

March 29, 2012, 04:26 
I understood now !

#5 
New Member
Join Date: Mar 2012
Posts: 26
Rep Power: 5 
Thank you very much Banty , I have not seen that when I wrote my UDF.
It works perfectly now ! thank you ! 

May 14, 2012, 17:03 
boundary condition problems

#6 
New Member
moon
Join Date: Feb 2012
Posts: 24
Rep Power: 5 
i wrote a udf for a boundary condition with mass fraction ,but when i want to initialize it write me : error: fluent receive fatal .....
.... .... ... i tried keep memory...[yes] and solve/expert/ save gradient ? to #t this is my udf /* my condition is rearanged as ma=map(D/jv)*(dma/dy)*/ #include "udf.h" DEFINE_PROFILE(frac,t,i) { real ma=0.0002; /*initialization of mass fraction */ real grad=0.0002;/*initialization of gradient */ cell_t c; face_t f; begin_f_loop(f,t) { c=F_C0(f,t); THREAD_T0(t); grad=C_YI_RG(c,t,i)[1]; ma=0.0000550.00002199301*grad; F_PROFILE(f,t,i)=ma; } end_f_loop(f,t) } please ,help me . thank you a lot 

May 15, 2012, 06:18 

#7 
New Member
Join Date: Mar 2012
Posts: 26
Rep Power: 5 
You define noting with the command THREAD_T0(t) in your code.
First you have to define a thread name that we point on it with the command C_THREAD_T0 and after you have to define it. Then for all command start with "C_" you have to use the cell thread that you have defined (here the name of the thread is "cell_thread". you can choose a shorter name if you want) and not the face thread. #include "udf.h" DEFINE_PROFILE(frac,t,i) { real ma=0.0002; /*initialization of mass fraction */ real grad=0.0002; /*initialization of gradient */ cell_t c; face_t f; Thread *cell_thread; /* the star is to say that we will point on it */ begin_f_loop(f,t) { c=F_C0(f,t); cell_thread=THREAD_T0(t); /* the cell thread adjacent to the face thread */ grad=C_YI_RG(c,cell_thread,i)[1]; ma=0.0000550.00002199301*grad; F_PROFILE(f,t,i)=ma; } end_f_loop(f,t) } I hope that helps you. 

May 15, 2012, 07:56 
boundary

#8 
New Member
moon
Join Date: Feb 2012
Posts: 24
Rep Power: 5 
Dear tsi ,
thank you for your information,i try it but it write me the same problem ,also i changed solver to density based because it mentioned in UDF manual 'C YI RG can be used only in the densitybased solver.' can another persone help me ? thx 

Tags 
error.change.b.condition 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Use DEFINE_ADJUST change boundary condition  liurengtong123  Fluent UDF and Scheme Programming  24  August 1, 2014 10:28 
inlet velocity boundary condition  murali  CFX  5  August 3, 2012 08:56 
Trimmed cell and embedded refinement mesh conversion issues  michele  OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ...  2  July 15, 2005 04:15 
Pressure Boundary Condition  Matt Umbel  Main CFD Forum  0  January 11, 2002 11:06 
UDF, using DEFINE_ADJUST to change a boundary condition  Jonas Larsson  FLUENT  4  March 21, 2000 19:51 