# How to set the inlet gas velocity increasing linearly with time (eg in TFM)

Dear all,

I want to set a boundary condition that can make the inlet gas velocity increase linearly with time. For example, in the tutorial case “fluid_bed_tfm_2d”, how to make bc_v_g(1)=0.125*dt, where dt is the time step.

fluid_bed_tfm_2d2.mfx (8.5 KB)

You can write a UDF in usr1.f. usr1.f is called once every timestep, which may be able to implement the transient inlet gas velocity.

bc_V_g(BCV)=0.0+0.125*time

4 Likes

Hi, Xi Gao,

Thank you so much. Following your suggestions, I have written a usr1.f, which is attached here. However, although it can be built successfully, it did not work at all. In fact, there is no an option in BOUNDARY CONDITION for udf. Therefore, the real inlet gas velocity will still follow the set value (in the tutorial case “fluid_bed_tfm_2d”, it is 0.25 m/s).

Thank you again for your help.

usr1.f (2.2 KB)

Why are you multiplying by dt? dt is the time step:

`BC_V_g(1)=0+0.125*dt`

Which is ~ `1.0000e-03`

Also, make sure you enable user routines by selecting `Enable user-defined subroutines` on the `Model Setup` pane (`call_usr = .True.`).

1 Like

Hi, Justin,

Thanks very much for your reply. Indeed, it should be the physical time of the simulation, but not the time step. Do you know which variable I should use?

Another question, even though I have enabled the udf, the udf did not work. For example, when the udf is BC_V_g(1)=0+0.125*dt, which is attached previously and results in a very small value, the inlet gas velocity can still make the bed expand (obviously wrong).

You can access the current simulation time with the variable `time` from the `run` module. You also need to call `set_bc0_flow` to make sure the new value of `bc_v_g` is accounted for. Please see attached. I guess you will bound the inlet velocity at some time, otherwise it will keep increasing.

usr1.f (2.3 KB)

3 Likes

Hi, Jeff,

Thanks very much. Finally, the attached udf worked!!! The problem is solved.

Hi,

does someone know why the same udf that was provided here does not work if I try to set a boundary conditions for solids? I tried to change BC_V_g(4) to either BC_V_s(4,1) or bc_massflow_s(4,1) but in both cases nothing happened. Thanks!

You should update the PI_FACTOR(BCV_I) based on how many particles injected per DTSOLID.
Note that the BCV_I is different from the Boundary ID you defined.