-
-
May 30, 2023 at 9:09 am
TONY ARHUR
SubscriberHello 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.
-
May 30, 2023 at 11:05 am
Rob
Forum ModeratorDid you #include it? Single screw or interlocking?
-
May 30, 2023 at 11:07 am
TONY ARHUR
SubscriberPlease I am working on interlocking screws
-
May 30, 2023 at 11:08 am
Rob
Forum ModeratorAnd did you #include that header?
-
May 30, 2023 at 11:10 am
TONY ARHUR
SubscriberYes. I did include the motion.h in the script but it seems it can not be located on my file path
-
May 30, 2023 at 1:17 pm
Rob
Forum ModeratorDid you compile the UDF?
-
May 30, 2023 at 1:30 pm
TONY ARHUR
SubscriberI am trying to compile the script using the fluent setup but I received this error code which indicates the motion.h cannot be located
-
May 30, 2023 at 1:39 pm
Rob
Forum ModeratorI assume the solver is set to 3d and transient? Which moving mesh macro are you using?
-
May 30, 2023 at 1:44 pm
TONY ARHUR
SubscriberI am using the built in compiler for this so I have not specified the mesh macro
-
May 30, 2023 at 1:47 pm
Rob
Forum ModeratorIn the .c file, what's the motion macro? Ie DEFINE_GRID_MOTION etc.
-
May 30, 2023 at 1:55 pm
TONY ARHUR
SubscriberCan I send the script over for u to have a look please
-
May 30, 2023 at 2:19 pm
Rob
Forum ModeratorYou 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.
-
May 30, 2023 at 2:22 pm
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 -
May 30, 2023 at 3:13 pm
Rob
Forum ModeratorI'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
-
May 30, 2023 at 6:22 pm
TONY ARHUR
SubscriberMy 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.
-
May 31, 2023 at 10:26 am
Rob
Forum ModeratorI 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?
-
- The topic ‘Missing Motion.h for motion UDF compilation’ is closed to new replies.
-
4914
-
1608
-
1386
-
1242
-
1021
© 2026 Copyright ANSYS, Inc. All rights reserved.