Fluids

Fluids

COMPILATION errors and Hooking UDFs to ANSYS Fluent

    • Aditi Deekshita Pallay
      Subscriber

      Hello!

      I am currently working on CFD Analysis of a synthetic jet actuator modelled inside a 2D aerofoil using ANSYS Fluent 2022 R2 Student Version. All the modelling and meshing is done. I am able to compile the udf but it is not visible in the drop down menu while giving the boundary condition of the diaphragm.

      I have also installed Microsoft Visual Studio and tried. It isn't working.

      So then I have interpreted my code and checked that I was able to select it from the drop down menu of the velocity inlet boundary condition. But when I initialise the project, i am getting a "BAD TERMINATION" error and the fluent is closing.

      Can anyone suggest a possible solution for the compilation or interpretation procedures for loading udf in my case?

      This is a simple code that I used:

      #include "udf.h"
      #define pi 3.1415926535
       
      DEFINE_CG_MOTION(diaphragm_motion, dt, vel, omega, time, dtime)
      {
          real amplitude = 0.1; 
          real frequency = 1.0; 
       
          vel[1] = amplitude * frequency * cos(2 * pi * frequency * time);
          omega[1] = -2 * pi * amplitude * frequency * sin(2 * pi * frequency * time);
      }

       

    • Rob
      Ansys Employee

      As a starting point I'd use the built in compiler as finding all of the Microsoft components and getting them to work is somewhat more complex than it ought to be. Also, do not interpret any code, that's going to cause all sorts of problems with complex macros. 

      I'd then review the mesh, large jumps in cell size are really not going to make your model any more stable. 

    • Aditi Deekshita Pallay
      Subscriber

      Thank you for your response. 
      If I use a built in compiler there are many errors for the undeclared variables and other predefined functions and non existing directories. That's the reason I had to install Microsoft Visual Studio and then compile it . It has successfully compiled but I think the macro that I used which is DEFINE_CG-MOTION is only useful for the dynamic mesh case and one cannot find the loaded udf into the boundary condition of the velocity inlet for that macro. 
      However if I use another macro such as DEFINE_PROFILE for defining the motion of the diaphragm I encountered so many errors. I'm not able to figure out which kind of code is compatible with the existing user defined function directories of ANSYS Fluent 2022 R2. 

      This is the code that I have written using DEFINE_PROFILE

      #include "udf.h"

      #include .h>

      DEFINE_PROFILE(diaphragm_motion, t, i)

      {

      real x[ND_ND];

      real y;

      face_t f;

      begin_f_loop(f, t)

      {

      F_CENTROID(x,f,t);

      y = sin(2 * M_PI * x[0]);

      F_PROFILE(f, t, i) = y;

      }

      end_f_loop(f, t)

      }

       

    • Rob
      Ansys Employee

      Maybe read this  https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_DynamicMeshDEFINE.html%23flu_udf_sec_define_grid_motion    as it's the one I used. DEFINE_PROFILE is for properties on a boundary, so velocity, temperature etc and is nominally superseded by Expressions. 

      If the built in compiler is returning a load of complaints it's usually a good idea to read these and fix them. 

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