Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Rotating and mass flow inlet

    • warhammer975
      Subscriber

      Hello everybody!
      I'm trying to simulate air movement in 2D. There is an external fixed cylinder and an internal rotating one, as well as two channels (top and bottom) for pumping air. The geometry, shaft speed and mass flow of air that enters through the shaft are known. The question is whether it is possible to simultaneously “apply” the Rotating wall and Mass-Flow-Inlet conditions to the inner cylinder (modeled so that air flows evenly, as if from the shaft (inner cylinder))? Or are there any other ways to solve the problem?

      Thank you, I will be glad for any help!

    • Federico
      Ansys Employee

      Hello, 

      simple answer is no, you cannot have a boundary simultaneously a wall and an inlet. What exactly are you looking to model here? You want the mass-flow to come in tangentially from the inner cylinder?

      • warhammer975
        Subscriber

        Hello!
        Yes, I want the mass flow to be evenly distributed across the entire surface of the inner cylinder (this cylinder must rotate at a given speed) into the gap between the cylinders.
        There was an idea to pump this mass flow into the first wall cells near the inner cylinder using UDF, but so far I have not been able to do this, I need more experience in this matter.

    • Rob
      Forum Moderator

      You also need to ask in one thread.  https://innovationspace.ansys.com/forum/forums/topic/udf-for-mass-flow-inlet/  

      Hence my suggestion of a source term. But you may also need to add momentum if you need to account for the rotation speed in the mass coming into the domain. 

      • warhammer975
        Subscriber

        I tried to write a function to determine the wall cells of the inner cylinder (id=5) for pumping air into them, but so far Fluent refuses to understand this mass flow...

        #include "udf.h"
         
         
        DEFINE_EXECUTE_AT_END(find_first_near_wall_cells)
        {
            Domain *domain;
            Thread *wall_thread;
            face_t f;
            cell_t c;
            Thread *adjacent_thread;
            real cell_dist;
         
            domain = Get_Domain(1);
            
         
            wall_thread = Lookup_Thread(domain, 5); 
         
         
            begin_f_loop(f, wall_thread)
            {
               
                c = F_C0(f, wall_thread);
         
               
                adjacent_thread = THREAD_T0(wall_thread);
                cell_dist = C_WALL_DIST(c, adjacent_thread);
         
         
                if (cell_dist < 0.001)
                {
                    Message("Found adjacent cell to wall at face: %d\n", c);
                }
            }
            end_f_loop(f, wall_thread)
        }
         
        DEFINE_ADJUST(adjust_mass_source, domain)
        {
            Thread *t;
            cell_t c;
            real mass_flow = 2;  
            real cell_dist;
         
         
            thread_loop_c(t, domain)
            {
                begin_c_loop(c, t)
                {
         
                    cell_dist = C_WALL_DIST(c, t);
         
         
                    if (cell_dist < 0.001)  
                    {
         
                        C_UDMI(c, t, 0) = mass_flow;  
                    }
                }
                end_c_loop(c, t)
            }
        }

         

    • Rob
      Forum Moderator

      How are you adding the mass? 

      • warhammer975
        Subscriber

        I set the value ( real mass_flow = 2;) and used this cycle to set the mass flow:
         

        begin_c_loop(c, t)
                {
         
                    cell_dist = C_WALL_DIST(c, t);
         
         
                    if (cell_dist < 0.001)  
                    {
         
                        C_UDMI(c, t, 0) = mass_flow;  
                    }
                }
                end_c_loop(c, t)
            }
        }
    • Rob
      Forum Moderator

      That's telling a UDM a value, it's not doing anything to the DEFINE_SOURCE routine. 

      • warhammer975
        Subscriber

        I also tried to use this function, but the result remained the same:

        #include "udf.h"
         
        DEFINE_EXECUTE_AT_END(find_first_near_wall_cells)
        {
            Domain *domain;
            Thread *wall_thread;
            face_t f;
            cell_t c;
            Thread *adjacent_thread;
            real cell_dist;
            
            /* Получаем домен */
            domain = Get_Domain(1);
            
         
            wall_thread = Lookup_Thread(domain, 5); 
          
            begin_f_loop(f, wall_thread)
            {
                
                c = F_C0(f, wall_thread);
         
              
                adjacent_thread = THREAD_T0(wall_thread);
                cell_dist = C_WALL_DIST(c, adjacent_thread);
         
         
                if (cell_dist < 0.001)
                {
                    Message("Found adjacent cell to wall at face: %d\n", c);
                }
            }
            end_f_loop(f, wall_thread)
        }
         
         
        DEFINE_SOURCE(mass_source, cell, thread, dS, eqn)
        {
            real source;    
            real mass_flow; 
            real cell_dist;
            
         
            mass_flow = 2;
         
         
            cell_dist = C_WALL_DIST(cell, thread);
         
            
            if (cell_dist < 0.001) 
            {
                source = mass_flow;
            }
            else
            {
                source = 0.0;
            }
         
            return source;
        }

         

    • Rob
      Forum Moderator

      How big is the near wall cell?

      • warhammer975
        Subscriber

        3.47e-05

    • Rob
      Forum Moderator

      That should pick up. I assume you have assigned the UDM memory and added the source to the cell zone?

      • warhammer975
        Subscriber

        I used "DEFINE_EXECUTE_AT_END" in Function Hooks and "DEFINE_SOURCE" in Fluid domain --> Source  term

    • Rob
      Forum Moderator

      Hmm, not sure you need the DEFINE_EXECUTE_AT_END, but you will need to assign the wall bits in the SOURCE as not sure what is passed within the code.  An easier option may be to split some cells out near the wall & then just add the source into the smaller cell zone. 

      • warhammer975
        Subscriber

        If it doesn’t bother you, can you tell me in more detail how to do this correctly?

    • Rob
      Forum Moderator

      If you create a register (under the Adapt functions), you can then split the mesh with the register. The new cell zone can be used for the source. 

      • warhammer975
        Subscriber

        Thank you very much, this helped me move forward in solving the problem. Can you help me with another question? How can I create a ring region of cells (with certain inner and outer radii) in the same way? I chose the "cylinder" shape in Adapt - Region, which should correspond to a ring for a two-dimensional problem, but I only get a rectangular region of cells

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