Aidan Murphy


In the last few months of developing and validating the UDF I have, I spent a majority of my time reading through the entire UDF manual to understand how to modify all the terms and use specific macros to customize the turbulence model. I know of other CFD codes that are open-source and allow for alteration of the built-in turbulence modeling using their source code, however, I would like to continue using Fluent. I know ANSYS employees typically can not help too much due to proprietary information, however, if you are able to assist in the theory of how I developed and implemented the UDF, that would be greatly appreciated.

Currently, the UDF I have is supposed to alter the SA transport variable (nu tilde), but the results for the hypersonic flat plate and compression corner cases I have run do not change between the SA model in fluent (which is actually the SA-noft2 according to the Fluent Theory Guide) and my UDF for the SA-noft2-CatrisCon turbulence model. Below I will outline my method for coding the UDF and the implementation method and if you are able to note any discrepancies in the proper method of implementing the UDF it would be greatly appreciated.

The UDF is currently coded as follows:

  • Define all necessary coefficients
  • Define the user-defined source term and all the memory location variables needed
    • I also include a definition that allows for the reconstructive gradient to be taken on user-defined scalars
  • Execute on loading the naming of all scalars and memory locations
  • Define the adjust function hook
    • Inside this, I loop through the threads and cells
    • Here is where I define the user-defined scalar which is the terms inside of the partial w.r.t. x_j from source 1 in the above post.
    • Also within the adjust function hook is a function that enables the derivative and reconstructive gradient to be taken for user-defined scalars
  • Define source terms
    • The first source term is generated from the reconstructive gradient of the user-defined scalar
    • The second source term is coded following the equation from the above post
    • Both source terms are treated as explicit (I have a UDF revision with implicit treatment of the source terms and that did not change the results)

To implement this UDF I first allocate the proper amount of scalars and memory locations. I then enable the retention of the temporary solver memory using the TUI command: solve/set/advance/retain-temporary-solver-mem. I then initialize and run a single iteration with the regular SA model without the UDF to allocate all the temporary solver mem variables (specifically to retain the SA transport variable and its reconstructive gradient C_NUT(c,t) and C_NUT_RG(c,t)). After this single iteration has run, I compile and load the UDF, then turn off the scalar equation in the controls section, ensure the specified flux of the scalar is 0 for all boundary conditions, input the adjust function hook, and enable 2 source terms under the fluid cell zone conditions for the modified turbulent viscosity. I then reinitialize and run the case until convergence. 

When running this same case using the SA model in fluent and using my UDF, the convergence of the nut variable changes, leading me to believe that the UDF is implemented correctly and is changing the SA transport variable (nu tilde), however, for every validation case I have run, the results simply do not change for pressure, wall shear, heat flux, boundary layer profile, etc.

If you are able to provide any feedback on the methods that I am employing to implement and code the UDF, I would greatly appreciate it. If this is simply a problem that can not be answered due to proprietary information or not being able to assist in specifics, please let me know so that I can then switch CFD codes to one that offers this assistance and guidance on turbulence modeling. 

Thank you,