Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

UDF for variable mass flow inlet

    • abdullahhassan
      Subscriber

      Hello, i am new to UDF and i made a first UDF. 

      include "udf.h"
      DEFINE_PROFILE(inlet_mf,th,i)
      {
      face_t f;
      int time_step = (int) CURRENT_TIME;
      begin_f_loop(f,th)
      {
      if(time_step %2 != 0)
      F_PROFILE(f,th,i) = 0.2410;
      else
      F_PROFILE(f,th,i) = 0.0;
      }
      end_f_loop(f,th);
      }

      Basically, I am doing condensation of vapor steam inside a shell so I wanted to input variable mass flow rate in such a way that mass flow stops at even timestep and vapor focuses on condensation & then mass flow resumes on odd time steps.

      UDF is working and i am getting variable mass flow rate. the confusion is that;

      suppose there are 1000 number of time steps with time step size of 0.1 and max iteration/time step is 10. Input Mass flow changes after 10*10 iteration that at 990 timesteps remaining, it value becomes 0 and then at remaining 980 iteration left, mass flow changes to 0.2410. 

      1- why? I think it should change on every time step. I mean mass flow should change after 10 iterations/timesteps which is mass flow should be 0.2410 at 999 timesteps remaining and 0 at 998 timesteps remaining. 

      2- Secondly, if the UDF is right and results are also ok then based on this, I need to work with 1e-5 time step size in actual simulation (and above is the just the simple water test case) then the mass flow inlet will remain same i.e. 0.2410 for many number of time steps like 10,000 or more. how can i resolve that issue?

       

      Thanks.

    • Rob
      Forum Moderator

      I've never seen CURRENT_TIME used like that, read this  https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v241/en/flu_udf/flu_udf_RPVariables.html  

      We tend to base any boundary conditions on the flow time, and if you need to alter the boundary value use time not time step. 

    • abdullahhassan
      Subscriber

      Hello Rob,

      Yeah, it is my learning phase of UDF. I am unable to open this link, can you please share the image of what is inside in this link. 

    • Rob
      Forum Moderator

      Ah, open Help in Fluent & paste the link into that browser. 

Viewing 3 reply threads
  • The topic ‘UDF for variable mass flow inlet’ is closed to new replies.