We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

User Defined Function Error – Invalid type for binary expression

    • 15753433
      Subscriber

      Hi everyone,


      I am trying to upload a User Defined Function to Ansys and it gives me the following error:

      line 18: invalid type for binary expression: int + pointer to structure.


      Here is the code that I am trying use:

      #include"udf.h"
      DEFINE_PROPERTY(moving_wall, thread, u)
      {

      /* Declare variables */
      float t, speed;
      face_t f;

      /* Get time */
      t = RP_Get_Real("flow-time");

      /* Calculate speed */
      speed = 1.6 * sin(3.8 * t);

      /* Apply speed to face */
      begin_f_loop(f, thread)
      {
      F_PROFILE(f, thread, u) = speed;
      }
      end_f_loop(f, thread)
      }



      *PS - I am new to Ansys and coding so please dont use any shorthand explanations, if possible.

      Thank you!

    • Luca B.
      Forum Moderator

      Hi, i can try to help you. what is line 18? there is not numbering.

      anyway it seems you are combining differt type of variable, can you debug and identify the wrong command line? 

       

      Thanks

      Luca

       

    • 15753433
      Subscriber

      Hi Luca,

       

      Thank you for the response.

       

      I tried to copy and paste the code from a PDF, originally. And it didnt want to work. I eventually typed out the code over from scratch, and then it worked fine!

Viewing 2 reply threads
  • The topic ‘User Defined Function Error – Invalid type for binary expression’ is closed to new replies.