Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

How to look for a face in a UDF?

TAGGED: ,

    • Gloria
      Subscriber

      Hello! I am building a UDF and at some point, I need to use the property of a cell adjacent to the wall/another cell. For that purpose, I use macros THREAD_T(t) and F_C0(f, t). Then, I need to define a face, but warning C4700 appears after compiling the UDF and Fluent closes after hitting calculate. The warning points out that local variable ‘f’ is used without being initialised.

      Here it is the section of my UDF that is causing me problems:

      DEFINE_DPM_SOURCE(udf_source, c, t, S, strength, tp)

      {

      (…)

      real C1;

      int i;

             Domain *domain;

             Thread *tg, *t0;

             cell_t cell;       

             face_t f;

             domain = Get_Domain(1);          

             tg = Lookup_Thread(domain, 7); // ID wall = 7

             begin_c_loop(cell, tg)                        

             {

                   cell = F_C0(f, tg);                     

                   t0 = THREAD_T0(tg);              

                   C1 = C_YI(cell, tg, 0);

             }

             end_c_loop(cell, tg)

      (…)

      }

      I am aware that the are some restrictions on answering UDF questions, but I would appreciate any hint anybody can give me about this. How can I initialise 'f'? Am I approaching it in the right way? Thank you!

    • Rob
      Ansys Employee

      Face thread isn't passed by the macro (no f in the macro), so I wonder if https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_GenPurposeLoopingMacros.html%23flu_udf_sec_thread_loop_f  is what you'll need. 

Viewing 1 reply thread
  • You must be logged in to reply to this topic.