Can you please help in making the UDF for scalar shear stress work in Fluent (2020R1)?

Hello,

I am trying to calculate the scalar shear stress on blood in the radial gap of a motor using a UDF code. This UDF code has been written in Microsoft Visual Studio 2017 Professional.

I am using Ansys Fluent 2020 R1. Weirdly, when I used this same UDF code in other workstation it was able to calculate results.

Could you please help in making this UDF work?

Looking forward for your response. Thanks,


Shweta

Answers

  • Hello,

    What error message are you seeing when you compile the code? Are you able to successfully compile the code without any errors? Or is the issue with compilation?

    Please post a screenshot.

    Thanks.

    Karthik

  • ShwetaKShwetaK Member
    edited September 10

    I am able to compile and load the UDF successfully. But, it doesn't seem to record any values.

  • DrAmineDrAmine GermanyForum Coordinator

    Please tell use what do you mean it does not record any value. Did you hook UDF?

  • Here's what I get on the console when I plug the UDF.

  • Here's the output that I get from the UDF:


    When I had used the same UDF code in a different workstation, I got the following results :



  • Have you hooked the UDF to your Fluent case? Also, what results do you get in Fluent? Did you create a similar plot in Fluent?

    Thanks.

    Karthik

  • What do you mean by hooked the UDF to fluent case?

    Also, I had created a contour for it and it showed zero as the result.

  • RobRob UKForum Coordinator
    edited September 11

    Reading/compiling the code just makes it available to the solver. You then need to attach the code in the right place, and that depends on the macros used and it's purpose.

    A zero result could mean an error in the code or that Fluent doesn't know anything about it if it's not been hooked up correctly. If you look in the documentation for the main macro it'll say where it's attached in most cases.

  • It used to work fine in other workstation. We had to move our license to a better workstation, and it doesn't work anymore.

    I haven't changed any step in my method of setting up the simulation. Can anyone help me to figure out the problem via a meeting/call?

  • Hello,

    We will not be able to organize meeting / calls on this forum. Having said that, we should still be able to help you here via these posts.

    To understand your issue better, could you please share a screenshot of where you are hooking your UDF. Also, where are you using this shear stress from your UDF in your boundary condition? Could you please share a screenshot of this as well?

    One more thing - please share a screenshot of your UDF so we understand the macros you are using?

    Please embed these screenshots directly in your post (and not as attachments)

    Thank you.

    Karthik

  • Hi Karthik,

    Thanks for your response.


    I am calculating shear stress and storing in UDM. I am not using the UDF as a boundary condition. I am using the results in the post processing to plot a chart of shear stress (user defined scalar) vs X axis.


    Here are the steps that I followed:

    User-Defined -> User-Defined Memory -> Number of User-Defined Memory Locations = 10


    User-Defined-> Functions -> Compiled UDFs -> Source file -> Build -> Load


    These are the messages on the TUI when I am done hooking the UDF.


    Here's the UDF:


    Looking forward to your response. Thanks,


    Shweta

  • Can you please send me a screenshot of your Function Hooks?

    Also, could you please use 'Message' statements in different parts of the UDF to make sure that the code is working as intended? You don't really need to run the entire simulation. You might just want to run 1 time-step just to verify the code. If you are seeing the values being printed in the console, please check if the UDMIs are being plotted in Fluent when you post-process the case.

    Just a minor observation - the compiled source code name seems to be different from the name of the file shown in the UDF screenshot. Just wanted to point it out in case you want to double check if you are the correct UDF file.

    Please let me know what your findings are.

    Thanks.

    Karthik

  • The UDF worked. I could plot scalar shear stress after function hooks!

    Thank you very much!!

  • Glad the Function hooks worked. I'm going to mark this post as resolved.

    Thanks.

    Karthik

Sign In or Register to comment.