Fluids

Fluids

DEFINE_GRID_MOTION + UDF

    • mreza65
      Subscriber

      Hi there,


      I prepared a UDF, I was wondering to know that is it correct? 


      #include "udf.h"


      DEFINE_GRID_MOTION(membrane, domain, dt, time, dtime)


      {


        Thread *tf = DT_THREAD(dt);


      face_t f;


      Node *node_p;


      real x, y;


      int n;


      /* Set/activate the deforming flag on adjacent cell zone, which */


      /* means that the cells adjacent to the deforming wall will also be */


      /* deformed, in order to avoid skewness. */


      SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf));


      begin_f_loop (f, tf)


      {


      f_node_loop (f, tf, n)


      {


      node_p = F_NODE (f, tf, n);


       


      if (NODE_POS_NEED_UPDATE (node_p))


      {


       


      NODE_POS_UPDATED (node_p);


      x = NODE_X (node_p);


      y = 0.00004*(1.0-(x*x))*sin(2.0*M_PI*560.0*CURRENT_TIME);


      NODE_Y (node_p) = y;


      }


      }


      }


      end_f_loop (f, tf);


      }


       


      regards

    • DrAmine
      Ansys Employee
      Ansys staff do not debug udf. Try it and introduce some messages which help to debug.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.