CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Fluent received fatal signal (ACCESS_VIOLATION) (http://www.cfd-online.com/Forums/fluent-udf/79093-fluent-received-fatal-signal-access_violation.html)

sravan451 August 12, 2010 04:57

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/m-sec2*/

#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*(1-e)*rho*vol*res)/(a*H);

}

Can somebody please help me?



Thanks
Sravan

coglione August 12, 2010 06:07

C_DUDX returns the respective velocity-gradient in a cell. That won't work if you give this macro a face-id f and a face-thread t as arguments.
Get the cell c and cell-thread ct of the adjacent cell to your wall faces and C_DUDX(c,ct) should work.
cheers

sravan451 August 12, 2010 09:58

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/m-sec2*/

#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*(1-e)*rho*vol*res)/(a*H);

}

Could you please suggest me?

Thanks
Sravan.

coglione August 13, 2010 04:22

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

sravan451 August 17, 2010 03:04

Thanks coglione for your help.

ximik May 10, 2011 23:37

Quote:

Originally Posted by coglione (Post 271378)
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


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.