Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Repeated calculations in each iteration of the DEFINE_PROFILE macro

    • aliborhan
      Subscriber

      Hello,

      I have a multiblock domain with four different zones (two fluid zones and two porous zones). The UDF I'm using includes the macro DEFINE_PROFILE. It appears that calculations are performed twice during each iteration! Furthermore, when I run the simulation in parallel mode with two processors, the information is printed four times on the console. Why is this happening?

      I appreciate your guidance in advance!

       

    • aliborhan
      Subscriber

      Hello,

      I have a multiblock domain with four different zones (two fluid zones and two porous zones). The UDF I'm using includes the macro DEFINE_PROFILE. It appears that calculations are performed twice during each iteration! Furthermore, when I run the simulation in parallel mode with two processors, the information is printed four times on the console. Why is this happening?

      I appreciate your guidance in advance!

    • Rob
      Forum Moderator

      Please post the code. I'm not going to debug it but may see something when having a quick look. 

    • aliborhan
      Subscriber
      #include "udf.h"
       
      DEFINE_ON_DEMAND(store_resistance)
      { 
      Domain *domain;
      Thread *t, *tt;
      cell_t c;
      int mem_1_id = 9;
      domain = Get_Domain(1);
      t = Lookup_Thread(domain,mem_1_id);
       
      /* Fill the UDM with initial resistance */
       
      begin_c_loop (c,t)
      {
      C_UDMI(c,t,0) = 1.0e12;
      }
      end_c_loop (c,t)
      }
      //----------------------------------
      DEFINE_PROFILE(vis_res,t,i)
       {
      cell_t c;
      begin_c_loop(c,t)
      {
      if ( N_TIME <= 1.0 )
      {
      F_PROFILE(c,t,i) = C_UDMI(c,t,0);
      }
      if ( N_TIME > 1.0 ) 
      {
      F_PROFILE(c,t,i) = 1.1*C_UDMI(c,t,0);
      C_UDMI(c,t,0) = F_PROFILE(c,t,i);
      }
      }
      end_c_loop(c,t)
      }

      This is a test code. I just wanted to make sure that the variable of interest is updated and multiplied by "1.1" during each iteration. But after each iteration, it is multiplied by "1.21=1.1*1.1".

    • Rob
      Forum Moderator

      Not sure. What is N_TIME? 

    • aliborhan
      Subscriber

      The computational domain is 2D and I hooked the same UDF in two places, specifically for "Viscous Resistance: Direction-1" and "Viscous Resistance: Direction-2," that results in duplicated calculations.

    • aliborhan
      Subscriber

      N_TIME is an integer number of time steps.

    • Rob
      Forum Moderator

      So, two zones and two entries, one of those may be why it's updating twice. 

Viewing 7 reply threads
  • The topic ‘Repeated calculations in each iteration of the DEFINE_PROFILE macro’ is closed to new replies.