Fluent received fatal signal (ACCESS_VIOLATION)
Hi All,
I wrote a UDF for calculating erosion in a pipe. UDF is compiling sucessfully, but after running for some (around) iterations it is giving Access_violation error. Here is my UDF: #include "udf.h" #include "stdio.h" #include "mem.h" #define con 1 #define e 0.9988 /* Volume Fraction of Fluid */ #define rho 1650 /* Density of solids in kg/m3*/ #define d 0.127 /* Diameter of Pipe in m */ #define H 3.434e+8 /* Material Hardness in kg/msec2*/ #define vol 0.1102 /* Volume of the fluid in m3 */ DEFINE_DPM_EROSION(dpm_erosion, p, t, f, normal, alpha, Vmag, Mdot) { real a,U,res; cell_t c ; // c = F_C(f,t); real imp_vel[3]; imp_vel[0] = P_VEL(p)[0]; imp_vel[1] = P_VEL(p)[1]; imp_vel[2] = P_VEL(p)[2]; a = 3.14*d*d/4; res = (NVD_DOT(imp_vel,C_DUDX(f,t),C_DUDY(f,t),C_DUDZ(f, t))); F_STORAGE_R(f,t,SV_DPMS_EROSION) = (con*(1e)*rho*vol*res)/(a*H); } Can somebody please help me? Thanks Sravan 
C_DUDX returns the respective velocitygradient in a cell. That won't work if you give this macro a faceid f and a facethread t as arguments.
Get the cell c and cellthread ct of the adjacent cell to your wall faces and C_DUDX(c,ct) should work. cheers 
Thanks so much Coglione for your reply. I tried with the following and got the same error.
#include "udf.h" #include "stdio.h" #include "mem.h" #define con 1 #define e 0.9988 /* Volume Fraction of Fluid */ #define rho 1650 /* Density of solids in kg/m3*/ #define d 0.127 /* Diameter of Pipe in m */ #define H 3.434e+8 /* Material Hardness in kg/msec2*/ #define vol 0.1102 /* Volume of the fluid in m3 */ DEFINE_DPM_EROSION(dpm_erosion, p, t, f, normal, alpha, Vmag, Mdot) { real a,U,res; cell_t c ; // c = F_C(f,t); real imp_vel[3]; imp_vel[0] = P_VEL(p)[0]; imp_vel[1] = P_VEL(p)[1]; imp_vel[2] = P_VEL(p)[2]; a = 3.14*d*d/4; res = (NVD_DOT(imp_vel,C_DUDX(c,t),C_DUDY(c,t),C_DUDZ(c, t))); F_STORAGE_R(f,t,SV_DPMS_EROSION) = (con*(1e)*rho*vol*res)/(a*H); } Could you please suggest me? Thanks Sravan. 
Your code still does not tell Fluent for which cell (and cell thread) velocity gradients are to be evaluated.
Use c0 = F_C0(f,t); t0 = THREAD_T0(t); to get them. cheers 
Thanks coglione for your help.

Quote:
coglione, I was wondering if you could help me with the F_C0 and THREAD_T0(t) functions. Essentially, I have : thread_loop_f(t,d) { if (t == Lookup_Thread(d, ID)) { begin_f_loop(f,t) { F_UDMI(f,t,1) = 10000; C_UDMI(F_C0(f,t),THREAD_T0(t),1) = F_UDMI(f,t,1); } } } in a DEFINE_EXECUTE_AT_END(calc_ID) macro. Everything interprets fine, but when i test this in my energy source: DEFINE_SOURCE(energy_source,c,t,dS,eqn) { real source; source = C_UDMI(c,t,1); return source; } the UDMI(1) is a 0 when I check it via running a few iterations. Any suggestions? 
All times are GMT 4. The time now is 11:36. 