Fluids

Fluids

Calculating OSI

    • Jhash
      Subscriber

      Hello Everyone,


      I tried to solve OSI using the UDF as follow:


      /******************************************************


      Oscillatory shear index


      ******************************************************/


       


      #include "udf.h"


      #include "math.h"


      #include "storage.h"


      #include "sg_udms.h"


       


      #define domain_ID 1


      #define zone_ID 7


       


      /* Define Names for the WSS UDMI and its components */


      DEFINE_EXECUTE_ON_LOADING(nameinit, libudf)


      {


      Set_User_Memory_Name(0, "uWSS");


      Set_User_Memory_Name(1, "uWSSx");


      Set_User_Memory_Name(2, "uWSSy");


      Set_User_Memory_Name(3, "uWSSz");


      Set_User_Memory_Name(4, "OSI");


      }


       


       


      /* Initialize the UDM value to zero in complete domain */


      DEFINE_INIT(meminit,domain)


      {


      Thread *c_thread;


      cell_t c;


       


      thread_loop_c(c_thread,domain)


      {


      begin_c_loop(c, c_thread)


      {


      C_UDMI(c,c_thread,0)= 0;


      C_UDMI(c,c_thread,1)= 0;


      C_UDMI(c,c_thread,2)= 0;


      C_UDMI(c,c_thread,3)= 0;


      C_UDMI(c,c_thread,4)= 0;


      }


      end_c_loop(c, c_thread)


      }


      }


       


      /* Calculate wall shear stress and store them in UDM */


      DEFINE_EXECUTE_AT_END(OSI)


      {


      Domain *domain;


      real area;


      face_t f;


      real A[ND_ND];


      cell_t c, c0;


      Thread *t,*t0, *c_thread;


      real wallshear [ND_ND];


       


      domain = Get_Domain(domain_ID);


      t = Lookup_Thread(domain,zone_ID);


       


      begin_f_loop(f, t)


      {


      F_AREA(A,f,t);


      area = NV_MAG(A);


      NV_V(wallshear,=,F_STORAGE_R_N3V(f,t, SV_WALL_SHEAR));


      c0 = F_C0(f,t);


      t0 = THREAD_T0(t);


      C_UDMI(c0,t0,0) += NV_MAG(wallshear)/area;


      C_UDMI(c0,t0,1) += -wallshear[0]/area;


      C_UDMI(c0,t0,2) += -wallshear[1]/area;


      C_UDMI(c0,t0,3) += -wallshear[2]/area;


      C_UDMI(c0,t0,4) = (1.-sqrt(C_UDMI(c0,t0,1)*C_UDMI(c0,t0,1) + C_UDMI(c0,t0,2)*C_UDMI(c0,t0,2) + C_UDMI(c0,t0,3)*C_UDMI(c0,t0,3))/C_UDMI(c0,t0,0))/2;


      }


      end_f_loop(f,t)


      }


      But, I have faced a problem after starting calculation. I checked the results in report but FLUENT show just 0 as result for all parameters which defined in UDM. Would you please help me for fixing the problem?


      Thanks.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.