- **FLUENT**
(*http://www.cfd-online.com/Forums/fluent/*)

- - **an error problem for a change of boundary condition**
(*http://www.cfd-online.com/Forums/fluent/99146-error-problem-change-boundary-condition.html*)

an error problem for a change of boundary conditionHI every body,
it's my first time on this forum.:D 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,(n-1))+TAU0*(1-exp(-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_MAG-SL)/(VC_MAG*Cf); } } end_f_loop(f, thread) } //////////////////////////// Thanks for your help !! :) |

a simplified issue to solve my problemHere 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"` Thanks....... |

Can I call an adjacent cell with an other way ?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 ? |

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. |

I understood now !Thank you very much Banty :), I have not seen that when I wrote my UDF.
It works perfectly now ! :D thank you ! |

boundary condition problemsi 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.000055-0.00002199301*grad; F_PROFILE(f,t,i)=ma; } end_f_loop(f,t) } please ,help me . thank you a lot |

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.000055-0.00002199301*grad; F_PROFILE(f,t,i)=ma; } end_f_loop(f,t) } I hope that helps you. ;) |

boundaryDear 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 density-based solver.' can another persone help me ? thx |

All times are GMT -4. The time now is 02:12. |