Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Understanding of contact detection UDF

    • Lee
      Subscriber

      Hello, everyone:

       I am now using ‘contact detection’ function to keep a distance between two faces(one is stationary and the other is moving), some part of the UDF for contact detection is a little hard for me to understand since some macros cannot be found in UDF manual, so I am here asking for help to figure the whole things out.

       UDF code is presented and divided into five parts according to my understanding of its logic, which is shown in Figure 1, besides, this code originates from Example1 of DEFINE_CONTACT in official UDF manual.

       Any advice will be appreciated, please help me understand those macros and share your point on the UDF code and my corresponding comments, thanks a lot!

      Regards,

      Excited

      UDF macros which cannot be found in UDF manual:

      1.What is ‘Objp’? (Part 1, line 6)

      2. Loop(o, contacts) (Par2 line 33)

      Loop the elements which pointer 'o' points to in contacts?

      3.face = O_F(o) (Par2 line 35)

      4.thread = O_F_THREAD(o) (Par2 line 36)

      5.REAL_MIN (Par3 line 79)

      6. SDOF_Get_Motion(dt, vel0, omega0, theta0) (Par4 line 113)

      Get the motion property of the structure which thread dt points to, velocity(vel0), revolution speed(omega0) and degree produced by revolution(theta0), am I right?

      7. SDOF_Overwrite_Motion(ndt, vel1, omega1, theta1) (Par5 line 144)

      Overwrite the motion property of thread ‘ndt’, the new property of motion is: velocity_new = vel1, revolution speed_new = omega1 and degree_new = theta1, am I right?


      Logic problem

      1./* 'Fetch current thread ID'---UDF manual, */ what does 'current thread' mean? (part 2, line 29),

      2.tid = THREAD_ID(DT_THREAD(dt)), 'dt' was not defined in previous statement, why it can be used here? (part 2, line 30)

      3.nid = -1; what is nid? why nid = -1? (part 2, line 31)

      4.n_faces++, Obtain the total number of faces on face ‘nid’? (part 2, line 56)

      5. N3V_S(xc, /=, n_faces), Is this operation to obtain the centroid of whole face? if so, is it an axiom? (part, line 81)

      6. ndt = THREAD_DT(thread), convert thread to dynamic thread, thread is the pointer of face ‘nid’, why do this operation? (part 4, line 110)

      7./* Reflect velocity across the normal */

      v1dotn0 = 2 * N3V_DOT(vel1, norm0);

      N3V_S(norm0, *=, v1dotn0);

      N3V_V(vel1, -=, norm0);

      why not just N3V_V(vel1, -=, 2*vel1) , why obtain the final vel1 through normal vector? (part 5, line 139-142)?


    • Surya Deb
      Ansys Employee
      Hello,
      N3V_* macros are used to perform vector operations like assignment of values to vector components or performing dot product etc.
      I would recommend you to test this using a simple UDF.
      Regards SD


    • MathBorges
      Subscriber
      Hi' I'm trying to use contact detection too, but as you I'm fronting difficult to understand the codes on udf manual, Did you resolve your problem? where did you learn to resolve?
Viewing 2 reply threads
  • The topic ‘Understanding of contact detection UDF’ is closed to new replies.