CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Access_violation Errors when using the macros C_T_G(c,t) in FLUENT UDF (https://www.cfd-online.com/Forums/fluent/91137-access_violation-errors-when-using-macros-c_t_g-c-t-fluent-udf.html)

SuperNova79 August 1, 2011 13:52

Access_violation Errors when using the macros C_T_G(c,t) in FLUENT UDF
 
Hello,

I am using FLUENT 6.3.26 on a Windows 64 bit machine with XP installed. I am writing UDF source files in Visual Studio 2008 on the same computer.

If I use the following code without line [*] (i.e. just set grad_f = 0.0 or something), then the code will generally initialise and iterate fine. (Using interpreted UDFs for now).

#include "udf.h"
#include "mem.h"

#define K_MEMB 0.6
#define K_F 0.0242
#define T_o 310.66
#define DELTA_MEMB 0.001

DEFINE_PROFILE(heat_flux, thread, position)
{
face_t f;
cell_t c;

/*Local variables*/
real T_s, grad_f, q_f, q_memb, q_use;
real NV_VEC(A);

begin_f_loop(f, thread)
{
/*Find the relavant cell to current face*/
c = F_C0(f,thread);

/*Find the face temperature*/
T_s = F_T(f,thread);

/*Find the face area vector*/
F_AREA(A,f,thread);

/*Find the temperature gradient in the face normal direction*/
[*] grad_f = (C_T_G(c,thread)[0])*A[0] + (C_T_G(c,thread)[1])*A[1] + (C_T_G(c,thread)[2])*A[2];

/*Find the heat flux*/
q_f = -K_F*grad_f;

/*Apply this value to the boundary*/
F_PROFILE(f, thread, position) = q_f;
}
end_f_loop(f, thread)

}

When the problem is either initialised or iterations are begun (it differs from time to time), the following error pops up:

Error: FLUENT received fatal signal (ACCESS_VIOLATION)

1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.

Error Object: ()

And just cannot get it to work. It will work provided there is no mention of C_T_G(c,t). (it works with A[0], A[1] and A[2]). I have tried typing solve/set/expert into the command window and selecting yes to "keep tempory memory from being freed?", to no avail.

Any help would be very appreciated!


All times are GMT -4. The time now is 20:13.