Fluids

Fluids

UDF Area of an interior face

    • isaps1860
      Subscriber

      I have written an UDF for Calculating the area of a surface. The UDF works perfect for the surface of an inlet or an outlet, but for an interior surface the values are wrong. A test example for a simple tube gives different results for inlet and interior surfaces although the areas should be identical.

      Is there anything additional to consider for the calculations of the areas for interior?

      UDF is below:

      #include "udf.h"

      DEFINE_ADJUST(Face_area1, domain)

      {

      face_t face;

      Thread* thread;

      domain = Get_Domain(1);

      int zone_id = 35;

      thread = Lookup_Thread(domain, zone_id);

      real NV_VEC(va); /* 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 surface1 is %e ", Area);

      #endif

      }


      Best regards

    • Rob
      Ansys Employee
      Try summing the modulus of the area. Interiors don't have an aligned surface normal. It's why the Flux Reports don't pick up the interior faces.
    • isaps1860
      Subscriber
      Thank you for your answer . Makes sense, that with no aligned surface normal there is no logical result.
      But I have to ask what do you mean with "summing the modulus of the area"? Don┬┤t really understand that.
    • DrAmine
      Ansys Employee
      Look in the documentation you will see that on interior bcs not all variables are available and that you require other connectivity macro
    • Rob
      Ansys Employee
      If the vector is random you may find the x-area to be positive or negative: hence sum the modulus (positive) values.
Viewing 4 reply threads
  • You must be logged in to reply to this topic.