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.

UDF problem——How to get parameters of boundary condition in UDF?

    • Lee
      Subscriber

       Hi everyone,

       I encountered a problem when I was coding UDF.

      Here is the background:

       Figure 1 presents the model I put in Fluent, inlet was set as pressure inlet and corresponding value, shown in Figure 2, was input by a profile document(because of inlet pressure consists of discrete points). I want to exert an external force F on the bottom surface to push the surface to move along axis y, and the force F can be calculated by inlet pressure, for example,

      F=2*Pi*Ab ... (1)

      Where Pi is inlet pressure, Ab is area of bottom surface.

       In UDF, we can use function to specify external force, such as external force command in macro DEFINE_SDOF_PROPERTIES(), or expected boundary condition, however, in my case, the load I want to exert on surface cannot be expressed by function, actually, it consists of numerous points.

      My questions:

       1. how to collect the inlet pressure as my data source?

      There are two ways, I guess, can realize this goal, but I don’t know how to do and I am not sure if my suppose is right.

       First method, reading the profile by UDF.

       Second method, getting the pressure directly from inlet by UDF, do not need to reading the profile once more.

       2. How to put the obtained data in function?

      If both of these two methods can get the data, is it possible to set the obtained data as input(i.e. Pi) of equation (1) in UDF?

      P.S. is there any relevant cases or references to be recommended, so I can educate myself?


      Regards,

      Excited


    • Amine Ben Hadj Ali
      Ansys Employee
      A transient table or profile can be used directly without UDF for the pressure input.n
    • YasserSelima
      Subscriber
      The example provided in the UDF manual for DEFINE_CG_MOTION , integrates the pressure on a body to calculate the pressure force. You can use the same , inside SDOF_PROPERTIES to calculate the pressure force n
    • Lee
      Subscriber
      Hi, thanks for your reply, I knew the profile can be used for pressure input for inlet boundary, but I am not sure if it can be used to exert a load force on the bottom surface to push it to move along y axis. In my case, I selected the bottom surface as the dynamic mesh zones, according to my understanding of your comment, I can use the profile to specify the load on bottom surface, and directly create the dynamic mesh zones, then, in simulation the bottom surface will be forced to move along y axis? am I right?nmy settings about dynamic mesh is shown in Figure 3nnFigure 3
    • Lee
      Subscriber
      Hello,thanks for your suggestion, the thing is that I knew how to calculte force(the equation(1) in my post can help obtain force), but I do not know how to get the pressure(discrete points) in UDF, or in other words, how to use UDF to read profile containing pressure data or directly get pressure value in inlet boundary simutaneously? and then put the obtained data into function in UDF?n
    • YasserSelima
      Subscriber
      The UDF does that. it gets the pressure in every cell around the body and multiply it by the area .... n
    • YasserSelima
      Subscriber
      please note, the udf in the example needs to be parallelised. n
    • Amine Ben Hadj Ali
      Ansys Employee
      Please go with the cg motion udf in the manual. You need however to read the file with C and add an Interpolation routine. If you can translate the pressure directly into velocity again go with profile. n
Viewing 7 reply threads
  • The topic ‘UDF problem——How to get parameters of boundary condition in UDF?’ is closed to new replies.