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.

Implement a Command Prompt inside UDF of Fluent

    • s.sethuraman
      Subscriber

      Hi, 

      I want to run a line of cmd prompt inside my C UDF on iteration runtime in Fluent. Is it possible to do so?

      Because I enconunter numerous errors while running iteration. So, I want to know if it is due to my UDF or if Fluent cannot interfere/access cmd. 

      Thanks in advance. :)

    • Rob
      Forum Moderator

      You can use an embedded Scheme command in a UDF however it's not always a trivial operation. What are you trying to achieve? 

    • s.sethuraman
      Subscriber

      Hi, Rob. 

      Thanks for the answer. I have already tried it but it didn't fully work. 

      The UDF is a DEFINE_SOURCE UDF. Inside the UDF, I want to run a custom Chemistry Calculator (coded in Python) which will take the C_Yi and C_T and return R_i. Since the Chemistry Calculator is in .py, I could not make it run (neither direct coupling inside UDF nor accessing it via cmd. I cannot write a PyUDF for chemistry source term as you have previously mentioned in another post, atleast not yet in 2025R1). The UDF struggles to get the output which is printed in the cmd window into Fluent Interface. Printing the output of cmd to temporary.txt and then asking the C UDF to read the .txt also fails for some reason. 

      So, I am currently rewriting the .py program into C :( 

      Any suggestions regarding these issues would be helpful :)

      Thanks in advance. 

    • Rob
      Forum Moderator

      Fluent cpu doesn't have full Python UDFs, and Fluent gpu doesn't yet have all of the model hooks.  

      Some of the coupling functions (and Ansys software) let you link to an external library/code but if the chemistry solver is simple it may be better in the UDF for now. 

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