Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Momentum source UDF in Eulerian Multiphase Flow (Fluent)

    • Asif Shahriar Nafi
      Subscriber

      For Eulerian Multiphase flow:

      As far I know, UDF of the momentum source term has to be hooked for each phase inside the "cell zone condition" (i.e., for phase 1, phase 2, etc.)

      For example:

      say for phase-1: x-momentum source term UDF is 

       

      DEFINE_SOURCE(xmom_source,cell,thread,dS,eqn)

      {

             PHASE1_U_Velocity = C_U(cell, thread);

             PHASE1_VOF = C_VOF(cell, thread);

             source = PHASE1_VOF*PHASE1_U_Velocity;

             return source ;

      }

       

      From my understanding, C_U and C_VOF here will give the Phase 1 velocity and volume fraction only. To calculate my source term, I need the PHASE2 velocity and volume fraction as well. how do I get both of them for Phase 2 inside that particular cell. 

      Thanks in Advance 

       

       

    • Rob
      Forum Moderator

      You need to access the phase thread, so start reading here   https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v241/en/flu_udf/flu_udf_GenPurposeLoopingMacros.html%23flu_udf_sec_THREAD_SUB_THREAD

    • Asif Shahriar Nafi
      Subscriber
      If my understanding is correct:
      for water (phase 1) - air (phase 2) flow (Eulerian Multiphase):

      A UDF for Phase 1 x-momentum source can be written as:

      DEFINE_SOURCE(xmom_source,cell, mixture_thread, dS, eqn)

      {    

          int phase1_domain_index = 0;           /* primary (water) phase-1 index is 0     */
         int phase2_domain_index = 1; /* secondary (air) phase-2 index is 1 */
      Thread *mixture_thread; /* mixture-level thread pointer */
      Thread *water = THREAD_SUB_THREAD(mixture_thread,phase1_domain_index);
          Thread *air = THREAD_SUB_THREAD(mixture_thread,phase2_domain_index);


             water_U_Velocity = C_U(cell, water);

             water_VOF = C_VOF(cell, water);

             air_U_Velocity = C_U(cell, air);

             air_VOF = C_VOF(cell, air);

       

             source = water_VOF*water_U_Velocity*air_VOF*air_U_Velocity;

             return source ;

      }


      Please let me know if my assumption is correct ?
      Thanks in Advance
    • Rob
      Forum Moderator

      Looks about right. Best approach is to build a simple model and test. We're unable to give UDF advice on here beyond what's in the manual, or "very obvious" in code snippets. 

Viewing 3 reply threads
  • The topic ‘Momentum source UDF in Eulerian Multiphase Flow (Fluent)’ is closed to new replies.