Ansys Innovation Courses

Ansys Innovation Courses

Provide feedback or ask questions related to the Ansys Innovation Courses content.

UDF running error. Fluent reports “not compiled for parallel use”

TAGGED: 

    • muhammaddanishmasood
      Subscriber

      I am having trouble loading a UDF that writes data after defined timestep. The UDF compiles without any errors, but Fluent refuses to load it whenever the code attempts to save data. The strange part is that this happens even when using a single processor in the Fluent Launcher. I am using ANSYS 2025 R2 Student version.

      If I remove the file-writing part, the UDF loads and runs normally.

      Here is the UDF:

       
      #include "udf.h"
      #include
      #define WRITE_FREQUENCY 10
      DEFINE_EXECUTE_AT_END(write_flow_data)
      int current_ts = N_TIME; if (current_ts % WRITE_FREQUENCY == 0 && current_ts > 0)
        #if RP_HOST char filename[256];
      sprintf(filename, "flowfield_ts_%d.dat", current_ts);
      Message("[UDF] Writing data file: %s\n", filename);
      Write_Data(filename);
      Message("[UDF] Done writing file.\n"); #endif

      I also tried the alternative version:

       
      #if RP_HOST RP_Write_Data(filename); #endif

      Both versions compile correctly, but when I try to load the library Fluent reports:

       
      ERROR: The UDF library you are trying to load (libudf\win64\2ddp_node\libudf.dll) is not compiled for parallel use

      This is confusing because:

      • I launch Fluent in Serial mode

      • The UDF only fails when data-writing functions are present

      • Without the Write_Data/RP_Write_Data call, the same UDF loads fine

    • Rob
      Forum Moderator

      I assume it's actually compiled, loaded and hooked into Fluent without any errors? Are there any warnings? Is time really an integer? 

      • muhammaddanishmasood
        Subscriber

        Right now, I am only checking for integral values. There are no problem while building it. But on loading, I get the error: 
        Copyright 1987-2025 ANSYS, Inc. All Rights Reserved. Compiler and linker: Microsoft Visual C++

        # Generating ud_io1.h UDF_timestep.c

        # Generating udf_names.c because of makefile UDF_timestep.obj udf_names.c

        # Linking libudf.dll because of makefile user_nt.udf udf_names.obj UDF_timestep.obj Creating library libudf.lib and object libudf.exp

        Done.

        DESKTOP-G8ISVJC:

        Opening library “C:\Fluent_UDF_Test\libudf”… ERROR: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64). The system cannot find the file specified. C:\\Fluent_UDF_Test\\libudf\\win64\\2ddp_host\\libudf.dll Done.

         

    • Rob
      Forum Moderator

      So it's not built. Try compiling with the built in CLANG compiler and see what comes up. 

    • muhammaddanishmasood
      Subscriber

      I get this error while using the built i compiler.

      Compiler path: "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v252\fluent"\ntbin\clang\bin\clang-cl

      Linker path: "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v252\fluent"\ntbin\clang\bin\lld-link

      C sources: ['MYUDF3.c']

      lld-link: error: undefined symbol: Write_Data

      >>> referenced by MYUDF3.obj:(write_flow_data)

      scons: *** [libudf.dll] Error 1

      Creating user_nt.udf file for 2ddp_node ...

      But I can build it using Visual code compiler:

      Compiler and linker: Microsoft Visual C++

      # Generating ud_io1.h

      MYUDF3.c

      # Generating udf_names.c because of makefile MYUDF3.obj

      udf_names.c

      # Linking libudf.dll because of makefile user_nt.udf udf_names.obj MYUDF3.obj

      Creating library libudf.lib and object libudf.exp

       

      Done.

       

    • Rob
      Forum Moderator

      So the built in compiler has a problem. Are you compiling the VS version in Fluent or outside Fluent? Note, a .c file can compile as it's gramatically correct but still fail to build for Fluent if it's not appropriate. 

    • muhammaddanishmasood
      Subscriber

      I am running inside fluent.

       

    • Rob
      Forum Moderator

      Have you read https://ansyshelp.ansys.com/public/account/Secured?returnurl=/Views/Secured/corp/v252/en/flu_udf/flu_udf_sec_parallel_printing_reading.html%23flu_udf_sec_parallel_reading  ?

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