Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

mass transfer UDF error

    • majam
      Subscriber

      Hello,


      I want to use a conditional statement in my UDF for mass transfer so that if the O2 concentration is more than saturation the mass transfer is zero otherwise it uses a formula to calculate mass transfer, Can anyone tell me what I am doing is correct or not?


      #include "udf.h"

      real m_lg;


      DEFINE_MASS_TRANSFER(kl_my2, cell, thread, from_index, from_species_index, to_index, to_species_index)

      {


      cell_t c;


      Thread *liq= THREAD_SUB_THREAD(thread, to_index);



      m_lg = 0.0;


      if ( C_YI(c,liq,to_species_index) < 0.00009379)

      {

      m_lg = ((0.4)*0.0000443846*pow(C_D(c,thread)*C_R(c,liq)/C_MU_EFF(c,liq), 0.25));

      }

      else

      {

      m_lg= 0.0;

      }

      end


      C_UDMI(c,thread,0)=m_lg;



      return m_lg;

      }



      I get an error: undeclared variable for the part where I use C_YI, I do not know why?


      Thanks,

    • Murari Iyengar
      Ansys Employee
      Hi Majam The syntax is incorrect for C_YI. It should be of the form C_YI (c,t,i) where i is the species mass fraction.
      You can find more information on Cell Macros below.

      3.2.3. Cell Macros (ansys.com)


    • DrAmine
      Ansys Employee
      I think it is best if you rather show what you want to do and which formula you want to use. Mass Fraction macro seems to be Okay (cc) but you are using the wrong cell index:
      DEFINE_MASS_TRANSFER(kl_my2, cell, thread, from_index, from_species_index, to_index, to_species_index): cell index is cell. Moreover check if the to_phase is a multicomponent phase.
      Moreover how are you "estimating" the saturation mass fraction?
    • majam
      Subscriber
      -hi
      yes, thank you answers. I think the macro is fine now. But the results are still troubling.
      Both from and two phases are multi-component. The from phase consists of O2,N2 and to phase is O2(liquid), glucose, biomass, and water.
      I use henry's law and use this UDF for the overall mass transfer rate. Henry's law is supposed to take care of equilibrium but without this limiting condition that I mentioned in my first comment the dissolved O2 concentration increases to a very high amount (200 mg O2 !!!) so I need to define that mass transfer is allowed if the cell concentration is less than 8mg/l

      -(or maybe I should define it for the overall concentration of O2 instead of cell???)

      Thanks
    • DrAmine
      Ansys Employee
      I cannot comment on results issuing from a UDF.
Viewing 4 reply threads
  • You must be logged in to reply to this topic.