Fluids

Fluids

UDF loop over compute nodes

TAGGED: 

    • K
      Subscriber

      I'm trying to write a UDF that loops over the compute nodes one by one using compute_node_loop.

      I did a small test below on 4 cores, where I save the compute node number into each of the cells: cells in compute node 0 would have a UDM of 0, cells in compute node 1 would have a UDM of 1, and so on. However, when I plot the UDM, all the values in the entire domain are 3, rather than having values ranging from 0 to 3 between partitions.

      #include "udf.h"

      DEFINE_ON_DEMAND(my_on_demand_function)
      {
          int pe;
          
          #if !RP_HOST

          compute_node_loop(pe)
          {
              Domain *domain;
            Thread *tc;
        
              cell_t c;

              domain = Get_Domain(ROOT_DOMAIN_ID);
              
              thread_loop_c(tc,domain)
              {
                  begin_c_loop(c,tc)
                  {
                      C_UDMI(c,tc,0) = pe;
                  }
                  end_c_loop(c,tc)
              }
          }
          
          #endif
      }
    • Keyur Kanade
      Ansys Employee

      As support we do not debug UDFs. But can provide help on particular syntex. Please check following link for details of UDF. Also if you have any subsequent questions, please post it on Ansys Forum Ansys Learning Forum under specific category.  

      Chapter 1: Overview of User-Defined Functions (UDFs) (ansys.com)

      Regards,

      Keyur

      How to access Ansys Online Help Document

      Guidelines on the Student Community

      Fluids Engineering Courses | Ansys Innovation Courses

       

Viewing 1 reply thread
  • You must be logged in to reply to this topic.