CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Problems modelling nucleate boiling using mass transfer udf from tutorial

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 7, 2015, 08:23
Default Problems modelling nucleate boiling using mass transfer udf from tutorial
  #1
New Member
 
Aayush
Join Date: Feb 2015
Location: Solapur
Posts: 3
Rep Power: 11
aayushjain27 is on a distinguished road
hello friends I am trying to model nucleate boiling using mass transfer udf provided in Ansys Fluent tutorial. What modifications in the UDFwould be necessary for it. UDF of the film boiling is
Code:
#include "udf.h"
#include "sg.h"
#include "sg_mphase.h"
#include "flow.h"
#include "mem.h"



/**************************************************************/
/* UDF for specifying an interfacail area density             */
/**************************************************************/


DEFINE_ADJUST(area_density, domain)
{
  Thread *t;
  Thread **pt;
  cell_t c;
  Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE);
  real voidx, voidy, voidz=0;
  
   
  {
  Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);
  Scalar_Reconstruction(pDomain, SV_VOF,-1,SV_VOF_RG,NULL);
  Scalar_Derivatives(pDomain,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,
             Vof_Deriv_Accumulate);
   }
                
   {
      Alloc_Storage_Vars(domain, SV_T_RG, SV_T_G,  SV_NULL);
      T_derivatives(domain);
      Free_Storage_Vars(domain, SV_T_RG, SV_NULL);
    }
             
      mp_thread_loop_c (t,domain,pt)
    if (FLUID_THREAD_P(t))
      {
        Thread *tp = pt[P_PHASE];

        begin_c_loop (c,t)
          {

#if RP_3D
    C_UDMI(c,t,0) = (C_VOF_G(c,tp)[0]*C_T_G(c,t)[0]+
    C_VOF_G(c,tp)[1]*C_T_G(c,t)[1]+C_VOF_G(c,tp)[2]*C_T_G(c,t)[2]);
#endif

#if RP_2D
    C_UDMI(c,t,0) = (C_VOF_G(c,tp)[0]*C_T_G(c,t)[0]+
    C_VOF_G(c,tp)[1]*C_T_G(c,t)[1]);
#endif

          }
          end_c_loop (c,t)
         }
         
 Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);
 Free_Storage_Vars(domain, SV_T_G, SV_NULL);
}

DEFINE_SOURCE(gas, cell, thread, dS, eqn)
{

  real x[ND_ND];
  real source;
  Thread *tm = THREAD_SUPER_THREAD(thread);
  Thread **pt = THREAD_SUB_THREADS(tm);
   
  real Kl = C_K_L(cell, pt[1])*C_VOF(cell, pt[1]),
  Kg = C_K_L(cell, pt[0])*C_VOF(cell, pt[0]);
  real L = 2.26e6;

  source = (Kl+Kg)*C_UDMI(cell,tm,0) / L;
  
 
  
  C_UDMI(cell, tm, 1) = source;
  

  C_UDMI(cell, tm, 2) = -source*L;

  
  
  dS[eqn] =0;
  
  return source;
}

DEFINE_SOURCE(liquid, cell, thread, dS, eqn)
{
  real x[ND_ND];
  real source;
  Thread *tm = THREAD_SUPER_THREAD(thread);
  Thread **pt = THREAD_SUB_THREADS(tm);

  source = -C_UDMI(cell, tm, 1);
  
  dS[eqn] = 0;
  
  return source;
}

DEFINE_SOURCE(energy, cell, thread, dS, eqn)
{
  real x[ND_ND];
  real source;
  Thread *tm = thread;
  
  

  source = C_UDMI(cell, tm, 2);
  dS[eqn] = 0;
  
  return source;
}

/***********************************************************************/
/* UDF for initializing flow field variables                           */
/***********************************************************************/


DEFINE_INIT(my_init_function, domain)
{
  Thread *t;
  Thread **pt;
  Thread **st;
  cell_t c;
  Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE);
  Domain *sDomain = DOMAIN_SUB_DOMAIN(domain,S_PHASE);
  
  real xc[ND_ND], y, x;

      mp_thread_loop_c (t,domain,pt)
    if (FLUID_THREAD_P(t))
      {
        Thread *tp = pt[P_PHASE];

        begin_c_loop (c,t)
          {
     C_CENTROID(xc,c,t);
     x=xc[0];
     y=xc[1];
     
      if ( y < 0.00292 + 0.0006*cos(6.283*x/0.0778) )
      C_VOF(c,tp) = 1;
      else
      C_VOF(c,tp) = 0;

          }
          end_c_loop (c,t)
         }
         
               mp_thread_loop_c (t,domain,st)
    if (FLUID_THREAD_P(t))
      {
        Thread *sp = st[S_PHASE];

        begin_c_loop (c,t)
          {
     C_CENTROID(xc,c,t);
     x=xc[0];
     y=xc[1];
     
      if ( y < 0.00292 + 0.0006*cos(6.283*x/0.0778) )
      C_VOF(c,sp) = 0;
      else
      C_VOF(c,sp) = 1;

          }
          end_c_loop (c,t)
         }

}
Help would be deeply appreciated. I am new in this and this is definitely not my cup of tea.

Last edited by wyldckat; February 7, 2015 at 08:40. Reason: Added [CODE][/CODE]
aayushjain27 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for Subcooled Nucleate Boiling Jake Fluent UDF and Scheme Programming 3 December 30, 2019 06:10
Mass Transfer UDF using Fluent VOF Anirudh_Deodhar Fluent UDF and Scheme Programming 3 November 18, 2015 10:29
mass transfer coefficient for boundary condition niek Main CFD Forum 0 March 29, 2011 06:33
Mass Transfer UDF using Fluent VOF Anirudh_Deodhar FLUENT 0 February 7, 2011 16:10
is it possible to solve mass transfer problems in FLUENT travikiran FLUENT 2 August 11, 2010 05:46


All times are GMT -4. The time now is 01:03.