Fluids

Fluids

UDF for BFD in driven cavity

TAGGED: 

    • Tawsif Mahmud
      Subscriber

      my source term is not working for biomagnetic fluid driven cavity. This is my code.what have i missed in my code??

       

      #include "udf.h"

      #define a 0.0250
      #define b -0.0025
      #define pi 3.1415926535
      #define gamma 0.078539816
      #define muX 1.60007704
      #define sigMu 0

      /*________ x momemtum source term ________*/ 
      DEFINE_SOURCE(xmom_source,c,t,dS,eqn)
      {
          real x[ND_ND];
          real source;
          real h,hx,hy;
          real source_magnet,source_lorentz;
          real dHx;
          C_CENTROID(x,c,t);

          /*magnetic source term*/ 
          h = gamma/(2*pi*(sqrt(pow((x[0]-a),2)+pow((x[1]-b),2))));
          dHx =  -(gamma/(2*pi))*((x[0]-a)/pow(pow((x[0]-a),2)+pow((x[1]-b),2),(3/2)));
          source_magnet =  muX * h * dHx;

          /*lorentz source term*/ 
          hx = (gamma/2*pi)*((x[1]-b)/(pow(x[0]-a,2)+pow(x[0]-a,2)));
          hy = -(gamma/2*pi)*((x[0]-a)/(pow(x[0]-a,2)+pow(x[0]-a,2)));
          source_lorentz = sigMu * ((hx*hy*C_V(c, t))-(hy*hy*C_U(c, t)));

          source = source_magnet + source_lorentz;
          return source;
      }


      /*________ y momemtum source term ________*/ 
      DEFINE_SOURCE(ymom_source,c,t,dS,eqn)
      {
          real x[ND_ND];
          real source;
          real h,hx,hy;
          real source_magnet,source_lorentz;
          real dHy;
          C_CENTROID(x,c,t);

          /*magnetic source term*/ 
          h = gamma/(2*pi*(sqrt(pow((x[0]-a),2)+pow((x[1]-b),2))));
          dHy = -(gamma/(2*pi))*((x[1]-b)/pow(pow((x[0]-a),2)+pow((x[1]-b),2),(3/2)));
          source_magnet =  muX * h * dHy;

          /*lorentz source term*/ 
          hx = (gamma/2*pi)*((x[1]-b)/(pow(x[0]-a,2)+pow(x[0]-a,2)));
          hy = - (gamma/2*pi)*((x[0]-a)/(pow(x[0]-a,2)+pow(x[0]-a,2)));
          source_lorentz = sigMu * ((hx*hy*C_U(c, t))-(hx*hx*C_V(c, t)));

          source = source_magnet + source_lorentz;
          return source;
      }

    • DrAmine
      Ansys Employee

      What do you mean with "is not working"? We cannot judge what you have implemented with UDF as that is based on our custom laws you want to add / consider or any other model formulation or source terms.

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