CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   error C2107: illegal index, indirection not allowed (https://www.cfd-online.com/Forums/fluent/114863-error-c2107-illegal-index-indirection-not-allowed.html)

Raymond.Leoi March 19, 2013 04:26

error C2107: illegal index, indirection not allowed
 
An udf is to specify heat flux by means of the secondary gradient source of temperature, C_T_G(c0,t0). The error, error C2107: illegal index, indirection not allowed, occured when executing the following udf. Any suggestion for this problem?

DEFINE_PROFILE(heat_flux_bc, thread, position)
{
face_t face;
Thread *t0;
cell_t c0;
real xf[ND_ND], xf_shdw[ND_ND];
real T0_shdw, Tf_shdw;
real A[ND_ND],At;
real dT[ND_ND],dr0[ND_ND],es[ND_ND],ds,A_by_es;
real gamma0,alpha0,aterm,Tcross,Tprim;

begin_f_loop (face,thread)
{
c0 = F_C0(face,thread);
t0 = THREAD_T0(thread);

BOUNDARY_FACE_GEOMETRY(face,thread,A,ds,es,A_by_es ,dr0);
At = NV_MAG(A);

if (NULLP(T_STORAGE_R_NV(t0,C_T_G(c0,t0))))
Tcross = 0.;
else
BOUNDARY_SECONDARY_GRADIENT_SOURCE(Tcross,C_T_G(c0 ,t0),dT,es,A_by_es,1.);


F_PROFILE(face,thread,position) = 20000.; /* just for udf testing*/
}
end_f_loop (face,thread)
}

vasava March 19, 2013 06:49

I think you must point properly the name of the boundary or cell where you want to apply these conditions. Your code has several flaws which are causing the errors.

1. DEFINE_PROFILE(heat_flux_bc, thread, position). I think 'thread' is a keyword and you can not use it to for a boundary name.

2. You must point the face or cell where the condition is applied. e.g.
DEFINE_PROFILE(pressure_profile,t,i)
{
face_t*f;
.....
begin_f_loop(f,t)


Also 'face_t face;' and 'cell_t c0;' together are wrong. You could have either of them. In addition you also have 'Thread *t0;' which is again bit strange.

As far as I know face_, cell_ and Thread *t0 are pointers which point to the surface or cell where the profile is to be applied.

You have declared 'real gamma0,alpha0,aterm,Tcross,Tprim;'. However many of these variables have not be used in the code.

Other Readers: If any of my comments are wrong please correct me.

Raymond.Leoi March 19, 2013 07:21

Thanks a lot for your reply, Vasava. It should be fine to declare face, cell and thread in that way. c0 and t0 are for the adjacent cell index and thread respectively. I just demonstrated small part of my udf and those variables including Tcross are used indeed. Anyway, that would not be a problem.


Quote:

Originally Posted by vasava (Post 414952)
I think you must point properly the name of the boundary or cell where you want to apply these conditions. Your code has several flaws which are causing the errors.

1. DEFINE_PROFILE(heat_flux_bc, thread, position). I think 'thread' is a keyword and you can not use it to for a boundary name.

2. You must point the face or cell where the condition is applied. e.g.
DEFINE_PROFILE(pressure_profile,t,i)
{
face_t*f;
.....
begin_f_loop(f,t)


Also 'face_t face;' and 'cell_t c0;' together are wrong. You could have either of them. In addition you also have 'Thread *t0;' which is again bit strange.

As far as I know face_, cell_ and Thread *t0 are pointers which point to the surface or cell where the profile is to be applied.

You have declared 'real gamma0,alpha0,aterm,Tcross,Tprim;'. However many of these variables have not be used in the code.

Other Readers: If any of my comments are wrong please correct me.



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