Simple Harmonic UDF

    • RCamp

      Hi all, 

      I am attempting to write a UDF such that a simple harmonic vibration is loaded into the entire fluid region of my model. Something such that the velocity would be:

      vel[t] = sin(2*M_PI*freq*time)

      I wrote a simple code: 

      "    #include "udf.h"

      real freq = 1.;

      DEFINE_CG_MOTION(osc, dt, vel, omega, time, dtime) {

      vel[0] = sin(2*M_PI*freq*time); }   "

      However, I am extremely new to coding and this code keeps kicking back the following errors in the TUI and GUI when I am trying to hook it to Fluent: 


      Can someone help explain what I am doing wrong? 



    • desouzadacosta

      It says is missing  the curly brackets

    • Keyur Kanade
      Ansys Employee


      Here is example for this macro. 

      Also your error says about parallel. Make sure that you use serial mode for serial udf. If you are using parallel mode then you may need to convert serial udf to parallel. 



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