We’re putting the final touches on our new badges platform. Badge issuance remains temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Missing Motion.h for motion UDF compilation

    • TONY ARHUR
      Subscriber

      Hello please I am compiling a UDF for rotating screws but I receive an error message which indicates the motion.h is missing. Please where can I get this header.

    • Rob
      Forum Moderator

      Did you #include it?  Single screw or interlocking? 

    • TONY ARHUR
      Subscriber

      Please I am working on interlocking screws 

    • Rob
      Forum Moderator

      And did you #include that header? 

    • TONY ARHUR
      Subscriber

      Yes. I did include the motion.h in the script but it seems it can not be located on my file path

    • Rob
      Forum Moderator

      Did you compile the UDF? 

    • TONY ARHUR
      Subscriber

      I am trying to compile the script using the fluent setup but I received this error code which indicates the motion.h cannot be located 

    • Rob
      Forum Moderator

      I assume the solver is set to 3d and transient? Which moving mesh macro are you using? 

    • TONY ARHUR
      Subscriber

      I am using the built in compiler for this so I have not specified the mesh macro 

    • Rob
      Forum Moderator

      In the .c file, what's the motion macro? Ie DEFINE_GRID_MOTION etc. 

    • TONY ARHUR
      Subscriber

      Can I send the script over for u to have a look please

    • Rob
      Forum Moderator

      You can post it here, but I (and other Ansys staff) will only have a quick look as we don't debug code. Others aren't similarly constrained, but their participitation is voluntary. 

    • TONY ARHUR
      Subscriber

      #include "udf.h"
      #include "motion.h"

      DEFINE_CG_MOTION(rotating_screws, dt, vel, omega, time, dtime)
      {
          Thread *t;
          cell_t c;
          real omega_z1 = 300 * 2 * M_PI / 60;  // Rotational speed for screw in rad/s
          real omega_z2 = 200 * 2 * M_PI / 60;  // Rotational speed for screw-2 in rad/s

          /* Loop over all cell threads */
          c_thread_loop_c (t, dt)
          {
              /* Loop over all cells in the cell thread */
              begin_c_loop (c, t)
              {
                  /* Update the rotation of the cell centroid based on the angular velocity for screw */
                  C_CENTROID(c, t)[0] += omega_z1 * dt * (C_NORMAL(c, t)[1] * (C_CENTROID(c, t)[2] - 0.0) 
                                                       - C_NORMAL(c, t)[2] * (C_CENTROID(c, t)[1] - 0.0));
                  C_CENTROID(c, t)[1] += omega_z1 * dt * (C_NORMAL(c, t)[2] * (C_CENTROID(c, t)[0] - 0.0) 
                                                       - C_NORMAL(c, t)[0] * (C_CENTROID(c, t)[2] - 0.0));
                  C_CENTROID(c, t)[2] += omega_z1 * dt * (C_NORMAL(c, t)[0] * (C_CENTROID(c, t)[1] - 0.0) 
                                                       - C_NORMAL(c, t)[1] * (C_CENTROID(c, t)[0] - 0.0));
                  
                  /* Update the rotation of the cell centroid based on the angular velocity for screw-2 */
                  C_CENTROID(c, t)[0] += omega_z2 * dt * (C_NORMAL

    • Rob
      Forum Moderator

      I'm not sure you can calculate both motions in one macro, you may need two DEFINE_CG_MOTION sections. Compare with the example to see if there's anything else you need to do. 

      https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_DynamicMeshDEFINE.html%23flu_udf_sec_define_cg_motion

    • TONY ARHUR
      Subscriber

      My main problem has to do with the fatal error that says: motion.h file not found. I have check the installation directory and I could not find the header file "motion.h". Please where can I get this file.

    • Rob
      Forum Moderator

      I don't have that file in my install, so maybe the error is non-diagnostic. 

      And review the example - is this the macro you should be using?

       

Viewing 15 reply threads
  • The topic ‘Missing Motion.h for motion UDF compilation’ is closed to new replies.