动态接触角

更新时间:2023-05-15 16:02:09 阅读: 评论:0

#include "udf.h"
#include "sg_mpha.h"
#include "sg_vof.h"
#include "sg.h"
#include "mem.h"


#define VISCOSITY 0.001
#define SURF_TENS 0.0728
#define MYTRUE 1
#define MYFALSE 0
#define Hoff(x) acos(1-(2.0*tanh(5.16*(pow((x/(1+(1.31*pow(x, 0.99)))), 0.706)))))
#define static_Con_Ang 60.
#define index_source 2



/* This Code computes the normals of the VOF function*/

DEFINE_ADJUST(store_gradient, domain)
{
      Thread *t;
      Thread **pt;
          Thread *phat;

      cell_t c;
      int pha_domain_index = 1;  /* Secondary Domain */
      Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,pha_domain_index);
      void calc_source();           

      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);


      mp_thread_loop_c (t,domain,pt)
         if (FLUID_THREAD_P(t))
           {
              Thread *ppt = pt[pha_domain_index];
                          begin_c_loop (c,t)
               {
                  calc_source(c,t);
               }
              end_c_loop (c,t)
           } 
      Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);
     

}

void calc_source(cell_t cell, Thread *thread)
   {
   
  real VOF_Val[2], VOF_Mag, source, VOF_Norm[2];
  Thread *phat;
  phat= THREAD_SUB_THREAD(thread,1);

perjury  if(C_VOF(cell,phat)!=0.0 && N_TIME > 1)
    {
    /* The gradients of the VOF function are found in the x,y and z dir.  */
                if (NULLP(THREAD_STORAGE(phat, SV_VOF_G)))
          {
            Message0("N_TIME = %d, ....show-grad:Gradient of VOF is not available \n ", N_TIME); 
      Error("0");
          }
    VOF_Val[0]=-C_VOF_G(cell,phat)[0];
拜拜的英文    VOF_Val[1]=-C_VOF_G(cell,phat)[1];
 

    /* The magnitude of the VOF gradients is found so it can be normalized  */
    VOF_Mag=NV_MAG(VOF_Val);
    if(VOF_Mag!=0.0)
      { everyday
      VOF_Mag=NV_MAG(VOF_Val);
      VOF_Norm[0]=VOF_Val[0]/VOF_Mag;
      VOF_Norm[1]=VOF_Val[1]/VOF_Mag;
   
      }
easyjet    el
      {
      /* This is to avoid the divide by zero function*/
      VOF_Norm[0]=0.0;
      VOF_Norm[1]=0.0;
   
      }
    C_UDMI(cell,thread,0)=VOF_Norm[0];
    C_UDMI(cell,thread,1)=VOF_Norm[1];
   }
     source=0.0;
   C_UDMI(cell,thread,index_source)=source;
  }
DEFINE_SOURCE(VOF_Norms, cell, thread, dS, eqn)
{
   real source;
      source = C_UDMI(cell, thread, index_source);
   return source;

}

DEFINE_PROFILE(con_ang, t, pos)
{
  /* First the various pointer variables are created*/
  face_t f;
  cell_t c;
  real feta_d, vel_Val[2], cont_Line_Vel, VOF_Normal[2], cap_Num, static_Con_Rad, x_Bottom,
x_Top, x_Bict, hoff_Old, hoff_Cur, hoff_New, finish_Cond, inv_Hoff=0.0;
上海文来中学  int notConverged, itNum;
  Thread *t0,*pt;

/* This code is designed to find the zero for the inverted hoffman function by finding the zero  */
neither的用法/* of the function at which the hoffman function results in the static contact angle    */
  /* First the variables are assigned*/
  notConverged=MYTRUE;
  x_Bottom=0.001;
  x_Top=2.0;
  itNum=0;
    static_Con_Rad=((static_Con_Ang*M_PI)/180.);
  /* A while loop performs the biction method, a simple but very stable zero finder  */
  while(notConverged)
    {
    /* The variables ud in the biction method are assigned and the hoffman   */
    /* functions are evaluated            */
    itNum++;
    hoff_Old=(Hoff(x_Bottom)- static_Con_Rad);
    hoff_Cur=(Hoff(x_Top)- static_Con_Rad);
    x_Bict=(x_Bottom+x_Top)/2.0;
    hoff_New=(Hoff(x_Bict)- static_Con_Rad); nexus
    finish_Cond=fabs(1-(x_Bict/x_Top));

    /* The loop ends when the relative error is less than 1e-8 and the inver  */
    /* hoffman value is stored for u later          */
    if(finish_Cond<0.00000001 || itNum>10000000)
      {
      inv_Hoff=x_Bict;
      notConverged=MYFALSE;
      }
    /* Conditions for the biction method         
英语口语班成都  */
    if((hoff_Old*hoff_New)<0.0)
humanoid      {
      x_Top=x_Bict;
      }
    if((hoff_Cur*hoff_New)<=0.0)
      {
      x_Bottom=x_Bict;
      }
     
    }
/* Now the main loop goes through all the faces in the boundary         */
  begin_f_loop(f,t)
          { 

    /* The cell and pha threads are isolated           */
    c=F_C0(f,t);
    t0=THREAD_T0(t);
              pt= THREAD_SUB_THREAD(t0,1);
    /* The main formulation is only applied if the VOF is >0      */
    if(C_VOF(c,pt)!=0.0)
      {
      /* The velocities are recorded in each direction      */
      vel_Val[0]=C_U(c,t0);
      vel_Val[1]=C_V(c,t0);
the lucky one
     
      /* The VOF normals are brought in         
  */
      VOF_Normal[0]=C_UDMI(c,t0,0);
      VOF_Normal[1]=C_UDMI(c,t0,1);
     
      /* The contact line vel. is calc from the dot product of VOF and Vel  */
      cont_Line_Vel=NV_DOT(vel_Val,VOF_Normal);
     
      /* The capillary number is found bad on cont line vel.    */
      cap_Num=fabs((VISCOSITY*cont_Line_Vel)/SURF_TENS);

      /* The dynamic contact angle is defined then stored in the profile  */
               if(cap_Num+inv_Hoff<0.0)
         {
        cap_Num=inv_Hoff;
         }
      feta_d=((Hoff(cap_Num+inv_Hoff))*180)/M_PI;
      F_PROFILE(f,t,pos)=feta_d;
 
      }
    el
      {
      F_PROFILE(f,t,pos)=static_Con_Ang;
      }
         }
  end_f_loop(f,t)
}

本文发布于:2023-05-15 16:02:09,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/109529.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:中学   上海
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图