Fluids

Fluids

parallel udf for multiphase

    • PRASANT PANIGRAHI
      Subscriber

      Hi,

      I am writing a parallel version of the UDF to do the numbering of the solid cells in a domain. Since the domain is partitioned into multiple NODES (No. of processors- 4), I am unable to number the solid cells consecutively in all NODES. I am using a variable max_count to do the numbering of the solid cells and store it in corresponding UDMI-2. The max_count variable is always initialised to zero for each computer NODE process. I need to assign the final (max_count) value of NODE-0 to initialise the (max_count) of NODE-1 and so on further. So that the counting and numbering of the solid cells in the domain sequentially. let's say the partitioned NODE-0 contains 50 solid cells, and NODE- 1 contains 20 solid cells. so the numbering of solid cells in the NODE-1 should start at 51, not at 0. I tried using max_count as static variable and have not got the intended result. 

      My UDF:

      #include "udf.h"
      #include "mem.h" 
      #include "prf.h"  /// for global sum in parallel udf //
      #include "sg_mem.h"  
      #include "sg_mphase.h"
      #include "para.h"


      DEFINE_ADJUST(solid_segregation,mix_domain)
      {
          int max_count,shift;
              
          #if !RP_HOST
              
              Domain *meltjet_domain;
              Thread *meltjet_thread;    // meltjet thread pointer //
              cell_t cm;    // melt jet cell identifier //
              meltjet_domain = Get_Domain(3); /* melt jet domain if multiphase */    
              
              thread_loop_c(meltjet_thread, meltjet_domain)  //loops over all cell threads in domain//
              {
                  begin_c_loop_int(cm, meltjet_thread)
                  {
                      if (C_VOF(cm,meltjet_thread) >= 0.5 && C_LIQF(cm, meltjet_thread) <= 0.90)
                      {
                          shift+=1.0;
                      }
                      
                  }
                  end_c_loop_int(cm, meltjet_thread)
                  Message("shift index at NODE: %d\n", shift);
              }
              
              thread_loop_c(meltjet_thread, meltjet_domain)  //loops over all cell threads in domain//
              {
                  Message("I am in the node process: %d\n", myid);
                  Message("max_count at beginning of loop: %d\n", max_count);
                  Message("total sum count at beginning of loop: %d\n", (max_count+(shift*myid)));
                  begin_c_loop_int(cm, meltjet_thread)
                  {
                          
                      if (C_VOF(cm,meltjet_thread) >= 0.5 && C_LIQF(cm, meltjet_thread) <= 0.90)
                      {
                          max_count+=1.0;
                          C_UDMI(cm, meltjet_thread,0)=1.0; // identify the solid cell: assign as 1 //
                          C_UDMI(cm, meltjet_thread,2)= (max_count+(shift*myid)); // numbering solid cells //
                      }
                      else
                      {
                          C_UDMI(cm, meltjet_thread,0)=0.0;  // identify the liquid cell: assign as 0 //
                          C_UDMI(cm, meltjet_thread,2)=0.0;  // identify the liquid cell: assign as 0 //
                      }    
                  }
                  end_c_loop_int(cm, meltjet_thread)
                  Message("total sum count at end of loop: %d\n", (max_count+(shift*myid)));
              }
              max_count = PRF_GISUM1(max_count);
              Message0("Real max_count at end: %d\n", max_count);
          #endif //* !RP_HOST */        
      }

       

       

    • Rob
      Ansys Employee

      We (Ansys staff) can't help with details, and can only really point you at the documentation. However, if you explain what you're trying to do there may be an alternative approach. 

    • PRASANT PANIGRAHI
      Subscriber

      I am doing solidifcation during jet breakup using coupled VOF and soldification model. The molten jet is quenched by surrounding liquid and the fragments produced during breakup become solid. I am trying to group the solid cells (fragments) formed during solidification  if they are adjacent or connected and number that group. So that the  neighboring solid cells can be grouped as a single solid and assigned with user-input velocity for all the solid cells in that group. There may be separate solid cell group in the domain with corresponding user-input velocity values. For this i have to assign same number (counter) to the adjacent connected solid cells in UDMI to group them a single solid object later while imposing velocity. I have used c_face_loop looping, and the C0 and C1 neigboring cells identifiers to group solid cells. The UDF is working fine when running in single processor. But, while running UDF in multi-processors, the neighboring cells (C0 and C1) search is limited  to partition boundary (of active partitions) only. I can't group the connected solids that are adjacent to partitioned boundary and part of next computer NODEs. The parallel UDF gives separate solid groups even though they are connected, while the series UDF gives a single connected solid group for the same. Please suggest an alternative approach to access the cells of adjacent NODEs and group them in one group. I found that all the NODES run in sync only, not sequentially. 

    • Rob
      Ansys Employee

       

      If you’re using VOF and the solidification model you might want to read up on how they work: I suspect it’s not what you think.  With the droplets that are being lumped together, do you have so many nodes that the partitions are causing a lot of problems? Equally, if two lumps of VOF touch they’ll form a bigger lump. 

      https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v222/en/flu_udf/flu_udf_sec_using_udfs_parallel.html  Section 7.3.2.5.2

       

    • PRASANT PANIGRAHI
      Subscriber

      The issue with VOF is that if the two lumps (solids) touch, they will be merged forming a larger lump. This is a major draw back. Any suggestion from your side in this regard: how to handle this issue? 

    • Rob
      Ansys Employee

      You want to track large solids flying through the domain? Ie as the large droplets solidify you want to see where they go? By large I mean relative to the cell size. 

    • PRASANT PANIGRAHI
      Subscriber

      yes, i need to track the solid motion in the domain.

    • PRASANT PANIGRAHI
      Subscriber

      This case is similar to: If you throw a bucket of water in antarctica, how the water freezes to ice in mid air and how the ice moves in the mid air and falls on the ground. This is very exciting !!!

    • Rob
      Ansys Employee

      Difficult, fun but difficult.

      The VOF model will merge lumps that come into contact, or that get close enough (one cell) that they can diffuse together. There's not an easy way to switch the VOF lumps to large solids automatically: manually could work but you'd then need to use the 6DOF solver.  How much time, compute and experience have you got? 

    • PRASANT PANIGRAHI
      Subscriber

      I will look into it and how I can use the 6 DOF solver in my model. I have been working on this project for eight months now. I have gained good experience with it and will try to include your suggestions if the project timeline (Jan, 2023) is extended further. Otherwise, I will work on this in my free time.

Viewing 9 reply threads
  • You must be logged in to reply to this topic.