Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Incorrect area for an interior face through udf.

    • Ramesh Chandra Mishra
      Subscriber

      Hi

      I am trying to calculate area of interior face through UDF and getting wrong results. I have already come across a thread on forums regarding a similar problem but could not reach correct results. My UDF is as follows:

      #include "udf.h"
      #include "sg.h"
      DEFINE_ON_DEMAND(Face_area)
      {
      face_t face;
      Thread* thread;
      Domain* domain;
      domain = Get_Domain(1);
      int zone_id = 8;
      thread = Lookup_Thread(domain, zone_id);
      real va[ND_ND]; /* for storing area vector */
      real Area = 0;

      begin_f_loop(face, thread)
      {
      F_AREA(va, face, thread); /* Obtain the area vector */
      Area += NV_MAG(va); /* Obtain area magnitude */

      }
      end_f_loop(face, thread)
      #if RP_NODE
      Area = PRF_GRSUM1(Area);
      #endif
      node_to_host_real_1(Area);
      #if RP_HOST
      Message("Area of top surface is %e\n", Area);
      #endif
      }

    • Atharva Nagarkar
      Ansys Employee

      Hello,

      As per Ansys policy, employees cannot debug UDFs on this platform. However, I would request you to check the following things.

      • The DEFINE_ON_DEMAND will ensure that the UDF will be executed immediately, after it is activated, but it is not accessible while the solver is iterating. The link below from the Ansys Fluent Customization Manual explains how to use this macro. I would suggest you to look through the example of using this macro for better understanding.

      2.2. General Purpose DEFINE Macros (ansys.com)

      • Ensure that the correct zone id is for using the domain variable for the zone_id function. Also, for the Get_Domain function, the argument value is 1 for the mixture domain, but the values for the phase domains can be any integer greater than 1. The ID for a particular phase can be found by selecting it in the Phases dialog box in Ansys Fluent. I have attached links from the Ansys Fluent Customization Manual related to these macros. 

      3.2.6. Special Macros (ansys.com)

      • The issue might be because of incorrect Parallelization of the UDF. The link below from the Ansys Fluent Customization Manual contains information on all the concerned topics such as Compiler Directives, Node-to-Host Data Transfer, Global Summations and more. Please check that you have used them correctly.

      7.3. Parallelizing Your Serial UDF (ansys.com)

      • I am also attaching the link for the calculation of the area magnitude using the NV_MAG macro. You might want to check the how the Face Area Normal Direction is defined in Ansys Fluent.

      3.4.4. Vector Operation Macros (ansys.com); 3.2.4. Face Macros (ansys.com) 

      If you are not able to access the link, please refer to this forum discussion: Using Help with links (ansys.com)

      Thanks

Viewing 1 reply thread
  • The topic ‘Incorrect area for an interior face through udf.’ is closed to new replies.