Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Dynamic Mesh DEFINE_GRID_MOTION UDF Errors

    • jdch232
      Subscriber

      Hello,

      I'm attempting to model a flexible flat plate using using a UDF with the DEFINE_GRID_MOTION macro in Fluent 2025 R1 student through Workbench. I'm new to using UDFs, though I have gotten some working. I'm defining a flexible plate as one that alternates between flat and bulging outwards in several peaks over time.

      I'm using the following equation for y-velocity: Vy = (5pi/33) * (sin{2pi * t - 1.5} + 1) * sin{10000pi * x}

      This results in a plate alternating between flat at 0s, 1s, 2s, ... and a flexed at 0.5s, 1.5, 2.5s, ..., as shown below.

      I'm using the following c code:

      #include "udf.h"

      DEFINE_GRID_MOTION(flexible_wall_velocity, domain, dt, time, dtime)
      {
        Thread *t;
        face_t f;
        Node *v;
        real NV_VEC(velocity);

        thread_loop_c(t, domain)
        {
            // Loop across faces in wall
            begin_f_loop(f, t)
            {
              // Loop across nodes of face
              f_node_loop(f, t, v)
              {
                // Current node's coordinates
                real x_coord = NODE_X(v);
                real y_coord = NODE_Y(v);

                // Calculate velocity based on x_coord and time
                velocity[0] = 0;
                velocity[1] = (5 * 3.14159 / 33) * (sin(2 * 3.14159 * time - 1.5) + 1) * (sin(1000 * 3.14159 * x_coord));

                // Update node's position from calculated velocity
                NODE_X(v) += velocity[0] * dtime;
                NODE_Y(v) += velocity[1] * dtime;
              }
            }
            end_f_loop(f, t)
          }
        }

      When I compile the code in Fluent I get this warning: 

      "warning: ordered comparison between pointer and integer ('Node *' (aka 'struct _tg_node_struct *') and 'int')

                  f_node_loop(f, t, v)

                  ^~~~~~~~~~~~~~~~~~~~"

      I've looked into this and found it's saying I'm comparing a pointer variable and an integer. Though I'm having trouble seeing where.

      Then when I create the dynamic mesh on the plate, I get this warning:

      "Warning: incorrect cg motion UDF flexible_wall_velocity::libudf on zone 10 (assuming no motion)"

      This confuses me as I'm not using the CG Motion macro. Does anyone have any advice or direction I could take?

Viewing 0 reply threads
  • You must be logged in to reply to this topic.