CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Compilation error in UDF for gas-solid fluidized bed (https://www.cfd-online.com/Forums/fluent-udf/103064-compilation-error-udf-gas-solid-fluidized-bed.html)

ahmadimo June 9, 2012 20:05

Compilation error in UDF for gas-solid fluidized bed
 
Hi all,

I am simulating a 2D gas-solid fluidized bed using eulerian/eulerian plus granular flow theory. I have two user-defined memory variables (C_UDMI(0) and C_UDMI(1)) and want to calculate C_UDMI(1) for each cell in my domain using C_UDMI(0) of adjacent cells.

I need to loop over all faces of a cell and find out if the solid mass flux is going into the cell or outside of it. If going into, then I will use the value of C_UDMI(0) of the adjacent cell to find out the C_UDMI(1) value. For this purpose I have written the following UDF:

Code:

DEFINE_ON_DEMAND(on_demand_calc)
{
    Domain *d;
    Thread *mix, *par_t, *tf,  *t1;
    Thread **pt;
    cell_t c, c1;
    int n, m;

    d = Get_Domain(1);   
    m = 0;
  mp_thread_loop_c (mix,d,pt)
    {
          par_t=pt[1];      /* solid phase */
          begin_c_loop(c,par_t)
          {
              c_face_loop(c, par_t, n) 
              {
                  tf = C_FACE_THREAD(c, par_t, n);
                    c1 = F_C1(tf, par_t);
                    t1 = F_C1_THREAD(tf, par_t);
                    if(F_FLUX(tf, par_t)<0)
                    {
                    C_UDMI(c, par_t, 1) += C_UDMI(c1, t1, 0);
                    m += 1;
                    }
              }
              if(m!=0)
              {
              C_UDMI(c, mix, 1) /= m;
              m = 0;
              }
              else
              {
                    C_UDMI(c, mix, 1) = -1;
              }
          }
          end_c_loop(c,par_t)
    }
}

When I try to interpret this UDF I get an error that "non-integer subscript expression: unsigned char." on the following line:

c_face_loop(c, par_t, n)

I would appreciate if you could check the issue and advice if I am going the right way or I have errors in the way of accessing data in my UDF.

Thanks
Amir

laurentb June 14, 2012 03:32

http://www.cfd-online.com/Forums/flu...face_loop.html


All times are GMT -4. The time now is 19:48.